]> Pileus Git - ~andy/linux/blobdiff - net/ipv4/gre.c
gso: Handle Trans-Ether-Bridging protocol in skb_network_protocol()
[~andy/linux] / net / ipv4 / gre.c
index 7a4c710c4cddef241766bf5816b20ef768e8a45b..b2e805af9b87a03675d7bac1a7e210124757e566 100644 (file)
 
 static const struct gre_protocol __rcu *gre_proto[GREPROTO_MAX] __read_mostly;
 static DEFINE_SPINLOCK(gre_proto_lock);
-struct gre_base_hdr {
-       __be16 flags;
-       __be16 protocol;
-};
-#define GRE_HEADER_SECTION 4
 
 int gre_add_protocol(const struct gre_protocol *proto, u8 version)
 {
@@ -126,6 +121,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
        int ghl = GRE_HEADER_SECTION;
        struct gre_base_hdr *greh;
        int mac_len = skb->mac_len;
+       __be16 protocol = skb->protocol;
        int tnl_hlen;
        bool csum;
 
@@ -154,13 +150,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
                csum = false;
 
        /* setup inner skb. */
-       if (greh->protocol == htons(ETH_P_TEB)) {
-               struct ethhdr *eth = eth_hdr(skb);
-               skb->protocol = eth->h_proto;
-       } else {
-               skb->protocol = greh->protocol;
-       }
-
+       skb->protocol = greh->protocol;
        skb->encapsulation = 0;
 
        if (unlikely(!pskb_may_pull(skb, ghl)))
@@ -204,6 +194,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
                skb_reset_mac_header(skb);
                skb_set_network_header(skb, mac_len);
                skb->mac_len = mac_len;
+               skb->protocol = protocol;
        } while ((skb = skb->next));
 out:
        return segs;