diff options
-rw-r--r-- | include/linux/igmp.h | 1 | ||||
-rw-r--r-- | include/linux/mroute.h | 3 | ||||
-rw-r--r-- | net/ipv4/af_inet.c | 5 | ||||
-rw-r--r-- | net/ipv4/ipmr.c | 28 |
4 files changed, 28 insertions, 9 deletions
diff --git a/include/linux/igmp.h b/include/linux/igmp.h index f5a1a0db2e8e..7bb3c095c15b 100644 --- a/include/linux/igmp.h +++ b/include/linux/igmp.h | |||
@@ -228,7 +228,6 @@ extern int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf, | |||
228 | extern int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, | 228 | extern int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, |
229 | struct group_filter __user *optval, int __user *optlen); | 229 | struct group_filter __user *optval, int __user *optlen); |
230 | extern int ip_mc_sf_allow(struct sock *sk, __be32 local, __be32 rmt, int dif); | 230 | extern int ip_mc_sf_allow(struct sock *sk, __be32 local, __be32 rmt, int dif); |
231 | extern void ip_mr_init(void); | ||
232 | extern void ip_mc_init_dev(struct in_device *); | 231 | extern void ip_mc_init_dev(struct in_device *); |
233 | extern void ip_mc_destroy_dev(struct in_device *); | 232 | extern void ip_mc_destroy_dev(struct in_device *); |
234 | extern void ip_mc_up(struct in_device *); | 233 | extern void ip_mc_up(struct in_device *); |
diff --git a/include/linux/mroute.h b/include/linux/mroute.h index de4decfa1bfc..df8efd42bf8a 100644 --- a/include/linux/mroute.h +++ b/include/linux/mroute.h | |||
@@ -147,8 +147,7 @@ static inline int ip_mroute_opt(int opt) | |||
147 | extern int ip_mroute_setsockopt(struct sock *, int, char __user *, int); | 147 | extern int ip_mroute_setsockopt(struct sock *, int, char __user *, int); |
148 | extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *); | 148 | extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *); |
149 | extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg); | 149 | extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg); |
150 | extern void ip_mr_init(void); | 150 | extern int ip_mr_init(void); |
151 | |||
152 | 151 | ||
153 | struct vif_device | 152 | struct vif_device |
154 | { | 153 | { |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 42bd24b64b57..dc411335c14f 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1479,14 +1479,15 @@ static int __init inet_init(void) | |||
1479 | * Initialise the multicast router | 1479 | * Initialise the multicast router |
1480 | */ | 1480 | */ |
1481 | #if defined(CONFIG_IP_MROUTE) | 1481 | #if defined(CONFIG_IP_MROUTE) |
1482 | ip_mr_init(); | 1482 | if (ip_mr_init()) |
1483 | printk(KERN_CRIT "inet_init: Cannot init ipv4 mroute\n"); | ||
1483 | #endif | 1484 | #endif |
1484 | /* | 1485 | /* |
1485 | * Initialise per-cpu ipv4 mibs | 1486 | * Initialise per-cpu ipv4 mibs |
1486 | */ | 1487 | */ |
1487 | 1488 | ||
1488 | if (init_ipv4_mibs()) | 1489 | if (init_ipv4_mibs()) |
1489 | printk(KERN_CRIT "inet_init: Cannot init ipv4 mibs\n"); ; | 1490 | printk(KERN_CRIT "inet_init: Cannot init ipv4 mibs\n"); |
1490 | 1491 | ||
1491 | ipv4_proc_init(); | 1492 | ipv4_proc_init(); |
1492 | 1493 | ||
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 300ab0c2919e..438fab9c62a0 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -1878,16 +1878,36 @@ static struct net_protocol pim_protocol = { | |||
1878 | * Setup for IP multicast routing | 1878 | * Setup for IP multicast routing |
1879 | */ | 1879 | */ |
1880 | 1880 | ||
1881 | void __init ip_mr_init(void) | 1881 | int __init ip_mr_init(void) |
1882 | { | 1882 | { |
1883 | int err; | ||
1884 | |||
1883 | mrt_cachep = kmem_cache_create("ip_mrt_cache", | 1885 | mrt_cachep = kmem_cache_create("ip_mrt_cache", |
1884 | sizeof(struct mfc_cache), | 1886 | sizeof(struct mfc_cache), |
1885 | 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, | 1887 | 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, |
1886 | NULL); | 1888 | NULL); |
1889 | if (!mrt_cachep) | ||
1890 | return -ENOMEM; | ||
1891 | |||
1887 | setup_timer(&ipmr_expire_timer, ipmr_expire_process, 0); | 1892 | setup_timer(&ipmr_expire_timer, ipmr_expire_process, 0); |
1888 | register_netdevice_notifier(&ip_mr_notifier); | 1893 | err = register_netdevice_notifier(&ip_mr_notifier); |
1894 | if (err) | ||
1895 | goto reg_notif_fail; | ||
1889 | #ifdef CONFIG_PROC_FS | 1896 | #ifdef CONFIG_PROC_FS |
1890 | proc_net_fops_create(&init_net, "ip_mr_vif", 0, &ipmr_vif_fops); | 1897 | err = -ENOMEM; |
1891 | proc_net_fops_create(&init_net, "ip_mr_cache", 0, &ipmr_mfc_fops); | 1898 | if (!proc_net_fops_create(&init_net, "ip_mr_vif", 0, &ipmr_vif_fops)) |
1899 | goto proc_vif_fail; | ||
1900 | if (!proc_net_fops_create(&init_net, "ip_mr_cache", 0, &ipmr_mfc_fops)) | ||
1901 | goto proc_cache_fail; | ||
1892 | #endif | 1902 | #endif |
1903 | return 0; | ||
1904 | reg_notif_fail: | ||
1905 | kmem_cache_destroy(mrt_cachep); | ||
1906 | #ifdef CONFIG_PROC_FS | ||
1907 | proc_vif_fail: | ||
1908 | unregister_netdevice_notifier(&ip_mr_notifier); | ||
1909 | proc_cache_fail: | ||
1910 | proc_net_remove(&init_net, "ip_mr_vif"); | ||
1911 | #endif | ||
1912 | return err; | ||
1893 | } | 1913 | } |