[ovs-dev] [net-next RFC 14/14] arp: Associate ARP requests with tunnel info

Thomas Graf tgraf at suug.ch
Mon Jun 1 14:27:38 UTC 2015


Since ARP performs its own route lookup call, eventually
returned tunnel metadata must be attached manually.

Signed-off-by: Thomas Graf <tgraf at suug.ch>
---
 net/ipv4/arp.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 933a928..6cf0502 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -489,6 +489,7 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
 	unsigned char *arp_ptr;
 	int hlen = LL_RESERVED_SPACE(dev);
 	int tlen = dev->needed_tailroom;
+	struct rtable *rt;
 
 	/*
 	 *	Allocate a buffer
@@ -577,6 +578,13 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
 	}
 	memcpy(arp_ptr, &dest_ip, 4);
 
+	rt = ip_route_output(dev_net(dev), dest_ip, src_ip, 0, dev->ifindex);
+	if (!IS_ERR(rt)) {
+		if (rt->rt_tun_info)
+			skb_attach_tunnel_info(skb, rt->rt_tun_info);
+		ip_rt_put(rt);
+	}
+
 	return skb;
 
 out:
-- 
2.3.5




More information about the dev mailing list