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 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)  * Please send any bug reports or fixes you make to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   11)  * email addresses:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   12)  *    lksctp developers <linux-sctp@vger.kernel.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   13)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   14)  * Written or modified by:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   15)  *    Randall Stewart	    <randall@sctp.chicago.il.us>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   16)  *    Ken Morneau	    <kmorneau@cisco.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   17)  *    Qiaobing Xie	    <qxie1@email.mot.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   18)  *    La Monte H.P. Yarroll <piggy@acm.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   19)  *    Karl Knutson	    <karl@athena.chicago.il.us>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   20)  *    Jon Grimm		    <jgrimm@us.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   21)  *    Xingang Guo	    <xingang.guo@intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   22)  *    Hui Huang		    <hui.huang@nokia.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   23)  *    Sridhar Samudrala	    <sri@us.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   24)  *    Daisy Chang	    <daisyc@us.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   25)  *    Dajiang Zhang	    <dajiang.zhang@nokia.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   26)  *    Ardelle Fan	    <ardelle.fan@intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   27)  *    Ryan Layer	    <rmlayer@us.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   28)  *    Anup Pemmaiah	    <pemmaiah@cc.usu.edu>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   29)  *    Kevin Gao             <kevin.gao@intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   30)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   32) #ifndef __sctp_structs_h__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   33) #define __sctp_structs_h__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   35) #include <linux/ktime.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   36) #include <linux/generic-radix-tree.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   37) #include <linux/rhashtable-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   38) #include <linux/socket.h>	/* linux/in.h needs this!!    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   39) #include <linux/in.h>		/* We get struct sockaddr_in. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   40) #include <linux/in6.h>		/* We get struct in6_addr     */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   41) #include <linux/ipv6.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   42) #include <asm/param.h>		/* We get MAXHOSTNAMELEN.     */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   43) #include <linux/atomic.h>		/* This gets us atomic counters.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   44) #include <linux/skbuff.h>	/* We need sk_buff_head. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   45) #include <linux/workqueue.h>	/* We need tq_struct.	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   46) #include <linux/sctp.h>		/* We need sctp* header structs.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   47) #include <net/sctp/auth.h>	/* We need auth specific structs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   48) #include <net/ip.h>		/* For inet_skb_parm */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   50) /* A convenience structure for handling sockaddr structures.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   51)  * We should wean ourselves off this.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   52)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   53) union sctp_addr {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   54) 	struct sockaddr_in v4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   55) 	struct sockaddr_in6 v6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   56) 	struct sockaddr sa;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   57) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   59) /* Forward declarations for data structures. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   60) struct sctp_globals;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   61) struct sctp_endpoint;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   62) struct sctp_association;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   63) struct sctp_transport;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   64) struct sctp_packet;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   65) struct sctp_chunk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   66) struct sctp_inq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   67) struct sctp_outq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   68) struct sctp_bind_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   69) struct sctp_ulpq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   70) struct sctp_ep_common;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   71) struct crypto_shash;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   72) struct sctp_stream;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   75) #include <net/sctp/tsnmap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   76) #include <net/sctp/ulpevent.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   77) #include <net/sctp/ulpqueue.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   78) #include <net/sctp/stream_interleave.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   80) /* Structures useful for managing bind/connect. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   82) struct sctp_bind_bucket {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   83) 	unsigned short	port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   84) 	signed char	fastreuse;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   85) 	signed char	fastreuseport;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   86) 	kuid_t		fastuid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   87) 	struct hlist_node	node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   88) 	struct hlist_head	owner;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   89) 	struct net	*net;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   90) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   92) struct sctp_bind_hashbucket {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   93) 	spinlock_t	lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   94) 	struct hlist_head	chain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   95) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   97) /* Used for hashing all associations.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   98) struct sctp_hashbucket {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   99) 	rwlock_t	lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  100) 	struct hlist_head	chain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  101) } __attribute__((__aligned__(8)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  104) /* The SCTP globals structure. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  105) extern struct sctp_globals {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  106) 	/* This is a list of groups of functions for each address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  107) 	 * family that we support.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  108) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  109) 	struct list_head address_families;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  111) 	/* This is the hash of all endpoints. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  112) 	struct sctp_hashbucket *ep_hashtable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  113) 	/* This is the sctp port control hash.	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  114) 	struct sctp_bind_hashbucket *port_hashtable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  115) 	/* This is the hash of all transports. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  116) 	struct rhltable transport_hashtable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  118) 	/* Sizes of above hashtables. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  119) 	int ep_hashsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  120) 	int port_hashsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  122) 	/* Default initialization values to be applied to new associations. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  123) 	__u16 max_instreams;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  124) 	__u16 max_outstreams;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  125) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  126) 	/* Flag to indicate whether computing and verifying checksum
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  127) 	 * is disabled. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  128)         bool checksum_disable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  129) } sctp_globals;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  131) #define sctp_max_instreams		(sctp_globals.max_instreams)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  132) #define sctp_max_outstreams		(sctp_globals.max_outstreams)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  133) #define sctp_address_families		(sctp_globals.address_families)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  134) #define sctp_ep_hashsize		(sctp_globals.ep_hashsize)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  135) #define sctp_ep_hashtable		(sctp_globals.ep_hashtable)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  136) #define sctp_port_hashsize		(sctp_globals.port_hashsize)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  137) #define sctp_port_hashtable		(sctp_globals.port_hashtable)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  138) #define sctp_transport_hashtable	(sctp_globals.transport_hashtable)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  139) #define sctp_checksum_disable		(sctp_globals.checksum_disable)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  141) /* SCTP Socket type: UDP or TCP style. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  142) enum sctp_socket_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  143) 	SCTP_SOCKET_UDP = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  144) 	SCTP_SOCKET_UDP_HIGH_BANDWIDTH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  145) 	SCTP_SOCKET_TCP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  146) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  148) /* Per socket SCTP information. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  149) struct sctp_sock {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  150) 	/* inet_sock has to be the first member of sctp_sock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  151) 	struct inet_sock inet;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  152) 	/* What kind of a socket is this? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  153) 	enum sctp_socket_type type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  155) 	/* PF_ family specific functions.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  156) 	struct sctp_pf *pf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  158) 	/* Access to HMAC transform. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  159) 	struct crypto_shash *hmac;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  160) 	char *sctp_hmac_alg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  161) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  162) 	/* What is our base endpointer? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  163) 	struct sctp_endpoint *ep;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  164) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  165) 	struct sctp_bind_bucket *bind_hash;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  166) 	/* Various Socket Options.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  167) 	__u16 default_stream;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  168) 	__u32 default_ppid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  169) 	__u16 default_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  170) 	__u32 default_context;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  171) 	__u32 default_timetolive;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  172) 	__u32 default_rcv_context;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  173) 	int max_burst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  175) 	/* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  176) 	 * the destination address every heartbeat interval. This value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  177) 	 * will be inherited by all new associations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  178) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  179) 	__u32 hbinterval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  180) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  181) 	/* This is the max_retrans value for new associations. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  182) 	__u16 pathmaxrxt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  184) 	__u32 flowlabel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  185) 	__u8  dscp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  187) 	__u16 pf_retrans;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  188) 	__u16 ps_retrans;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  190) 	/* The initial Path MTU to use for new associations. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  191) 	__u32 pathmtu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  192) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  193) 	/* The default SACK delay timeout for new associations. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  194) 	__u32 sackdelay;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  195) 	__u32 sackfreq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  197) 	/* Flags controlling Heartbeat, SACK delay, and Path MTU Discovery. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  198) 	__u32 param_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  200) 	__u32 default_ss;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  202) 	struct sctp_rtoinfo rtoinfo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  203) 	struct sctp_paddrparams paddrparam;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  204) 	struct sctp_assocparams assocparams;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  205) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  206) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  207) 	 * These two structures must be grouped together for the usercopy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  208) 	 * whitelist region.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  209) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  210) 	__u16 subscribe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  211) 	struct sctp_initmsg initmsg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  213) 	int user_frag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  214) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  215) 	__u32 autoclose;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  216) 	__u32 adaptation_ind;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  217) 	__u32 pd_point;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  218) 	__u16	nodelay:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  219) 		pf_expose:2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  220) 		reuse:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  221) 		disable_fragments:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  222) 		v4mapped:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  223) 		frag_interleave:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  224) 		recvrcvinfo:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  225) 		recvnxtinfo:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  226) 		data_ready_signalled:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  228) 	atomic_t pd_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  229) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  230) 	/* Fields after this point will be skipped on copies, like on accept
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  231) 	 * and peeloff operations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  232) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  234) 	/* Receive to here while partial delivery is in effect. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  235) 	struct sk_buff_head pd_lobby;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  236) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  237) 	struct list_head auto_asconf_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  238) 	int do_auto_asconf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  239) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  240) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  241) static inline struct sctp_sock *sctp_sk(const struct sock *sk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  242) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  243)        return (struct sctp_sock *)sk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  244) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  245) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  246) static inline struct sock *sctp_opt2sk(const struct sctp_sock *sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  247) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  248)        return (struct sock *)sp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  249) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  250) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  251) #if IS_ENABLED(CONFIG_IPV6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  252) struct sctp6_sock {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  253)        struct sctp_sock  sctp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  254)        struct ipv6_pinfo inet6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  255) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  256) #endif /* CONFIG_IPV6 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  257) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  258) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  259) /* This is our APPLICATION-SPECIFIC state cookie.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  260)  * THIS IS NOT DICTATED BY THE SPECIFICATION.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  261)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  262) /* These are the parts of an association which we send in the cookie.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  263)  * Most of these are straight out of:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  264)  * RFC2960 12.2 Parameters necessary per association (i.e. the TCB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  265)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  266)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  267) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  268) struct sctp_cookie {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  269) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  270) 	/* My	       : Tag expected in every inbound packet and sent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  271) 	 * Verification: in the INIT or INIT ACK chunk.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  272) 	 * Tag	       :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  273) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  274) 	__u32 my_vtag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  275) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  276) 	/* Peer's      : Tag expected in every outbound packet except
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  277) 	 * Verification: in the INIT chunk.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  278) 	 * Tag	       :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  279) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  280) 	__u32 peer_vtag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  281) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  282) 	/* The rest of these are not from the spec, but really need to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  283) 	 * be in the cookie.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  284) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  285) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  286) 	/* My Tie Tag  : Assist in discovering a restarting association. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  287) 	__u32 my_ttag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  288) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  289) 	/* Peer's Tie Tag: Assist in discovering a restarting association. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  290) 	__u32 peer_ttag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  291) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  292) 	/* When does this cookie expire? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  293) 	ktime_t expiration;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  294) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  295) 	/* Number of inbound/outbound streams which are set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  296) 	 * and negotiated during the INIT process.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  297) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  298) 	__u16 sinit_num_ostreams;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  299) 	__u16 sinit_max_instreams;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  300) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  301) 	/* This is the first sequence number I used.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  302) 	__u32 initial_tsn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  303) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  304) 	/* This holds the originating address of the INIT packet.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  305) 	union sctp_addr peer_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  306) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  307) 	/* IG Section 2.35.3 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  308) 	 * Include the source port of the INIT-ACK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  309) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  310) 	__u16		my_port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  311) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  312) 	__u8 prsctp_capable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  313) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  314) 	/* Padding for future use */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  315) 	__u8 padding;  		
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  316) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  317) 	__u32 adaptation_ind;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  318) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  319) 	__u8 auth_random[sizeof(struct sctp_paramhdr) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  320) 			 SCTP_AUTH_RANDOM_LENGTH];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  321) 	__u8 auth_hmacs[SCTP_AUTH_NUM_HMACS * sizeof(__u16) + 2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  322) 	__u8 auth_chunks[sizeof(struct sctp_paramhdr) + SCTP_AUTH_MAX_CHUNKS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  323) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  324) 	/* This is a shim for my peer's INIT packet, followed by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  325) 	 * a copy of the raw address list of the association.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  326) 	 * The length of the raw address list is saved in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  327) 	 * raw_addr_list_len field, which will be used at the time when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  328) 	 * the association TCB is re-constructed from the cookie.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  329) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  330) 	__u32 raw_addr_list_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  331) 	struct sctp_init_chunk peer_init[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  332) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  333) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  334) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  335) /* The format of our cookie that we send to our peer. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  336) struct sctp_signed_cookie {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  337) 	__u8 signature[SCTP_SECRET_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  338) 	__u32 __pad;		/* force sctp_cookie alignment to 64 bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  339) 	struct sctp_cookie c;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  340) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  341) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  342) /* This is another convenience type to allocate memory for address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  343)  * params for the maximum size and pass such structures around
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  344)  * internally.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  345)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  346) union sctp_addr_param {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  347) 	struct sctp_paramhdr p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  348) 	struct sctp_ipv4addr_param v4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  349) 	struct sctp_ipv6addr_param v6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  350) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  351) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  352) /* A convenience type to allow walking through the various
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  353)  * parameters and avoid casting all over the place.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  354)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  355) union sctp_params {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  356) 	void *v;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  357) 	struct sctp_paramhdr *p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  358) 	struct sctp_cookie_preserve_param *life;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  359) 	struct sctp_hostname_param *dns;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  360) 	struct sctp_cookie_param *cookie;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  361) 	struct sctp_supported_addrs_param *sat;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  362) 	struct sctp_ipv4addr_param *v4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  363) 	struct sctp_ipv6addr_param *v6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  364) 	union sctp_addr_param *addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  365) 	struct sctp_adaptation_ind_param *aind;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  366) 	struct sctp_supported_ext_param *ext;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  367) 	struct sctp_random_param *random;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  368) 	struct sctp_chunks_param *chunks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  369) 	struct sctp_hmac_algo_param *hmac_algo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  370) 	struct sctp_addip_param *addip;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  371) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  372) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  373) /* RFC 2960.  Section 3.3.5 Heartbeat.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  374)  *    Heartbeat Information: variable length
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  375)  *    The Sender-specific Heartbeat Info field should normally include
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  376)  *    information about the sender's current time when this HEARTBEAT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  377)  *    chunk is sent and the destination transport address to which this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  378)  *    HEARTBEAT is sent (see Section 8.3).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  379)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  380) struct sctp_sender_hb_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  381) 	struct sctp_paramhdr param_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  382) 	union sctp_addr daddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  383) 	unsigned long sent_at;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  384) 	__u64 hb_nonce;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  385) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  386) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  387) int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  388) 		     gfp_t gfp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  389) int sctp_stream_init_ext(struct sctp_stream *stream, __u16 sid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  390) void sctp_stream_free(struct sctp_stream *stream);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  391) void sctp_stream_clear(struct sctp_stream *stream);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  392) void sctp_stream_update(struct sctp_stream *stream, struct sctp_stream *new);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  393) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  394) /* What is the current SSN number for this stream? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  395) #define sctp_ssn_peek(stream, type, sid) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  396) 	(sctp_stream_##type((stream), (sid))->ssn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  397) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  398) /* Return the next SSN number for this stream.	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  399) #define sctp_ssn_next(stream, type, sid) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  400) 	(sctp_stream_##type((stream), (sid))->ssn++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  401) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  402) /* Skip over this ssn and all below. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  403) #define sctp_ssn_skip(stream, type, sid, ssn) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  404) 	(sctp_stream_##type((stream), (sid))->ssn = ssn + 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  405) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  406) /* What is the current MID number for this stream? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  407) #define sctp_mid_peek(stream, type, sid) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  408) 	(sctp_stream_##type((stream), (sid))->mid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  409) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  410) /* Return the next MID number for this stream.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  411) #define sctp_mid_next(stream, type, sid) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  412) 	(sctp_stream_##type((stream), (sid))->mid++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  413) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  414) /* Skip over this mid and all below. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  415) #define sctp_mid_skip(stream, type, sid, mid) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  416) 	(sctp_stream_##type((stream), (sid))->mid = mid + 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  417) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  418) /* What is the current MID_uo number for this stream? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  419) #define sctp_mid_uo_peek(stream, type, sid) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  420) 	(sctp_stream_##type((stream), (sid))->mid_uo)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  421) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  422) /* Return the next MID_uo number for this stream.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  423) #define sctp_mid_uo_next(stream, type, sid) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  424) 	(sctp_stream_##type((stream), (sid))->mid_uo++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  425) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  426) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  427)  * Pointers to address related SCTP functions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  428)  * (i.e. things that depend on the address family.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  429)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  430) struct sctp_af {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  431) 	int		(*sctp_xmit)	(struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  432) 					 struct sctp_transport *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  433) 	int		(*setsockopt)	(struct sock *sk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  434) 					 int level,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  435) 					 int optname,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  436) 					 sockptr_t optval,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  437) 					 unsigned int optlen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  438) 	int		(*getsockopt)	(struct sock *sk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  439) 					 int level,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  440) 					 int optname,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  441) 					 char __user *optval,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  442) 					 int __user *optlen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  443) 	void		(*get_dst)	(struct sctp_transport *t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  444) 					 union sctp_addr *saddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  445) 					 struct flowi *fl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  446) 					 struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  447) 	void		(*get_saddr)	(struct sctp_sock *sk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  448) 					 struct sctp_transport *t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  449) 					 struct flowi *fl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  450) 	void		(*copy_addrlist) (struct list_head *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  451) 					  struct net_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  452) 	int		(*cmp_addr)	(const union sctp_addr *addr1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  453) 					 const union sctp_addr *addr2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  454) 	void		(*addr_copy)	(union sctp_addr *dst,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  455) 					 union sctp_addr *src);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  456) 	void		(*from_skb)	(union sctp_addr *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  457) 					 struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  458) 					 int saddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  459) 	void		(*from_sk)	(union sctp_addr *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  460) 					 struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  461) 	bool		(*from_addr_param) (union sctp_addr *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  462) 					    union sctp_addr_param *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  463) 					    __be16 port, int iif);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  464) 	int		(*to_addr_param) (const union sctp_addr *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  465) 					  union sctp_addr_param *); 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  466) 	int		(*addr_valid)	(union sctp_addr *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  467) 					 struct sctp_sock *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  468) 					 const struct sk_buff *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  469) 	enum sctp_scope	(*scope)(union sctp_addr *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  470) 	void		(*inaddr_any)	(union sctp_addr *, __be16);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  471) 	int		(*is_any)	(const union sctp_addr *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  472) 	int		(*available)	(union sctp_addr *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  473) 					 struct sctp_sock *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  474) 	int		(*skb_iif)	(const struct sk_buff *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  475) 	int		(*is_ce)	(const struct sk_buff *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  476) 	void		(*seq_dump_addr)(struct seq_file *seq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  477) 					 union sctp_addr *addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  478) 	void		(*ecn_capable)(struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  479) 	__u16		net_header_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  480) 	int		sockaddr_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  481) 	int		(*ip_options_len)(struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  482) 	sa_family_t	sa_family;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  483) 	struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  484) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  485) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  486) struct sctp_af *sctp_get_af_specific(sa_family_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  487) int sctp_register_af(struct sctp_af *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  488) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  489) /* Protocol family functions. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  490) struct sctp_pf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  491) 	void (*event_msgname)(struct sctp_ulpevent *, char *, int *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  492) 	void (*skb_msgname)  (struct sk_buff *, char *, int *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  493) 	int  (*af_supported) (sa_family_t, struct sctp_sock *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  494) 	int  (*cmp_addr) (const union sctp_addr *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  495) 			  const union sctp_addr *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  496) 			  struct sctp_sock *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  497) 	int  (*bind_verify) (struct sctp_sock *, union sctp_addr *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  498) 	int  (*send_verify) (struct sctp_sock *, union sctp_addr *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  499) 	int  (*supported_addrs)(const struct sctp_sock *, __be16 *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  500) 	struct sock *(*create_accept_sk) (struct sock *sk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  501) 					  struct sctp_association *asoc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  502) 					  bool kern);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  503) 	int (*addr_to_user)(struct sctp_sock *sk, union sctp_addr *addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  504) 	void (*to_sk_saddr)(union sctp_addr *, struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  505) 	void (*to_sk_daddr)(union sctp_addr *, struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  506) 	void (*copy_ip_options)(struct sock *sk, struct sock *newsk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  507) 	struct sctp_af *af;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  508) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  509) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  510) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  511) /* Structure to track chunk fragments that have been acked, but peer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  512)  * fragments of the same message have not.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  513)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  514) struct sctp_datamsg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  515) 	/* Chunks waiting to be submitted to lower layer. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  516) 	struct list_head chunks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  517) 	/* Reference counting. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  518) 	refcount_t refcnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  519) 	/* When is this message no longer interesting to the peer? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  520) 	unsigned long expires_at;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  521) 	/* Did the messenge fail to send? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  522) 	int send_error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  523) 	u8 send_failed:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  524) 	   can_delay:1,	/* should this message be Nagle delayed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  525) 	   abandoned:1;	/* should this message be abandoned */
^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) struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  529) 					    struct sctp_sndrcvinfo *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  530) 					    struct iov_iter *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  531) void sctp_datamsg_free(struct sctp_datamsg *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  532) void sctp_datamsg_put(struct sctp_datamsg *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  533) void sctp_chunk_fail(struct sctp_chunk *, int error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  534) int sctp_chunk_abandoned(struct sctp_chunk *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  535) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  536) /* RFC2960 1.4 Key Terms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  537)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  538)  * o Chunk: A unit of information within an SCTP packet, consisting of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  539)  * a chunk header and chunk-specific content.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  540)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  541)  * As a matter of convenience, we remember the SCTP common header for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  542)  * each chunk as well as a few other header pointers...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  543)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  544) struct sctp_chunk {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  545) 	struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  546) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  547) 	refcount_t refcnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  548) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  549) 	/* How many times this chunk have been sent, for prsctp RTX policy */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  550) 	int sent_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  551) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  552) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  553) 		/* This is our link to the per-transport transmitted list.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  554) 		struct list_head transmitted_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  555) 		/* List in specific stream outq */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  556) 		struct list_head stream_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  557) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  558) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  559) 	/* This field is used by chunks that hold fragmented data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  560) 	 * For the first fragment this is the list that holds the rest of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  561) 	 * fragments. For the remaining fragments, this is the link to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  562) 	 * frag_list maintained in the first fragment.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  563) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  564) 	struct list_head frag_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  565) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  566) 	/* This points to the sk_buff containing the actual data.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  567) 	struct sk_buff *skb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  568) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  569) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  570) 		/* In case of GSO packets, this will store the head one */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  571) 		struct sk_buff *head_skb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  572) 		/* In case of auth enabled, this will point to the shkey */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  573) 		struct sctp_shared_key *shkey;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  574) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  575) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  576) 	/* These are the SCTP headers by reverse order in a packet.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  577) 	 * Note that some of these may happen more than once.  In that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  578) 	 * case, we point at the "current" one, whatever that means
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  579) 	 * for that level of header.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  580) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  581) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  582) 	/* We point this at the FIRST TLV parameter to chunk_hdr.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  583) 	union sctp_params param_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  584) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  585) 		__u8 *v;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  586) 		struct sctp_datahdr *data_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  587) 		struct sctp_inithdr *init_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  588) 		struct sctp_sackhdr *sack_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  589) 		struct sctp_heartbeathdr *hb_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  590) 		struct sctp_sender_hb_info *hbs_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  591) 		struct sctp_shutdownhdr *shutdown_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  592) 		struct sctp_signed_cookie *cookie_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  593) 		struct sctp_ecnehdr *ecne_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  594) 		struct sctp_cwrhdr *ecn_cwr_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  595) 		struct sctp_errhdr *err_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  596) 		struct sctp_addiphdr *addip_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  597) 		struct sctp_fwdtsn_hdr *fwdtsn_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  598) 		struct sctp_authhdr *auth_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  599) 		struct sctp_idatahdr *idata_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  600) 		struct sctp_ifwdtsn_hdr *ifwdtsn_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  601) 	} subh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  602) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  603) 	__u8 *chunk_end;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  604) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  605) 	struct sctp_chunkhdr *chunk_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  606) 	struct sctphdr *sctp_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  607) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  608) 	/* This needs to be recoverable for SCTP_SEND_FAILED events. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  609) 	struct sctp_sndrcvinfo sinfo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  610) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  611) 	/* Which association does this belong to?  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  612) 	struct sctp_association *asoc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  613) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  614) 	/* What endpoint received this chunk? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  615) 	struct sctp_ep_common *rcvr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  616) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  617) 	/* We fill this in if we are calculating RTT. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  618) 	unsigned long sent_at;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  619) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  620) 	/* What is the origin IP address for this chunk?  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  621) 	union sctp_addr source;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  622) 	/* Destination address for this chunk. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  623) 	union sctp_addr dest;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  624) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  625) 	/* For outbound message, track all fragments for SEND_FAILED. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  626) 	struct sctp_datamsg *msg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  627) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  628) 	/* For an inbound chunk, this tells us where it came from.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  629) 	 * For an outbound chunk, it tells us where we'd like it to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  630) 	 * go.	It is NULL if we have no preference.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  631) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  632) 	struct sctp_transport *transport;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  633) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  634) 	/* SCTP-AUTH:  For the special case inbound processing of COOKIE-ECHO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  635) 	 * we need save a pointer to the AUTH chunk, since the SCTP-AUTH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  636) 	 * spec violates the principle premis that all chunks are processed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  637) 	 * in order.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  638) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  639) 	struct sk_buff *auth_chunk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  640) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  641) #define SCTP_CAN_FRTX 0x0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  642) #define SCTP_NEED_FRTX 0x1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  643) #define SCTP_DONT_FRTX 0x2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  644) 	__u16	rtt_in_progress:1,	/* This chunk used for RTT calc? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  645) 		has_tsn:1,		/* Does this chunk have a TSN yet? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  646) 		has_ssn:1,		/* Does this chunk have a SSN yet? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  647) #define has_mid has_ssn
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  648) 		singleton:1,		/* Only chunk in the packet? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  649) 		end_of_packet:1,	/* Last chunk in the packet? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  650) 		ecn_ce_done:1,		/* Have we processed the ECN CE bit? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  651) 		pdiscard:1,		/* Discard the whole packet now? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  652) 		tsn_gap_acked:1,	/* Is this chunk acked by a GAP ACK? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  653) 		data_accepted:1,	/* At least 1 chunk accepted */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  654) 		auth:1,			/* IN: was auth'ed | OUT: needs auth */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  655) 		has_asconf:1,		/* IN: have seen an asconf before */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  656) 		tsn_missing_report:2,	/* Data chunk missing counter. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  657) 		fast_retransmit:2;	/* Is this chunk fast retransmitted? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  658) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  659) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  660) #define sctp_chunk_retransmitted(chunk)	(chunk->sent_count > 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  661) void sctp_chunk_hold(struct sctp_chunk *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  662) void sctp_chunk_put(struct sctp_chunk *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  663) int sctp_user_addto_chunk(struct sctp_chunk *chunk, int len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  664) 			  struct iov_iter *from);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  665) void sctp_chunk_free(struct sctp_chunk *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  666) void  *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  667) struct sctp_chunk *sctp_chunkify(struct sk_buff *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  668) 				 const struct sctp_association *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  669) 				 struct sock *, gfp_t gfp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  670) void sctp_init_addrs(struct sctp_chunk *, union sctp_addr *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  671) 		     union sctp_addr *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  672) const union sctp_addr *sctp_source(const struct sctp_chunk *chunk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  673) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  674) static inline __u16 sctp_chunk_stream_no(struct sctp_chunk *ch)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  675) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  676) 	return ntohs(ch->subh.data_hdr->stream);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  677) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  678) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  679) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  680) 	SCTP_ADDR_NEW,		/* new address added to assoc/ep */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  681) 	SCTP_ADDR_SRC,		/* address can be used as source */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  682) 	SCTP_ADDR_DEL,		/* address about to be deleted */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  683) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  684) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  685) /* This is a structure for holding either an IPv6 or an IPv4 address.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  686) struct sctp_sockaddr_entry {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  687) 	struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  688) 	struct rcu_head	rcu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  689) 	union sctp_addr a;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  690) 	__u8 state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  691) 	__u8 valid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  692) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  693) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  694) #define SCTP_ADDRESS_TICK_DELAY	500
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  695) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  696) /* This structure holds lists of chunks as we are assembling for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  697)  * transmission.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  698)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  699) struct sctp_packet {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  700) 	/* These are the SCTP header values (host order) for the packet. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  701) 	__u16 source_port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  702) 	__u16 destination_port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  703) 	__u32 vtag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  704) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  705) 	/* This contains the payload chunks.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  706) 	struct list_head chunk_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  707) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  708) 	/* This is the overhead of the sctp and ip headers. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  709) 	size_t overhead;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  710) 	/* This is the total size of all chunks INCLUDING padding.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  711) 	size_t size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  712) 	/* This is the maximum size this packet may have */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  713) 	size_t max_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  714) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  715) 	/* The packet is destined for this transport address.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  716) 	 * The function we finally use to pass down to the next lower
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  717) 	 * layer lives in the transport structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  718) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  719) 	struct sctp_transport *transport;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  720) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  721) 	/* pointer to the auth chunk for this packet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  722) 	struct sctp_chunk *auth;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  723) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  724) 	u8  has_cookie_echo:1,	/* This packet contains a COOKIE-ECHO chunk. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  725) 	    has_sack:1,		/* This packet contains a SACK chunk. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  726) 	    has_auth:1,		/* This packet contains an AUTH chunk */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  727) 	    has_data:1,		/* This packet contains at least 1 DATA chunk */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  728) 	    ipfragok:1;		/* So let ip fragment this packet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  729) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  730) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  731) void sctp_packet_init(struct sctp_packet *, struct sctp_transport *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  732) 		      __u16 sport, __u16 dport);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  733) void sctp_packet_config(struct sctp_packet *, __u32 vtag, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  734) enum sctp_xmit sctp_packet_transmit_chunk(struct sctp_packet *packet,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  735) 					  struct sctp_chunk *chunk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  736) 					  int one_packet, gfp_t gfp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  737) enum sctp_xmit sctp_packet_append_chunk(struct sctp_packet *packet,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  738) 					struct sctp_chunk *chunk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  739) int sctp_packet_transmit(struct sctp_packet *, gfp_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  740) void sctp_packet_free(struct sctp_packet *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  741) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  742) static inline int sctp_packet_empty(struct sctp_packet *packet)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  743) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  744) 	return packet->size == packet->overhead;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  745) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  746) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  747) /* This represents a remote transport address.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  748)  * For local transport addresses, we just use union sctp_addr.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  749)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  750)  * RFC2960 Section 1.4 Key Terms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  751)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  752)  *   o	Transport address:  A Transport Address is traditionally defined
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  753)  *	by Network Layer address, Transport Layer protocol and Transport
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  754)  *	Layer port number.  In the case of SCTP running over IP, a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  755)  *	transport address is defined by the combination of an IP address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  756)  *	and an SCTP port number (where SCTP is the Transport protocol).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  757)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  758)  * RFC2960 Section 7.1 SCTP Differences from TCP Congestion control
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  759)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  760)  *   o	The sender keeps a separate congestion control parameter set for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  761)  *	each of the destination addresses it can send to (not each
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  762)  *	source-destination pair but for each destination).  The parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  763)  *	should decay if the address is not used for a long enough time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  764)  *	period.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  765)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  766)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  767) struct sctp_transport {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  768) 	/* A list of transports. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  769) 	struct list_head transports;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  770) 	struct rhlist_head node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  771) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  772) 	/* Reference counting. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  773) 	refcount_t refcnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  774) 		/* RTO-Pending : A flag used to track if one of the DATA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  775) 		 *		chunks sent to this address is currently being
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  776) 		 *		used to compute a RTT. If this flag is 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  777) 		 *		the next DATA chunk sent to this destination
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  778) 		 *		should be used to compute a RTT and this flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  779) 		 *		should be set. Every time the RTT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  780) 		 *		calculation completes (i.e. the DATA chunk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  781) 		 *		is SACK'd) clear this flag.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  782) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  783) 	__u32	rto_pending:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  784) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  785) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  786) 		 * hb_sent : a flag that signals that we have a pending
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  787) 		 * heartbeat.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  788) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  789) 		hb_sent:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  790) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  791) 		/* Is the Path MTU update pending on this tranport */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  792) 		pmtu_pending:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  793) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  794) 		dst_pending_confirm:1,	/* need to confirm neighbour */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  795) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  796) 		/* Has this transport moved the ctsn since we last sacked */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  797) 		sack_generation:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  798) 	u32 dst_cookie;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  799) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  800) 	struct flowi fl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  801) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  802) 	/* This is the peer's IP address and port. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  803) 	union sctp_addr ipaddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  804) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  805) 	/* These are the functions we call to handle LLP stuff.	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  806) 	struct sctp_af *af_specific;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  807) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  808) 	/* Which association do we belong to?  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  809) 	struct sctp_association *asoc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  810) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  811) 	/* RFC2960
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  812) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  813) 	 * 12.3 Per Transport Address Data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  814) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  815) 	 * For each destination transport address in the peer's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  816) 	 * address list derived from the INIT or INIT ACK chunk, a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  817) 	 * number of data elements needs to be maintained including:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  818) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  819) 	/* RTO	       : The current retransmission timeout value.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  820) 	unsigned long rto;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  821) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  822) 	__u32 rtt;		/* This is the most recent RTT.	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  823) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  824) 	/* RTTVAR      : The current RTT variation.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  825) 	__u32 rttvar;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  826) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  827) 	/* SRTT	       : The current smoothed round trip time.	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  828) 	__u32 srtt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  829) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  830) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  831) 	 * These are the congestion stats.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  832) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  833) 	/* cwnd	       : The current congestion window.	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  834) 	__u32 cwnd;		  /* This is the actual cwnd.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  835) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  836) 	/* ssthresh    : The current slow start threshold value.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  837) 	__u32 ssthresh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  838) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  839) 	/* partial     : The tracking method for increase of cwnd when in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  840) 	 * bytes acked : congestion avoidance mode (see Section 6.2.2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  841) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  842) 	__u32 partial_bytes_acked;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  843) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  844) 	/* Data that has been sent, but not acknowledged. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  845) 	__u32 flight_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  846) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  847) 	__u32 burst_limited;	/* Holds old cwnd when max.burst is applied */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  848) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  849) 	/* Destination */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  850) 	struct dst_entry *dst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  851) 	/* Source address. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  852) 	union sctp_addr saddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  853) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  854) 	/* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  855) 	 * the destination address every heartbeat interval.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  856) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  857) 	unsigned long hbinterval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  858) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  859) 	/* SACK delay timeout */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  860) 	unsigned long sackdelay;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  861) 	__u32 sackfreq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  862) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  863) 	atomic_t mtu_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  864) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  865) 	/* When was the last time that we heard from this transport? We use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  866) 	 * this to pick new active and retran paths.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  867) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  868) 	ktime_t last_time_heard;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  869) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  870) 	/* When was the last time that we sent a chunk using this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  871) 	 * transport? We use this to check for idle transports
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  872) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  873) 	unsigned long last_time_sent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  874) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  875) 	/* Last time(in jiffies) when cwnd is reduced due to the congestion
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  876) 	 * indication based on ECNE chunk.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  877) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  878) 	unsigned long last_time_ecne_reduced;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  879) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  880) 	/* This is the max_retrans value for the transport and will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  881) 	 * be initialized from the assocs value.  This can be changed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  882) 	 * using the SCTP_SET_PEER_ADDR_PARAMS socket option.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  883) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  884) 	__u16 pathmaxrxt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  885) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  886) 	__u32 flowlabel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  887) 	__u8  dscp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  888) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  889) 	/* This is the partially failed retrans value for the transport
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  890) 	 * and will be initialized from the assocs value.  This can be changed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  891) 	 * using the SCTP_PEER_ADDR_THLDS socket option
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  892) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  893) 	__u16 pf_retrans;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  894) 	/* Used for primary path switchover. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  895) 	__u16 ps_retrans;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  896) 	/* PMTU	      : The current known path MTU.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  897) 	__u32 pathmtu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  898) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  899) 	/* Flags controlling Heartbeat, SACK delay, and Path MTU Discovery. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  900) 	__u32 param_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  901) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  902) 	/* The number of times INIT has been sent on this transport. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  903) 	int init_sent_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  904) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  905) 	/* state       : The current state of this destination,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  906) 	 *             : i.e. SCTP_ACTIVE, SCTP_INACTIVE, SCTP_UNKNOWN.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  907) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  908) 	int state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  909) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  910) 	/* These are the error stats for this destination.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  911) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  912) 	/* Error count : The current error count for this destination.	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  913) 	unsigned short error_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  914) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  915) 	/* Per	       : A timer used by each destination.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  916) 	 * Destination :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  917) 	 * Timer       :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  918) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  919) 	 * [Everywhere else in the text this is called T3-rtx. -ed]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  920) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  921) 	struct timer_list T3_rtx_timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  922) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  923) 	/* Heartbeat timer is per destination. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  924) 	struct timer_list hb_timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  925) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  926) 	/* Timer to handle ICMP proto unreachable envets */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  927) 	struct timer_list proto_unreach_timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  928) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  929) 	/* Timer to handler reconf chunk rtx */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  930) 	struct timer_list reconf_timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  931) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  932) 	/* Since we're using per-destination retransmission timers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  933) 	 * (see above), we're also using per-destination "transmitted"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  934) 	 * queues.  This probably ought to be a private struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  935) 	 * accessible only within the outqueue, but it's not, yet.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  936) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  937) 	struct list_head transmitted;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  938) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  939) 	/* We build bundle-able packets for this transport here.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  940) 	struct sctp_packet packet;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  941) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  942) 	/* This is the list of transports that have chunks to send.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  943) 	struct list_head send_ready;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  944) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  945) 	/* State information saved for SFR_CACC algorithm. The key
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  946) 	 * idea in SFR_CACC is to maintain state at the sender on a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  947) 	 * per-destination basis when a changeover happens.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  948) 	 *	char changeover_active;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  949) 	 *	char cycling_changeover;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  950) 	 *	__u32 next_tsn_at_change;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  951) 	 *	char cacc_saw_newack;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  952) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  953) 	struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  954) 		/* An unsigned integer, which stores the next TSN to be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  955) 		 * used by the sender, at the moment of changeover.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  956) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  957) 		__u32 next_tsn_at_change;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  958) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  959) 		/* A flag which indicates the occurrence of a changeover */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  960) 		char changeover_active;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  961) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  962) 		/* A flag which indicates whether the change of primary is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  963) 		 * the first switch to this destination address during an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  964) 		 * active switch.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  965) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  966) 		char cycling_changeover;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  967) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  968) 		/* A temporary flag, which is used during the processing of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  969) 		 * a SACK to estimate the causative TSN(s)'s group.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  970) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  971) 		char cacc_saw_newack;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  972) 	} cacc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  973) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  974) 	/* 64-bit random number sent with heartbeat. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  975) 	__u64 hb_nonce;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  976) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  977) 	struct rcu_head rcu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  978) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  979) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  980) struct sctp_transport *sctp_transport_new(struct net *, const union sctp_addr *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  981) 					  gfp_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  982) void sctp_transport_set_owner(struct sctp_transport *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  983) 			      struct sctp_association *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  984) void sctp_transport_route(struct sctp_transport *, union sctp_addr *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  985) 			  struct sctp_sock *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  986) void sctp_transport_pmtu(struct sctp_transport *, struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  987) void sctp_transport_free(struct sctp_transport *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  988) void sctp_transport_reset_t3_rtx(struct sctp_transport *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  989) void sctp_transport_reset_hb_timer(struct sctp_transport *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  990) void sctp_transport_reset_reconf_timer(struct sctp_transport *transport);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  991) int sctp_transport_hold(struct sctp_transport *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  992) void sctp_transport_put(struct sctp_transport *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  993) void sctp_transport_update_rto(struct sctp_transport *, __u32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  994) void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  995) void sctp_transport_lower_cwnd(struct sctp_transport *t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  996) 			       enum sctp_lower_cwnd reason);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  997) void sctp_transport_burst_limited(struct sctp_transport *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  998) void sctp_transport_burst_reset(struct sctp_transport *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  999) unsigned long sctp_transport_timeout(struct sctp_transport *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1000) void sctp_transport_reset(struct sctp_transport *t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1001) bool sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1002) void sctp_transport_immediate_rtx(struct sctp_transport *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1003) void sctp_transport_dst_release(struct sctp_transport *t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1004) void sctp_transport_dst_confirm(struct sctp_transport *t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1005) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1006) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1007) /* This is the structure we use to queue packets as they come into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1008)  * SCTP.  We write packets to it and read chunks from it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1009)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1010) struct sctp_inq {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1011) 	/* This is actually a queue of sctp_chunk each
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1012) 	 * containing a partially decoded packet.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1013) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1014) 	struct list_head in_chunk_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1015) 	/* This is the packet which is currently off the in queue and is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1016) 	 * being worked on through the inbound chunk processing.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1017) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1018) 	struct sctp_chunk *in_progress;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1019) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1020) 	/* This is the delayed task to finish delivering inbound
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1021) 	 * messages.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1022) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1023) 	struct work_struct immediate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1024) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1025) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1026) void sctp_inq_init(struct sctp_inq *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1027) void sctp_inq_free(struct sctp_inq *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1028) void sctp_inq_push(struct sctp_inq *, struct sctp_chunk *packet);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1029) struct sctp_chunk *sctp_inq_pop(struct sctp_inq *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1030) struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1031) void sctp_inq_set_th_handler(struct sctp_inq *, work_func_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1032) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1033) /* This is the structure we use to hold outbound chunks.  You push
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1034)  * chunks in and they automatically pop out the other end as bundled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1035)  * packets (it calls (*output_handler)()).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1036)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1037)  * This structure covers sections 6.3, 6.4, 6.7, 6.8, 6.10, 7., 8.1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1038)  * and 8.2 of the v13 draft.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1039)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1040)  * It handles retransmissions.	The connection to the timeout portion
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1041)  * of the state machine is through sctp_..._timeout() and timeout_handler.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1042)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1043)  * If you feed it SACKs, it will eat them.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1044)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1045)  * If you give it big chunks, it will fragment them.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1046)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1047)  * It assigns TSN's to data chunks.  This happens at the last possible
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1048)  * instant before transmission.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1049)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1050)  * When free()'d, it empties itself out via output_handler().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1051)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1052) struct sctp_outq {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1053) 	struct sctp_association *asoc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1054) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1055) 	/* Data pending that has never been transmitted.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1056) 	struct list_head out_chunk_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1057) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1058) 	/* Stream scheduler being used */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1059) 	struct sctp_sched_ops *sched;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1060) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1061) 	unsigned int out_qlen;	/* Total length of queued data chunks. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1062) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1063) 	/* Error of send failed, may used in SCTP_SEND_FAILED event. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1064) 	unsigned int error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1065) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1066) 	/* These are control chunks we want to send.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1067) 	struct list_head control_chunk_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1068) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1069) 	/* These are chunks that have been sacked but are above the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1070) 	 * CTSN, or cumulative tsn ack point.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1071) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1072) 	struct list_head sacked;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1073) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1074) 	/* Put chunks on this list to schedule them for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1075) 	 * retransmission.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1076) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1077) 	struct list_head retransmit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1078) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1079) 	/* Put chunks on this list to save them for FWD TSN processing as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1080) 	 * they were abandoned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1081) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1082) 	struct list_head abandoned;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1083) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1084) 	/* How many unackd bytes do we have in-flight?	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1085) 	__u32 outstanding_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1086) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1087) 	/* Are we doing fast-rtx on this queue */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1088) 	char fast_rtx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1089) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1090) 	/* Corked? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1091) 	char cork;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1092) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1093) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1094) void sctp_outq_init(struct sctp_association *, struct sctp_outq *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1095) void sctp_outq_teardown(struct sctp_outq *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1096) void sctp_outq_free(struct sctp_outq*);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1097) void sctp_outq_tail(struct sctp_outq *, struct sctp_chunk *chunk, gfp_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1098) int sctp_outq_sack(struct sctp_outq *, struct sctp_chunk *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1099) int sctp_outq_is_empty(const struct sctp_outq *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1100) void sctp_outq_restart(struct sctp_outq *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1102) void sctp_retransmit(struct sctp_outq *q, struct sctp_transport *transport,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1103) 		     enum sctp_retransmit_reason reason);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1104) void sctp_retransmit_mark(struct sctp_outq *, struct sctp_transport *, __u8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1105) void sctp_outq_uncork(struct sctp_outq *, gfp_t gfp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1106) void sctp_prsctp_prune(struct sctp_association *asoc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1107) 		       struct sctp_sndrcvinfo *sinfo, int msg_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1108) void sctp_generate_fwdtsn(struct sctp_outq *q, __u32 sack_ctsn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1109) /* Uncork and flush an outqueue.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1110) static inline void sctp_outq_cork(struct sctp_outq *q)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1111) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1112) 	q->cork = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1113) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1115) /* SCTP skb control block.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1116)  * sctp_input_cb is currently used on rx and sock rx queue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1117)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1118) struct sctp_input_cb {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1119) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1120) 		struct inet_skb_parm	h4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1121) #if IS_ENABLED(CONFIG_IPV6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1122) 		struct inet6_skb_parm	h6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1123) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1124) 	} header;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1125) 	struct sctp_chunk *chunk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1126) 	struct sctp_af *af;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1127) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1128) #define SCTP_INPUT_CB(__skb)	((struct sctp_input_cb *)&((__skb)->cb[0]))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1130) struct sctp_output_cb {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1131) 	struct sk_buff *last;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1132) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1133) #define SCTP_OUTPUT_CB(__skb)	((struct sctp_output_cb *)&((__skb)->cb[0]))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1135) static inline const struct sk_buff *sctp_gso_headskb(const struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1136) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1137) 	const struct sctp_chunk *chunk = SCTP_INPUT_CB(skb)->chunk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1139) 	return chunk->head_skb ? : skb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1140) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1142) /* These bind address data fields common between endpoints and associations */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1143) struct sctp_bind_addr {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1145) 	/* RFC 2960 12.1 Parameters necessary for the SCTP instance
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1146) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1147) 	 * SCTP Port:	The local SCTP port number the endpoint is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1148) 	 *		bound to.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1149) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1150) 	__u16 port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1152) 	/* RFC 2960 12.1 Parameters necessary for the SCTP instance
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1153) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1154) 	 * Address List: The list of IP addresses that this instance
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1155) 	 *	has bound.  This information is passed to one's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1156) 	 *	peer(s) in INIT and INIT ACK chunks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1157) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1158) 	struct list_head address_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1159) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1161) void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1162) void sctp_bind_addr_free(struct sctp_bind_addr *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1163) int sctp_bind_addr_copy(struct net *net, struct sctp_bind_addr *dest,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1164) 			const struct sctp_bind_addr *src,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1165) 			enum sctp_scope scope, gfp_t gfp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1166) 			int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1167) int sctp_bind_addr_dup(struct sctp_bind_addr *dest,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1168) 			const struct sctp_bind_addr *src,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1169) 			gfp_t gfp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1170) int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1171) 		       int new_size, __u8 addr_state, gfp_t gfp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1172) int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1173) int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1174) 			 struct sctp_sock *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1175) int sctp_bind_addr_conflict(struct sctp_bind_addr *, const union sctp_addr *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1176) 			 struct sctp_sock *, struct sctp_sock *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1177) int sctp_bind_addr_state(const struct sctp_bind_addr *bp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1178) 			 const union sctp_addr *addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1179) int sctp_bind_addrs_check(struct sctp_sock *sp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1180) 			  struct sctp_sock *sp2, int cnt2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1181) union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr	*bp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1182) 					const union sctp_addr	*addrs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1183) 					int			addrcnt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1184) 					struct sctp_sock	*opt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1185) union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1186) 					 int *addrs_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1187) 					 gfp_t gfp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1188) int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw, int len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1189) 			   __u16 port, gfp_t gfp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1190) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1191) enum sctp_scope sctp_scope(const union sctp_addr *addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1192) int sctp_in_scope(struct net *net, const union sctp_addr *addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1193) 		  const enum sctp_scope scope);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1194) int sctp_is_any(struct sock *sk, const union sctp_addr *addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1195) int sctp_is_ep_boundall(struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1198) /* What type of endpoint?  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1199) enum sctp_endpoint_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1200) 	SCTP_EP_TYPE_SOCKET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1201) 	SCTP_EP_TYPE_ASSOCIATION,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1202) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1204) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1205)  * A common base class to bridge the implmentation view of a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1206)  * socket (usually listening) endpoint versus an association's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1207)  * local endpoint.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1208)  * This common structure is useful for several purposes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1209)  *   1) Common interface for lookup routines.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1210)  *	a) Subfunctions work for either endpoint or association
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1211)  *	b) Single interface to lookup allows hiding the lookup lock rather
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1212)  *	   than acquiring it externally.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1213)  *   2) Common interface for the inbound chunk handling/state machine.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1214)  *   3) Common object handling routines for reference counting, etc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1215)  *   4) Disentangle association lookup from endpoint lookup, where we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1216)  *	do not have to find our endpoint to find our association.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1217)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1218)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1219) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1220) struct sctp_ep_common {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1221) 	/* Fields to help us manage our entries in the hash tables. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1222) 	struct hlist_node node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1223) 	int hashent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1225) 	/* Runtime type information.  What kind of endpoint is this? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1226) 	enum sctp_endpoint_type type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1228) 	/* Some fields to help us manage this object.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1229) 	 *   refcnt   - Reference count access to this object.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1230) 	 *   dead     - Do not attempt to use this object.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1231) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1232) 	refcount_t    refcnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1233) 	bool	    dead;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1234) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1235) 	/* What socket does this endpoint belong to?  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1236) 	struct sock *sk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1238) 	/* Cache netns and it won't change once set */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1239) 	struct net *net;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1240) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1241) 	/* This is where we receive inbound chunks.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1242) 	struct sctp_inq	  inqueue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1243) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1244) 	/* This substructure includes the defining parameters of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1245) 	 * endpoint:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1246) 	 * bind_addr.port is our shared port number.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1247) 	 * bind_addr.address_list is our set of local IP addresses.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1248) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1249) 	struct sctp_bind_addr bind_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1250) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1251) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1252) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1253) /* RFC Section 1.4 Key Terms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1254)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1255)  * o SCTP endpoint: The logical sender/receiver of SCTP packets. On a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1256)  *   multi-homed host, an SCTP endpoint is represented to its peers as a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1257)  *   combination of a set of eligible destination transport addresses to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1258)  *   which SCTP packets can be sent and a set of eligible source
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1259)  *   transport addresses from which SCTP packets can be received.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1260)  *   All transport addresses used by an SCTP endpoint must use the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1261)  *   same port number, but can use multiple IP addresses. A transport
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1262)  *   address used by an SCTP endpoint must not be used by another
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1263)  *   SCTP endpoint. In other words, a transport address is unique
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1264)  *   to an SCTP endpoint.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1265)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1266)  * From an implementation perspective, each socket has one of these.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1267)  * A TCP-style socket will have exactly one association on one of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1268)  * these.  An UDP-style socket will have multiple associations hanging
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1269)  * off one of these.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1270)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1271) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1272) struct sctp_endpoint {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1273) 	/* Common substructure for endpoint and association. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1274) 	struct sctp_ep_common base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1275) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1276) 	/* Associations: A list of current associations and mappings
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1277) 	 *	      to the data consumers for each association. This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1278) 	 *	      may be in the form of a hash table or other
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1279) 	 *	      implementation dependent structure. The data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1280) 	 *	      consumers may be process identification
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1281) 	 *	      information such as file descriptors, named pipe
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1282) 	 *	      pointer, or table pointers dependent on how SCTP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1283) 	 *	      is implemented.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1284) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1285) 	/* This is really a list of struct sctp_association entries. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1286) 	struct list_head asocs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1287) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1288) 	/* Secret Key: A secret key used by this endpoint to compute
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1289) 	 *	      the MAC.	This SHOULD be a cryptographic quality
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1290) 	 *	      random number with a sufficient length.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1291) 	 *	      Discussion in [RFC1750] can be helpful in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1292) 	 *	      selection of the key.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1293) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1294) 	__u8 secret_key[SCTP_SECRET_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1295) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1296)  	/* digest:  This is a digest of the sctp cookie.  This field is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1297)  	 * 	    only used on the receive path when we try to validate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1298)  	 * 	    that the cookie has not been tampered with.  We put
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1299)  	 * 	    this here so we pre-allocate this once and can re-use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1300)  	 * 	    on every receive.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1301)  	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1302)  	__u8 *digest;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1303)  
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1304) 	/* sendbuf acct. policy.	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1305) 	__u32 sndbuf_policy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1306) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1307) 	/* rcvbuf acct. policy.	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1308) 	__u32 rcvbuf_policy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1309) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1310) 	/* SCTP AUTH: array of the HMACs that will be allocated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1311) 	 * we need this per association so that we don't serialize
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1312) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1313) 	struct crypto_shash **auth_hmacs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1314) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1315) 	/* SCTP-AUTH: hmacs for the endpoint encoded into parameter */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1316) 	 struct sctp_hmac_algo_param *auth_hmacs_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1317) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1318) 	/* SCTP-AUTH: chunks to authenticate encoded into parameter */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1319) 	struct sctp_chunks_param *auth_chunk_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1320) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1321) 	/* SCTP-AUTH: endpoint shared keys */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1322) 	struct list_head endpoint_shared_keys;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1323) 	__u16 active_key_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1324) 	__u8  ecn_enable:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1325) 	      auth_enable:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1326) 	      intl_enable:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1327) 	      prsctp_enable:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1328) 	      asconf_enable:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1329) 	      reconf_enable:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1330) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1331) 	__u8  strreset_enable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1332) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1333) 	/* Security identifiers from incoming (INIT). These are set by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1334) 	 * security_sctp_assoc_request(). These will only be used by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1335) 	 * SCTP TCP type sockets and peeled off connections as they
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1336) 	 * cause a new socket to be generated. security_sctp_sk_clone()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1337) 	 * will then plug these into the new socket.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1338) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1339) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1340) 	u32 secid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1341) 	u32 peer_secid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1342) 	struct rcu_head rcu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1343) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1344) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1345) /* Recover the outter endpoint structure. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1346) static inline struct sctp_endpoint *sctp_ep(struct sctp_ep_common *base)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1347) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1348) 	struct sctp_endpoint *ep;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1349) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1350) 	ep = container_of(base, struct sctp_endpoint, base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1351) 	return ep;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1352) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1353) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1354) /* These are function signatures for manipulating endpoints.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1355) struct sctp_endpoint *sctp_endpoint_new(struct sock *, gfp_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1356) void sctp_endpoint_free(struct sctp_endpoint *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1357) void sctp_endpoint_put(struct sctp_endpoint *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1358) int sctp_endpoint_hold(struct sctp_endpoint *ep);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1359) void sctp_endpoint_add_asoc(struct sctp_endpoint *, struct sctp_association *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1360) struct sctp_association *sctp_endpoint_lookup_assoc(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1361) 	const struct sctp_endpoint *ep,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1362) 	const union sctp_addr *paddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1363) 	struct sctp_transport **);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1364) bool sctp_endpoint_is_peeled_off(struct sctp_endpoint *ep,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1365) 				 const union sctp_addr *paddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1366) struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1367) 					struct net *, const union sctp_addr *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1368) bool sctp_has_association(struct net *net, const union sctp_addr *laddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1369) 			  const union sctp_addr *paddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1370) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1371) int sctp_verify_init(struct net *net, const struct sctp_endpoint *ep,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1372) 		     const struct sctp_association *asoc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1373) 		     enum sctp_cid cid, struct sctp_init_chunk *peer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1374) 		     struct sctp_chunk *chunk, struct sctp_chunk **err_chunk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1375) int sctp_process_init(struct sctp_association *, struct sctp_chunk *chunk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1376) 		      const union sctp_addr *peer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1377) 		      struct sctp_init_chunk *init, gfp_t gfp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1378) __u32 sctp_generate_tag(const struct sctp_endpoint *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1379) __u32 sctp_generate_tsn(const struct sctp_endpoint *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1380) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1381) struct sctp_inithdr_host {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1382) 	__u32 init_tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1383) 	__u32 a_rwnd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1384) 	__u16 num_outbound_streams;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1385) 	__u16 num_inbound_streams;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1386) 	__u32 initial_tsn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1387) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1388) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1389) struct sctp_stream_priorities {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1390) 	/* List of priorities scheduled */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1391) 	struct list_head prio_sched;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1392) 	/* List of streams scheduled */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1393) 	struct list_head active;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1394) 	/* The next stream in line */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1395) 	struct sctp_stream_out_ext *next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1396) 	__u16 prio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1397) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1398) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1399) struct sctp_stream_out_ext {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1400) 	__u64 abandoned_unsent[SCTP_PR_INDEX(MAX) + 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1401) 	__u64 abandoned_sent[SCTP_PR_INDEX(MAX) + 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1402) 	struct list_head outq; /* chunks enqueued by this stream */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1403) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1404) 		struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1405) 			/* Scheduled streams list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1406) 			struct list_head prio_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1407) 			struct sctp_stream_priorities *prio_head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1408) 		};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1409) 		/* Fields used by RR scheduler */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1410) 		struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1411) 			struct list_head rr_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1412) 		};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1413) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1414) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1415) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1416) struct sctp_stream_out {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1417) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1418) 		__u32 mid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1419) 		__u16 ssn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1420) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1421) 	__u32 mid_uo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1422) 	struct sctp_stream_out_ext *ext;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1423) 	__u8 state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1424) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1425) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1426) struct sctp_stream_in {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1427) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1428) 		__u32 mid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1429) 		__u16 ssn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1430) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1431) 	__u32 mid_uo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1432) 	__u32 fsn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1433) 	__u32 fsn_uo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1434) 	char pd_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1435) 	char pd_mode_uo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1436) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1437) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1438) struct sctp_stream {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1439) 	GENRADIX(struct sctp_stream_out) out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1440) 	GENRADIX(struct sctp_stream_in)	in;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1441) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1442) 	__u16 outcnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1443) 	__u16 incnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1444) 	/* Current stream being sent, if any */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1445) 	struct sctp_stream_out *out_curr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1446) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1447) 		/* Fields used by priority scheduler */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1448) 		struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1449) 			/* List of priorities scheduled */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1450) 			struct list_head prio_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1451) 		};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1452) 		/* Fields used by RR scheduler */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1453) 		struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1454) 			/* List of streams scheduled */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1455) 			struct list_head rr_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1456) 			/* The next stream in line */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1457) 			struct sctp_stream_out_ext *rr_next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1458) 		};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1459) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1460) 	struct sctp_stream_interleave *si;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1461) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1462) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1463) static inline struct sctp_stream_out *sctp_stream_out(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1464) 	struct sctp_stream *stream,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1465) 	__u16 sid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1466) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1467) 	return genradix_ptr(&stream->out, sid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1468) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1469) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1470) static inline struct sctp_stream_in *sctp_stream_in(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1471) 	struct sctp_stream *stream,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1472) 	__u16 sid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1473) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1474) 	return genradix_ptr(&stream->in, sid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1475) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1476) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1477) #define SCTP_SO(s, i) sctp_stream_out((s), (i))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1478) #define SCTP_SI(s, i) sctp_stream_in((s), (i))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1479) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1480) #define SCTP_STREAM_CLOSED		0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1481) #define SCTP_STREAM_OPEN		0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1482) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1483) static inline __u16 sctp_datachk_len(const struct sctp_stream *stream)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1484) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1485) 	return stream->si->data_chunk_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1486) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1487) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1488) static inline __u16 sctp_datahdr_len(const struct sctp_stream *stream)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1489) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1490) 	return stream->si->data_chunk_len - sizeof(struct sctp_chunkhdr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1491) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1492) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1493) static inline __u16 sctp_ftsnchk_len(const struct sctp_stream *stream)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1494) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1495) 	return stream->si->ftsn_chunk_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1496) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1497) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1498) static inline __u16 sctp_ftsnhdr_len(const struct sctp_stream *stream)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1499) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1500) 	return stream->si->ftsn_chunk_len - sizeof(struct sctp_chunkhdr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1501) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1502) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1503) /* SCTP_GET_ASSOC_STATS counters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1504) struct sctp_priv_assoc_stats {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1505) 	/* Maximum observed rto in the association during subsequent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1506) 	 * observations. Value is set to 0 if no RTO measurement took place
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1507) 	 * The transport where the max_rto was observed is returned in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1508) 	 * obs_rto_ipaddr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1509) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1510) 	struct sockaddr_storage obs_rto_ipaddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1511) 	__u64 max_obs_rto;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1512) 	/* Total In and Out SACKs received and sent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1513) 	__u64 isacks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1514) 	__u64 osacks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1515) 	/* Total In and Out packets received and sent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1516) 	__u64 opackets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1517) 	__u64 ipackets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1518) 	/* Total retransmitted chunks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1519) 	__u64 rtxchunks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1520) 	/* TSN received > next expected */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1521) 	__u64 outofseqtsns;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1522) 	/* Duplicate Chunks received */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1523) 	__u64 idupchunks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1524) 	/* Gap Ack Blocks received */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1525) 	__u64 gapcnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1526) 	/* Unordered data chunks sent and received */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1527) 	__u64 ouodchunks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1528) 	__u64 iuodchunks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1529) 	/* Ordered data chunks sent and received */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1530) 	__u64 oodchunks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1531) 	__u64 iodchunks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1532) 	/* Control chunks sent and received */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1533) 	__u64 octrlchunks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1534) 	__u64 ictrlchunks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1535) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1536) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1537) /* RFC2960
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1538)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1539)  * 12. Recommended Transmission Control Block (TCB) Parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1540)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1541)  * This section details a recommended set of parameters that should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1542)  * be contained within the TCB for an implementation. This section is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1543)  * for illustrative purposes and should not be deemed as requirements
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1544)  * on an implementation or as an exhaustive list of all parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1545)  * inside an SCTP TCB. Each implementation may need its own additional
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1546)  * parameters for optimization.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1547)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1548) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1549) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1550) /* Here we have information about each individual association. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1551) struct sctp_association {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1552) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1553) 	/* A base structure common to endpoint and association.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1554) 	 * In this context, it represents the associations's view
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1555) 	 * of the local endpoint of the association.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1556) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1557) 	struct sctp_ep_common base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1558) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1559) 	/* Associations on the same socket. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1560) 	struct list_head asocs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1561) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1562) 	/* association id. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1563) 	sctp_assoc_t assoc_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1564) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1565) 	/* This is our parent endpoint.	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1566) 	struct sctp_endpoint *ep;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1567) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1568) 	/* These are those association elements needed in the cookie.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1569) 	struct sctp_cookie c;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1570) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1571) 	/* This is all information about our peer.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1572) 	struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1573) 		/* transport_addr_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1574) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1575) 		 * Peer	       : A list of SCTP transport addresses that the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1576) 		 * Transport   : peer is bound to. This information is derived
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1577) 		 * Address     : from the INIT or INIT ACK and is used to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1578) 		 * List	       : associate an inbound packet with a given
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1579) 		 *	       : association. Normally this information is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1580) 		 *	       : hashed or keyed for quick lookup and access
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1581) 		 *	       : of the TCB.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1582) 		 *	       : The list is also initialized with the list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1583) 		 *	       : of addresses passed with the sctp_connectx()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1584) 		 *	       : call.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1585) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1586) 		 * It is a list of SCTP_transport's.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1587) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1588) 		struct list_head transport_addr_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1589) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1590) 		/* rwnd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1591) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1592) 		 * Peer Rwnd   : Current calculated value of the peer's rwnd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1593) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1594) 		__u32 rwnd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1595) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1596) 		/* transport_count
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1597) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1598) 		 * Peer        : A count of the number of peer addresses
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1599) 		 * Transport   : in the Peer Transport Address List.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1600) 		 * Address     :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1601) 		 * Count       :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1602) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1603) 		__u16 transport_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1604) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1605) 		/* port
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1606) 		 *   The transport layer port number.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1607) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1608) 		__u16 port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1609) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1610) 		/* primary_path
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1611) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1612) 		 * Primary     : This is the current primary destination
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1613) 		 * Path	       : transport address of the peer endpoint.  It
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1614) 		 *	       : may also specify a source transport address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1615) 		 *	       : on this endpoint.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1616) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1617) 		 * All of these paths live on transport_addr_list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1618) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1619) 		 * At the bakeoffs, we discovered that the intent of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1620) 		 * primaryPath is that it only changes when the ULP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1621) 		 * asks to have it changed.  We add the activePath to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1622) 		 * designate the connection we are currently using to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1623) 		 * transmit new data and most control chunks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1624) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1625) 		struct sctp_transport *primary_path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1626) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1627) 		/* Cache the primary path address here, when we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1628) 		 * need a an address for msg_name.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1629) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1630) 		union sctp_addr primary_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1631) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1632) 		/* active_path
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1633) 		 *   The path that we are currently using to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1634) 		 *   transmit new data and most control chunks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1635) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1636) 		struct sctp_transport *active_path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1637) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1638) 		/* retran_path
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1639) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1640) 		 * RFC2960 6.4 Multi-homed SCTP Endpoints
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1641) 		 * ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1642) 		 * Furthermore, when its peer is multi-homed, an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1643) 		 * endpoint SHOULD try to retransmit a chunk to an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1644) 		 * active destination transport address that is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1645) 		 * different from the last destination address to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1646) 		 * which the DATA chunk was sent.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1647) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1648) 		struct sctp_transport *retran_path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1649) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1650) 		/* Pointer to last transport I have sent on.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1651) 		struct sctp_transport *last_sent_to;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1652) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1653) 		/* This is the last transport I have received DATA on.	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1654) 		struct sctp_transport *last_data_from;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1655) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1656) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1657) 		 * Mapping  An array of bits or bytes indicating which out of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1658) 		 * Array    order TSN's have been received (relative to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1659) 		 *	    Last Rcvd TSN). If no gaps exist, i.e. no out of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1660) 		 *	    order packets have been received, this array
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1661) 		 *	    will be set to all zero. This structure may be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1662) 		 *	    in the form of a circular buffer or bit array.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1663) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1664) 		 * Last Rcvd   : This is the last TSN received in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1665) 		 * TSN	       : sequence. This value is set initially by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1666) 		 *	       : taking the peer's Initial TSN, received in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1667) 		 *	       : the INIT or INIT ACK chunk, and subtracting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1668) 		 *	       : one from it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1669) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1670) 		 * Throughout most of the specification this is called the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1671) 		 * "Cumulative TSN ACK Point".	In this case, we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1672) 		 * ignore the advice in 12.2 in favour of the term
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1673) 		 * used in the bulk of the text.  This value is hidden
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1674) 		 * in tsn_map--we get it by calling sctp_tsnmap_get_ctsn().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1675) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1676) 		struct sctp_tsnmap tsn_map;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1677) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1678) 		/* This mask is used to disable sending the ASCONF chunk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1679) 		 * with specified parameter to peer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1680) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1681) 		__be16 addip_disabled_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1682) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1683) 		/* These are capabilities which our peer advertised.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1684) 		__u16	ecn_capable:1,      /* Can peer do ECN? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1685) 			ipv4_address:1,     /* Peer understands IPv4 addresses? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1686) 			ipv6_address:1,     /* Peer understands IPv6 addresses? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1687) 			hostname_address:1, /* Peer understands DNS addresses? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1688) 			asconf_capable:1,   /* Does peer support ADDIP? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1689) 			prsctp_capable:1,   /* Can peer do PR-SCTP? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1690) 			reconf_capable:1,   /* Can peer do RE-CONFIG? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1691) 			intl_capable:1,     /* Can peer do INTERLEAVE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1692) 			auth_capable:1,     /* Is peer doing SCTP-AUTH? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1693) 			/* sack_needed:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1694) 			 *   This flag indicates if the next received
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1695) 			 *   packet is to be responded to with a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1696) 			 *   SACK. This is initialized to 0.  When a packet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1697) 			 *   is received sack_cnt is incremented. If this value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1698) 			 *   reaches 2 or more, a SACK is sent and the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1699) 			 *   value is reset to 0. Note: This is used only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1700) 			 *   when no DATA chunks are received out of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1701) 			 *   order.  When DATA chunks are out of order,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1702) 			 *   SACK's are not delayed (see Section 6).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1703) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1704) 			sack_needed:1,     /* Do we need to sack the peer? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1705) 			sack_generation:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1706) 			zero_window_announced:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1707) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1708) 		__u32	sack_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1709) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1710) 		__u32   adaptation_ind;	 /* Adaptation Code point. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1711) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1712) 		struct sctp_inithdr_host i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1713) 		void *cookie;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1714) 		int cookie_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1715) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1716) 		/* ADDIP Section 4.2 Upon reception of an ASCONF Chunk.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1717) 		 * C1) ... "Peer-Serial-Number'. This value MUST be initialized to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1718) 		 * Initial TSN Value minus 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1719) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1720) 		__u32 addip_serial;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1721) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1722) 		/* SCTP-AUTH: We need to know pears random number, hmac list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1723) 		 * and authenticated chunk list.  All that is part of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1724) 		 * cookie and these are just pointers to those locations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1725) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1726) 		struct sctp_random_param *peer_random;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1727) 		struct sctp_chunks_param *peer_chunks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1728) 		struct sctp_hmac_algo_param *peer_hmacs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1729) 	} peer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1730) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1731) 	/* State       : A state variable indicating what state the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1732) 	 *	       : association is in, i.e. COOKIE-WAIT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1733) 	 *	       : COOKIE-ECHOED, ESTABLISHED, SHUTDOWN-PENDING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1734) 	 *	       : SHUTDOWN-SENT, SHUTDOWN-RECEIVED, SHUTDOWN-ACK-SENT.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1735) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1736) 	 *		Note: No "CLOSED" state is illustrated since if a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1737) 	 *		association is "CLOSED" its TCB SHOULD be removed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1738) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1739) 	 *		In this implementation we DO have a CLOSED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1740) 	 *		state which is used during initiation and shutdown.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1741) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1742) 	 *		State takes values from SCTP_STATE_*.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1743) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1744) 	enum sctp_state state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1745) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1746) 	/* Overall     : The overall association error count.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1747) 	 * Error Count : [Clear this any time I get something.]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1748) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1749) 	int overall_error_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1750) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1751) 	/* The cookie life I award for any cookie.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1752) 	ktime_t cookie_life;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1753) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1754) 	/* These are the association's initial, max, and min RTO values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1755) 	 * These values will be initialized by system defaults, but can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1756) 	 * be modified via the SCTP_RTOINFO socket option.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1757) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1758) 	unsigned long rto_initial;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1759) 	unsigned long rto_max;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1760) 	unsigned long rto_min;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1761) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1762) 	/* Maximum number of new data packets that can be sent in a burst.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1763) 	int max_burst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1764) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1765) 	/* This is the max_retrans value for the association.  This value will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1766) 	 * be initialized from system defaults, but can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1767) 	 * modified by the SCTP_ASSOCINFO socket option.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1768) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1769) 	int max_retrans;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1770) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1771) 	/* This is the partially failed retrans value for the transport
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1772) 	 * and will be initialized from the assocs value.  This can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1773) 	 * changed using the SCTP_PEER_ADDR_THLDS socket option
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1774) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1775) 	__u16 pf_retrans;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1776) 	/* Used for primary path switchover. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1777) 	__u16 ps_retrans;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1778) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1779) 	/* Maximum number of times the endpoint will retransmit INIT  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1780) 	__u16 max_init_attempts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1781) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1782) 	/* How many times have we resent an INIT? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1783) 	__u16 init_retries;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1784) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1785) 	/* The largest timeout or RTO value to use in attempting an INIT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1786) 	unsigned long max_init_timeo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1787) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1788) 	/* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1789) 	 * the destination address every heartbeat interval. This value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1790) 	 * will be inherited by all new transports.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1791) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1792) 	unsigned long hbinterval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1793) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1794) 	/* This is the max_retrans value for new transports in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1795) 	 * association.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1796) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1797) 	__u16 pathmaxrxt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1798) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1799) 	__u32 flowlabel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1800) 	__u8  dscp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1801) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1802) 	/* Flag that path mtu update is pending */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1803) 	__u8   pmtu_pending;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1804) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1805) 	/* Association : The smallest PMTU discovered for all of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1806) 	 * PMTU	       : peer's transport addresses.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1807) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1808) 	__u32 pathmtu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1809) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1810) 	/* Flags controlling Heartbeat, SACK delay, and Path MTU Discovery. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1811) 	__u32 param_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1812) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1813) 	__u32 sackfreq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1814) 	/* SACK delay timeout */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1815) 	unsigned long sackdelay;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1816) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1817) 	unsigned long timeouts[SCTP_NUM_TIMEOUT_TYPES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1818) 	struct timer_list timers[SCTP_NUM_TIMEOUT_TYPES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1819) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1820) 	/* Transport to which SHUTDOWN chunk was last sent.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1821) 	struct sctp_transport *shutdown_last_sent_to;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1822) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1823) 	/* Transport to which INIT chunk was last sent.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1824) 	struct sctp_transport *init_last_sent_to;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1825) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1826) 	/* How many times have we resent a SHUTDOWN */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1827) 	int shutdown_retries;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1828) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1829) 	/* Next TSN    : The next TSN number to be assigned to a new
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1830) 	 *	       : DATA chunk.  This is sent in the INIT or INIT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1831) 	 *	       : ACK chunk to the peer and incremented each
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1832) 	 *	       : time a DATA chunk is assigned a TSN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1833) 	 *	       : (normally just prior to transmit or during
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1834) 	 *	       : fragmentation).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1835) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1836) 	__u32 next_tsn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1837) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1838) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1839) 	 * Last Rcvd   : This is the last TSN received in sequence.  This value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1840) 	 * TSN	       : is set initially by taking the peer's Initial TSN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1841) 	 *	       : received in the INIT or INIT ACK chunk, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1842) 	 *	       : subtracting one from it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1843) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1844) 	 * Most of RFC 2960 refers to this as the Cumulative TSN Ack Point.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1845) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1846) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1847) 	__u32 ctsn_ack_point;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1848) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1849) 	/* PR-SCTP Advanced.Peer.Ack.Point */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1850) 	__u32 adv_peer_ack_point;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1851) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1852) 	/* Highest TSN that is acknowledged by incoming SACKs. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1853) 	__u32 highest_sacked;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1854) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1855) 	/* TSN marking the fast recovery exit point */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1856) 	__u32 fast_recovery_exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1857) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1858) 	/* Flag to track the current fast recovery state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1859) 	__u8 fast_recovery;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1860) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1861) 	/* The number of unacknowledged data chunks.  Reported through
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1862) 	 * the SCTP_STATUS sockopt.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1863) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1864) 	__u16 unack_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1865) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1866) 	/* The total number of data chunks that we've had to retransmit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1867) 	 * as the result of a T3 timer expiration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1868) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1869) 	__u32 rtx_data_chunks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1870) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1871) 	/* This is the association's receive buffer space.  This value is used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1872) 	 * to set a_rwnd field in an INIT or a SACK chunk.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1873) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1874) 	__u32 rwnd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1875) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1876) 	/* This is the last advertised value of rwnd over a SACK chunk. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1877) 	__u32 a_rwnd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1878) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1879) 	/* Number of bytes by which the rwnd has slopped.  The rwnd is allowed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1880) 	 * to slop over a maximum of the association's frag_point.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1881) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1882) 	__u32 rwnd_over;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1883) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1884) 	/* Keeps treack of rwnd pressure.  This happens when we have
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1885) 	 * a window, but not recevie buffer (i.e small packets).  This one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1886) 	 * is releases slowly (1 PMTU at a time ).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1887) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1888) 	__u32 rwnd_press;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1889) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1890) 	/* This is the sndbuf size in use for the association.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1891) 	 * This corresponds to the sndbuf size for the association,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1892) 	 * as specified in the sk->sndbuf.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1893) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1894) 	int sndbuf_used;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1895) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1896) 	/* This is the amount of memory that this association has allocated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1897) 	 * in the receive path at any given time.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1898) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1899) 	atomic_t rmem_alloc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1900) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1901) 	/* This is the wait queue head for send requests waiting on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1902) 	 * the association sndbuf space.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1903) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1904) 	wait_queue_head_t	wait;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1905) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1906) 	/* The message size at which SCTP fragmentation will occur. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1907) 	__u32 frag_point;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1908) 	__u32 user_frag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1909) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1910) 	/* Counter used to count INIT errors. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1911) 	int init_err_counter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1912) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1913) 	/* Count the number of INIT cycles (for doubling timeout). */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1914) 	int init_cycle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1915) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1916) 	/* Default send parameters. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1917) 	__u16 default_stream;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1918) 	__u16 default_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1919) 	__u32 default_ppid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1920) 	__u32 default_context;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1921) 	__u32 default_timetolive;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1922) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1923) 	/* Default receive parameters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1924) 	__u32 default_rcv_context;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1925) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1926) 	/* Stream arrays */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1927) 	struct sctp_stream stream;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1928) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1929) 	/* All outbound chunks go through this structure.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1930) 	struct sctp_outq outqueue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1931) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1932) 	/* A smart pipe that will handle reordering and fragmentation,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1933) 	 * as well as handle passing events up to the ULP.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1934) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1935) 	struct sctp_ulpq ulpq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1936) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1937) 	/* Last TSN that caused an ECNE Chunk to be sent.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1938) 	__u32 last_ecne_tsn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1939) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1940) 	/* Last TSN that caused a CWR Chunk to be sent.	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1941) 	__u32 last_cwr_tsn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1942) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1943) 	/* How many duplicated TSNs have we seen?  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1944) 	int numduptsns;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1945) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1946) 	/* These are to support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1947) 	 * "SCTP Extensions for Dynamic Reconfiguration of IP Addresses
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1948) 	 *  and Enforcement of Flow and Message Limits"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1949) 	 * <draft-ietf-tsvwg-addip-sctp-02.txt>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1950) 	 * or "ADDIP" for short.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1951) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1952) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1953) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1954) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1955) 	/* ADDIP Section 4.1.1 Congestion Control of ASCONF Chunks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1956) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1957) 	 * R1) One and only one ASCONF Chunk MAY be in transit and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1958) 	 * unacknowledged at any one time.  If a sender, after sending
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1959) 	 * an ASCONF chunk, decides it needs to transfer another
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1960) 	 * ASCONF Chunk, it MUST wait until the ASCONF-ACK Chunk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1961) 	 * returns from the previous ASCONF Chunk before sending a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1962) 	 * subsequent ASCONF. Note this restriction binds each side,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1963) 	 * so at any time two ASCONF may be in-transit on any given
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1964) 	 * association (one sent from each endpoint).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1965) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1966) 	 * [This is our one-and-only-one ASCONF in flight.  If we do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1967) 	 * not have an ASCONF in flight, this is NULL.]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1968) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1969) 	struct sctp_chunk *addip_last_asconf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1970) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1971) 	/* ADDIP Section 5.2 Upon reception of an ASCONF Chunk.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1972) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1973) 	 * This is needed to implement itmes E1 - E4 of the updated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1974) 	 * spec.  Here is the justification:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1975) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1976) 	 * Since the peer may bundle multiple ASCONF chunks toward us,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1977) 	 * we now need the ability to cache multiple ACKs.  The section
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1978) 	 * describes in detail how they are cached and cleaned up.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1979) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1980) 	struct list_head asconf_ack_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1981) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1982) 	/* These ASCONF chunks are waiting to be sent.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1983) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1984) 	 * These chunaks can't be pushed to outqueue until receiving
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1985) 	 * ASCONF_ACK for the previous ASCONF indicated by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1986) 	 * addip_last_asconf, so as to guarantee that only one ASCONF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1987) 	 * is in flight at any time.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1988) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1989) 	 * ADDIP Section 4.1.1 Congestion Control of ASCONF Chunks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1990) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1991) 	 * In defining the ASCONF Chunk transfer procedures, it is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1992) 	 * essential that these transfers MUST NOT cause congestion
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1993) 	 * within the network.	To achieve this, we place these
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1994) 	 * restrictions on the transfer of ASCONF Chunks:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1995) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1996) 	 * R1) One and only one ASCONF Chunk MAY be in transit and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1997) 	 * unacknowledged at any one time.  If a sender, after sending
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1998) 	 * an ASCONF chunk, decides it needs to transfer another
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1999) 	 * ASCONF Chunk, it MUST wait until the ASCONF-ACK Chunk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2000) 	 * returns from the previous ASCONF Chunk before sending a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2001) 	 * subsequent ASCONF. Note this restriction binds each side,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2002) 	 * so at any time two ASCONF may be in-transit on any given
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2003) 	 * association (one sent from each endpoint).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2004) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2005) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2006) 	 * [I really think this is EXACTLY the sort of intelligence
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2007) 	 *  which already resides in sctp_outq.	 Please move this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2008) 	 *  queue and its supporting logic down there.	--piggy]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2009) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2010) 	struct list_head addip_chunk_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2011) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2012) 	/* ADDIP Section 4.1 ASCONF Chunk Procedures
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2013) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2014) 	 * A2) A serial number should be assigned to the Chunk. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2015) 	 * serial number SHOULD be a monotonically increasing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2016) 	 * number. The serial number SHOULD be initialized at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2017) 	 * the start of the association to the same value as the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2018) 	 * Initial TSN and every time a new ASCONF chunk is created
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2019) 	 * it is incremented by one after assigning the serial number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2020) 	 * to the newly created chunk.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2021) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2022) 	 * ADDIP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2023) 	 * 3.1.1  Address/Stream Configuration Change Chunk (ASCONF)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2024) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2025) 	 * Serial Number : 32 bits (unsigned integer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2026) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2027) 	 * This value represents a Serial Number for the ASCONF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2028) 	 * Chunk. The valid range of Serial Number is from 0 to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2029) 	 * 4294967295 (2^32 - 1).  Serial Numbers wrap back to 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2030) 	 * after reaching 4294967295.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2031) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2032) 	__u32 addip_serial;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2033) 	int src_out_of_asoc_ok;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2034) 	union sctp_addr *asconf_addr_del_pending;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2035) 	struct sctp_transport *new_transport;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2036) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2037) 	/* SCTP AUTH: list of the endpoint shared keys.  These
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2038) 	 * keys are provided out of band by the user applicaton
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2039) 	 * and can't change during the lifetime of the association
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2040) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2041) 	struct list_head endpoint_shared_keys;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2042) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2043) 	/* SCTP AUTH:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2044) 	 * The current generated assocaition shared key (secret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2045) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2046) 	struct sctp_auth_bytes *asoc_shared_key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2047) 	struct sctp_shared_key *shkey;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2048) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2049) 	/* SCTP AUTH: hmac id of the first peer requested algorithm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2050) 	 * that we support.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2051) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2052) 	__u16 default_hmac_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2053) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2054) 	__u16 active_key_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2055) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2056) 	__u8 need_ecne:1,	/* Need to send an ECNE Chunk? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2057) 	     temp:1,		/* Is it a temporary association? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2058) 	     pf_expose:2,       /* Expose pf state? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2059) 	     force_delay:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2060) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2061) 	__u8 strreset_enable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2062) 	__u8 strreset_outstanding; /* request param count on the fly */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2063) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2064) 	__u32 strreset_outseq; /* Update after receiving response */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2065) 	__u32 strreset_inseq; /* Update after receiving request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2066) 	__u32 strreset_result[2]; /* save the results of last 2 responses */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2067) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2068) 	struct sctp_chunk *strreset_chunk; /* save request chunk */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2069) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2070) 	struct sctp_priv_assoc_stats stats;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2071) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2072) 	int sent_cnt_removable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2073) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2074) 	__u16 subscribe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2075) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2076) 	__u64 abandoned_unsent[SCTP_PR_INDEX(MAX) + 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2077) 	__u64 abandoned_sent[SCTP_PR_INDEX(MAX) + 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2078) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2079) 	struct rcu_head rcu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2080) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2081) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2082) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2083) /* An eyecatcher for determining if we are really looking at an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2084)  * association data structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2085)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2086) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2087) 	SCTP_ASSOC_EYECATCHER = 0xa550c123,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2088) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2089) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2090) /* Recover the outter association structure. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2091) static inline struct sctp_association *sctp_assoc(struct sctp_ep_common *base)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2092) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2093) 	struct sctp_association *asoc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2094) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2095) 	asoc = container_of(base, struct sctp_association, base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2096) 	return asoc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2097) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2098) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2099) /* These are function signatures for manipulating associations.	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2102) struct sctp_association *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2103) sctp_association_new(const struct sctp_endpoint *ep, const struct sock *sk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2104) 		     enum sctp_scope scope, gfp_t gfp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2105) void sctp_association_free(struct sctp_association *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2106) void sctp_association_put(struct sctp_association *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2107) void sctp_association_hold(struct sctp_association *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2109) struct sctp_transport *sctp_assoc_choose_alter_transport(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2110) 	struct sctp_association *, struct sctp_transport *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2111) void sctp_assoc_update_retran_path(struct sctp_association *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2112) struct sctp_transport *sctp_assoc_lookup_paddr(const struct sctp_association *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2113) 					  const union sctp_addr *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2114) int sctp_assoc_lookup_laddr(struct sctp_association *asoc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2115) 			    const union sctp_addr *laddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2116) struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2117) 				     const union sctp_addr *address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2118) 				     const gfp_t gfp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2119) 				     const int peer_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2120) void sctp_assoc_del_peer(struct sctp_association *asoc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2121) 			 const union sctp_addr *addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2122) void sctp_assoc_rm_peer(struct sctp_association *asoc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2123) 			 struct sctp_transport *peer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2124) void sctp_assoc_control_transport(struct sctp_association *asoc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2125) 				  struct sctp_transport *transport,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2126) 				  enum sctp_transport_cmd command,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2127) 				  sctp_sn_error_t error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2128) struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *, __u32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2129) void sctp_assoc_migrate(struct sctp_association *, struct sock *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2130) int sctp_assoc_update(struct sctp_association *old,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2131) 		      struct sctp_association *new);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2133) __u32 sctp_association_get_next_tsn(struct sctp_association *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2135) void sctp_assoc_update_frag_point(struct sctp_association *asoc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2136) void sctp_assoc_set_pmtu(struct sctp_association *asoc, __u32 pmtu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2137) void sctp_assoc_sync_pmtu(struct sctp_association *asoc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2138) void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2139) void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2140) void sctp_assoc_set_primary(struct sctp_association *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2141) 			    struct sctp_transport *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2142) void sctp_assoc_del_nonprimary_peers(struct sctp_association *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2143) 				    struct sctp_transport *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2144) int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *asoc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2145) 				     enum sctp_scope scope, gfp_t gfp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2146) int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2147) 					 struct sctp_cookie*,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2148) 					 gfp_t gfp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2149) int sctp_assoc_set_id(struct sctp_association *, gfp_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2150) void sctp_assoc_clean_asconf_ack_cache(const struct sctp_association *asoc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2151) struct sctp_chunk *sctp_assoc_lookup_asconf_ack(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2152) 					const struct sctp_association *asoc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2153) 					__be32 serial);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2154) void sctp_asconf_queue_teardown(struct sctp_association *asoc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2156) int sctp_cmp_addr_exact(const union sctp_addr *ss1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2157) 			const union sctp_addr *ss2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2158) struct sctp_chunk *sctp_get_ecne_prepend(struct sctp_association *asoc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2160) /* A convenience structure to parse out SCTP specific CMSGs. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2161) struct sctp_cmsgs {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2162) 	struct sctp_initmsg *init;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2163) 	struct sctp_sndrcvinfo *srinfo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2164) 	struct sctp_sndinfo *sinfo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2165) 	struct sctp_prinfo *prinfo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2166) 	struct sctp_authinfo *authinfo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2167) 	struct msghdr *addrs_msg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2168) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2170) /* Structure for tracking memory objects */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2171) struct sctp_dbg_objcnt_entry {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2172) 	char *label;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2173) 	atomic_t *counter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2174) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2176) #endif /* __sctp_structs_h__ */