aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
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/ipv4
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/ipv4')
-rw-r--r--net/ipv4/devinet.c10
-rw-r--r--net/ipv4/ipmr.c12
2 files changed, 20 insertions, 2 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index e13183abd7f6..cc06a47f1216 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1453,6 +1453,8 @@ static int inet_netconf_msgsize_devconf(int type)
1453 size += nla_total_size(4); 1453 size += nla_total_size(4);
1454 if (type == -1 || type == NETCONFA_RP_FILTER) 1454 if (type == -1 || type == NETCONFA_RP_FILTER)
1455 size += nla_total_size(4); 1455 size += nla_total_size(4);
1456 if (type == -1 || type == NETCONFA_MC_FORWARDING)
1457 size += nla_total_size(4);
1456 1458
1457 return size; 1459 return size;
1458} 1460}
@@ -1485,6 +1487,10 @@ static int inet_netconf_fill_devconf(struct sk_buff *skb, int ifindex,
1485 nla_put_s32(skb, NETCONFA_RP_FILTER, 1487 nla_put_s32(skb, NETCONFA_RP_FILTER,
1486 IPV4_DEVCONF(*devconf, RP_FILTER)) < 0) 1488 IPV4_DEVCONF(*devconf, RP_FILTER)) < 0)
1487 goto nla_put_failure; 1489 goto nla_put_failure;
1490 if ((type == -1 || type == NETCONFA_MC_FORWARDING) &&
1491 nla_put_s32(skb, NETCONFA_MC_FORWARDING,
1492 IPV4_DEVCONF(*devconf, MC_FORWARDING)) < 0)
1493 goto nla_put_failure;
1488 1494
1489 return nlmsg_end(skb, nlh); 1495 return nlmsg_end(skb, nlh);
1490 1496
@@ -1493,8 +1499,8 @@ nla_put_failure:
1493 return -EMSGSIZE; 1499 return -EMSGSIZE;
1494} 1500}
1495 1501
1496static void inet_netconf_notify_devconf(struct net *net, int type, int ifindex, 1502void inet_netconf_notify_devconf(struct net *net, int type, int ifindex,
1497 struct ipv4_devconf *devconf) 1503 struct ipv4_devconf *devconf)
1498{ 1504{
1499 struct sk_buff *skb; 1505 struct sk_buff *skb;
1500 int err = -ENOBUFS; 1506 int err = -ENOBUFS;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 58e4160fdcee..0c452e3fdc1b 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -65,6 +65,7 @@
65#include <net/checksum.h> 65#include <net/checksum.h>
66#include <net/netlink.h> 66#include <net/netlink.h>
67#include <net/fib_rules.h> 67#include <net/fib_rules.h>
68#include <linux/netconf.h>
68 69
69#if defined(CONFIG_IP_PIMSM_V1) || defined(CONFIG_IP_PIMSM_V2) 70#if defined(CONFIG_IP_PIMSM_V1) || defined(CONFIG_IP_PIMSM_V2)
70#define CONFIG_IP_PIMSM 1 71#define CONFIG_IP_PIMSM 1
@@ -582,6 +583,9 @@ static int vif_delete(struct mr_table *mrt, int vifi, int notify,
582 in_dev = __in_dev_get_rtnl(dev); 583 in_dev = __in_dev_get_rtnl(dev);
583 if (in_dev) { 584 if (in_dev) {
584 IPV4_DEVCONF(in_dev->cnf, MC_FORWARDING)--; 585 IPV4_DEVCONF(in_dev->cnf, MC_FORWARDING)--;
586 inet_netconf_notify_devconf(dev_net(dev),
587 NETCONFA_MC_FORWARDING,
588 dev->ifindex, &in_dev->cnf);
585 ip_rt_multicast_event(in_dev); 589 ip_rt_multicast_event(in_dev);
586 } 590 }
587 591
@@ -772,6 +776,8 @@ static int vif_add(struct net *net, struct mr_table *mrt,
772 return -EADDRNOTAVAIL; 776 return -EADDRNOTAVAIL;
773 } 777 }
774 IPV4_DEVCONF(in_dev->cnf, MC_FORWARDING)++; 778 IPV4_DEVCONF(in_dev->cnf, MC_FORWARDING)++;
779 inet_netconf_notify_devconf(net, NETCONFA_MC_FORWARDING, dev->ifindex,
780 &in_dev->cnf);
775 ip_rt_multicast_event(in_dev); 781 ip_rt_multicast_event(in_dev);
776 782
777 /* Fill in the VIF structures */ 783 /* Fill in the VIF structures */
@@ -1185,6 +1191,9 @@ static void mrtsock_destruct(struct sock *sk)
1185 ipmr_for_each_table(mrt, net) { 1191 ipmr_for_each_table(mrt, net) {
1186 if (sk == rtnl_dereference(mrt->mroute_sk)) { 1192 if (sk == rtnl_dereference(mrt->mroute_sk)) {
1187 IPV4_DEVCONF_ALL(net, MC_FORWARDING)--; 1193 IPV4_DEVCONF_ALL(net, MC_FORWARDING)--;
1194 inet_netconf_notify_devconf(net, NETCONFA_MC_FORWARDING,
1195 NETCONFA_IFINDEX_ALL,
1196 net->ipv4.devconf_all);
1188 RCU_INIT_POINTER(mrt->mroute_sk, NULL); 1197 RCU_INIT_POINTER(mrt->mroute_sk, NULL);
1189 mroute_clean_tables(mrt); 1198 mroute_clean_tables(mrt);
1190 } 1199 }
@@ -1236,6 +1245,9 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, unsi
1236 if (ret == 0) { 1245 if (ret == 0) {
1237 rcu_assign_pointer(mrt->mroute_sk, sk); 1246 rcu_assign_pointer(mrt->mroute_sk, sk);
1238 IPV4_DEVCONF_ALL(net, MC_FORWARDING)++; 1247 IPV4_DEVCONF_ALL(net, MC_FORWARDING)++;
1248 inet_netconf_notify_devconf(net, NETCONFA_MC_FORWARDING,
1249 NETCONFA_IFINDEX_ALL,
1250 net->ipv4.devconf_all);
1239 } 1251 }
1240 rtnl_unlock(); 1252 rtnl_unlock();
1241 return ret; 1253 return ret;