diff --git a/net/nsh/nsh.c b/net/nsh/nsh.c index f4a38bd6a7e0..1344653916c4 100644 --- a/net/nsh/nsh.c +++ b/net/nsh/nsh.c @@ -77,13 +77,15 @@ EXPORT_SYMBOL_GPL(nsh_pop); static struct sk_buff *nsh_gso_segment(struct sk_buff *skb, netdev_features_t features) { + unsigned int tnl_hlen, mac_len, nsh_len; struct sk_buff *segs = ERR_PTR(-EINVAL); u16 mac_offset = skb->mac_header; - unsigned int nsh_len, mac_len; - __be16 proto; + __be16 tnl_proto, proto; skb_reset_network_header(skb); + tnl_proto = skb->protocol; + tnl_hlen = skb->network_header - skb->mac_header; mac_len = skb->mac_len; if (unlikely(!pskb_may_pull(skb, NSH_BASE_HDR_LEN))) @@ -113,11 +115,11 @@ static struct sk_buff *nsh_gso_segment(struct sk_buff *skb, } for (skb = segs; skb; skb = skb->next) { - skb->protocol = htons(ETH_P_NSH); - __skb_push(skb, nsh_len); - skb->mac_header = mac_offset; - skb->network_header = skb->mac_header + mac_len; + __skb_push(skb, nsh_len + tnl_hlen); + skb_reset_mac_header(skb); + skb->network_header = skb->mac_header + tnl_hlen; skb->mac_len = mac_len; + skb->protocol = tnl_proto; } out: