Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags   |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /* SCTP kernel implementation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * (C) Copyright IBM Corp. 2001, 2004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright (c) 1999-2000 Cisco, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (c) 1999-2001 Motorola, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Copyright (c) 2001-2003 Intel Corp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * This file is part of the SCTP kernel implementation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * The base lksctp header.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * Please send any bug reports or fixes you make to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * email address(es):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  *    lksctp developers <linux-sctp@vger.kernel.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * Written or modified by:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  *    La Monte H.P. Yarroll <piggy@acm.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *    Xingang Guo           <xingang.guo@intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  *    Jon Grimm             <jgrimm@us.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *    Daisy Chang           <daisyc@us.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  *    Sridhar Samudrala     <sri@us.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  *    Ardelle Fan           <ardelle.fan@intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  *    Ryan Layer            <rmlayer@us.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  *    Kevin Gao             <kevin.gao@intel.com> 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #ifndef __net_sctp_h__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #define __net_sctp_h__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) /* Header Strategy.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  *    Start getting some control over the header file depencies:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  *       includes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  *       constants
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  *       structs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  *       prototypes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  *       macros, externs, and inlines
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  *   Move test_frame specific items out of the kernel headers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  *   and into the test frame headers.   This is not perfect in any sense
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  *   and will continue to evolve.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #include <linux/in.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) #include <linux/tty.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) #include <linux/proc_fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) #include <linux/spinlock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #include <linux/jiffies.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) #include <linux/idr.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) #if IS_ENABLED(CONFIG_IPV6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) #include <net/ipv6.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) #include <net/ip6_route.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) #include <linux/uaccess.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) #include <asm/page.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) #include <net/sock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) #include <net/snmp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) #include <net/sctp/structs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) #include <net/sctp/constants.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) #ifdef CONFIG_IP_SCTP_MODULE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) #define SCTP_PROTOSW_FLAG 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) #else /* static! */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) #define SCTP_PROTOSW_FLAG INET_PROTOSW_PERMANENT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) /* Round an int up to the next multiple of 4.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) #define SCTP_PAD4(s) (((s)+3)&~3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) /* Truncate to the previous multiple of 4.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) #define SCTP_TRUNC4(s) ((s)&~3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76)  * Function declarations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)  * sctp/protocol.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) int sctp_copy_local_addr_list(struct net *net, struct sctp_bind_addr *addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 			      enum sctp_scope, gfp_t gfp, int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) struct sctp_pf *sctp_get_pf_specific(sa_family_t family);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) int sctp_register_pf(struct sctp_pf *, sa_family_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) void sctp_addr_wq_mgmt(struct net *, struct sctp_sockaddr_entry *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)  * sctp/socket.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) int sctp_inet_connect(struct socket *sock, struct sockaddr *uaddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 		      int addr_len, int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) int sctp_inet_listen(struct socket *sock, int backlog);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) void sctp_write_space(struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) void sctp_data_ready(struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) __poll_t sctp_poll(struct file *file, struct socket *sock,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		poll_table *wait);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) void sctp_sock_rfree(struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) void sctp_copy_sock(struct sock *newsk, struct sock *sk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		    struct sctp_association *asoc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) extern struct percpu_counter sctp_sockets_allocated;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) int sctp_asconf_mgmt(struct sctp_sock *, struct sctp_sockaddr_entry *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) struct sk_buff *sctp_skb_recv_datagram(struct sock *, int, int, int *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) typedef int (*sctp_callback_t)(struct sctp_endpoint *, struct sctp_transport *, void *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) void sctp_transport_walk_start(struct rhashtable_iter *iter);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) void sctp_transport_walk_stop(struct rhashtable_iter *iter);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) struct sctp_transport *sctp_transport_get_next(struct net *net,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 			struct rhashtable_iter *iter);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) struct sctp_transport *sctp_transport_get_idx(struct net *net,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 			struct rhashtable_iter *iter, int pos);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) int sctp_transport_lookup_process(int (*cb)(struct sctp_transport *, void *),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 				  struct net *net,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 				  const union sctp_addr *laddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 				  const union sctp_addr *paddr, void *p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) int sctp_transport_traverse_process(sctp_callback_t cb, sctp_callback_t cb_done,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 				    struct net *net, int *pos, void *p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) int sctp_for_each_endpoint(int (*cb)(struct sctp_endpoint *, void *), void *p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) int sctp_get_sctp_info(struct sock *sk, struct sctp_association *asoc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 		       struct sctp_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)  * sctp/primitive.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) int sctp_primitive_ASSOCIATE(struct net *, struct sctp_association *, void *arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) int sctp_primitive_SHUTDOWN(struct net *, struct sctp_association *, void *arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) int sctp_primitive_ABORT(struct net *, struct sctp_association *, void *arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) int sctp_primitive_SEND(struct net *, struct sctp_association *, void *arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) int sctp_primitive_REQUESTHEARTBEAT(struct net *, struct sctp_association *, void *arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) int sctp_primitive_ASCONF(struct net *, struct sctp_association *, void *arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) int sctp_primitive_RECONF(struct net *net, struct sctp_association *asoc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 			  void *arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)  * sctp/input.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) int sctp_rcv(struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) int sctp_v4_err(struct sk_buff *skb, u32 info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) int sctp_hash_endpoint(struct sctp_endpoint *ep);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) void sctp_unhash_endpoint(struct sctp_endpoint *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 			     struct sctphdr *, struct sctp_association **,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 			     struct sctp_transport **);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) void sctp_err_finish(struct sock *, struct sctp_transport *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) void sctp_icmp_frag_needed(struct sock *, struct sctp_association *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 			   struct sctp_transport *t, __u32 pmtu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) void sctp_icmp_redirect(struct sock *, struct sctp_transport *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 			struct sk_buff *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) void sctp_icmp_proto_unreachable(struct sock *sk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 				 struct sctp_association *asoc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 				 struct sctp_transport *t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) void sctp_backlog_migrate(struct sctp_association *assoc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 			  struct sock *oldsk, struct sock *newsk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) int sctp_transport_hashtable_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) void sctp_transport_hashtable_destroy(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) int sctp_hash_transport(struct sctp_transport *t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) void sctp_unhash_transport(struct sctp_transport *t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) struct sctp_transport *sctp_addrs_lookup_transport(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 				struct net *net,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 				const union sctp_addr *laddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 				const union sctp_addr *paddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) struct sctp_transport *sctp_epaddr_lookup_transport(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 				const struct sctp_endpoint *ep,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 				const union sctp_addr *paddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)  * sctp/proc.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) int __net_init sctp_proc_init(struct net *net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)  * sctp/offload.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) int sctp_offload_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)  * sctp/stream_sched.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) void sctp_sched_ops_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)  * sctp/stream.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) int sctp_send_reset_streams(struct sctp_association *asoc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 			    struct sctp_reset_streams *params);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) int sctp_send_reset_assoc(struct sctp_association *asoc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) int sctp_send_add_streams(struct sctp_association *asoc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 			  struct sctp_add_streams *params);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)  * Module global variables
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)  /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)   * sctp/protocol.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) extern struct kmem_cache *sctp_chunk_cachep __read_mostly;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) extern struct kmem_cache *sctp_bucket_cachep __read_mostly;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) extern long sysctl_sctp_mem[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) extern int sysctl_sctp_rmem[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) extern int sysctl_sctp_wmem[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)  *  Section:  Macros, externs, and inlines
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) /* SCTP SNMP MIB stats handlers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) #define SCTP_INC_STATS(net, field)	SNMP_INC_STATS((net)->sctp.sctp_statistics, field)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) #define __SCTP_INC_STATS(net, field)	__SNMP_INC_STATS((net)->sctp.sctp_statistics, field)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) #define SCTP_DEC_STATS(net, field)	SNMP_DEC_STATS((net)->sctp.sctp_statistics, field)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) /* sctp mib definitions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	SCTP_MIB_NUM = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	SCTP_MIB_CURRESTAB,			/* CurrEstab */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	SCTP_MIB_ACTIVEESTABS,			/* ActiveEstabs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	SCTP_MIB_PASSIVEESTABS,			/* PassiveEstabs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	SCTP_MIB_ABORTEDS,			/* Aborteds */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	SCTP_MIB_SHUTDOWNS,			/* Shutdowns */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	SCTP_MIB_OUTOFBLUES,			/* OutOfBlues */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	SCTP_MIB_CHECKSUMERRORS,		/* ChecksumErrors */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	SCTP_MIB_OUTCTRLCHUNKS,			/* OutCtrlChunks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	SCTP_MIB_OUTORDERCHUNKS,		/* OutOrderChunks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	SCTP_MIB_OUTUNORDERCHUNKS,		/* OutUnorderChunks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	SCTP_MIB_INCTRLCHUNKS,			/* InCtrlChunks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	SCTP_MIB_INORDERCHUNKS,			/* InOrderChunks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	SCTP_MIB_INUNORDERCHUNKS,		/* InUnorderChunks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	SCTP_MIB_FRAGUSRMSGS,			/* FragUsrMsgs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	SCTP_MIB_REASMUSRMSGS,			/* ReasmUsrMsgs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	SCTP_MIB_OUTSCTPPACKS,			/* OutSCTPPacks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	SCTP_MIB_INSCTPPACKS,			/* InSCTPPacks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	SCTP_MIB_T1_INIT_EXPIREDS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	SCTP_MIB_T1_COOKIE_EXPIREDS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	SCTP_MIB_T2_SHUTDOWN_EXPIREDS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	SCTP_MIB_T3_RTX_EXPIREDS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	SCTP_MIB_T4_RTO_EXPIREDS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	SCTP_MIB_T5_SHUTDOWN_GUARD_EXPIREDS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	SCTP_MIB_DELAY_SACK_EXPIREDS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	SCTP_MIB_AUTOCLOSE_EXPIREDS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	SCTP_MIB_T1_RETRANSMITS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	SCTP_MIB_T3_RETRANSMITS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	SCTP_MIB_PMTUD_RETRANSMITS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	SCTP_MIB_FAST_RETRANSMITS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	SCTP_MIB_IN_PKT_SOFTIRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	SCTP_MIB_IN_PKT_BACKLOG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	SCTP_MIB_IN_PKT_DISCARDS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	SCTP_MIB_IN_DATA_CHUNK_DISCARDS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	__SCTP_MIB_MAX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) #define SCTP_MIB_MAX    __SCTP_MIB_MAX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) struct sctp_mib {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)         unsigned long   mibs[SCTP_MIB_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) /* helper function to track stats about max rto and related transport */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) static inline void sctp_max_rto(struct sctp_association *asoc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 				struct sctp_transport *trans)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	if (asoc->stats.max_obs_rto < (__u64)trans->rto) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 		asoc->stats.max_obs_rto = trans->rto;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 		memset(&asoc->stats.obs_rto_ipaddr, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 			sizeof(struct sockaddr_storage));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 		memcpy(&asoc->stats.obs_rto_ipaddr, &trans->ipaddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 			trans->af_specific->sockaddr_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)  * Macros for keeping a global reference of object allocations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) #ifdef CONFIG_SCTP_DBG_OBJCNT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) extern atomic_t sctp_dbg_objcnt_sock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) extern atomic_t sctp_dbg_objcnt_ep;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) extern atomic_t sctp_dbg_objcnt_assoc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) extern atomic_t sctp_dbg_objcnt_transport;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) extern atomic_t sctp_dbg_objcnt_chunk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) extern atomic_t sctp_dbg_objcnt_bind_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) extern atomic_t sctp_dbg_objcnt_bind_bucket;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) extern atomic_t sctp_dbg_objcnt_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) extern atomic_t sctp_dbg_objcnt_datamsg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) extern atomic_t sctp_dbg_objcnt_keys;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) /* Macros to atomically increment/decrement objcnt counters.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) #define SCTP_DBG_OBJCNT_INC(name) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) atomic_inc(&sctp_dbg_objcnt_## name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) #define SCTP_DBG_OBJCNT_DEC(name) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) atomic_dec(&sctp_dbg_objcnt_## name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) #define SCTP_DBG_OBJCNT(name) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) atomic_t sctp_dbg_objcnt_## name = ATOMIC_INIT(0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) /* Macro to help create new entries in the global array of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)  * objcnt counters.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) #define SCTP_DBG_OBJCNT_ENTRY(name) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) {.label= #name, .counter= &sctp_dbg_objcnt_## name}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) void sctp_dbg_objcnt_init(struct net *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) #define SCTP_DBG_OBJCNT_INC(name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) #define SCTP_DBG_OBJCNT_DEC(name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) static inline void sctp_dbg_objcnt_init(struct net *net) { return; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) #endif /* CONFIG_SCTP_DBG_OBJCOUNT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) #if defined CONFIG_SYSCTL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) void sctp_sysctl_register(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) void sctp_sysctl_unregister(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) int sctp_sysctl_net_register(struct net *net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) void sctp_sysctl_net_unregister(struct net *net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) static inline void sctp_sysctl_register(void) { return; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) static inline void sctp_sysctl_unregister(void) { return; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) static inline int sctp_sysctl_net_register(struct net *net) { return 0; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) static inline void sctp_sysctl_net_unregister(struct net *net) { return; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) /* Size of Supported Address Parameter for 'x' address types. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) #define SCTP_SAT_LEN(x) (sizeof(struct sctp_paramhdr) + (x) * sizeof(__u16))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) #if IS_ENABLED(CONFIG_IPV6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) void sctp_v6_pf_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) void sctp_v6_pf_exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) int sctp_v6_protosw_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) void sctp_v6_protosw_exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) int sctp_v6_add_protocol(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) void sctp_v6_del_protocol(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) #else /* #ifdef defined(CONFIG_IPV6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) static inline void sctp_v6_pf_init(void) { return; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) static inline void sctp_v6_pf_exit(void) { return; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) static inline int sctp_v6_protosw_init(void) { return 0; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) static inline void sctp_v6_protosw_exit(void) { return; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) static inline int sctp_v6_add_protocol(void) { return 0; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) static inline void sctp_v6_del_protocol(void) { return; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) #endif /* #if defined(CONFIG_IPV6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) /* Map an association to an assoc_id. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 	return asoc ? asoc->assoc_id : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) static inline enum sctp_sstat_state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) sctp_assoc_to_state(const struct sctp_association *asoc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 	/* SCTP's uapi always had SCTP_EMPTY(=0) as a dummy state, but we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 	 * got rid of it in kernel space. Therefore SCTP_CLOSED et al
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 	 * start at =1 in user space, but actually as =0 in kernel space.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 	 * Now that we can not break user space and SCTP_EMPTY is exposed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 	 * there, we need to fix it up with an ugly offset not to break
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 	 * applications. :(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 	return asoc->state + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) /* Look up the association by its id.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) /* A macro to walk a list of skbs.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) #define sctp_skb_for_each(pos, head, tmp) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 	skb_queue_walk_safe(head, pos, tmp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376)  *	sctp_list_dequeue - remove from the head of the queue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377)  *	@list: list to dequeue from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379)  *	Remove the head of the list. The head item is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380)  *	returned or %NULL if the list is empty.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) static inline struct list_head *sctp_list_dequeue(struct list_head *list)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 	struct list_head *result = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 	if (!list_empty(list)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 		result = list->next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 		list_del_init(result);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 	return result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) /* SCTP version of skb_set_owner_r.  We need this one because
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395)  * of the way we have to do receive buffer accounting on bundled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396)  * chunks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) static inline void sctp_skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 	struct sctp_ulpevent *event = sctp_skb2event(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 	skb_orphan(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 	skb->sk = sk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 	skb->destructor = sctp_sock_rfree;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 	atomic_add(event->rmem_len, &sk->sk_rmem_alloc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 	 * This mimics the behavior of skb_set_owner_r
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 	sk_mem_charge(sk, event->rmem_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) /* Tests if the list has one and only one entry. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) static inline int sctp_list_single_entry(struct list_head *head)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 	return list_is_singular(head);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) static inline bool sctp_chunk_pending(const struct sctp_chunk *chunk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 	return !list_empty(&chunk->list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) /* Walk through a list of TLV parameters.  Don't trust the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)  * individual parameter lengths and instead depend on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425)  * the chunk length to indicate when to stop.  Make sure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426)  * there is room for a param header too.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) #define sctp_walk_params(pos, chunk, member)\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) _sctp_walk_params((pos), (chunk), ntohs((chunk)->chunk_hdr.length), member)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) #define _sctp_walk_params(pos, chunk, end, member)\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) for (pos.v = chunk->member;\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433)      (pos.v + offsetof(struct sctp_paramhdr, length) + sizeof(pos.p->length) <=\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434)       (void *)chunk + end) &&\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435)      pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436)      ntohs(pos.p->length) >= sizeof(struct sctp_paramhdr);\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437)      pos.v += SCTP_PAD4(ntohs(pos.p->length)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) #define sctp_walk_errors(err, chunk_hdr)\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) #define _sctp_walk_errors(err, chunk_hdr, end)\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) for (err = (struct sctp_errhdr *)((void *)chunk_hdr + \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 	    sizeof(struct sctp_chunkhdr));\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445)      ((void *)err + offsetof(struct sctp_errhdr, length) + sizeof(err->length) <=\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446)       (void *)chunk_hdr + end) &&\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447)      (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448)      ntohs(err->length) >= sizeof(struct sctp_errhdr); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449)      err = (struct sctp_errhdr *)((void *)err + SCTP_PAD4(ntohs(err->length))))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) #define sctp_walk_fwdtsn(pos, chunk)\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) _sctp_walk_fwdtsn((pos), (chunk), ntohs((chunk)->chunk_hdr->length) - sizeof(struct sctp_fwdtsn_chunk))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) #define _sctp_walk_fwdtsn(pos, chunk, end)\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) for (pos = chunk->subh.fwdtsn_hdr->skip;\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456)      (void *)pos <= (void *)chunk->subh.fwdtsn_hdr->skip + end - sizeof(struct sctp_fwdtsn_skip);\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457)      pos++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) /* External references. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) extern struct proto sctp_prot;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) extern struct proto sctpv6_prot;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) void sctp_put_port(struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) extern struct idr sctp_assocs_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) extern spinlock_t sctp_assocs_id_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) /* Static inline functions. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) /* Convert from an IP version number to an Address Family symbol.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) static inline int ipver2af(__u8 ipver)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) 	switch (ipver) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) 	case 4:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) 	        return  AF_INET;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) 	case 6:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) 		return AF_INET6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) /* Convert from an address parameter type to an address family.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) static inline int param_type2af(__be16 type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) 	switch (type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) 	case SCTP_PARAM_IPV4_ADDRESS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) 	        return  AF_INET;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) 	case SCTP_PARAM_IPV6_ADDRESS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) 		return AF_INET6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) /* Warning: The following hash functions assume a power of two 'size'. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) /* This is the hash function for the SCTP port hash table. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) static inline int sctp_phashfn(struct net *net, __u16 lport)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) 	return (net_hash_mix(net) + lport) & (sctp_port_hashsize - 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) /* This is the hash function for the endpoint hash table. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) static inline int sctp_ep_hashfn(struct net *net, __u16 lport)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) 	return (net_hash_mix(net) + lport) & (sctp_ep_hashsize - 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) #define sctp_for_each_hentry(epb, head) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) 	hlist_for_each_entry(epb, head, node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) /* Is a socket of this style? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) #define sctp_style(sk, style) __sctp_style((sk), (SCTP_SOCKET_##style))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) static inline int __sctp_style(const struct sock *sk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) 			       enum sctp_socket_type style)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) 	return sctp_sk(sk)->type == style;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) /* Is the association in this state? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) #define sctp_state(asoc, state) __sctp_state((asoc), (SCTP_STATE_##state))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) static inline int __sctp_state(const struct sctp_association *asoc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) 			       enum sctp_state state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) 	return asoc->state == state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) /* Is the socket in this state? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) #define sctp_sstate(sk, state) __sctp_sstate((sk), (SCTP_SS_##state))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) static inline int __sctp_sstate(const struct sock *sk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) 				enum sctp_sock_state state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) 	return sk->sk_state == state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) /* Map v4-mapped v6 address back to v4 address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) static inline void sctp_v6_map_v4(union sctp_addr *addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) 	addr->v4.sin_family = AF_INET;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) 	addr->v4.sin_port = addr->v6.sin6_port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) 	addr->v4.sin_addr.s_addr = addr->v6.sin6_addr.s6_addr32[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) /* Map v4 address to v4-mapped v6 address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) static inline void sctp_v4_map_v6(union sctp_addr *addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) 	__be16 port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) 	port = addr->v4.sin_port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) 	addr->v6.sin6_addr.s6_addr32[3] = addr->v4.sin_addr.s_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) 	addr->v6.sin6_port = port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) 	addr->v6.sin6_family = AF_INET6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) 	addr->v6.sin6_flowinfo = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) 	addr->v6.sin6_scope_id = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) 	addr->v6.sin6_addr.s6_addr32[0] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) 	addr->v6.sin6_addr.s6_addr32[1] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) 	addr->v6.sin6_addr.s6_addr32[2] = htonl(0x0000ffff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) /* The cookie is always 0 since this is how it's used in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561)  * pmtu code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) static inline struct dst_entry *sctp_transport_dst_check(struct sctp_transport *t)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) 	if (t->dst && !dst_check(t->dst, t->dst_cookie))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) 		sctp_transport_dst_release(t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) 	return t->dst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) /* Calculate max payload size given a MTU, or the total overhead if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572)  * given MTU is zero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) static inline __u32 sctp_mtu_payload(const struct sctp_sock *sp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) 				     __u32 mtu, __u32 extra)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) 	__u32 overhead = sizeof(struct sctphdr) + extra;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) 	if (sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) 		overhead += sp->pf->af->net_header_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) 		overhead += sizeof(struct ipv6hdr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) 	if (WARN_ON_ONCE(mtu && mtu <= overhead))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) 		mtu = overhead;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) 	return mtu ? mtu - overhead : overhead;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) static inline __u32 sctp_dst_mtu(const struct dst_entry *dst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) 	return SCTP_TRUNC4(max_t(__u32, dst_mtu(dst),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) 				 SCTP_DEFAULT_MINSEGMENT));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) static inline bool sctp_transport_pmtu_check(struct sctp_transport *t)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) 	__u32 pmtu = sctp_dst_mtu(t->dst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) 	if (t->pathmtu == pmtu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) 		return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) 	t->pathmtu = pmtu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) 	return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) static inline __u32 sctp_min_frag_point(struct sctp_sock *sp, __u16 datasize)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) 	return sctp_mtu_payload(sp, SCTP_DEFAULT_MINSEGMENT, datasize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) static inline bool sctp_newsk_ready(const struct sock *sk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) 	return sock_flag(sk, SOCK_DEAD) || sk->sk_socket;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) static inline void sctp_sock_set_nodelay(struct sock *sk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) 	lock_sock(sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) 	sctp_sk(sk)->nodelay = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) 	release_sock(sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) #endif /* __net_sctp_h__ */