hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/include/net/sctp/structs.h
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /* SCTP kernel implementation
23 * (C) Copyright IBM Corp. 2001, 2004
34 * Copyright (c) 1999-2000 Cisco, Inc.
....@@ -5,22 +6,6 @@
56 * Copyright (c) 2001 Intel Corp.
67 *
78 * This file is part of the SCTP kernel implementation
8
- *
9
- * This SCTP implementation is free software;
10
- * you can redistribute it and/or modify it under the terms of
11
- * the GNU General Public License as published by
12
- * the Free Software Foundation; either version 2, or (at your option)
13
- * any later version.
14
- *
15
- * This SCTP implementation is distributed in the hope that it
16
- * will be useful, but WITHOUT ANY WARRANTY; without even the implied
17
- * ************************
18
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19
- * See the GNU General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU General Public License
22
- * along with GNU CC; see the file COPYING. If not, see
23
- * <http://www.gnu.org/licenses/>.
249 *
2510 * Please send any bug reports or fixes you make to the
2611 * email addresses:
....@@ -48,6 +33,7 @@
4833 #define __sctp_structs_h__
4934
5035 #include <linux/ktime.h>
36
+#include <linux/generic-radix-tree.h>
5137 #include <linux/rhashtable-types.h>
5238 #include <linux/socket.h> /* linux/in.h needs this!! */
5339 #include <linux/in.h> /* We get struct sockaddr_in. */
....@@ -57,7 +43,6 @@
5743 #include <linux/atomic.h> /* This gets us atomic counters. */
5844 #include <linux/skbuff.h> /* We need sk_buff_head. */
5945 #include <linux/workqueue.h> /* We need tq_struct. */
60
-#include <linux/flex_array.h> /* We need flex_array. */
6146 #include <linux/sctp.h> /* We need sctp* header structs. */
6247 #include <net/sctp/auth.h> /* We need auth specific structs */
6348 #include <net/ip.h> /* For inet_skb_parm */
....@@ -96,7 +81,9 @@
9681
9782 struct sctp_bind_bucket {
9883 unsigned short port;
99
- unsigned short fastreuse;
84
+ signed char fastreuse;
85
+ signed char fastreuseport;
86
+ kuid_t fastuid;
10087 struct hlist_node node;
10188 struct hlist_head owner;
10289 struct net *net;
....@@ -197,6 +184,9 @@
197184 __u32 flowlabel;
198185 __u8 dscp;
199186
187
+ __u16 pf_retrans;
188
+ __u16 ps_retrans;
189
+
200190 /* The initial Path MTU to use for new associations. */
201191 __u32 pathmtu;
202192
....@@ -207,6 +197,8 @@
207197 /* Flags controlling Heartbeat, SACK delay, and Path MTU Discovery. */
208198 __u32 param_flags;
209199
200
+ __u32 default_ss;
201
+
210202 struct sctp_rtoinfo rtoinfo;
211203 struct sctp_paddrparams paddrparam;
212204 struct sctp_assocparams assocparams;
....@@ -215,7 +207,7 @@
215207 * These two structures must be grouped together for the usercopy
216208 * whitelist region.
217209 */
218
- struct sctp_event_subscribe subscribe;
210
+ __u16 subscribe;
219211 struct sctp_initmsg initmsg;
220212
221213 int user_frag;
....@@ -224,22 +216,24 @@
224216 __u32 adaptation_ind;
225217 __u32 pd_point;
226218 __u16 nodelay:1,
219
+ pf_expose:2,
227220 reuse:1,
228221 disable_fragments:1,
229222 v4mapped:1,
230223 frag_interleave:1,
231
- strm_interleave:1,
232224 recvrcvinfo:1,
233225 recvnxtinfo:1,
234226 data_ready_signalled:1;
235227
236228 atomic_t pd_mode;
229
+
230
+ /* Fields after this point will be skipped on copies, like on accept
231
+ * and peeloff operations
232
+ */
233
+
237234 /* Receive to here while partial delivery is in effect. */
238235 struct sk_buff_head pd_lobby;
239236
240
- /* These must be the last fields, as they will skipped on copies,
241
- * like on accept and peeloff operations
242
- */
243237 struct list_head auto_asconf_list;
244238 int do_auto_asconf;
245239 };
....@@ -334,7 +328,7 @@
334328 * the association TCB is re-constructed from the cookie.
335329 */
336330 __u32 raw_addr_list_len;
337
- struct sctp_init_chunk peer_init[0];
331
+ struct sctp_init_chunk peer_init[];
338332 };
339333
340334
....@@ -439,19 +433,9 @@
439433 int (*setsockopt) (struct sock *sk,
440434 int level,
441435 int optname,
442
- char __user *optval,
436
+ sockptr_t optval,
443437 unsigned int optlen);
444438 int (*getsockopt) (struct sock *sk,
445
- int level,
446
- int optname,
447
- char __user *optval,
448
- int __user *optlen);
449
- int (*compat_setsockopt) (struct sock *sk,
450
- int level,
451
- int optname,
452
- char __user *optval,
453
- unsigned int optlen);
454
- int (*compat_getsockopt) (struct sock *sk,
455439 int level,
456440 int optname,
457441 char __user *optval,
....@@ -906,7 +890,9 @@
906890 * and will be initialized from the assocs value. This can be changed
907891 * using the SCTP_PEER_ADDR_THLDS socket option
908892 */
909
- int pf_retrans;
893
+ __u16 pf_retrans;
894
+ /* Used for primary path switchover. */
895
+ __u16 ps_retrans;
910896 /* PMTU : The current known path MTU. */
911897 __u32 pathmtu;
912898
....@@ -1190,6 +1176,8 @@
11901176 struct sctp_sock *, struct sctp_sock *);
11911177 int sctp_bind_addr_state(const struct sctp_bind_addr *bp,
11921178 const union sctp_addr *addr);
1179
+int sctp_bind_addrs_check(struct sctp_sock *sp,
1180
+ struct sctp_sock *sp2, int cnt2);
11931181 union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp,
11941182 const union sctp_addr *addrs,
11951183 int addrcnt,
....@@ -1333,8 +1321,11 @@
13331321 /* SCTP-AUTH: endpoint shared keys */
13341322 struct list_head endpoint_shared_keys;
13351323 __u16 active_key_id;
1336
- __u8 auth_enable:1,
1324
+ __u8 ecn_enable:1,
1325
+ auth_enable:1,
1326
+ intl_enable:1,
13371327 prsctp_enable:1,
1328
+ asconf_enable:1,
13381329 reconf_enable:1;
13391330
13401331 __u8 strreset_enable;
....@@ -1400,7 +1391,7 @@
14001391 struct list_head prio_sched;
14011392 /* List of streams scheduled */
14021393 struct list_head active;
1403
- /* The next stream stream in line */
1394
+ /* The next stream in line */
14041395 struct sctp_stream_out_ext *next;
14051396 __u16 prio;
14061397 };
....@@ -1445,8 +1436,9 @@
14451436 };
14461437
14471438 struct sctp_stream {
1448
- struct flex_array *out;
1449
- struct flex_array *in;
1439
+ GENRADIX(struct sctp_stream_out) out;
1440
+ GENRADIX(struct sctp_stream_in) in;
1441
+
14501442 __u16 outcnt;
14511443 __u16 incnt;
14521444 /* Current stream being sent, if any */
....@@ -1461,7 +1453,7 @@
14611453 struct {
14621454 /* List of streams scheduled */
14631455 struct list_head rr_list;
1464
- /* The next stream stream in line */
1456
+ /* The next stream in line */
14651457 struct sctp_stream_out_ext *rr_next;
14661458 };
14671459 };
....@@ -1469,17 +1461,17 @@
14691461 };
14701462
14711463 static inline struct sctp_stream_out *sctp_stream_out(
1472
- const struct sctp_stream *stream,
1464
+ struct sctp_stream *stream,
14731465 __u16 sid)
14741466 {
1475
- return flex_array_get(stream->out, sid);
1467
+ return genradix_ptr(&stream->out, sid);
14761468 }
14771469
14781470 static inline struct sctp_stream_in *sctp_stream_in(
1479
- const struct sctp_stream *stream,
1471
+ struct sctp_stream *stream,
14801472 __u16 sid)
14811473 {
1482
- return flex_array_get(stream->in, sid);
1474
+ return genradix_ptr(&stream->in, sid);
14831475 }
14841476
14851477 #define SCTP_SO(s, i) sctp_stream_out((s), (i))
....@@ -1689,28 +1681,30 @@
16891681 __be16 addip_disabled_mask;
16901682
16911683 /* These are capabilities which our peer advertised. */
1692
- __u8 ecn_capable:1, /* Can peer do ECN? */
1684
+ __u16 ecn_capable:1, /* Can peer do ECN? */
16931685 ipv4_address:1, /* Peer understands IPv4 addresses? */
16941686 ipv6_address:1, /* Peer understands IPv6 addresses? */
16951687 hostname_address:1, /* Peer understands DNS addresses? */
16961688 asconf_capable:1, /* Does peer support ADDIP? */
16971689 prsctp_capable:1, /* Can peer do PR-SCTP? */
16981690 reconf_capable:1, /* Can peer do RE-CONFIG? */
1699
- auth_capable:1; /* Is peer doing SCTP-AUTH? */
1700
-
1701
- /* sack_needed : This flag indicates if the next received
1702
- * : packet is to be responded to with a
1703
- * : SACK. This is initialized to 0. When a packet
1704
- * : is received sack_cnt is incremented. If this value
1705
- * : reaches 2 or more, a SACK is sent and the
1706
- * : value is reset to 0. Note: This is used only
1707
- * : when no DATA chunks are received out of
1708
- * : order. When DATA chunks are out of order,
1709
- * : SACK's are not delayed (see Section 6).
1710
- */
1711
- __u8 sack_needed:1, /* Do we need to sack the peer? */
1691
+ intl_capable:1, /* Can peer do INTERLEAVE */
1692
+ auth_capable:1, /* Is peer doing SCTP-AUTH? */
1693
+ /* sack_needed:
1694
+ * This flag indicates if the next received
1695
+ * packet is to be responded to with a
1696
+ * SACK. This is initialized to 0. When a packet
1697
+ * is received sack_cnt is incremented. If this value
1698
+ * reaches 2 or more, a SACK is sent and the
1699
+ * value is reset to 0. Note: This is used only
1700
+ * when no DATA chunks are received out of
1701
+ * order. When DATA chunks are out of order,
1702
+ * SACK's are not delayed (see Section 6).
1703
+ */
1704
+ sack_needed:1, /* Do we need to sack the peer? */
17121705 sack_generation:1,
17131706 zero_window_announced:1;
1707
+
17141708 __u32 sack_cnt;
17151709
17161710 __u32 adaptation_ind; /* Adaptation Code point. */
....@@ -1769,7 +1763,7 @@
17691763 int max_burst;
17701764
17711765 /* This is the max_retrans value for the association. This value will
1772
- * be initialized initialized from system defaults, but can be
1766
+ * be initialized from system defaults, but can be
17731767 * modified by the SCTP_ASSOCINFO socket option.
17741768 */
17751769 int max_retrans;
....@@ -1778,7 +1772,9 @@
17781772 * and will be initialized from the assocs value. This can be
17791773 * changed using the SCTP_PEER_ADDR_THLDS socket option
17801774 */
1781
- int pf_retrans;
1775
+ __u16 pf_retrans;
1776
+ /* Used for primary path switchover. */
1777
+ __u16 ps_retrans;
17821778
17831779 /* Maximum number of times the endpoint will retransmit INIT */
17841780 __u16 max_init_attempts;
....@@ -2059,10 +2055,8 @@
20592055
20602056 __u8 need_ecne:1, /* Need to send an ECNE Chunk? */
20612057 temp:1, /* Is it a temporary association? */
2062
- force_delay:1,
2063
- intl_enable:1,
2064
- prsctp_enable:1,
2065
- reconf_enable:1;
2058
+ pf_expose:2, /* Expose pf state? */
2059
+ force_delay:1;
20662060
20672061 __u8 strreset_enable;
20682062 __u8 strreset_outstanding; /* request param count on the fly */
....@@ -2077,6 +2071,8 @@
20772071
20782072 int sent_cnt_removable;
20792073
2074
+ __u16 subscribe;
2075
+
20802076 __u64 abandoned_unsent[SCTP_PR_INDEX(MAX) + 1];
20812077 __u64 abandoned_sent[SCTP_PR_INDEX(MAX) + 1];
20822078