hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/ipv6/ah6.c
....@@ -1,18 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (C)2002 USAGI/WIDE Project
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License as published by
6
- * the Free Software Foundation; either version 2 of the License, or
7
- * (at your option) any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU General Public License
15
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
164 *
175 * Authors
186 *
....@@ -48,7 +36,7 @@
4836 struct in6_addr saddr;
4937 #endif
5038 struct in6_addr daddr;
51
- char hdrs[0];
39
+ char hdrs[];
5240 };
5341
5442 struct ah_skb_cb {
....@@ -271,7 +259,7 @@
271259 case NEXTHDR_DEST:
272260 if (dir == XFRM_POLICY_OUT)
273261 ipv6_rearrange_destopt(iph, exthdr.opth);
274
- /* fall through */
262
+ fallthrough;
275263 case NEXTHDR_HOP:
276264 if (!zero_out_mutable_opts(exthdr.opth)) {
277265 net_dbg_ratelimited("overrun %sopts\n",
....@@ -476,7 +464,7 @@
476464 struct ah_data *ahp = x->data;
477465 struct ip_auth_hdr *ah = ip_auth_hdr(skb);
478466 int hdr_len = skb_network_header_len(skb);
479
- int ah_hlen = (ah->hdrlen + 2) << 2;
467
+ int ah_hlen = ipv6_authlen(ah);
480468
481469 if (err)
482470 goto out;
....@@ -558,7 +546,7 @@
558546 ahash = ahp->ahash;
559547
560548 nexthdr = ah->nexthdr;
561
- ah_hlen = (ah->hdrlen + 2) << 2;
549
+ ah_hlen = ipv6_authlen(ah);
562550
563551 if (ah_hlen != XFRM_ALIGN8(sizeof(*ah) + ahp->icv_full_len) &&
564552 ah_hlen != XFRM_ALIGN8(sizeof(*ah) + ahp->icv_trunc_len))
....@@ -780,6 +768,7 @@
780768
781769 static struct xfrm6_protocol ah6_protocol = {
782770 .handler = xfrm6_rcv,
771
+ .input_handler = xfrm_input,
783772 .cb_handler = ah6_rcv_cb,
784773 .err_handler = ah6_err,
785774 .priority = 0,
....@@ -806,9 +795,7 @@
806795 if (xfrm6_protocol_deregister(&ah6_protocol, IPPROTO_AH) < 0)
807796 pr_info("%s: can't remove protocol\n", __func__);
808797
809
- if (xfrm_unregister_type(&ah6_type, AF_INET6) < 0)
810
- pr_info("%s: can't remove xfrm type\n", __func__);
811
-
798
+ xfrm_unregister_type(&ah6_type, AF_INET6);
812799 }
813800
814801 module_init(ah6_init);