netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] arp: fix arp_filter on l3slave devices
@ 2018-04-05  8:25 Miguel Fadon Perlines
  2018-04-05 14:40 ` David Ahern
  2018-04-09  3:36 ` Sasha Levin
  0 siblings, 2 replies; 6+ messages in thread
From: Miguel Fadon Perlines @ 2018-04-05  8:25 UTC (permalink / raw)
  To: netdev; +Cc: David Ahern, Miguel Fadon Perlines

arp_filter performs an ip_route_output search for arp source address and
checks if output device is the same where the arp request was received,
if it is not, the arp request is not answered.

This route lookup is always done on main route table so l3slave devices
never find the proper route and arp is not answered.

Passing l3mdev_master_ifindex_rcu(dev) return value as oif fixes the
lookup for l3slave devices while maintaining same behavior for non
l3slave devices as this function returns 0 in that case.

Signed-off-by: Miguel Fadon Perlines <mfadon@teldat.com>
---
 net/ipv4/arp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index f28f06c..7333db1 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -437,7 +437,7 @@ static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev)
 	/*unsigned long now; */
 	struct net *net = dev_net(dev);
 
-	rt = ip_route_output(net, sip, tip, 0, 0);
+	rt = ip_route_output(net, sip, tip, 0, l3mdev_master_ifindex_rcu(dev));
 	if (IS_ERR(rt))
 		return 1;
 	if (rt->dst.dev != dev) {
-- 
2.1.4

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

end of thread, other threads:[~2018-04-09 14:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <HE1PR07MB087563C78F897EABB6B8F326B6A40@HE1PR07MB0875.eurprd07.prod.outlook.com>
2018-04-04 17:11 ` [PATCH net] arp: fix arp_filter on l3slave devices David Ahern
2018-04-05  8:25 Miguel Fadon Perlines
2018-04-05 14:40 ` David Ahern
2018-04-06  2:05   ` David Miller
2018-04-09  3:36 ` Sasha Levin
2018-04-09 14:41   ` David Ahern

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).