History

ipv4: add option to drop gratuitous ARP packets

In certain 802.11 wireless deployments, there will be ARP proxies that use knowledge of the network to correctly answer requests. To prevent gratuitous ARP frames on the shared medium from being a problem, on such deployments wireless needs to drop them. Enable this by providing an option called "drop_gratuitous_arp".

Johannes Berg committed 10 years ago

Commit 97daf331 parent 12b74df4 files · +17 −0Browse files

Unified · Split

4 files
  1. Documentation/networking/ip-sysctl.txt +6 −0
  2. include/uapi/linux/ip.h +1 −0
  3. net/ipv4/arp.c +8 −0
  4. net/ipv4/devinet.c +2 −0
Documentation/networking/ip-sysctl.txt+6−0
@@ -1223,6 +1223,12 @@ drop_unicast_in_l2_multicast - BOOLEAN · 1222 unmodified lines
1223 1122, but is disabled by default for compatibility reasons.1223 1122, but is disabled by default for compatibility reasons.
1224 Default: off (0)1224 Default: off (0)
1225 1225
1226drop_gratuitous_arp - BOOLEAN
1227 Drop all gratuitous ARP frames, for example if there's a known
1228 good ARP proxy on the network and such frames need not be used
1229 (or in the case of 802.11, must not be used to prevent attacks.)
1230 Default: off (0)
1231
1226 1232
1227tag - INTEGER1233tag - INTEGER
1228 Allows you to write a number, which can be used as required.1234 Allows you to write a number, which can be used as required.
include/uapi/linux/ip.h+1−0
@@ -166,6 +166,7 @@ enum · 165 unmodified lines
166 IPV4_DEVCONF_IGMPV3_UNSOLICITED_REPORT_INTERVAL,166 IPV4_DEVCONF_IGMPV3_UNSOLICITED_REPORT_INTERVAL,
167 IPV4_DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN,167 IPV4_DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN,
168 IPV4_DEVCONF_DROP_UNICAST_IN_L2_MULTICAST,168 IPV4_DEVCONF_DROP_UNICAST_IN_L2_MULTICAST,
169 IPV4_DEVCONF_DROP_GRATUITOUS_ARP,
169 __IPV4_DEVCONF_MAX170 __IPV4_DEVCONF_MAX
170};171};
171 172
net/ipv4/arp.c+8−0
@@ -735,6 +735,14 @@ static int arp_process(struct net *net, struct sock *sk, struct sk_buff *skb) · 734 unmodified lines
735 (!IN_DEV_ROUTE_LOCALNET(in_dev) && ipv4_is_loopback(tip)))735 (!IN_DEV_ROUTE_LOCALNET(in_dev) && ipv4_is_loopback(tip)))
736 goto out;736 goto out;
737 737
738 /*
739 * For some 802.11 wireless deployments (and possibly other networks),
740 * there will be an ARP proxy and gratuitous ARP frames are attacks
741 * and thus should not be accepted.
742 */
743 if (sip == tip && IN_DEV_ORCONF(in_dev, DROP_GRATUITOUS_ARP))
744 goto out;
745
738/*746/*
739 * Special case: We must set Frame Relay source Q.922 address747 * Special case: We must set Frame Relay source Q.922 address
740 */748 */
net/ipv4/devinet.c+2−0
@@ -2185,6 +2185,8 @@ static struct devinet_sysctl_table { · 2184 unmodified lines
2185 "igmpv3_unsolicited_report_interval"),2185 "igmpv3_unsolicited_report_interval"),
2186 DEVINET_SYSCTL_RW_ENTRY(IGNORE_ROUTES_WITH_LINKDOWN,2186 DEVINET_SYSCTL_RW_ENTRY(IGNORE_ROUTES_WITH_LINKDOWN,
2187 "ignore_routes_with_linkdown"),2187 "ignore_routes_with_linkdown"),
2188 DEVINET_SYSCTL_RW_ENTRY(DROP_GRATUITOUS_ARP,
2189 "drop_gratuitous_arp"),
2188 2190
2189 DEVINET_SYSCTL_FLUSHING_ENTRY(NOXFRM, "disable_xfrm"),2191 DEVINET_SYSCTL_FLUSHING_ENTRY(NOXFRM, "disable_xfrm"),
2190 DEVINET_SYSCTL_FLUSHING_ENTRY(NOPOLICY, "disable_policy"),2192 DEVINET_SYSCTL_FLUSHING_ENTRY(NOPOLICY, "disable_policy"),

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t