aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorNicolas Dichtel <nicolas.dichtel@6wind.com>2012-12-03 20:13:35 -0500
committerDavid S. Miller <davem@davemloft.net>2012-12-04 13:08:10 -0500
commitd67b8c616b48df30e2836d797795f2420d109bc9 (patch)
treee06b3f77e905e789def714958fcd455c8b3c037b /net/ipv6
parente8ad1a8fab6f550aba1f1fe7ba26749ff5460751 (diff)
netconf: advertise mc_forwarding status
This patch advertise the MC_FORWARDING status for IPv4 and IPv6. This field is readonly, only multicast engine in the kernel updates it. Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/addrconf.c10
-rw-r--r--net/ipv6/ip6mr.c20
2 files changed, 26 insertions, 4 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 22ae75d54017..28e0e627229c 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -469,6 +469,8 @@ static int inet6_netconf_msgsize_devconf(int type)
469 /* type -1 is used for ALL */ 469 /* type -1 is used for ALL */
470 if (type == -1 || type == NETCONFA_FORWARDING) 470 if (type == -1 || type == NETCONFA_FORWARDING)
471 size += nla_total_size(4); 471 size += nla_total_size(4);
472 if (type == -1 || type == NETCONFA_MC_FORWARDING)
473 size += nla_total_size(4);
472 474
473 return size; 475 return size;
474} 476}
@@ -496,6 +498,10 @@ static int inet6_netconf_fill_devconf(struct sk_buff *skb, int ifindex,
496 if ((type == -1 || type == NETCONFA_FORWARDING) && 498 if ((type == -1 || type == NETCONFA_FORWARDING) &&
497 nla_put_s32(skb, NETCONFA_FORWARDING, devconf->forwarding) < 0) 499 nla_put_s32(skb, NETCONFA_FORWARDING, devconf->forwarding) < 0)
498 goto nla_put_failure; 500 goto nla_put_failure;
501 if ((type == -1 || type == NETCONFA_MC_FORWARDING) &&
502 nla_put_s32(skb, NETCONFA_MC_FORWARDING,
503 devconf->mc_forwarding) < 0)
504 goto nla_put_failure;
499 505
500 return nlmsg_end(skb, nlh); 506 return nlmsg_end(skb, nlh);
501 507
@@ -504,8 +510,8 @@ nla_put_failure:
504 return -EMSGSIZE; 510 return -EMSGSIZE;
505} 511}
506 512
507static void inet6_netconf_notify_devconf(struct net *net, int type, int ifindex, 513void inet6_netconf_notify_devconf(struct net *net, int type, int ifindex,
508 struct ipv6_devconf *devconf) 514 struct ipv6_devconf *devconf)
509{ 515{
510 struct sk_buff *skb; 516 struct sk_buff *skb;
511 int err = -ENOBUFS; 517 int err = -ENOBUFS;
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 926ea544f499..1c05fe604d37 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -52,6 +52,7 @@
52#include <linux/netfilter_ipv6.h> 52#include <linux/netfilter_ipv6.h>
53#include <linux/export.h> 53#include <linux/export.h>
54#include <net/ip6_checksum.h> 54#include <net/ip6_checksum.h>
55#include <linux/netconf.h>
55 56
56struct mr6_table { 57struct mr6_table {
57 struct list_head list; 58 struct list_head list;
@@ -805,8 +806,12 @@ static int mif6_delete(struct mr6_table *mrt, int vifi, struct list_head *head)
805 dev_set_allmulti(dev, -1); 806 dev_set_allmulti(dev, -1);
806 807
807 in6_dev = __in6_dev_get(dev); 808 in6_dev = __in6_dev_get(dev);
808 if (in6_dev) 809 if (in6_dev) {
809 in6_dev->cnf.mc_forwarding--; 810 in6_dev->cnf.mc_forwarding--;
811 inet6_netconf_notify_devconf(dev_net(dev),
812 NETCONFA_MC_FORWARDING,
813 dev->ifindex, &in6_dev->cnf);
814 }
810 815
811 if (v->flags & MIFF_REGISTER) 816 if (v->flags & MIFF_REGISTER)
812 unregister_netdevice_queue(dev, head); 817 unregister_netdevice_queue(dev, head);
@@ -958,8 +963,12 @@ static int mif6_add(struct net *net, struct mr6_table *mrt,
958 } 963 }
959 964
960 in6_dev = __in6_dev_get(dev); 965 in6_dev = __in6_dev_get(dev);
961 if (in6_dev) 966 if (in6_dev) {
962 in6_dev->cnf.mc_forwarding++; 967 in6_dev->cnf.mc_forwarding++;
968 inet6_netconf_notify_devconf(dev_net(dev),
969 NETCONFA_MC_FORWARDING,
970 dev->ifindex, &in6_dev->cnf);
971 }
963 972
964 /* 973 /*
965 * Fill in the VIF structures 974 * Fill in the VIF structures
@@ -1513,6 +1522,9 @@ static int ip6mr_sk_init(struct mr6_table *mrt, struct sock *sk)
1513 if (likely(mrt->mroute6_sk == NULL)) { 1522 if (likely(mrt->mroute6_sk == NULL)) {
1514 mrt->mroute6_sk = sk; 1523 mrt->mroute6_sk = sk;
1515 net->ipv6.devconf_all->mc_forwarding++; 1524 net->ipv6.devconf_all->mc_forwarding++;
1525 inet6_netconf_notify_devconf(net, NETCONFA_MC_FORWARDING,
1526 NETCONFA_IFINDEX_ALL,
1527 net->ipv6.devconf_all);
1516 } 1528 }
1517 else 1529 else
1518 err = -EADDRINUSE; 1530 err = -EADDRINUSE;
@@ -1535,6 +1547,10 @@ int ip6mr_sk_done(struct sock *sk)
1535 write_lock_bh(&mrt_lock); 1547 write_lock_bh(&mrt_lock);
1536 mrt->mroute6_sk = NULL; 1548 mrt->mroute6_sk = NULL;
1537 net->ipv6.devconf_all->mc_forwarding--; 1549 net->ipv6.devconf_all->mc_forwarding--;
1550 inet6_netconf_notify_devconf(net,
1551 NETCONFA_MC_FORWARDING,
1552 NETCONFA_IFINDEX_ALL,
1553 net->ipv6.devconf_all);
1538 write_unlock_bh(&mrt_lock); 1554 write_unlock_bh(&mrt_lock);
1539 1555
1540 mroute_clean_tables(mrt); 1556 mroute_clean_tables(mrt);