@@ -1696,6 +1696,8 @@ static int inet_netconf_msgsize_devconf(int type)
16961696 size += nla_total_size (4 );
16971697 if (type == -1 || type == NETCONFA_MC_FORWARDING )
16981698 size += nla_total_size (4 );
1699+ if (type == -1 || type == NETCONFA_PROXY_ARP )
1700+ size += nla_total_size (4 );
16991701
17001702 return size ;
17011703}
@@ -1732,6 +1734,10 @@ static int inet_netconf_fill_devconf(struct sk_buff *skb, int ifindex,
17321734 nla_put_s32 (skb , NETCONFA_MC_FORWARDING ,
17331735 IPV4_DEVCONF (* devconf , MC_FORWARDING )) < 0 )
17341736 goto nla_put_failure ;
1737+ if ((type == -1 || type == NETCONFA_PROXY_ARP ) &&
1738+ nla_put_s32 (skb , NETCONFA_PROXY_ARP ,
1739+ IPV4_DEVCONF (* devconf , PROXY_ARP )) < 0 )
1740+ goto nla_put_failure ;
17351741
17361742 return nlmsg_end (skb , nlh );
17371743
@@ -1769,6 +1775,7 @@ static const struct nla_policy devconf_ipv4_policy[NETCONFA_MAX+1] = {
17691775 [NETCONFA_IFINDEX ] = { .len = sizeof (int ) },
17701776 [NETCONFA_FORWARDING ] = { .len = sizeof (int ) },
17711777 [NETCONFA_RP_FILTER ] = { .len = sizeof (int ) },
1778+ [NETCONFA_PROXY_ARP ] = { .len = sizeof (int ) },
17721779};
17731780
17741781static int inet_netconf_get_devconf (struct sk_buff * in_skb ,
@@ -1950,6 +1957,19 @@ static void inet_forward_change(struct net *net)
19501957 }
19511958}
19521959
1960+ static int devinet_conf_ifindex (struct net * net , struct ipv4_devconf * cnf )
1961+ {
1962+ if (cnf == net -> ipv4 .devconf_dflt )
1963+ return NETCONFA_IFINDEX_DEFAULT ;
1964+ else if (cnf == net -> ipv4 .devconf_all )
1965+ return NETCONFA_IFINDEX_ALL ;
1966+ else {
1967+ struct in_device * idev
1968+ = container_of (cnf , struct in_device , cnf );
1969+ return idev -> dev -> ifindex ;
1970+ }
1971+ }
1972+
19531973static int devinet_conf_proc (struct ctl_table * ctl , int write ,
19541974 void __user * buffer ,
19551975 size_t * lenp , loff_t * ppos )
@@ -1962,6 +1982,7 @@ static int devinet_conf_proc(struct ctl_table *ctl, int write,
19621982 struct ipv4_devconf * cnf = ctl -> extra1 ;
19631983 struct net * net = ctl -> extra2 ;
19641984 int i = (int * )ctl -> data - cnf -> data ;
1985+ int ifindex ;
19651986
19661987 set_bit (i , cnf -> state );
19671988
@@ -1971,23 +1992,19 @@ static int devinet_conf_proc(struct ctl_table *ctl, int write,
19711992 i == IPV4_DEVCONF_ROUTE_LOCALNET - 1 )
19721993 if ((new_value == 0 ) && (old_value != 0 ))
19731994 rt_cache_flush (net );
1995+
19741996 if (i == IPV4_DEVCONF_RP_FILTER - 1 &&
19751997 new_value != old_value ) {
1976- int ifindex ;
1977-
1978- if (cnf == net -> ipv4 .devconf_dflt )
1979- ifindex = NETCONFA_IFINDEX_DEFAULT ;
1980- else if (cnf == net -> ipv4 .devconf_all )
1981- ifindex = NETCONFA_IFINDEX_ALL ;
1982- else {
1983- struct in_device * idev =
1984- container_of (cnf , struct in_device ,
1985- cnf );
1986- ifindex = idev -> dev -> ifindex ;
1987- }
1998+ ifindex = devinet_conf_ifindex (net , cnf );
19881999 inet_netconf_notify_devconf (net , NETCONFA_RP_FILTER ,
19892000 ifindex , cnf );
19902001 }
2002+ if (i == IPV4_DEVCONF_PROXY_ARP - 1 &&
2003+ new_value != old_value ) {
2004+ ifindex = devinet_conf_ifindex (net , cnf );
2005+ inet_netconf_notify_devconf (net , NETCONFA_PROXY_ARP ,
2006+ ifindex , cnf );
2007+ }
19912008 }
19922009
19932010 return ret ;
0 commit comments