diff options
author | Andy Gospodarek <gospo@cumulusnetworks.com> | 2015-07-07 13:56:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-07-09 02:34:53 -0400 |
commit | 974d7af5fcc295dcf8315255142b2fe44fd74b0c (patch) | |
tree | 63edec7d12d90ec24d170f48a002c6bb9b07318e | |
parent | 671b53eec2edcbfac3e53d02cf3d0c6d9ecc07de (diff) |
ipv4: add support for linkdown sysctl to netconf
This kernel patch exports the value of the new
ignore_routes_with_linkdown via netconf.
v2: changes to notify userspace via netlink when sysctl values change
and proposed for 'net' since this could be considered a bugfix
Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com>
Suggested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/uapi/linux/netconf.h | 1 | ||||
-rw-r--r-- | net/ipv4/devinet.c | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/include/uapi/linux/netconf.h b/include/uapi/linux/netconf.h index 669a1f0b1d97..23cbd34e4ac7 100644 --- a/include/uapi/linux/netconf.h +++ b/include/uapi/linux/netconf.h | |||
@@ -15,6 +15,7 @@ enum { | |||
15 | NETCONFA_RP_FILTER, | 15 | NETCONFA_RP_FILTER, |
16 | NETCONFA_MC_FORWARDING, | 16 | NETCONFA_MC_FORWARDING, |
17 | NETCONFA_PROXY_NEIGH, | 17 | NETCONFA_PROXY_NEIGH, |
18 | NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN, | ||
18 | __NETCONFA_MAX | 19 | __NETCONFA_MAX |
19 | }; | 20 | }; |
20 | #define NETCONFA_MAX (__NETCONFA_MAX - 1) | 21 | #define NETCONFA_MAX (__NETCONFA_MAX - 1) |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 7498716e8f54..e813196c91c7 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -1740,6 +1740,8 @@ static int inet_netconf_msgsize_devconf(int type) | |||
1740 | size += nla_total_size(4); | 1740 | size += nla_total_size(4); |
1741 | if (type == -1 || type == NETCONFA_PROXY_NEIGH) | 1741 | if (type == -1 || type == NETCONFA_PROXY_NEIGH) |
1742 | size += nla_total_size(4); | 1742 | size += nla_total_size(4); |
1743 | if (type == -1 || type == NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN) | ||
1744 | size += nla_total_size(4); | ||
1743 | 1745 | ||
1744 | return size; | 1746 | return size; |
1745 | } | 1747 | } |
@@ -1780,6 +1782,10 @@ static int inet_netconf_fill_devconf(struct sk_buff *skb, int ifindex, | |||
1780 | nla_put_s32(skb, NETCONFA_PROXY_NEIGH, | 1782 | nla_put_s32(skb, NETCONFA_PROXY_NEIGH, |
1781 | IPV4_DEVCONF(*devconf, PROXY_ARP)) < 0) | 1783 | IPV4_DEVCONF(*devconf, PROXY_ARP)) < 0) |
1782 | goto nla_put_failure; | 1784 | goto nla_put_failure; |
1785 | if ((type == -1 || type == NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN) && | ||
1786 | nla_put_s32(skb, NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN, | ||
1787 | IPV4_DEVCONF(*devconf, IGNORE_ROUTES_WITH_LINKDOWN)) < 0) | ||
1788 | goto nla_put_failure; | ||
1783 | 1789 | ||
1784 | nlmsg_end(skb, nlh); | 1790 | nlmsg_end(skb, nlh); |
1785 | return 0; | 1791 | return 0; |
@@ -1819,6 +1825,7 @@ static const struct nla_policy devconf_ipv4_policy[NETCONFA_MAX+1] = { | |||
1819 | [NETCONFA_FORWARDING] = { .len = sizeof(int) }, | 1825 | [NETCONFA_FORWARDING] = { .len = sizeof(int) }, |
1820 | [NETCONFA_RP_FILTER] = { .len = sizeof(int) }, | 1826 | [NETCONFA_RP_FILTER] = { .len = sizeof(int) }, |
1821 | [NETCONFA_PROXY_NEIGH] = { .len = sizeof(int) }, | 1827 | [NETCONFA_PROXY_NEIGH] = { .len = sizeof(int) }, |
1828 | [NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN] = { .len = sizeof(int) }, | ||
1822 | }; | 1829 | }; |
1823 | 1830 | ||
1824 | static int inet_netconf_get_devconf(struct sk_buff *in_skb, | 1831 | static int inet_netconf_get_devconf(struct sk_buff *in_skb, |
@@ -2048,6 +2055,12 @@ static int devinet_conf_proc(struct ctl_table *ctl, int write, | |||
2048 | inet_netconf_notify_devconf(net, NETCONFA_PROXY_NEIGH, | 2055 | inet_netconf_notify_devconf(net, NETCONFA_PROXY_NEIGH, |
2049 | ifindex, cnf); | 2056 | ifindex, cnf); |
2050 | } | 2057 | } |
2058 | if (i == IPV4_DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN - 1 && | ||
2059 | new_value != old_value) { | ||
2060 | ifindex = devinet_conf_ifindex(net, cnf); | ||
2061 | inet_netconf_notify_devconf(net, NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN, | ||
2062 | ifindex, cnf); | ||
2063 | } | ||
2051 | } | 2064 | } |
2052 | 2065 | ||
2053 | return ret; | 2066 | return ret; |