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>
This commit is contained in:
		
					parent
					
						
							
								671b53eec2
							
						
					
				
			
			
				commit
				
					
						974d7af5fc
					
				
			
		
					 2 changed files with 14 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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,
 | 
			
		||||
| 
						 | 
				
			
			@ -2048,6 +2055,12 @@ static int devinet_conf_proc(struct ctl_table *ctl, int write,
 | 
			
		|||
			inet_netconf_notify_devconf(net, NETCONFA_PROXY_NEIGH,
 | 
			
		||||
						    ifindex, cnf);
 | 
			
		||||
		}
 | 
			
		||||
		if (i == IPV4_DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN - 1 &&
 | 
			
		||||
		    new_value != old_value) {
 | 
			
		||||
			ifindex = devinet_conf_ifindex(net, cnf);
 | 
			
		||||
			inet_netconf_notify_devconf(net, NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN,
 | 
			
		||||
						    ifindex, cnf);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue