0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 #ifndef __sctp_structs_h__
0033 #define __sctp_structs_h__
0034
0035 #include <linux/ktime.h>
0036 #include <linux/generic-radix-tree.h>
0037 #include <linux/rhashtable-types.h>
0038 #include <linux/socket.h> /* linux/in.h needs this!! */
0039 #include <linux/in.h> /* We get struct sockaddr_in. */
0040 #include <linux/in6.h> /* We get struct in6_addr */
0041 #include <linux/ipv6.h>
0042 #include <asm/param.h> /* We get MAXHOSTNAMELEN. */
0043 #include <linux/atomic.h> /* This gets us atomic counters. */
0044 #include <linux/skbuff.h> /* We need sk_buff_head. */
0045 #include <linux/workqueue.h> /* We need tq_struct. */
0046 #include <linux/sctp.h> /* We need sctp* header structs. */
0047 #include <net/sctp/auth.h> /* We need auth specific structs */
0048 #include <net/ip.h> /* For inet_skb_parm */
0049
0050
0051
0052
0053 union sctp_addr {
0054 struct sockaddr_in v4;
0055 struct sockaddr_in6 v6;
0056 struct sockaddr sa;
0057 };
0058
0059
0060 struct sctp_globals;
0061 struct sctp_endpoint;
0062 struct sctp_association;
0063 struct sctp_transport;
0064 struct sctp_packet;
0065 struct sctp_chunk;
0066 struct sctp_inq;
0067 struct sctp_outq;
0068 struct sctp_bind_addr;
0069 struct sctp_ulpq;
0070 struct sctp_ep_common;
0071 struct crypto_shash;
0072 struct sctp_stream;
0073
0074
0075 #include <net/sctp/tsnmap.h>
0076 #include <net/sctp/ulpevent.h>
0077 #include <net/sctp/ulpqueue.h>
0078 #include <net/sctp/stream_interleave.h>
0079
0080
0081
0082 struct sctp_bind_bucket {
0083 unsigned short port;
0084 signed char fastreuse;
0085 signed char fastreuseport;
0086 kuid_t fastuid;
0087 struct hlist_node node;
0088 struct hlist_head owner;
0089 struct net *net;
0090 };
0091
0092 struct sctp_bind_hashbucket {
0093 spinlock_t lock;
0094 struct hlist_head chain;
0095 };
0096
0097
0098 struct sctp_hashbucket {
0099 rwlock_t lock;
0100 struct hlist_head chain;
0101 } __attribute__((__aligned__(8)));
0102
0103
0104
0105 extern struct sctp_globals {
0106
0107
0108
0109 struct list_head address_families;
0110
0111
0112 struct sctp_hashbucket *ep_hashtable;
0113
0114 struct sctp_bind_hashbucket *port_hashtable;
0115
0116 struct rhltable transport_hashtable;
0117
0118
0119 int ep_hashsize;
0120 int port_hashsize;
0121
0122
0123 __u16 max_instreams;
0124 __u16 max_outstreams;
0125
0126
0127
0128 bool checksum_disable;
0129 } sctp_globals;
0130
0131 #define sctp_max_instreams (sctp_globals.max_instreams)
0132 #define sctp_max_outstreams (sctp_globals.max_outstreams)
0133 #define sctp_address_families (sctp_globals.address_families)
0134 #define sctp_ep_hashsize (sctp_globals.ep_hashsize)
0135 #define sctp_ep_hashtable (sctp_globals.ep_hashtable)
0136 #define sctp_port_hashsize (sctp_globals.port_hashsize)
0137 #define sctp_port_hashtable (sctp_globals.port_hashtable)
0138 #define sctp_transport_hashtable (sctp_globals.transport_hashtable)
0139 #define sctp_checksum_disable (sctp_globals.checksum_disable)
0140
0141
0142 enum sctp_socket_type {
0143 SCTP_SOCKET_UDP = 0,
0144 SCTP_SOCKET_UDP_HIGH_BANDWIDTH,
0145 SCTP_SOCKET_TCP
0146 };
0147
0148
0149 struct sctp_sock {
0150
0151 struct inet_sock inet;
0152
0153 enum sctp_socket_type type;
0154
0155
0156 struct sctp_pf *pf;
0157
0158
0159 struct crypto_shash *hmac;
0160 char *sctp_hmac_alg;
0161
0162
0163 struct sctp_endpoint *ep;
0164
0165 struct sctp_bind_bucket *bind_hash;
0166
0167 __u16 default_stream;
0168 __u32 default_ppid;
0169 __u16 default_flags;
0170 __u32 default_context;
0171 __u32 default_timetolive;
0172 __u32 default_rcv_context;
0173 int max_burst;
0174
0175
0176
0177
0178
0179 __u32 hbinterval;
0180 __u32 probe_interval;
0181
0182 __be16 udp_port;
0183 __be16 encap_port;
0184
0185
0186 __u16 pathmaxrxt;
0187
0188 __u32 flowlabel;
0189 __u8 dscp;
0190
0191 __u16 pf_retrans;
0192 __u16 ps_retrans;
0193
0194
0195 __u32 pathmtu;
0196
0197
0198 __u32 sackdelay;
0199 __u32 sackfreq;
0200
0201
0202 __u32 param_flags;
0203
0204 __u32 default_ss;
0205
0206 struct sctp_rtoinfo rtoinfo;
0207 struct sctp_paddrparams paddrparam;
0208 struct sctp_assocparams assocparams;
0209
0210
0211
0212
0213
0214 __u16 subscribe;
0215 struct sctp_initmsg initmsg;
0216
0217 int user_frag;
0218
0219 __u32 autoclose;
0220 __u32 adaptation_ind;
0221 __u32 pd_point;
0222 __u16 nodelay:1,
0223 pf_expose:2,
0224 reuse:1,
0225 disable_fragments:1,
0226 v4mapped:1,
0227 frag_interleave:1,
0228 recvrcvinfo:1,
0229 recvnxtinfo:1,
0230 data_ready_signalled:1;
0231
0232 atomic_t pd_mode;
0233
0234
0235
0236
0237
0238
0239 struct sk_buff_head pd_lobby;
0240
0241 struct list_head auto_asconf_list;
0242 int do_auto_asconf;
0243 };
0244
0245 static inline struct sctp_sock *sctp_sk(const struct sock *sk)
0246 {
0247 return (struct sctp_sock *)sk;
0248 }
0249
0250 static inline struct sock *sctp_opt2sk(const struct sctp_sock *sp)
0251 {
0252 return (struct sock *)sp;
0253 }
0254
0255 #if IS_ENABLED(CONFIG_IPV6)
0256 struct sctp6_sock {
0257 struct sctp_sock sctp;
0258 struct ipv6_pinfo inet6;
0259 };
0260 #endif
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272 struct sctp_cookie {
0273
0274
0275
0276
0277
0278 __u32 my_vtag;
0279
0280
0281
0282
0283
0284 __u32 peer_vtag;
0285
0286
0287
0288
0289
0290
0291 __u32 my_ttag;
0292
0293
0294 __u32 peer_ttag;
0295
0296
0297 ktime_t expiration;
0298
0299
0300
0301
0302 __u16 sinit_num_ostreams;
0303 __u16 sinit_max_instreams;
0304
0305
0306 __u32 initial_tsn;
0307
0308
0309 union sctp_addr peer_addr;
0310
0311
0312
0313
0314 __u16 my_port;
0315
0316 __u8 prsctp_capable;
0317
0318
0319 __u8 padding;
0320
0321 __u32 adaptation_ind;
0322
0323 __u8 auth_random[sizeof(struct sctp_paramhdr) +
0324 SCTP_AUTH_RANDOM_LENGTH];
0325 __u8 auth_hmacs[SCTP_AUTH_NUM_HMACS * sizeof(__u16) + 2];
0326 __u8 auth_chunks[sizeof(struct sctp_paramhdr) + SCTP_AUTH_MAX_CHUNKS];
0327
0328
0329
0330
0331
0332
0333
0334 __u32 raw_addr_list_len;
0335 struct sctp_init_chunk peer_init[];
0336 };
0337
0338
0339
0340 struct sctp_signed_cookie {
0341 __u8 signature[SCTP_SECRET_SIZE];
0342 __u32 __pad;
0343 struct sctp_cookie c;
0344 } __packed;
0345
0346
0347
0348
0349
0350 union sctp_addr_param {
0351 struct sctp_paramhdr p;
0352 struct sctp_ipv4addr_param v4;
0353 struct sctp_ipv6addr_param v6;
0354 };
0355
0356
0357
0358
0359 union sctp_params {
0360 void *v;
0361 struct sctp_paramhdr *p;
0362 struct sctp_cookie_preserve_param *life;
0363 struct sctp_hostname_param *dns;
0364 struct sctp_cookie_param *cookie;
0365 struct sctp_supported_addrs_param *sat;
0366 struct sctp_ipv4addr_param *v4;
0367 struct sctp_ipv6addr_param *v6;
0368 union sctp_addr_param *addr;
0369 struct sctp_adaptation_ind_param *aind;
0370 struct sctp_supported_ext_param *ext;
0371 struct sctp_random_param *random;
0372 struct sctp_chunks_param *chunks;
0373 struct sctp_hmac_algo_param *hmac_algo;
0374 struct sctp_addip_param *addip;
0375 };
0376
0377
0378
0379
0380
0381
0382
0383
0384 struct sctp_sender_hb_info {
0385 struct sctp_paramhdr param_hdr;
0386 union sctp_addr daddr;
0387 unsigned long sent_at;
0388 __u64 hb_nonce;
0389 __u32 probe_size;
0390 };
0391
0392 int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt,
0393 gfp_t gfp);
0394 int sctp_stream_init_ext(struct sctp_stream *stream, __u16 sid);
0395 void sctp_stream_free(struct sctp_stream *stream);
0396 void sctp_stream_clear(struct sctp_stream *stream);
0397 void sctp_stream_update(struct sctp_stream *stream, struct sctp_stream *new);
0398
0399
0400 #define sctp_ssn_peek(stream, type, sid) \
0401 (sctp_stream_##type((stream), (sid))->ssn)
0402
0403
0404 #define sctp_ssn_next(stream, type, sid) \
0405 (sctp_stream_##type((stream), (sid))->ssn++)
0406
0407
0408 #define sctp_ssn_skip(stream, type, sid, ssn) \
0409 (sctp_stream_##type((stream), (sid))->ssn = ssn + 1)
0410
0411
0412 #define sctp_mid_peek(stream, type, sid) \
0413 (sctp_stream_##type((stream), (sid))->mid)
0414
0415
0416 #define sctp_mid_next(stream, type, sid) \
0417 (sctp_stream_##type((stream), (sid))->mid++)
0418
0419
0420 #define sctp_mid_skip(stream, type, sid, mid) \
0421 (sctp_stream_##type((stream), (sid))->mid = mid + 1)
0422
0423
0424 #define sctp_mid_uo_peek(stream, type, sid) \
0425 (sctp_stream_##type((stream), (sid))->mid_uo)
0426
0427
0428 #define sctp_mid_uo_next(stream, type, sid) \
0429 (sctp_stream_##type((stream), (sid))->mid_uo++)
0430
0431
0432
0433
0434
0435 struct sctp_af {
0436 int (*sctp_xmit) (struct sk_buff *skb,
0437 struct sctp_transport *);
0438 int (*setsockopt) (struct sock *sk,
0439 int level,
0440 int optname,
0441 sockptr_t optval,
0442 unsigned int optlen);
0443 int (*getsockopt) (struct sock *sk,
0444 int level,
0445 int optname,
0446 char __user *optval,
0447 int __user *optlen);
0448 void (*get_dst) (struct sctp_transport *t,
0449 union sctp_addr *saddr,
0450 struct flowi *fl,
0451 struct sock *sk);
0452 void (*get_saddr) (struct sctp_sock *sk,
0453 struct sctp_transport *t,
0454 struct flowi *fl);
0455 void (*copy_addrlist) (struct list_head *,
0456 struct net_device *);
0457 int (*cmp_addr) (const union sctp_addr *addr1,
0458 const union sctp_addr *addr2);
0459 void (*addr_copy) (union sctp_addr *dst,
0460 union sctp_addr *src);
0461 void (*from_skb) (union sctp_addr *,
0462 struct sk_buff *skb,
0463 int saddr);
0464 void (*from_sk) (union sctp_addr *,
0465 struct sock *sk);
0466 bool (*from_addr_param) (union sctp_addr *,
0467 union sctp_addr_param *,
0468 __be16 port, int iif);
0469 int (*to_addr_param) (const union sctp_addr *,
0470 union sctp_addr_param *);
0471 int (*addr_valid) (union sctp_addr *,
0472 struct sctp_sock *,
0473 const struct sk_buff *);
0474 enum sctp_scope (*scope)(union sctp_addr *);
0475 void (*inaddr_any) (union sctp_addr *, __be16);
0476 int (*is_any) (const union sctp_addr *);
0477 int (*available) (union sctp_addr *,
0478 struct sctp_sock *);
0479 int (*skb_iif) (const struct sk_buff *sk);
0480 int (*is_ce) (const struct sk_buff *sk);
0481 void (*seq_dump_addr)(struct seq_file *seq,
0482 union sctp_addr *addr);
0483 void (*ecn_capable)(struct sock *sk);
0484 __u16 net_header_len;
0485 int sockaddr_len;
0486 int (*ip_options_len)(struct sock *sk);
0487 sa_family_t sa_family;
0488 struct list_head list;
0489 };
0490
0491 struct sctp_af *sctp_get_af_specific(sa_family_t);
0492 int sctp_register_af(struct sctp_af *);
0493
0494
0495 struct sctp_pf {
0496 void (*event_msgname)(struct sctp_ulpevent *, char *, int *);
0497 void (*skb_msgname) (struct sk_buff *, char *, int *);
0498 int (*af_supported) (sa_family_t, struct sctp_sock *);
0499 int (*cmp_addr) (const union sctp_addr *,
0500 const union sctp_addr *,
0501 struct sctp_sock *);
0502 int (*bind_verify) (struct sctp_sock *, union sctp_addr *);
0503 int (*send_verify) (struct sctp_sock *, union sctp_addr *);
0504 int (*supported_addrs)(const struct sctp_sock *, __be16 *);
0505 struct sock *(*create_accept_sk) (struct sock *sk,
0506 struct sctp_association *asoc,
0507 bool kern);
0508 int (*addr_to_user)(struct sctp_sock *sk, union sctp_addr *addr);
0509 void (*to_sk_saddr)(union sctp_addr *, struct sock *sk);
0510 void (*to_sk_daddr)(union sctp_addr *, struct sock *sk);
0511 void (*copy_ip_options)(struct sock *sk, struct sock *newsk);
0512 struct sctp_af *af;
0513 };
0514
0515
0516
0517
0518
0519 struct sctp_datamsg {
0520
0521 struct list_head chunks;
0522
0523 refcount_t refcnt;
0524
0525 unsigned long expires_at;
0526
0527 int send_error;
0528 u8 send_failed:1,
0529 can_delay:1,
0530 abandoned:1;
0531 };
0532
0533 struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *,
0534 struct sctp_sndrcvinfo *,
0535 struct iov_iter *);
0536 void sctp_datamsg_free(struct sctp_datamsg *);
0537 void sctp_datamsg_put(struct sctp_datamsg *);
0538 void sctp_chunk_fail(struct sctp_chunk *, int error);
0539 int sctp_chunk_abandoned(struct sctp_chunk *);
0540
0541
0542
0543
0544
0545
0546
0547
0548
0549 struct sctp_chunk {
0550 struct list_head list;
0551
0552 refcount_t refcnt;
0553
0554
0555 int sent_count;
0556
0557 union {
0558
0559 struct list_head transmitted_list;
0560
0561 struct list_head stream_list;
0562 };
0563
0564
0565
0566
0567
0568
0569 struct list_head frag_list;
0570
0571
0572 struct sk_buff *skb;
0573
0574 union {
0575
0576 struct sk_buff *head_skb;
0577
0578 struct sctp_shared_key *shkey;
0579 };
0580
0581
0582
0583
0584
0585
0586
0587
0588 union sctp_params param_hdr;
0589 union {
0590 __u8 *v;
0591 struct sctp_datahdr *data_hdr;
0592 struct sctp_inithdr *init_hdr;
0593 struct sctp_sackhdr *sack_hdr;
0594 struct sctp_heartbeathdr *hb_hdr;
0595 struct sctp_sender_hb_info *hbs_hdr;
0596 struct sctp_shutdownhdr *shutdown_hdr;
0597 struct sctp_signed_cookie *cookie_hdr;
0598 struct sctp_ecnehdr *ecne_hdr;
0599 struct sctp_cwrhdr *ecn_cwr_hdr;
0600 struct sctp_errhdr *err_hdr;
0601 struct sctp_addiphdr *addip_hdr;
0602 struct sctp_fwdtsn_hdr *fwdtsn_hdr;
0603 struct sctp_authhdr *auth_hdr;
0604 struct sctp_idatahdr *idata_hdr;
0605 struct sctp_ifwdtsn_hdr *ifwdtsn_hdr;
0606 } subh;
0607
0608 __u8 *chunk_end;
0609
0610 struct sctp_chunkhdr *chunk_hdr;
0611 struct sctphdr *sctp_hdr;
0612
0613
0614 struct sctp_sndrcvinfo sinfo;
0615
0616
0617 struct sctp_association *asoc;
0618
0619
0620 struct sctp_ep_common *rcvr;
0621
0622
0623 unsigned long sent_at;
0624
0625
0626 union sctp_addr source;
0627
0628 union sctp_addr dest;
0629
0630
0631 struct sctp_datamsg *msg;
0632
0633
0634
0635
0636
0637 struct sctp_transport *transport;
0638
0639
0640
0641
0642
0643
0644 struct sk_buff *auth_chunk;
0645
0646 #define SCTP_CAN_FRTX 0x0
0647 #define SCTP_NEED_FRTX 0x1
0648 #define SCTP_DONT_FRTX 0x2
0649 __u16 rtt_in_progress:1,
0650 has_tsn:1,
0651 has_ssn:1,
0652 #define has_mid has_ssn
0653 singleton:1,
0654 end_of_packet:1,
0655 ecn_ce_done:1,
0656 pdiscard:1,
0657 tsn_gap_acked:1,
0658 data_accepted:1,
0659 auth:1,
0660 has_asconf:1,
0661 pmtu_probe:1,
0662 tsn_missing_report:2,
0663 fast_retransmit:2;
0664 };
0665
0666 #define sctp_chunk_retransmitted(chunk) (chunk->sent_count > 1)
0667 void sctp_chunk_hold(struct sctp_chunk *);
0668 void sctp_chunk_put(struct sctp_chunk *);
0669 int sctp_user_addto_chunk(struct sctp_chunk *chunk, int len,
0670 struct iov_iter *from);
0671 void sctp_chunk_free(struct sctp_chunk *);
0672 void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data);
0673 struct sctp_chunk *sctp_chunkify(struct sk_buff *,
0674 const struct sctp_association *,
0675 struct sock *, gfp_t gfp);
0676 void sctp_init_addrs(struct sctp_chunk *, union sctp_addr *,
0677 union sctp_addr *);
0678 const union sctp_addr *sctp_source(const struct sctp_chunk *chunk);
0679
0680 static inline __u16 sctp_chunk_stream_no(struct sctp_chunk *ch)
0681 {
0682 return ntohs(ch->subh.data_hdr->stream);
0683 }
0684
0685 enum {
0686 SCTP_ADDR_NEW,
0687 SCTP_ADDR_SRC,
0688 SCTP_ADDR_DEL,
0689 };
0690
0691
0692 struct sctp_sockaddr_entry {
0693 struct list_head list;
0694 struct rcu_head rcu;
0695 union sctp_addr a;
0696 __u8 state;
0697 __u8 valid;
0698 };
0699
0700 #define SCTP_ADDRESS_TICK_DELAY 500
0701
0702
0703
0704
0705 struct sctp_packet {
0706
0707 __u16 source_port;
0708 __u16 destination_port;
0709 __u32 vtag;
0710
0711
0712 struct list_head chunk_list;
0713
0714
0715 size_t overhead;
0716
0717 size_t size;
0718
0719 size_t max_size;
0720
0721
0722
0723
0724
0725 struct sctp_transport *transport;
0726
0727
0728 struct sctp_chunk *auth;
0729
0730 u8 has_cookie_echo:1,
0731 has_sack:1,
0732 has_auth:1,
0733 has_data:1,
0734 ipfragok:1;
0735 };
0736
0737 void sctp_packet_init(struct sctp_packet *, struct sctp_transport *,
0738 __u16 sport, __u16 dport);
0739 void sctp_packet_config(struct sctp_packet *, __u32 vtag, int);
0740 enum sctp_xmit sctp_packet_transmit_chunk(struct sctp_packet *packet,
0741 struct sctp_chunk *chunk,
0742 int one_packet, gfp_t gfp);
0743 enum sctp_xmit sctp_packet_append_chunk(struct sctp_packet *packet,
0744 struct sctp_chunk *chunk);
0745 int sctp_packet_transmit(struct sctp_packet *, gfp_t);
0746 void sctp_packet_free(struct sctp_packet *);
0747
0748 static inline int sctp_packet_empty(struct sctp_packet *packet)
0749 {
0750 return packet->size == packet->overhead;
0751 }
0752
0753
0754
0755
0756
0757
0758
0759
0760
0761
0762
0763
0764
0765
0766
0767
0768
0769
0770
0771
0772
0773 struct sctp_transport {
0774
0775 struct list_head transports;
0776 struct rhlist_head node;
0777
0778
0779 refcount_t refcnt;
0780
0781
0782
0783
0784
0785
0786
0787
0788
0789 __u32 rto_pending:1,
0790
0791
0792
0793
0794
0795 hb_sent:1,
0796
0797
0798 pmtu_pending:1,
0799
0800 dst_pending_confirm:1,
0801
0802
0803 sack_generation:1;
0804 u32 dst_cookie;
0805
0806 struct flowi fl;
0807
0808
0809 union sctp_addr ipaddr;
0810
0811
0812 struct sctp_af *af_specific;
0813
0814
0815 struct sctp_association *asoc;
0816
0817
0818
0819
0820
0821
0822
0823
0824
0825
0826 unsigned long rto;
0827
0828 __u32 rtt;
0829
0830
0831 __u32 rttvar;
0832
0833
0834 __u32 srtt;
0835
0836
0837
0838
0839
0840 __u32 cwnd;
0841
0842
0843 __u32 ssthresh;
0844
0845
0846
0847
0848 __u32 partial_bytes_acked;
0849
0850
0851 __u32 flight_size;
0852
0853 __u32 burst_limited;
0854
0855
0856 struct dst_entry *dst;
0857
0858 union sctp_addr saddr;
0859
0860
0861
0862
0863 unsigned long hbinterval;
0864 unsigned long probe_interval;
0865
0866
0867 unsigned long sackdelay;
0868 __u32 sackfreq;
0869
0870 atomic_t mtu_info;
0871
0872
0873
0874
0875 ktime_t last_time_heard;
0876
0877
0878
0879
0880 unsigned long last_time_sent;
0881
0882
0883
0884
0885 unsigned long last_time_ecne_reduced;
0886
0887 __be16 encap_port;
0888
0889
0890
0891
0892
0893 __u16 pathmaxrxt;
0894
0895 __u32 flowlabel;
0896 __u8 dscp;
0897
0898
0899
0900
0901
0902 __u16 pf_retrans;
0903
0904 __u16 ps_retrans;
0905
0906 __u32 pathmtu;
0907
0908
0909 __u32 param_flags;
0910
0911
0912 int init_sent_count;
0913
0914
0915
0916
0917 int state;
0918
0919
0920
0921
0922 unsigned short error_count;
0923
0924
0925
0926
0927
0928
0929
0930 struct timer_list T3_rtx_timer;
0931
0932
0933 struct timer_list hb_timer;
0934
0935
0936 struct timer_list proto_unreach_timer;
0937
0938
0939 struct timer_list reconf_timer;
0940
0941
0942 struct timer_list probe_timer;
0943
0944
0945
0946
0947
0948
0949 struct list_head transmitted;
0950
0951
0952 struct sctp_packet packet;
0953
0954
0955 struct list_head send_ready;
0956
0957
0958
0959
0960
0961
0962
0963
0964
0965 struct {
0966
0967
0968
0969 __u32 next_tsn_at_change;
0970
0971
0972 char changeover_active;
0973
0974
0975
0976
0977
0978 char cycling_changeover;
0979
0980
0981
0982
0983 char cacc_saw_newack;
0984 } cacc;
0985
0986 struct {
0987 __u16 pmtu;
0988 __u16 probe_size;
0989 __u16 probe_high;
0990 __u8 probe_count;
0991 __u8 state;
0992 } pl;
0993
0994
0995 __u64 hb_nonce;
0996
0997 struct rcu_head rcu;
0998 };
0999
1000 struct sctp_transport *sctp_transport_new(struct net *, const union sctp_addr *,
1001 gfp_t);
1002 void sctp_transport_set_owner(struct sctp_transport *,
1003 struct sctp_association *);
1004 void sctp_transport_route(struct sctp_transport *, union sctp_addr *,
1005 struct sctp_sock *);
1006 void sctp_transport_pmtu(struct sctp_transport *, struct sock *sk);
1007 void sctp_transport_free(struct sctp_transport *);
1008 void sctp_transport_reset_t3_rtx(struct sctp_transport *);
1009 void sctp_transport_reset_hb_timer(struct sctp_transport *);
1010 void sctp_transport_reset_reconf_timer(struct sctp_transport *transport);
1011 void sctp_transport_reset_probe_timer(struct sctp_transport *transport);
1012 void sctp_transport_reset_raise_timer(struct sctp_transport *transport);
1013 int sctp_transport_hold(struct sctp_transport *);
1014 void sctp_transport_put(struct sctp_transport *);
1015 void sctp_transport_update_rto(struct sctp_transport *, __u32);
1016 void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32);
1017 void sctp_transport_lower_cwnd(struct sctp_transport *t,
1018 enum sctp_lower_cwnd reason);
1019 void sctp_transport_burst_limited(struct sctp_transport *);
1020 void sctp_transport_burst_reset(struct sctp_transport *);
1021 unsigned long sctp_transport_timeout(struct sctp_transport *);
1022 void sctp_transport_reset(struct sctp_transport *t);
1023 bool sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu);
1024 void sctp_transport_immediate_rtx(struct sctp_transport *);
1025 void sctp_transport_dst_release(struct sctp_transport *t);
1026 void sctp_transport_dst_confirm(struct sctp_transport *t);
1027 void sctp_transport_pl_send(struct sctp_transport *t);
1028 bool sctp_transport_pl_recv(struct sctp_transport *t);
1029
1030
1031
1032
1033
1034 struct sctp_inq {
1035
1036
1037
1038 struct list_head in_chunk_list;
1039
1040
1041
1042 struct sctp_chunk *in_progress;
1043
1044
1045
1046
1047 struct work_struct immediate;
1048 };
1049
1050 void sctp_inq_init(struct sctp_inq *);
1051 void sctp_inq_free(struct sctp_inq *);
1052 void sctp_inq_push(struct sctp_inq *, struct sctp_chunk *packet);
1053 struct sctp_chunk *sctp_inq_pop(struct sctp_inq *);
1054 struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *);
1055 void sctp_inq_set_th_handler(struct sctp_inq *, work_func_t);
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076 struct sctp_outq {
1077 struct sctp_association *asoc;
1078
1079
1080 struct list_head out_chunk_list;
1081
1082
1083 struct sctp_sched_ops *sched;
1084
1085 unsigned int out_qlen;
1086
1087
1088 unsigned int error;
1089
1090
1091 struct list_head control_chunk_list;
1092
1093
1094
1095
1096 struct list_head sacked;
1097
1098
1099
1100
1101 struct list_head retransmit;
1102
1103
1104
1105
1106 struct list_head abandoned;
1107
1108
1109 __u32 outstanding_bytes;
1110
1111
1112 char fast_rtx;
1113
1114
1115 char cork;
1116 };
1117
1118 void sctp_outq_init(struct sctp_association *, struct sctp_outq *);
1119 void sctp_outq_teardown(struct sctp_outq *);
1120 void sctp_outq_free(struct sctp_outq*);
1121 void sctp_outq_tail(struct sctp_outq *, struct sctp_chunk *chunk, gfp_t);
1122 int sctp_outq_sack(struct sctp_outq *, struct sctp_chunk *);
1123 int sctp_outq_is_empty(const struct sctp_outq *);
1124 void sctp_outq_restart(struct sctp_outq *);
1125
1126 void sctp_retransmit(struct sctp_outq *q, struct sctp_transport *transport,
1127 enum sctp_retransmit_reason reason);
1128 void sctp_retransmit_mark(struct sctp_outq *, struct sctp_transport *, __u8);
1129 void sctp_outq_uncork(struct sctp_outq *, gfp_t gfp);
1130 void sctp_prsctp_prune(struct sctp_association *asoc,
1131 struct sctp_sndrcvinfo *sinfo, int msg_len);
1132 void sctp_generate_fwdtsn(struct sctp_outq *q, __u32 sack_ctsn);
1133
1134 static inline void sctp_outq_cork(struct sctp_outq *q)
1135 {
1136 q->cork = 1;
1137 }
1138
1139
1140
1141
1142 struct sctp_input_cb {
1143 union {
1144 struct inet_skb_parm h4;
1145 #if IS_ENABLED(CONFIG_IPV6)
1146 struct inet6_skb_parm h6;
1147 #endif
1148 } header;
1149 struct sctp_chunk *chunk;
1150 struct sctp_af *af;
1151 __be16 encap_port;
1152 };
1153 #define SCTP_INPUT_CB(__skb) ((struct sctp_input_cb *)&((__skb)->cb[0]))
1154
1155 struct sctp_output_cb {
1156 struct sk_buff *last;
1157 };
1158 #define SCTP_OUTPUT_CB(__skb) ((struct sctp_output_cb *)&((__skb)->cb[0]))
1159
1160 static inline const struct sk_buff *sctp_gso_headskb(const struct sk_buff *skb)
1161 {
1162 const struct sctp_chunk *chunk = SCTP_INPUT_CB(skb)->chunk;
1163
1164 return chunk->head_skb ? : skb;
1165 }
1166
1167
1168 struct sctp_bind_addr {
1169
1170
1171
1172
1173
1174
1175 __u16 port;
1176
1177
1178
1179
1180
1181
1182
1183 struct list_head address_list;
1184 };
1185
1186 void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port);
1187 void sctp_bind_addr_free(struct sctp_bind_addr *);
1188 int sctp_bind_addr_copy(struct net *net, struct sctp_bind_addr *dest,
1189 const struct sctp_bind_addr *src,
1190 enum sctp_scope scope, gfp_t gfp,
1191 int flags);
1192 int sctp_bind_addr_dup(struct sctp_bind_addr *dest,
1193 const struct sctp_bind_addr *src,
1194 gfp_t gfp);
1195 int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *,
1196 int new_size, __u8 addr_state, gfp_t gfp);
1197 int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *);
1198 int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *,
1199 struct sctp_sock *);
1200 int sctp_bind_addr_conflict(struct sctp_bind_addr *, const union sctp_addr *,
1201 struct sctp_sock *, struct sctp_sock *);
1202 int sctp_bind_addr_state(const struct sctp_bind_addr *bp,
1203 const union sctp_addr *addr);
1204 int sctp_bind_addrs_check(struct sctp_sock *sp,
1205 struct sctp_sock *sp2, int cnt2);
1206 union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp,
1207 const union sctp_addr *addrs,
1208 int addrcnt,
1209 struct sctp_sock *opt);
1210 union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp,
1211 int *addrs_len,
1212 gfp_t gfp);
1213 int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw, int len,
1214 __u16 port, gfp_t gfp);
1215
1216 enum sctp_scope sctp_scope(const union sctp_addr *addr);
1217 int sctp_in_scope(struct net *net, const union sctp_addr *addr,
1218 const enum sctp_scope scope);
1219 int sctp_is_any(struct sock *sk, const union sctp_addr *addr);
1220 int sctp_is_ep_boundall(struct sock *sk);
1221
1222
1223
1224 enum sctp_endpoint_type {
1225 SCTP_EP_TYPE_SOCKET,
1226 SCTP_EP_TYPE_ASSOCIATION,
1227 };
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245 struct sctp_ep_common {
1246
1247 enum sctp_endpoint_type type;
1248
1249
1250
1251
1252
1253 refcount_t refcnt;
1254 bool dead;
1255
1256
1257 struct sock *sk;
1258
1259
1260 struct net *net;
1261
1262
1263 struct sctp_inq inqueue;
1264
1265
1266
1267
1268
1269
1270 struct sctp_bind_addr bind_addr;
1271 };
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293 struct sctp_endpoint {
1294
1295 struct sctp_ep_common base;
1296
1297
1298 struct hlist_node node;
1299 int hashent;
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311 struct list_head asocs;
1312
1313
1314
1315
1316
1317
1318
1319 __u8 secret_key[SCTP_SECRET_SIZE];
1320
1321
1322
1323
1324
1325
1326
1327 __u8 *digest;
1328
1329
1330 __u32 sndbuf_policy;
1331
1332
1333 __u32 rcvbuf_policy;
1334
1335
1336
1337
1338 struct crypto_shash **auth_hmacs;
1339
1340
1341 struct sctp_hmac_algo_param *auth_hmacs_list;
1342
1343
1344 struct sctp_chunks_param *auth_chunk_list;
1345
1346
1347 struct list_head endpoint_shared_keys;
1348 __u16 active_key_id;
1349 __u8 ecn_enable:1,
1350 auth_enable:1,
1351 intl_enable:1,
1352 prsctp_enable:1,
1353 asconf_enable:1,
1354 reconf_enable:1;
1355
1356 __u8 strreset_enable;
1357 struct rcu_head rcu;
1358 };
1359
1360
1361 static inline struct sctp_endpoint *sctp_ep(struct sctp_ep_common *base)
1362 {
1363 struct sctp_endpoint *ep;
1364
1365 ep = container_of(base, struct sctp_endpoint, base);
1366 return ep;
1367 }
1368
1369
1370 struct sctp_endpoint *sctp_endpoint_new(struct sock *, gfp_t);
1371 void sctp_endpoint_free(struct sctp_endpoint *);
1372 void sctp_endpoint_put(struct sctp_endpoint *);
1373 int sctp_endpoint_hold(struct sctp_endpoint *ep);
1374 void sctp_endpoint_add_asoc(struct sctp_endpoint *, struct sctp_association *);
1375 struct sctp_association *sctp_endpoint_lookup_assoc(
1376 const struct sctp_endpoint *ep,
1377 const union sctp_addr *paddr,
1378 struct sctp_transport **);
1379 bool sctp_endpoint_is_peeled_off(struct sctp_endpoint *ep,
1380 const union sctp_addr *paddr);
1381 struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *,
1382 struct net *, const union sctp_addr *);
1383 bool sctp_has_association(struct net *net, const union sctp_addr *laddr,
1384 const union sctp_addr *paddr);
1385
1386 int sctp_verify_init(struct net *net, const struct sctp_endpoint *ep,
1387 const struct sctp_association *asoc,
1388 enum sctp_cid cid, struct sctp_init_chunk *peer_init,
1389 struct sctp_chunk *chunk, struct sctp_chunk **err_chunk);
1390 int sctp_process_init(struct sctp_association *, struct sctp_chunk *chunk,
1391 const union sctp_addr *peer,
1392 struct sctp_init_chunk *init, gfp_t gfp);
1393 __u32 sctp_generate_tag(const struct sctp_endpoint *);
1394 __u32 sctp_generate_tsn(const struct sctp_endpoint *);
1395
1396 struct sctp_inithdr_host {
1397 __u32 init_tag;
1398 __u32 a_rwnd;
1399 __u16 num_outbound_streams;
1400 __u16 num_inbound_streams;
1401 __u32 initial_tsn;
1402 };
1403
1404 struct sctp_stream_priorities {
1405
1406 struct list_head prio_sched;
1407
1408 struct list_head active;
1409
1410 struct sctp_stream_out_ext *next;
1411 __u16 prio;
1412 };
1413
1414 struct sctp_stream_out_ext {
1415 __u64 abandoned_unsent[SCTP_PR_INDEX(MAX) + 1];
1416 __u64 abandoned_sent[SCTP_PR_INDEX(MAX) + 1];
1417 struct list_head outq;
1418 union {
1419 struct {
1420
1421 struct list_head prio_list;
1422 struct sctp_stream_priorities *prio_head;
1423 };
1424
1425 struct {
1426 struct list_head rr_list;
1427 };
1428 };
1429 };
1430
1431 struct sctp_stream_out {
1432 union {
1433 __u32 mid;
1434 __u16 ssn;
1435 };
1436 __u32 mid_uo;
1437 struct sctp_stream_out_ext *ext;
1438 __u8 state;
1439 };
1440
1441 struct sctp_stream_in {
1442 union {
1443 __u32 mid;
1444 __u16 ssn;
1445 };
1446 __u32 mid_uo;
1447 __u32 fsn;
1448 __u32 fsn_uo;
1449 char pd_mode;
1450 char pd_mode_uo;
1451 };
1452
1453 struct sctp_stream {
1454 GENRADIX(struct sctp_stream_out) out;
1455 GENRADIX(struct sctp_stream_in) in;
1456
1457 __u16 outcnt;
1458 __u16 incnt;
1459
1460 struct sctp_stream_out *out_curr;
1461 union {
1462
1463 struct {
1464
1465 struct list_head prio_list;
1466 };
1467
1468 struct {
1469
1470 struct list_head rr_list;
1471
1472 struct sctp_stream_out_ext *rr_next;
1473 };
1474 };
1475 struct sctp_stream_interleave *si;
1476 };
1477
1478 static inline struct sctp_stream_out *sctp_stream_out(
1479 struct sctp_stream *stream,
1480 __u16 sid)
1481 {
1482 return genradix_ptr(&stream->out, sid);
1483 }
1484
1485 static inline struct sctp_stream_in *sctp_stream_in(
1486 struct sctp_stream *stream,
1487 __u16 sid)
1488 {
1489 return genradix_ptr(&stream->in, sid);
1490 }
1491
1492 #define SCTP_SO(s, i) sctp_stream_out((s), (i))
1493 #define SCTP_SI(s, i) sctp_stream_in((s), (i))
1494
1495 #define SCTP_STREAM_CLOSED 0x00
1496 #define SCTP_STREAM_OPEN 0x01
1497
1498 static inline __u16 sctp_datachk_len(const struct sctp_stream *stream)
1499 {
1500 return stream->si->data_chunk_len;
1501 }
1502
1503 static inline __u16 sctp_datahdr_len(const struct sctp_stream *stream)
1504 {
1505 return stream->si->data_chunk_len - sizeof(struct sctp_chunkhdr);
1506 }
1507
1508 static inline __u16 sctp_ftsnchk_len(const struct sctp_stream *stream)
1509 {
1510 return stream->si->ftsn_chunk_len;
1511 }
1512
1513 static inline __u16 sctp_ftsnhdr_len(const struct sctp_stream *stream)
1514 {
1515 return stream->si->ftsn_chunk_len - sizeof(struct sctp_chunkhdr);
1516 }
1517
1518
1519 struct sctp_priv_assoc_stats {
1520
1521
1522
1523
1524
1525 struct sockaddr_storage obs_rto_ipaddr;
1526 __u64 max_obs_rto;
1527
1528 __u64 isacks;
1529 __u64 osacks;
1530
1531 __u64 opackets;
1532 __u64 ipackets;
1533
1534 __u64 rtxchunks;
1535
1536 __u64 outofseqtsns;
1537
1538 __u64 idupchunks;
1539
1540 __u64 gapcnt;
1541
1542 __u64 ouodchunks;
1543 __u64 iuodchunks;
1544
1545 __u64 oodchunks;
1546 __u64 iodchunks;
1547
1548 __u64 octrlchunks;
1549 __u64 ictrlchunks;
1550 };
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566 struct sctp_association {
1567
1568
1569
1570
1571
1572 struct sctp_ep_common base;
1573
1574
1575 struct list_head asocs;
1576
1577
1578 sctp_assoc_t assoc_id;
1579
1580
1581 struct sctp_endpoint *ep;
1582
1583
1584 struct sctp_cookie c;
1585
1586
1587 struct {
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603 struct list_head transport_addr_list;
1604
1605
1606
1607
1608
1609 __u32 rwnd;
1610
1611
1612
1613
1614
1615
1616
1617
1618 __u16 transport_count;
1619
1620
1621
1622
1623 __u16 port;
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640 struct sctp_transport *primary_path;
1641
1642
1643
1644
1645 union sctp_addr primary_addr;
1646
1647
1648
1649
1650
1651 struct sctp_transport *active_path;
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663 struct sctp_transport *retran_path;
1664
1665
1666 struct sctp_transport *last_sent_to;
1667
1668
1669 struct sctp_transport *last_data_from;
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691 struct sctp_tsnmap tsn_map;
1692
1693
1694
1695
1696 __be16 addip_disabled_mask;
1697
1698
1699 __u16 ecn_capable:1,
1700 ipv4_address:1,
1701 ipv6_address:1,
1702 hostname_address:1,
1703 asconf_capable:1,
1704 prsctp_capable:1,
1705 reconf_capable:1,
1706 intl_capable:1,
1707 auth_capable:1,
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719 sack_needed:1,
1720 sack_generation:1,
1721 zero_window_announced:1;
1722
1723 __u32 sack_cnt;
1724
1725 __u32 adaptation_ind;
1726
1727 struct sctp_inithdr_host i;
1728 void *cookie;
1729 int cookie_len;
1730
1731
1732
1733
1734
1735 __u32 addip_serial;
1736
1737
1738
1739
1740
1741 struct sctp_random_param *peer_random;
1742 struct sctp_chunks_param *peer_chunks;
1743 struct sctp_hmac_algo_param *peer_hmacs;
1744 } peer;
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759 enum sctp_state state;
1760
1761
1762
1763
1764 int overall_error_count;
1765
1766
1767 ktime_t cookie_life;
1768
1769
1770
1771
1772
1773 unsigned long rto_initial;
1774 unsigned long rto_max;
1775 unsigned long rto_min;
1776
1777
1778 int max_burst;
1779
1780
1781
1782
1783
1784 int max_retrans;
1785
1786
1787
1788
1789
1790 __u16 pf_retrans;
1791
1792 __u16 ps_retrans;
1793
1794
1795 __u16 max_init_attempts;
1796
1797
1798 __u16 init_retries;
1799
1800
1801 unsigned long max_init_timeo;
1802
1803
1804
1805
1806
1807 unsigned long hbinterval;
1808 unsigned long probe_interval;
1809
1810 __be16 encap_port;
1811
1812
1813
1814
1815 __u16 pathmaxrxt;
1816
1817 __u32 flowlabel;
1818 __u8 dscp;
1819
1820
1821 __u8 pmtu_pending;
1822
1823
1824
1825
1826 __u32 pathmtu;
1827
1828
1829 __u32 param_flags;
1830
1831 __u32 sackfreq;
1832
1833 unsigned long sackdelay;
1834
1835 unsigned long timeouts[SCTP_NUM_TIMEOUT_TYPES];
1836 struct timer_list timers[SCTP_NUM_TIMEOUT_TYPES];
1837
1838
1839 struct sctp_transport *shutdown_last_sent_to;
1840
1841
1842 struct sctp_transport *init_last_sent_to;
1843
1844
1845 int shutdown_retries;
1846
1847
1848
1849
1850
1851
1852
1853
1854 __u32 next_tsn;
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865 __u32 ctsn_ack_point;
1866
1867
1868 __u32 adv_peer_ack_point;
1869
1870
1871 __u32 highest_sacked;
1872
1873
1874 __u32 fast_recovery_exit;
1875
1876
1877 __u8 fast_recovery;
1878
1879
1880
1881
1882 __u16 unack_data;
1883
1884
1885
1886
1887 __u32 rtx_data_chunks;
1888
1889
1890
1891
1892 __u32 rwnd;
1893
1894
1895 __u32 a_rwnd;
1896
1897
1898
1899
1900 __u32 rwnd_over;
1901
1902
1903
1904
1905
1906 __u32 rwnd_press;
1907
1908
1909
1910
1911
1912 int sndbuf_used;
1913
1914
1915
1916
1917 atomic_t rmem_alloc;
1918
1919
1920
1921
1922 wait_queue_head_t wait;
1923
1924
1925 __u32 frag_point;
1926 __u32 user_frag;
1927
1928
1929 int init_err_counter;
1930
1931
1932 int init_cycle;
1933
1934
1935 __u16 default_stream;
1936 __u16 default_flags;
1937 __u32 default_ppid;
1938 __u32 default_context;
1939 __u32 default_timetolive;
1940
1941
1942 __u32 default_rcv_context;
1943
1944
1945 struct sctp_stream stream;
1946
1947
1948 struct sctp_outq outqueue;
1949
1950
1951
1952
1953 struct sctp_ulpq ulpq;
1954
1955
1956 __u32 last_ecne_tsn;
1957
1958
1959 __u32 last_cwr_tsn;
1960
1961
1962 int numduptsns;
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987 struct sctp_chunk *addip_last_asconf;
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998 struct list_head asconf_ack_list;
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028 struct list_head addip_chunk_list;
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050 __u32 addip_serial;
2051 int src_out_of_asoc_ok;
2052 union sctp_addr *asconf_addr_del_pending;
2053 struct sctp_transport *new_transport;
2054
2055
2056
2057
2058
2059 struct list_head endpoint_shared_keys;
2060
2061
2062
2063
2064 struct sctp_auth_bytes *asoc_shared_key;
2065 struct sctp_shared_key *shkey;
2066
2067
2068
2069
2070 __u16 default_hmac_id;
2071
2072 __u16 active_key_id;
2073
2074 __u8 need_ecne:1,
2075 temp:1,
2076 pf_expose:2,
2077 force_delay:1;
2078
2079 __u8 strreset_enable;
2080 __u8 strreset_outstanding;
2081
2082 __u32 strreset_outseq;
2083 __u32 strreset_inseq;
2084 __u32 strreset_result[2];
2085
2086 struct sctp_chunk *strreset_chunk;
2087
2088 struct sctp_priv_assoc_stats stats;
2089
2090 int sent_cnt_removable;
2091
2092 __u16 subscribe;
2093
2094 __u64 abandoned_unsent[SCTP_PR_INDEX(MAX) + 1];
2095 __u64 abandoned_sent[SCTP_PR_INDEX(MAX) + 1];
2096
2097
2098
2099
2100
2101
2102
2103
2104 u32 secid;
2105 u32 peer_secid;
2106
2107 struct rcu_head rcu;
2108 };
2109
2110
2111
2112
2113
2114 enum {
2115 SCTP_ASSOC_EYECATCHER = 0xa550c123,
2116 };
2117
2118
2119 static inline struct sctp_association *sctp_assoc(struct sctp_ep_common *base)
2120 {
2121 struct sctp_association *asoc;
2122
2123 asoc = container_of(base, struct sctp_association, base);
2124 return asoc;
2125 }
2126
2127
2128
2129
2130 struct sctp_association *
2131 sctp_association_new(const struct sctp_endpoint *ep, const struct sock *sk,
2132 enum sctp_scope scope, gfp_t gfp);
2133 void sctp_association_free(struct sctp_association *);
2134 void sctp_association_put(struct sctp_association *);
2135 void sctp_association_hold(struct sctp_association *);
2136
2137 struct sctp_transport *sctp_assoc_choose_alter_transport(
2138 struct sctp_association *, struct sctp_transport *);
2139 void sctp_assoc_update_retran_path(struct sctp_association *);
2140 struct sctp_transport *sctp_assoc_lookup_paddr(const struct sctp_association *,
2141 const union sctp_addr *);
2142 int sctp_assoc_lookup_laddr(struct sctp_association *asoc,
2143 const union sctp_addr *laddr);
2144 struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *,
2145 const union sctp_addr *address,
2146 const gfp_t gfp,
2147 const int peer_state);
2148 void sctp_assoc_del_peer(struct sctp_association *asoc,
2149 const union sctp_addr *addr);
2150 void sctp_assoc_rm_peer(struct sctp_association *asoc,
2151 struct sctp_transport *peer);
2152 void sctp_assoc_control_transport(struct sctp_association *asoc,
2153 struct sctp_transport *transport,
2154 enum sctp_transport_cmd command,
2155 sctp_sn_error_t error);
2156 struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *, __u32);
2157 void sctp_assoc_migrate(struct sctp_association *, struct sock *);
2158 int sctp_assoc_update(struct sctp_association *old,
2159 struct sctp_association *new);
2160
2161 __u32 sctp_association_get_next_tsn(struct sctp_association *);
2162
2163 void sctp_assoc_update_frag_point(struct sctp_association *asoc);
2164 void sctp_assoc_set_pmtu(struct sctp_association *asoc, __u32 pmtu);
2165 void sctp_assoc_sync_pmtu(struct sctp_association *asoc);
2166 void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int);
2167 void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int);
2168 void sctp_assoc_set_primary(struct sctp_association *,
2169 struct sctp_transport *);
2170 void sctp_assoc_del_nonprimary_peers(struct sctp_association *,
2171 struct sctp_transport *);
2172 int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *asoc,
2173 enum sctp_scope scope, gfp_t gfp);
2174 int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *,
2175 struct sctp_cookie*,
2176 gfp_t gfp);
2177 int sctp_assoc_set_id(struct sctp_association *, gfp_t);
2178 void sctp_assoc_clean_asconf_ack_cache(const struct sctp_association *asoc);
2179 struct sctp_chunk *sctp_assoc_lookup_asconf_ack(
2180 const struct sctp_association *asoc,
2181 __be32 serial);
2182 void sctp_asconf_queue_teardown(struct sctp_association *asoc);
2183
2184 int sctp_cmp_addr_exact(const union sctp_addr *ss1,
2185 const union sctp_addr *ss2);
2186 struct sctp_chunk *sctp_get_ecne_prepend(struct sctp_association *asoc);
2187
2188
2189 struct sctp_cmsgs {
2190 struct sctp_initmsg *init;
2191 struct sctp_sndrcvinfo *srinfo;
2192 struct sctp_sndinfo *sinfo;
2193 struct sctp_prinfo *prinfo;
2194 struct sctp_authinfo *authinfo;
2195 struct msghdr *addrs_msg;
2196 };
2197
2198
2199 struct sctp_dbg_objcnt_entry {
2200 char *label;
2201 atomic_t *counter;
2202 };
2203
2204 #endif