hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/net/nsh/nsh.c
....@@ -1,11 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Network Service Header
34 *
45 * Copyright (c) 2017 Red Hat, Inc. -- Jiri Benc <jbenc@redhat.com>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2 as
8
- * published by the Free Software Foundation.
96 */
107
118 #include <linux/module.h>
....@@ -80,13 +77,12 @@
8077 netdev_features_t features)
8178 {
8279 struct sk_buff *segs = ERR_PTR(-EINVAL);
80
+ u16 mac_offset = skb->mac_header;
8381 unsigned int nsh_len, mac_len;
8482 __be16 proto;
85
- int nhoff;
8683
8784 skb_reset_network_header(skb);
8885
89
- nhoff = skb->network_header - skb->mac_header;
9086 mac_len = skb->mac_len;
9187
9288 if (unlikely(!pskb_may_pull(skb, NSH_BASE_HDR_LEN)))
....@@ -111,15 +107,14 @@
111107 segs = skb_mac_gso_segment(skb, features);
112108 if (IS_ERR_OR_NULL(segs)) {
113109 skb_gso_error_unwind(skb, htons(ETH_P_NSH), nsh_len,
114
- skb->network_header - nhoff,
115
- mac_len);
110
+ mac_offset, mac_len);
116111 goto out;
117112 }
118113
119114 for (skb = segs; skb; skb = skb->next) {
120115 skb->protocol = htons(ETH_P_NSH);
121116 __skb_push(skb, nsh_len);
122
- skb_set_mac_header(skb, -nhoff);
117
+ skb->mac_header = mac_offset;
123118 skb->network_header = skb->mac_header + mac_len;
124119 skb->mac_len = mac_len;
125120 }