| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* SCTP kernel implementation |
|---|
| 2 | 3 | * (C) Copyright IBM Corp. 2002, 2004 |
|---|
| 3 | 4 | * Copyright (c) 2001 Nokia, Inc. |
|---|
| .. | .. |
|---|
| 7 | 8 | * This file is part of the SCTP kernel implementation |
|---|
| 8 | 9 | * |
|---|
| 9 | 10 | * 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/>. |
|---|
| 26 | 11 | * |
|---|
| 27 | 12 | * Please send any bug reports or fixes you make to the |
|---|
| 28 | 13 | * email address(es): |
|---|
| .. | .. |
|---|
| 137 | 122 | }; |
|---|
| 138 | 123 | |
|---|
| 139 | 124 | /* 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, |
|---|
| 141 | 126 | u8 type, u8 code, int offset, __be32 info) |
|---|
| 142 | 127 | { |
|---|
| 143 | 128 | struct inet6_dev *idev; |
|---|
| .. | .. |
|---|
| 146 | 131 | struct sctp_transport *transport; |
|---|
| 147 | 132 | struct ipv6_pinfo *np; |
|---|
| 148 | 133 | __u16 saveip, savesctp; |
|---|
| 149 | | - int err; |
|---|
| 134 | + int err, ret = 0; |
|---|
| 150 | 135 | struct net *net = dev_net(skb->dev); |
|---|
| 151 | 136 | |
|---|
| 152 | 137 | idev = in6_dev_get(skb->dev); |
|---|
| .. | .. |
|---|
| 162 | 147 | skb->transport_header = savesctp; |
|---|
| 163 | 148 | if (!sk) { |
|---|
| 164 | 149 | __ICMP6_INC_STATS(net, idev, ICMP6_MIB_INERRORS); |
|---|
| 150 | + ret = -ENOENT; |
|---|
| 165 | 151 | goto out; |
|---|
| 166 | 152 | } |
|---|
| 167 | 153 | |
|---|
| .. | .. |
|---|
| 201 | 187 | out: |
|---|
| 202 | 188 | if (likely(idev != NULL)) |
|---|
| 203 | 189 | in6_dev_put(idev); |
|---|
| 190 | + |
|---|
| 191 | + return ret; |
|---|
| 204 | 192 | } |
|---|
| 205 | 193 | |
|---|
| 206 | 194 | static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport) |
|---|
| .. | .. |
|---|
| 227 | 215 | |
|---|
| 228 | 216 | rcu_read_lock(); |
|---|
| 229 | 217 | res = ip6_xmit(sk, skb, fl6, sk->sk_mark, rcu_dereference(np->opt), |
|---|
| 230 | | - tclass); |
|---|
| 218 | + tclass, sk->sk_priority); |
|---|
| 231 | 219 | rcu_read_unlock(); |
|---|
| 232 | 220 | return res; |
|---|
| 233 | 221 | } |
|---|
| .. | .. |
|---|
| 266 | 254 | struct ip6_flowlabel *flowlabel; |
|---|
| 267 | 255 | |
|---|
| 268 | 256 | flowlabel = fl6_sock_lookup(sk, fl6->flowlabel); |
|---|
| 269 | | - if (!flowlabel) |
|---|
| 257 | + if (IS_ERR(flowlabel)) |
|---|
| 270 | 258 | goto out; |
|---|
| 271 | 259 | fl6_sock_release(flowlabel); |
|---|
| 272 | 260 | } |
|---|
| .. | .. |
|---|
| 892 | 880 | case AF_INET: |
|---|
| 893 | 881 | if (!__ipv6_only_sock(sctp_opt2sk(sp))) |
|---|
| 894 | 882 | return 1; |
|---|
| 895 | | - /* fallthru */ |
|---|
| 883 | + fallthrough; |
|---|
| 896 | 884 | default: |
|---|
| 897 | 885 | return 0; |
|---|
| 898 | 886 | } |
|---|
| .. | .. |
|---|
| 1039 | 1027 | .getname = sctp_getname, |
|---|
| 1040 | 1028 | .poll = sctp_poll, |
|---|
| 1041 | 1029 | .ioctl = inet6_ioctl, |
|---|
| 1030 | + .gettstamp = sock_gettstamp, |
|---|
| 1042 | 1031 | .listen = sctp_inet_listen, |
|---|
| 1043 | 1032 | .shutdown = inet_shutdown, |
|---|
| 1044 | 1033 | .setsockopt = sock_common_setsockopt, |
|---|
| .. | .. |
|---|
| 1047 | 1036 | .recvmsg = inet_recvmsg, |
|---|
| 1048 | 1037 | .mmap = sock_no_mmap, |
|---|
| 1049 | 1038 | #ifdef CONFIG_COMPAT |
|---|
| 1050 | | - .compat_setsockopt = compat_sock_common_setsockopt, |
|---|
| 1051 | | - .compat_getsockopt = compat_sock_common_getsockopt, |
|---|
| 1039 | + .compat_ioctl = inet6_compat_ioctl, |
|---|
| 1052 | 1040 | #endif |
|---|
| 1053 | 1041 | }; |
|---|
| 1054 | 1042 | |
|---|
| .. | .. |
|---|
| 1103 | 1091 | .net_header_len = sizeof(struct ipv6hdr), |
|---|
| 1104 | 1092 | .sockaddr_len = sizeof(struct sockaddr_in6), |
|---|
| 1105 | 1093 | .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 |
|---|
| 1110 | 1094 | }; |
|---|
| 1111 | 1095 | |
|---|
| 1112 | 1096 | static struct sctp_pf sctp_pf_inet6 = { |
|---|