aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/ip6mr.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 2d2ac23b8606..8e693859ea03 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -333,13 +333,13 @@ static struct file_operations ip6mr_mfc_fops = {
333#endif 333#endif
334 334
335#ifdef CONFIG_IPV6_PIMSM_V2 335#ifdef CONFIG_IPV6_PIMSM_V2
336static int reg_vif_num = -1;
337 336
338static int pim6_rcv(struct sk_buff *skb) 337static int pim6_rcv(struct sk_buff *skb)
339{ 338{
340 struct pimreghdr *pim; 339 struct pimreghdr *pim;
341 struct ipv6hdr *encap; 340 struct ipv6hdr *encap;
342 struct net_device *reg_dev = NULL; 341 struct net_device *reg_dev = NULL;
342 int reg_vif_num = init_net.ipv6.mroute_reg_vif_num;
343 343
344 if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap))) 344 if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap)))
345 goto drop; 345 goto drop;
@@ -401,7 +401,7 @@ static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev)
401 read_lock(&mrt_lock); 401 read_lock(&mrt_lock);
402 dev->stats.tx_bytes += skb->len; 402 dev->stats.tx_bytes += skb->len;
403 dev->stats.tx_packets++; 403 dev->stats.tx_packets++;
404 ip6mr_cache_report(skb, reg_vif_num, MRT6MSG_WHOLEPKT); 404 ip6mr_cache_report(skb, init_net.ipv6.mroute_reg_vif_num, MRT6MSG_WHOLEPKT);
405 read_unlock(&mrt_lock); 405 read_unlock(&mrt_lock);
406 kfree_skb(skb); 406 kfree_skb(skb);
407 return 0; 407 return 0;
@@ -473,8 +473,8 @@ static int mif6_delete(int vifi)
473 } 473 }
474 474
475#ifdef CONFIG_IPV6_PIMSM_V2 475#ifdef CONFIG_IPV6_PIMSM_V2
476 if (vifi == reg_vif_num) 476 if (vifi == init_net.ipv6.mroute_reg_vif_num)
477 reg_vif_num = -1; 477 init_net.ipv6.mroute_reg_vif_num = -1;
478#endif 478#endif
479 479
480 if (vifi + 1 == init_net.ipv6.maxvif) { 480 if (vifi + 1 == init_net.ipv6.maxvif) {
@@ -610,7 +610,7 @@ static int mif6_add(struct mif6ctl *vifc, int mrtsock)
610 * Special Purpose VIF in PIM 610 * Special Purpose VIF in PIM
611 * All the packets will be sent to the daemon 611 * All the packets will be sent to the daemon
612 */ 612 */
613 if (reg_vif_num >= 0) 613 if (init_net.ipv6.mroute_reg_vif_num >= 0)
614 return -EADDRINUSE; 614 return -EADDRINUSE;
615 dev = ip6mr_reg_vif(); 615 dev = ip6mr_reg_vif();
616 if (!dev) 616 if (!dev)
@@ -658,7 +658,7 @@ static int mif6_add(struct mif6ctl *vifc, int mrtsock)
658 v->dev = dev; 658 v->dev = dev;
659#ifdef CONFIG_IPV6_PIMSM_V2 659#ifdef CONFIG_IPV6_PIMSM_V2
660 if (v->flags & MIFF_REGISTER) 660 if (v->flags & MIFF_REGISTER)
661 reg_vif_num = vifi; 661 init_net.ipv6.mroute_reg_vif_num = vifi;
662#endif 662#endif
663 if (vifi + 1 > init_net.ipv6.maxvif) 663 if (vifi + 1 > init_net.ipv6.maxvif)
664 init_net.ipv6.maxvif = vifi + 1; 664 init_net.ipv6.maxvif = vifi + 1;
@@ -777,7 +777,7 @@ static int ip6mr_cache_report(struct sk_buff *pkt, mifi_t mifi, int assert)
777 msg = (struct mrt6msg *)skb_transport_header(skb); 777 msg = (struct mrt6msg *)skb_transport_header(skb);
778 msg->im6_mbz = 0; 778 msg->im6_mbz = 0;
779 msg->im6_msgtype = MRT6MSG_WHOLEPKT; 779 msg->im6_msgtype = MRT6MSG_WHOLEPKT;
780 msg->im6_mif = reg_vif_num; 780 msg->im6_mif = init_net.ipv6.mroute_reg_vif_num;
781 msg->im6_pad = 0; 781 msg->im6_pad = 0;
782 ipv6_addr_copy(&msg->im6_src, &ipv6_hdr(pkt)->saddr); 782 ipv6_addr_copy(&msg->im6_src, &ipv6_hdr(pkt)->saddr);
783 ipv6_addr_copy(&msg->im6_dst, &ipv6_hdr(pkt)->daddr); 783 ipv6_addr_copy(&msg->im6_dst, &ipv6_hdr(pkt)->daddr);
@@ -964,7 +964,6 @@ static struct notifier_block ip6_mr_notifier = {
964static int __net_init ip6mr_net_init(struct net *net) 964static int __net_init ip6mr_net_init(struct net *net)
965{ 965{
966 int err = 0; 966 int err = 0;
967
968 net->ipv6.vif6_table = kcalloc(MAXMIFS, sizeof(struct mif_device), 967 net->ipv6.vif6_table = kcalloc(MAXMIFS, sizeof(struct mif_device),
969 GFP_KERNEL); 968 GFP_KERNEL);
970 if (!net->ipv6.vif6_table) { 969 if (!net->ipv6.vif6_table) {
@@ -980,6 +979,10 @@ static int __net_init ip6mr_net_init(struct net *net)
980 err = -ENOMEM; 979 err = -ENOMEM;
981 goto fail_mfc6_cache; 980 goto fail_mfc6_cache;
982 } 981 }
982
983#ifdef CONFIG_IPV6_PIMSM_V2
984 net->ipv6.mroute_reg_vif_num = -1;
985#endif
983 return 0; 986 return 0;
984 987
985fail_mfc6_cache: 988fail_mfc6_cache: