hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/net/ipv4/gre_demux.c
....@@ -1,13 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * GRE over IPv4 demultiplexer driver
34 *
45 * Authors: Dmitry Kozlov (xeb@mail.ru)
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public License
8
- * as published by the Free Software Foundation; either version
9
- * 2 of the License, or (at your option) any later version.
10
- *
116 */
127
138 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
....@@ -90,7 +85,7 @@
9085 options = (__be32 *)(greh + 1);
9186 if (greh->flags & GRE_CSUM) {
9287 if (!skb_checksum_simple_validate(skb)) {
93
- skb_checksum_try_convert(skb, IPPROTO_GRE, 0,
88
+ skb_checksum_try_convert(skb, IPPROTO_GRE,
9489 null_compute_pseudo);
9590 } else if (csum_err) {
9691 *csum_err = true;
....@@ -176,20 +171,25 @@
176171 return NET_RX_DROP;
177172 }
178173
179
-static void gre_err(struct sk_buff *skb, u32 info)
174
+static int gre_err(struct sk_buff *skb, u32 info)
180175 {
181176 const struct gre_protocol *proto;
182177 const struct iphdr *iph = (const struct iphdr *)skb->data;
183178 u8 ver = skb->data[(iph->ihl<<2) + 1]&0x7f;
179
+ int err = 0;
184180
185181 if (ver >= GREPROTO_MAX)
186
- return;
182
+ return -EINVAL;
187183
188184 rcu_read_lock();
189185 proto = rcu_dereference(gre_proto[ver]);
190186 if (proto && proto->err_handler)
191187 proto->err_handler(skb, info);
188
+ else
189
+ err = -EPROTONOSUPPORT;
192190 rcu_read_unlock();
191
+
192
+ return err;
193193 }
194194
195195 static const struct net_protocol net_gre_protocol = {