diff mbox

[net-next] net: add support for linkdown sysctl to netconf

Message ID 1436206919-973-1-git-send-email-gospo@cumulusnetworks.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Andy Gospodarek July 6, 2015, 6:21 p.m. UTC
This kernel patch exports the value of the new
ignore_routes_with_linkdown via netconf.

Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com>
Suggested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 include/uapi/linux/netconf.h | 1 +
 net/ipv4/devinet.c           | 7 +++++++
 2 files changed, 8 insertions(+)

Comments

Nicolas Dichtel July 7, 2015, 7:57 a.m. UTC | #1
Le 06/07/2015 20:21, Andy Gospodarek a écrit :
> This kernel patch exports the value of the new
> ignore_routes_with_linkdown via netconf.
>
> Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com>
> Suggested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
You need also to patch devinet_conf_proc() so that a netlink message is
sent when the user updates the sysctl entry.


Regards,
Nicolas
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andy Gospodarek July 7, 2015, 2:21 p.m. UTC | #2
On Tue, Jul 07, 2015 at 09:57:57AM +0200, Nicolas Dichtel wrote:
> Le 06/07/2015 20:21, Andy Gospodarek a écrit :
> >This kernel patch exports the value of the new
> >ignore_routes_with_linkdown via netconf.
> >
> >Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com>
> >Suggested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> >---
> You need also to patch devinet_conf_proc() so that a netlink message is
> sent when the user updates the sysctl entry.

Doh!  I had that change in a different topic branch, but didn't
cherry-pick correctly before posting.  Thanks for catching this!

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/uapi/linux/netconf.h b/include/uapi/linux/netconf.h
index 669a1f0..23cbd34 100644
--- a/include/uapi/linux/netconf.h
+++ b/include/uapi/linux/netconf.h
@@ -15,6 +15,7 @@  enum {
 	NETCONFA_RP_FILTER,
 	NETCONFA_MC_FORWARDING,
 	NETCONFA_PROXY_NEIGH,
+	NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN,
 	__NETCONFA_MAX
 };
 #define NETCONFA_MAX	(__NETCONFA_MAX - 1)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 7498716..de2c563 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1740,6 +1740,8 @@  static int inet_netconf_msgsize_devconf(int type)
 		size += nla_total_size(4);
 	if (type == -1 || type == NETCONFA_PROXY_NEIGH)
 		size += nla_total_size(4);
+	if (type == -1 || type == NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN)
+		size += nla_total_size(4);
 
 	return size;
 }
@@ -1780,6 +1782,10 @@  static int inet_netconf_fill_devconf(struct sk_buff *skb, int ifindex,
 	    nla_put_s32(skb, NETCONFA_PROXY_NEIGH,
 			IPV4_DEVCONF(*devconf, PROXY_ARP)) < 0)
 		goto nla_put_failure;
+	if ((type == -1 || type == NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN) &&
+	    nla_put_s32(skb, NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN,
+			IPV4_DEVCONF(*devconf, IGNORE_ROUTES_WITH_LINKDOWN)) < 0)
+		goto nla_put_failure;
 
 	nlmsg_end(skb, nlh);
 	return 0;
@@ -1819,6 +1825,7 @@  static const struct nla_policy devconf_ipv4_policy[NETCONFA_MAX+1] = {
 	[NETCONFA_FORWARDING]	= { .len = sizeof(int) },
 	[NETCONFA_RP_FILTER]	= { .len = sizeof(int) },
 	[NETCONFA_PROXY_NEIGH]	= { .len = sizeof(int) },
+	[NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN]	= { .len = sizeof(int) },
 };
 
 static int inet_netconf_get_devconf(struct sk_buff *in_skb,