Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 103212
b: refs/heads/master
c: 623d1a1
h: refs/heads/master
v: v3
  • Loading branch information
Wang Chen authored and YOSHIFUJI Hideaki committed Jul 3, 2008
1 parent 937cf01 commit 03434cb
Show file tree
Hide file tree
Showing 4 changed files with 46 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: dd3abc4ef52597ec8268274222574b2700ba3ded
refs/heads/master: 623d1a1af77bd52a389c6eda5920e28eb2ee468b
3 changes: 2 additions & 1 deletion trunk/include/linux/mroute6.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, int);
extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
extern int ip6_mr_input(struct sk_buff *skb);
extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg);
extern void ip6_mr_init(void);
extern int ip6_mr_init(void);
extern void ip6_mr_cleanup(void);

struct mif_device
{
Expand Down
11 changes: 10 additions & 1 deletion trunk/net/ipv6/af_inet6.c
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,9 @@ static int __init inet6_init(void)
if (err)
goto icmp_fail;
#ifdef CONFIG_IPV6_MROUTE
ip6_mr_init();
err = ip6_mr_init();
if (err)
goto ipmr_fail;
#endif
err = ndisc_init();
if (err)
Expand Down Expand Up @@ -1057,6 +1059,10 @@ static int __init inet6_init(void)
igmp_fail:
ndisc_cleanup();
ndisc_fail:
#ifdef CONFIG_IPV6_MROUTE
ip6_mr_cleanup();
ipmr_fail:
#endif
icmpv6_cleanup();
icmp_fail:
unregister_pernet_subsys(&inet6_net_ops);
Expand Down Expand Up @@ -1111,6 +1117,9 @@ static void __exit inet6_exit(void)
ipv6_netfilter_fini();
igmp6_cleanup();
ndisc_cleanup();
#ifdef CONFIG_IPV6_MROUTE
ip6_mr_cleanup();
#endif
icmpv6_cleanup();
rawv6_exit();

Expand Down
38 changes: 33 additions & 5 deletions trunk/net/ipv6/ip6mr.c
Original file line number Diff line number Diff line change
Expand Up @@ -948,23 +948,51 @@ static struct notifier_block ip6_mr_notifier = {
* Setup for IP multicast routing
*/

void __init ip6_mr_init(void)
int __init ip6_mr_init(void)
{
int err;

mrt_cachep = kmem_cache_create("ip6_mrt_cache",
sizeof(struct mfc6_cache),
0, SLAB_HWCACHE_ALIGN,
NULL);
if (!mrt_cachep)
panic("cannot allocate ip6_mrt_cache");
return -ENOMEM;

setup_timer(&ipmr_expire_timer, ipmr_expire_process, 0);
register_netdevice_notifier(&ip6_mr_notifier);
err = register_netdevice_notifier(&ip6_mr_notifier);
if (err)
goto reg_notif_fail;
#ifdef CONFIG_PROC_FS
err = -ENOMEM;
if (!proc_net_fops_create(&init_net, "ip6_mr_vif", 0, &ip6mr_vif_fops))
goto proc_vif_fail;
if (!proc_net_fops_create(&init_net, "ip6_mr_cache",
0, &ip6mr_mfc_fops))
goto proc_cache_fail;
#endif
return 0;
reg_notif_fail:
kmem_cache_destroy(mrt_cachep);
#ifdef CONFIG_PROC_FS
proc_net_fops_create(&init_net, "ip6_mr_vif", 0, &ip6mr_vif_fops);
proc_net_fops_create(&init_net, "ip6_mr_cache", 0, &ip6mr_mfc_fops);
proc_vif_fail:
unregister_netdevice_notifier(&ip6_mr_notifier);
proc_cache_fail:
proc_net_remove(&init_net, "ip6_mr_vif");
#endif
return err;
}

void ip6_mr_cleanup(void)
{
#ifdef CONFIG_PROC_FS
proc_net_remove(&init_net, "ip6_mr_cache");
proc_net_remove(&init_net, "ip6_mr_vif");
#endif
unregister_netdevice_notifier(&ip6_mr_notifier);
del_timer(&ipmr_expire_timer);
kmem_cache_destroy(mrt_cachep);
}

static int ip6mr_mfc_add(struct mf6cctl *mfc, int mrtsock)
{
Expand Down

0 comments on commit 03434cb

Please sign in to comment.