Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 5528
b: refs/heads/master
c: db44575
h: refs/heads/master
v: v3
  • Loading branch information
Alexey Kuznetsov authored and David S. Miller committed Jul 31, 2005
1 parent aa2acc6 commit 6cbfdbb
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1f494c0e040b001cf844280910d04ba7ebdc2898
refs/heads/master: db44575f6fd55df6ff67ddd21f7ad5be5a741136
21 changes: 18 additions & 3 deletions trunk/net/ipv4/ip_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int

dev_hold(dev);
ipgre_tunnel_link(nt);
/* Do not decrement MOD_USE_COUNT here. */
return nt;

failed:
Expand Down Expand Up @@ -1277,12 +1276,28 @@ static int __init ipgre_init(void)
goto out;
}

static void ipgre_fini(void)
static void __exit ipgre_destroy_tunnels(void)
{
int prio;

for (prio = 0; prio < 4; prio++) {
int h;
for (h = 0; h < HASH_SIZE; h++) {
struct ip_tunnel *t;
while ((t = tunnels[prio][h]) != NULL)
unregister_netdevice(t->dev);
}
}
}

static void __exit ipgre_fini(void)
{
if (inet_del_protocol(&ipgre_protocol, IPPROTO_GRE) < 0)
printk(KERN_INFO "ipgre close: can't remove protocol\n");

unregister_netdev(ipgre_fb_tunnel_dev);
rtnl_lock();
ipgre_destroy_tunnels();
rtnl_unlock();
}

module_init(ipgre_init);
Expand Down
20 changes: 18 additions & 2 deletions trunk/net/ipv4/ipip.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ static struct ip_tunnel * ipip_tunnel_locate(struct ip_tunnel_parm *parms, int c

dev_hold(dev);
ipip_tunnel_link(nt);
/* Do not decrement MOD_USE_COUNT here. */
return nt;

failed:
Expand Down Expand Up @@ -920,12 +919,29 @@ static int __init ipip_init(void)
goto out;
}

static void __exit ipip_destroy_tunnels(void)
{
int prio;

for (prio = 1; prio < 4; prio++) {
int h;
for (h = 0; h < HASH_SIZE; h++) {
struct ip_tunnel *t;
while ((t = tunnels[prio][h]) != NULL)
unregister_netdevice(t->dev);
}
}
}

static void __exit ipip_fini(void)
{
if (ipip_unregister() < 0)
printk(KERN_INFO "ipip close: can't deregister tunnel\n");

unregister_netdev(ipip_fb_tunnel_dev);
rtnl_lock();
ipip_destroy_tunnels();
unregister_netdevice(ipip_fb_tunnel_dev);
rtnl_unlock();
}

module_init(ipip_init);
Expand Down
21 changes: 19 additions & 2 deletions trunk/net/ipv6/sit.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int
dev_hold(dev);

ipip6_tunnel_link(nt);
/* Do not decrement MOD_USE_COUNT here. */
return nt;

failed:
Expand Down Expand Up @@ -794,10 +793,28 @@ static struct net_protocol sit_protocol = {
.err_handler = ipip6_err,
};

static void __exit sit_destroy_tunnels(void)
{
int prio;

for (prio = 1; prio < 4; prio++) {
int h;
for (h = 0; h < HASH_SIZE; h++) {
struct ip_tunnel *t;
while ((t = tunnels[prio][h]) != NULL)
unregister_netdevice(t->dev);
}
}
}

void __exit sit_cleanup(void)
{
inet_del_protocol(&sit_protocol, IPPROTO_IPV6);
unregister_netdev(ipip6_fb_tunnel_dev);

rtnl_lock();
sit_destroy_tunnels();
unregister_netdevice(ipip6_fb_tunnel_dev);
rtnl_unlock();
}

int __init sit_init(void)
Expand Down

0 comments on commit 6cbfdbb

Please sign in to comment.