Patchwork [2/3] vxlan: capture inner headers during encapsulation

login
register
mail settings
Submitter Joseph Gasparakis
Date Nov. 9, 2012, 2:18 a.m.
Message ID <1352427483-4380-3-git-send-email-joseph.gasparakis@intel.com>
Download mbox | patch
Permalink /patch/197910/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Joseph Gasparakis - Nov. 9, 2012, 2:18 a.m.
Populating the inner header pointers of skb for vxlan

Signed-off-by: Joseph Gasparakis <joseph.gasparakis@intel.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
---
 drivers/net/vxlan.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Patch

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 030559d..14e6c8f 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -694,11 +694,23 @@  static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 	__be16 df = 0;
 	__u8 tos, ttl;
 	int err;
+	unsigned int offset;
 
 	dst = vxlan_find_dst(vxlan, skb);
 	if (!dst)
 		goto drop;
 
+	offset = skb->data - skb->head;
+
+	skb_reset_inner_mac_header(skb);
+
+	if (skb->network_header)
+		skb_set_inner_network_header(skb, skb->network_header - offset);
+
+	if (skb->transport_header)
+		skb_set_inner_transport_header(skb, skb->transport_header -
+					      offset);
+
 	/* Need space for new headers (invalidates iph ptr) */
 	if (skb_cow_head(skb, VXLAN_HEADROOM))
 		goto drop;