netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next] arp: add macro to get drop_gratuitous_arp setting
@ 2016-03-08  7:53 Zhang Shengju
  2016-03-10 21:17 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang Shengju @ 2016-03-08  7:53 UTC (permalink / raw)
  To: davem, netdev

Add macro IN_DEV_DROP_GRATUITOUS_ARP to facilitate getting
drop_gratuitous_arp value.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
 include/linux/inetdevice.h | 3 +++
 net/ipv4/arp.c             | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index ee971f3..9d1dd2c 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -128,6 +128,9 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
 #define IN_DEV_ARP_ANNOUNCE(in_dev)	IN_DEV_MAXCONF((in_dev), ARP_ANNOUNCE)
 #define IN_DEV_ARP_IGNORE(in_dev)	IN_DEV_MAXCONF((in_dev), ARP_IGNORE)
 #define IN_DEV_ARP_NOTIFY(in_dev)	IN_DEV_MAXCONF((in_dev), ARP_NOTIFY)
+#define IN_DEV_DROP_GRATUITOUS_ARP(in_dev) \
+					IN_DEV_ORCONF((in_dev), \
+						      DROP_GRATUITOUS_ARP)
 
 struct in_ifaddr {
 	struct hlist_node	hash;
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index c34c754..0bf5cca 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -740,7 +740,7 @@ static int arp_process(struct net *net, struct sock *sk, struct sk_buff *skb)
   *	there will be an ARP proxy and gratuitous ARP frames are attacks
   *	and thus should not be accepted.
   */
-	if (sip == tip && IN_DEV_ORCONF(in_dev, DROP_GRATUITOUS_ARP))
+	if (sip == tip && IN_DEV_DROP_GRATUITOUS_ARP(in_dev))
 		goto out_free_skb;
 
 /*
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-10 21:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-08  7:53 [net-next] arp: add macro to get drop_gratuitous_arp setting Zhang Shengju
2016-03-10 21:17 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).