| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * GRE over IPv4 demultiplexer driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * 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 | | - * |
|---|
| 11 | 6 | */ |
|---|
| 12 | 7 | |
|---|
| 13 | 8 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
|---|
| .. | .. |
|---|
| 90 | 85 | options = (__be32 *)(greh + 1); |
|---|
| 91 | 86 | if (greh->flags & GRE_CSUM) { |
|---|
| 92 | 87 | if (!skb_checksum_simple_validate(skb)) { |
|---|
| 93 | | - skb_checksum_try_convert(skb, IPPROTO_GRE, 0, |
|---|
| 88 | + skb_checksum_try_convert(skb, IPPROTO_GRE, |
|---|
| 94 | 89 | null_compute_pseudo); |
|---|
| 95 | 90 | } else if (csum_err) { |
|---|
| 96 | 91 | *csum_err = true; |
|---|
| .. | .. |
|---|
| 176 | 171 | return NET_RX_DROP; |
|---|
| 177 | 172 | } |
|---|
| 178 | 173 | |
|---|
| 179 | | -static void gre_err(struct sk_buff *skb, u32 info) |
|---|
| 174 | +static int gre_err(struct sk_buff *skb, u32 info) |
|---|
| 180 | 175 | { |
|---|
| 181 | 176 | const struct gre_protocol *proto; |
|---|
| 182 | 177 | const struct iphdr *iph = (const struct iphdr *)skb->data; |
|---|
| 183 | 178 | u8 ver = skb->data[(iph->ihl<<2) + 1]&0x7f; |
|---|
| 179 | + int err = 0; |
|---|
| 184 | 180 | |
|---|
| 185 | 181 | if (ver >= GREPROTO_MAX) |
|---|
| 186 | | - return; |
|---|
| 182 | + return -EINVAL; |
|---|
| 187 | 183 | |
|---|
| 188 | 184 | rcu_read_lock(); |
|---|
| 189 | 185 | proto = rcu_dereference(gre_proto[ver]); |
|---|
| 190 | 186 | if (proto && proto->err_handler) |
|---|
| 191 | 187 | proto->err_handler(skb, info); |
|---|
| 188 | + else |
|---|
| 189 | + err = -EPROTONOSUPPORT; |
|---|
| 192 | 190 | rcu_read_unlock(); |
|---|
| 191 | + |
|---|
| 192 | + return err; |
|---|
| 193 | 193 | } |
|---|
| 194 | 194 | |
|---|
| 195 | 195 | static const struct net_protocol net_gre_protocol = { |
|---|