aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Benc <jbenc@redhat.com>2016-04-27 05:29:07 -0400
committerDavid S. Miller <davem@davemloft.net>2016-04-28 17:02:45 -0400
commit2090714e1d6e80979dd6926be22b0de9ca432273 (patch)
treef8745a471e54642e31bd682dc16eadc1b09ff568
parenta64b04d86d14c81f50f68e102f79ef301e3d0a0e (diff)
gre: build header correctly for collect metadata tunnels
In ipgre (i.e. not gretap) + collect metadata mode, the skb was assumed to contain Ethernet header and was encapsulated as ETH_P_TEB. This is not the case, the interface is ARPHRD_IPGRE and the protocol to be used for encapsulation is skb->protocol. Fixes: 2e15ea390e6f4 ("ip_gre: Add support to collect tunnel metadata.") Signed-off-by: Jiri Benc <jbenc@redhat.com> Acked-by: Pravin B Shelar <pshelar@ovn.org> Reviewed-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv4/ip_gre.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index d0abde4236af..f973e0a58993 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -523,7 +523,8 @@ static struct rtable *gre_get_rt(struct sk_buff *skb,
523 return ip_route_output_key(net, fl); 523 return ip_route_output_key(net, fl);
524} 524}
525 525
526static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev) 526static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev,
527 __be16 proto)
527{ 528{
528 struct ip_tunnel_info *tun_info; 529 struct ip_tunnel_info *tun_info;
529 const struct ip_tunnel_key *key; 530 const struct ip_tunnel_key *key;
@@ -575,7 +576,7 @@ static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev)
575 } 576 }
576 577
577 flags = tun_info->key.tun_flags & (TUNNEL_CSUM | TUNNEL_KEY); 578 flags = tun_info->key.tun_flags & (TUNNEL_CSUM | TUNNEL_KEY);
578 build_header(skb, tunnel_hlen, flags, htons(ETH_P_TEB), 579 build_header(skb, tunnel_hlen, flags, proto,
579 tunnel_id_to_key(tun_info->key.tun_id), 0); 580 tunnel_id_to_key(tun_info->key.tun_id), 0);
580 581
581 df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0; 582 df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0;
@@ -616,7 +617,7 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb,
616 const struct iphdr *tnl_params; 617 const struct iphdr *tnl_params;
617 618
618 if (tunnel->collect_md) { 619 if (tunnel->collect_md) {
619 gre_fb_xmit(skb, dev); 620 gre_fb_xmit(skb, dev, skb->protocol);
620 return NETDEV_TX_OK; 621 return NETDEV_TX_OK;
621 } 622 }
622 623
@@ -660,7 +661,7 @@ static netdev_tx_t gre_tap_xmit(struct sk_buff *skb,
660 struct ip_tunnel *tunnel = netdev_priv(dev); 661 struct ip_tunnel *tunnel = netdev_priv(dev);
661 662
662 if (tunnel->collect_md) { 663 if (tunnel->collect_md) {
663 gre_fb_xmit(skb, dev); 664 gre_fb_xmit(skb, dev, htons(ETH_P_TEB));
664 return NETDEV_TX_OK; 665 return NETDEV_TX_OK;
665 } 666 }
666 667