Skip to content

Commit

Permalink
ip_vti/ip6_vti: Do not touch skb->mark on xmit
Browse files Browse the repository at this point in the history
Instead of modifying skb->mark we can simply modify the flowi_mark that is
generated as a result of the xfrm_decode_session.  By doing this we don't
need to actually touch the skb->mark and it can be preserved as it passes
out through the tunnel.

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
  • Loading branch information
Alexander Duyck authored and Steffen Klassert committed May 28, 2015
1 parent 407d34e commit cd5279c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions net/ipv4/ip_vti.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@ static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)

memset(&fl, 0, sizeof(fl));

skb->mark = be32_to_cpu(tunnel->parms.o_key);

switch (skb->protocol) {
case htons(ETH_P_IP):
xfrm_decode_session(skb, &fl, AF_INET);
Expand All @@ -233,6 +231,9 @@ static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
return NETDEV_TX_OK;
}

/* override mark with tunnel output key */
fl.flowi_mark = be32_to_cpu(tunnel->parms.o_key);

return vti_xmit(skb, dev, &fl);
}

Expand Down
4 changes: 3 additions & 1 deletion net/ipv6/ip6_vti.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,6 @@ vti6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
int ret;

memset(&fl, 0, sizeof(fl));
skb->mark = be32_to_cpu(t->parms.o_key);

switch (skb->protocol) {
case htons(ETH_P_IPV6):
Expand All @@ -516,6 +515,9 @@ vti6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
goto tx_err;
}

/* override mark with tunnel output key */
fl.flowi_mark = be32_to_cpu(t->parms.o_key);

ret = vti6_xmit(skb, dev, &fl);
if (ret < 0)
goto tx_err;
Expand Down

0 comments on commit cd5279c

Please sign in to comment.