Skip to content

Commit abd596a

Browse files
nhormandavem330
authored andcommitted
[IPV4] ARP: Alloc acceptance of unsolicited ARP via netdevice sysctl.
Signed-off-by: Neil Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 59f1741 commit abd596a

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

include/linux/inetdevice.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ struct ipv4_devconf
2525
int arp_filter;
2626
int arp_announce;
2727
int arp_ignore;
28+
int arp_accept;
2829
int medium_id;
2930
int no_xfrm;
3031
int no_policy;

include/linux/sysctl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ enum
456456
NET_IPV4_CONF_ARP_ANNOUNCE=18,
457457
NET_IPV4_CONF_ARP_IGNORE=19,
458458
NET_IPV4_CONF_PROMOTE_SECONDARIES=20,
459+
NET_IPV4_CONF_ARP_ACCEPT=21,
459460
__NET_IPV4_CONF_MAX
460461
};
461462

net/ipv4/arp.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -879,16 +879,16 @@ static int arp_process(struct sk_buff *skb)
879879

880880
n = __neigh_lookup(&arp_tbl, &sip, dev, 0);
881881

882-
#ifdef CONFIG_IP_ACCEPT_UNSOLICITED_ARP
883-
/* Unsolicited ARP is not accepted by default.
884-
It is possible, that this option should be enabled for some
885-
devices (strip is candidate)
886-
*/
887-
if (n == NULL &&
888-
arp->ar_op == htons(ARPOP_REPLY) &&
889-
inet_addr_type(sip) == RTN_UNICAST)
890-
n = __neigh_lookup(&arp_tbl, &sip, dev, -1);
891-
#endif
882+
if (ipv4_devconf.arp_accept) {
883+
/* Unsolicited ARP is not accepted by default.
884+
It is possible, that this option should be enabled for some
885+
devices (strip is candidate)
886+
*/
887+
if (n == NULL &&
888+
arp->ar_op == htons(ARPOP_REPLY) &&
889+
inet_addr_type(sip) == RTN_UNICAST)
890+
n = __neigh_lookup(&arp_tbl, &sip, dev, -1);
891+
}
892892

893893
if (n) {
894894
int state = NUD_REACHABLE;

net/ipv4/devinet.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,6 +1393,14 @@ static struct devinet_sysctl_table {
13931393
.mode = 0644,
13941394
.proc_handler = &proc_dointvec,
13951395
},
1396+
{
1397+
.ctl_name = NET_IPV4_CONF_ARP_ACCEPT,
1398+
.procname = "arp_accept",
1399+
.data = &ipv4_devconf.arp_accept,
1400+
.maxlen = sizeof(int),
1401+
.mode = 0644,
1402+
.proc_handler = &proc_dointvec,
1403+
},
13961404
{
13971405
.ctl_name = NET_IPV4_CONF_NOXFRM,
13981406
.procname = "disable_xfrm",

0 commit comments

Comments
 (0)