As promised, new patch attached, that makes accepting gratuitous arps a
dynamically configurable option.  Tested successfully by me.

Thanks & Regards
Neil

Signed-off-by: Neil Horman <[EMAIL PROTECTED]>


 include/linux/inetdevice.h |    1 +
 include/linux/sysctl.h     |    3 ++-
 net/ipv4/arp.c             |   20 ++++++++++----------
 net/ipv4/devinet.c         |    8 ++++++++
 4 files changed, 21 insertions(+), 11 deletions(-)


diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -25,6 +25,7 @@ struct ipv4_devconf
        int     arp_filter;
        int     arp_announce;
        int     arp_ignore;
+       int     arp_accept;
        int     medium_id;
        int     no_xfrm;
        int     no_policy;
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -447,7 +447,8 @@ enum
        NET_IPV4_CONF_FORCE_IGMP_VERSION=17,
        NET_IPV4_CONF_ARP_ANNOUNCE=18,
        NET_IPV4_CONF_ARP_IGNORE=19,
-       NET_IPV4_CONF_PROMOTE_SECONDARIES=20,
+       NET_IPV4_CONF_ARP_ACCEPT=20,
+       NET_IPV4_CONF_PROMOTE_SECONDARIES=21,
        __NET_IPV4_CONF_MAX
 };
 
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -879,16 +879,16 @@ static int arp_process(struct sk_buff *s
 
        n = __neigh_lookup(&arp_tbl, &sip, dev, 0);
 
-#ifdef CONFIG_IP_ACCEPT_UNSOLICITED_ARP
-       /* Unsolicited ARP is not accepted by default.
-          It is possible, that this option should be enabled for some
-          devices (strip is candidate)
-        */
-       if (n == NULL &&
-           arp->ar_op == htons(ARPOP_REPLY) &&
-           inet_addr_type(sip) == RTN_UNICAST)
-               n = __neigh_lookup(&arp_tbl, &sip, dev, -1);
-#endif
+       if (ipv4_devconf.arp_accept) {
+               /* Unsolicited ARP is not accepted by default.
+                  It is possible, that this option should be enabled for some
+                  devices (strip is candidate)
+                */
+               if (n == NULL &&
+                   arp->ar_op == htons(ARPOP_REPLY) &&
+                   inet_addr_type(sip) == RTN_UNICAST)
+                       n = __neigh_lookup(&arp_tbl, &sip, dev, -1);
+       }
 
        if (n) {
                int state = NUD_REACHABLE;
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1394,6 +1394,14 @@ static struct devinet_sysctl_table {
                        .proc_handler   = &proc_dointvec,
                },
                {
+                       .ctl_name       = NET_IPV4_CONF_ARP_ACCEPT,
+                       .procname       = "arp_accept",
+                       .data           = &ipv4_devconf.arp_accept,
+                       .maxlen         = sizeof(int),
+                       .mode           = 0644,
+                       .proc_handler   = &proc_dointvec,
+               },
+               {
                        .ctl_name       = NET_IPV4_CONF_NOXFRM,
                        .procname       = "disable_xfrm",
                        .data           = &ipv4_devconf.no_xfrm,
-- 
/***************************************************
 *Neil Horman
 *Software Engineer
 *gpg keyid: 1024D / 0x92A74FA1 - http://pgp.mit.edu
 ***************************************************/
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to