[IPV4] ARP: Alloc acceptance of unsolicited ARP via netdevice sysctl.
authorNeil Horman <nhorman@tuxdriver.com>
Tue, 21 Mar 2006 06:39:47 +0000 (22:39 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Mar 2006 06:39:47 +0000 (22:39 -0800)
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/inetdevice.h
include/linux/sysctl.h
net/ipv4/arp.c
net/ipv4/devinet.c

index fd7af86151b1ed06879f12cd5fa3323cb1533f46..92297ff24e8525de2617dff728b3420a4649f66a 100644 (file)
@@ -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;
index dfcf449afc7c03c1482ad289421eeefdf50a4f90..8754568a75d79c4ecb283e330d5f7c5684bc1117 100644 (file)
@@ -456,6 +456,7 @@ enum
        NET_IPV4_CONF_ARP_ANNOUNCE=18,
        NET_IPV4_CONF_ARP_IGNORE=19,
        NET_IPV4_CONF_PROMOTE_SECONDARIES=20,
+       NET_IPV4_CONF_ARP_ACCEPT=21,
        __NET_IPV4_CONF_MAX
 };
 
index accdefedfed72654eba15e642d87630ddb090d9b..041dadde31af74c23b482bb65905f2bba6822471 100644 (file)
@@ -879,16 +879,16 @@ static int arp_process(struct sk_buff *skb)
 
        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;
index 3ffa60dadc0c6b7360ce91c2b58404785d6d1be3..44fdf1413e2c6e6eabda3b6c44dbb9e30881cd99 100644 (file)
@@ -1393,6 +1393,14 @@ static struct devinet_sysctl_table {
                        .mode           = 0644,
                        .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",