hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/sctp/ipv6.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /* SCTP kernel implementation
23 * (C) Copyright IBM Corp. 2002, 2004
34 * Copyright (c) 2001 Nokia, Inc.
....@@ -7,22 +8,6 @@
78 * This file is part of the SCTP kernel implementation
89 *
910 * SCTP over IPv6.
10
- *
11
- * This SCTP implementation is free software;
12
- * you can redistribute it and/or modify it under the terms of
13
- * the GNU General Public License as published by
14
- * the Free Software Foundation; either version 2, or (at your option)
15
- * any later version.
16
- *
17
- * This SCTP implementation is distributed in the hope that it
18
- * will be useful, but WITHOUT ANY WARRANTY; without even the implied
19
- * ************************
20
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21
- * See the GNU General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU General Public License
24
- * along with GNU CC; see the file COPYING. If not, see
25
- * <http://www.gnu.org/licenses/>.
2611 *
2712 * Please send any bug reports or fixes you make to the
2813 * email address(es):
....@@ -137,7 +122,7 @@
137122 };
138123
139124 /* ICMP error handler. */
140
-static void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
125
+static int sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
141126 u8 type, u8 code, int offset, __be32 info)
142127 {
143128 struct inet6_dev *idev;
....@@ -146,7 +131,7 @@
146131 struct sctp_transport *transport;
147132 struct ipv6_pinfo *np;
148133 __u16 saveip, savesctp;
149
- int err;
134
+ int err, ret = 0;
150135 struct net *net = dev_net(skb->dev);
151136
152137 idev = in6_dev_get(skb->dev);
....@@ -162,6 +147,7 @@
162147 skb->transport_header = savesctp;
163148 if (!sk) {
164149 __ICMP6_INC_STATS(net, idev, ICMP6_MIB_INERRORS);
150
+ ret = -ENOENT;
165151 goto out;
166152 }
167153
....@@ -201,6 +187,8 @@
201187 out:
202188 if (likely(idev != NULL))
203189 in6_dev_put(idev);
190
+
191
+ return ret;
204192 }
205193
206194 static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport)
....@@ -227,7 +215,7 @@
227215
228216 rcu_read_lock();
229217 res = ip6_xmit(sk, skb, fl6, sk->sk_mark, rcu_dereference(np->opt),
230
- tclass);
218
+ tclass, sk->sk_priority);
231219 rcu_read_unlock();
232220 return res;
233221 }
....@@ -266,7 +254,7 @@
266254 struct ip6_flowlabel *flowlabel;
267255
268256 flowlabel = fl6_sock_lookup(sk, fl6->flowlabel);
269
- if (!flowlabel)
257
+ if (IS_ERR(flowlabel))
270258 goto out;
271259 fl6_sock_release(flowlabel);
272260 }
....@@ -892,7 +880,7 @@
892880 case AF_INET:
893881 if (!__ipv6_only_sock(sctp_opt2sk(sp)))
894882 return 1;
895
- /* fallthru */
883
+ fallthrough;
896884 default:
897885 return 0;
898886 }
....@@ -1039,6 +1027,7 @@
10391027 .getname = sctp_getname,
10401028 .poll = sctp_poll,
10411029 .ioctl = inet6_ioctl,
1030
+ .gettstamp = sock_gettstamp,
10421031 .listen = sctp_inet_listen,
10431032 .shutdown = inet_shutdown,
10441033 .setsockopt = sock_common_setsockopt,
....@@ -1047,8 +1036,7 @@
10471036 .recvmsg = inet_recvmsg,
10481037 .mmap = sock_no_mmap,
10491038 #ifdef CONFIG_COMPAT
1050
- .compat_setsockopt = compat_sock_common_setsockopt,
1051
- .compat_getsockopt = compat_sock_common_getsockopt,
1039
+ .compat_ioctl = inet6_compat_ioctl,
10521040 #endif
10531041 };
10541042
....@@ -1103,10 +1091,6 @@
11031091 .net_header_len = sizeof(struct ipv6hdr),
11041092 .sockaddr_len = sizeof(struct sockaddr_in6),
11051093 .ip_options_len = sctp_v6_ip_options_len,
1106
-#ifdef CONFIG_COMPAT
1107
- .compat_setsockopt = compat_ipv6_setsockopt,
1108
- .compat_getsockopt = compat_ipv6_getsockopt,
1109
-#endif
11101094 };
11111095
11121096 static struct sctp_pf sctp_pf_inet6 = {