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 #ifndef __net_sctp_h__
0028 #define __net_sctp_h__
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 #include <linux/types.h>
0044 #include <linux/slab.h>
0045 #include <linux/in.h>
0046 #include <linux/tty.h>
0047 #include <linux/proc_fs.h>
0048 #include <linux/spinlock.h>
0049 #include <linux/jiffies.h>
0050 #include <linux/idr.h>
0051
0052 #if IS_ENABLED(CONFIG_IPV6)
0053 #include <net/ipv6.h>
0054 #include <net/ip6_route.h>
0055 #endif
0056
0057 #include <linux/uaccess.h>
0058 #include <asm/page.h>
0059 #include <net/sock.h>
0060 #include <net/snmp.h>
0061 #include <net/sctp/structs.h>
0062 #include <net/sctp/constants.h>
0063
0064 #ifdef CONFIG_IP_SCTP_MODULE
0065 #define SCTP_PROTOSW_FLAG 0
0066 #else
0067 #define SCTP_PROTOSW_FLAG INET_PROTOSW_PERMANENT
0068 #endif
0069
0070
0071 #define SCTP_PAD4(s) (((s)+3)&~3)
0072
0073 #define SCTP_TRUNC4(s) ((s)&~3)
0074
0075
0076
0077
0078
0079
0080
0081
0082 int sctp_copy_local_addr_list(struct net *net, struct sctp_bind_addr *addr,
0083 enum sctp_scope, gfp_t gfp, int flags);
0084 struct sctp_pf *sctp_get_pf_specific(sa_family_t family);
0085 int sctp_register_pf(struct sctp_pf *, sa_family_t);
0086 void sctp_addr_wq_mgmt(struct net *, struct sctp_sockaddr_entry *, int);
0087 int sctp_udp_sock_start(struct net *net);
0088 void sctp_udp_sock_stop(struct net *net);
0089
0090
0091
0092
0093 int sctp_inet_connect(struct socket *sock, struct sockaddr *uaddr,
0094 int addr_len, int flags);
0095 int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb);
0096 int sctp_inet_listen(struct socket *sock, int backlog);
0097 void sctp_write_space(struct sock *sk);
0098 void sctp_data_ready(struct sock *sk);
0099 __poll_t sctp_poll(struct file *file, struct socket *sock,
0100 poll_table *wait);
0101 void sctp_sock_rfree(struct sk_buff *skb);
0102 void sctp_copy_sock(struct sock *newsk, struct sock *sk,
0103 struct sctp_association *asoc);
0104 extern struct percpu_counter sctp_sockets_allocated;
0105 int sctp_asconf_mgmt(struct sctp_sock *, struct sctp_sockaddr_entry *);
0106 struct sk_buff *sctp_skb_recv_datagram(struct sock *, int, int *);
0107
0108 typedef int (*sctp_callback_t)(struct sctp_endpoint *, struct sctp_transport *, void *);
0109 void sctp_transport_walk_start(struct rhashtable_iter *iter);
0110 void sctp_transport_walk_stop(struct rhashtable_iter *iter);
0111 struct sctp_transport *sctp_transport_get_next(struct net *net,
0112 struct rhashtable_iter *iter);
0113 struct sctp_transport *sctp_transport_get_idx(struct net *net,
0114 struct rhashtable_iter *iter, int pos);
0115 int sctp_transport_lookup_process(sctp_callback_t cb, struct net *net,
0116 const union sctp_addr *laddr,
0117 const union sctp_addr *paddr, void *p);
0118 int sctp_transport_traverse_process(sctp_callback_t cb, sctp_callback_t cb_done,
0119 struct net *net, int *pos, void *p);
0120 int sctp_for_each_endpoint(int (*cb)(struct sctp_endpoint *, void *), void *p);
0121 int sctp_get_sctp_info(struct sock *sk, struct sctp_association *asoc,
0122 struct sctp_info *info);
0123
0124
0125
0126
0127 int sctp_primitive_ASSOCIATE(struct net *, struct sctp_association *, void *arg);
0128 int sctp_primitive_SHUTDOWN(struct net *, struct sctp_association *, void *arg);
0129 int sctp_primitive_ABORT(struct net *, struct sctp_association *, void *arg);
0130 int sctp_primitive_SEND(struct net *, struct sctp_association *, void *arg);
0131 int sctp_primitive_REQUESTHEARTBEAT(struct net *, struct sctp_association *, void *arg);
0132 int sctp_primitive_ASCONF(struct net *, struct sctp_association *, void *arg);
0133 int sctp_primitive_RECONF(struct net *net, struct sctp_association *asoc,
0134 void *arg);
0135
0136
0137
0138
0139 int sctp_rcv(struct sk_buff *skb);
0140 int sctp_v4_err(struct sk_buff *skb, u32 info);
0141 int sctp_hash_endpoint(struct sctp_endpoint *ep);
0142 void sctp_unhash_endpoint(struct sctp_endpoint *);
0143 struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *,
0144 struct sctphdr *, struct sctp_association **,
0145 struct sctp_transport **);
0146 void sctp_err_finish(struct sock *, struct sctp_transport *);
0147 int sctp_udp_v4_err(struct sock *sk, struct sk_buff *skb);
0148 int sctp_udp_v6_err(struct sock *sk, struct sk_buff *skb);
0149 void sctp_icmp_frag_needed(struct sock *, struct sctp_association *,
0150 struct sctp_transport *t, __u32 pmtu);
0151 void sctp_icmp_redirect(struct sock *, struct sctp_transport *,
0152 struct sk_buff *);
0153 void sctp_icmp_proto_unreachable(struct sock *sk,
0154 struct sctp_association *asoc,
0155 struct sctp_transport *t);
0156 void sctp_backlog_migrate(struct sctp_association *assoc,
0157 struct sock *oldsk, struct sock *newsk);
0158 int sctp_transport_hashtable_init(void);
0159 void sctp_transport_hashtable_destroy(void);
0160 int sctp_hash_transport(struct sctp_transport *t);
0161 void sctp_unhash_transport(struct sctp_transport *t);
0162 struct sctp_transport *sctp_addrs_lookup_transport(
0163 struct net *net,
0164 const union sctp_addr *laddr,
0165 const union sctp_addr *paddr);
0166 struct sctp_transport *sctp_epaddr_lookup_transport(
0167 const struct sctp_endpoint *ep,
0168 const union sctp_addr *paddr);
0169
0170
0171
0172
0173 int __net_init sctp_proc_init(struct net *net);
0174
0175
0176
0177
0178 int sctp_offload_init(void);
0179
0180
0181
0182
0183 void sctp_sched_ops_init(void);
0184
0185
0186
0187
0188 int sctp_send_reset_streams(struct sctp_association *asoc,
0189 struct sctp_reset_streams *params);
0190 int sctp_send_reset_assoc(struct sctp_association *asoc);
0191 int sctp_send_add_streams(struct sctp_association *asoc,
0192 struct sctp_add_streams *params);
0193
0194
0195
0196
0197
0198
0199
0200
0201 extern struct kmem_cache *sctp_chunk_cachep __read_mostly;
0202 extern struct kmem_cache *sctp_bucket_cachep __read_mostly;
0203 extern long sysctl_sctp_mem[3];
0204 extern int sysctl_sctp_rmem[3];
0205 extern int sysctl_sctp_wmem[3];
0206
0207
0208
0209
0210
0211
0212 #define SCTP_INC_STATS(net, field) SNMP_INC_STATS((net)->sctp.sctp_statistics, field)
0213 #define __SCTP_INC_STATS(net, field) __SNMP_INC_STATS((net)->sctp.sctp_statistics, field)
0214 #define SCTP_DEC_STATS(net, field) SNMP_DEC_STATS((net)->sctp.sctp_statistics, field)
0215
0216
0217 enum {
0218 SCTP_MIB_NUM = 0,
0219 SCTP_MIB_CURRESTAB,
0220 SCTP_MIB_ACTIVEESTABS,
0221 SCTP_MIB_PASSIVEESTABS,
0222 SCTP_MIB_ABORTEDS,
0223 SCTP_MIB_SHUTDOWNS,
0224 SCTP_MIB_OUTOFBLUES,
0225 SCTP_MIB_CHECKSUMERRORS,
0226 SCTP_MIB_OUTCTRLCHUNKS,
0227 SCTP_MIB_OUTORDERCHUNKS,
0228 SCTP_MIB_OUTUNORDERCHUNKS,
0229 SCTP_MIB_INCTRLCHUNKS,
0230 SCTP_MIB_INORDERCHUNKS,
0231 SCTP_MIB_INUNORDERCHUNKS,
0232 SCTP_MIB_FRAGUSRMSGS,
0233 SCTP_MIB_REASMUSRMSGS,
0234 SCTP_MIB_OUTSCTPPACKS,
0235 SCTP_MIB_INSCTPPACKS,
0236 SCTP_MIB_T1_INIT_EXPIREDS,
0237 SCTP_MIB_T1_COOKIE_EXPIREDS,
0238 SCTP_MIB_T2_SHUTDOWN_EXPIREDS,
0239 SCTP_MIB_T3_RTX_EXPIREDS,
0240 SCTP_MIB_T4_RTO_EXPIREDS,
0241 SCTP_MIB_T5_SHUTDOWN_GUARD_EXPIREDS,
0242 SCTP_MIB_DELAY_SACK_EXPIREDS,
0243 SCTP_MIB_AUTOCLOSE_EXPIREDS,
0244 SCTP_MIB_T1_RETRANSMITS,
0245 SCTP_MIB_T3_RETRANSMITS,
0246 SCTP_MIB_PMTUD_RETRANSMITS,
0247 SCTP_MIB_FAST_RETRANSMITS,
0248 SCTP_MIB_IN_PKT_SOFTIRQ,
0249 SCTP_MIB_IN_PKT_BACKLOG,
0250 SCTP_MIB_IN_PKT_DISCARDS,
0251 SCTP_MIB_IN_DATA_CHUNK_DISCARDS,
0252 __SCTP_MIB_MAX
0253 };
0254
0255 #define SCTP_MIB_MAX __SCTP_MIB_MAX
0256 struct sctp_mib {
0257 unsigned long mibs[SCTP_MIB_MAX];
0258 };
0259
0260
0261 static inline void sctp_max_rto(struct sctp_association *asoc,
0262 struct sctp_transport *trans)
0263 {
0264 if (asoc->stats.max_obs_rto < (__u64)trans->rto) {
0265 asoc->stats.max_obs_rto = trans->rto;
0266 memset(&asoc->stats.obs_rto_ipaddr, 0,
0267 sizeof(struct sockaddr_storage));
0268 memcpy(&asoc->stats.obs_rto_ipaddr, &trans->ipaddr,
0269 trans->af_specific->sockaddr_len);
0270 }
0271 }
0272
0273
0274
0275
0276 #ifdef CONFIG_SCTP_DBG_OBJCNT
0277
0278 extern atomic_t sctp_dbg_objcnt_sock;
0279 extern atomic_t sctp_dbg_objcnt_ep;
0280 extern atomic_t sctp_dbg_objcnt_assoc;
0281 extern atomic_t sctp_dbg_objcnt_transport;
0282 extern atomic_t sctp_dbg_objcnt_chunk;
0283 extern atomic_t sctp_dbg_objcnt_bind_addr;
0284 extern atomic_t sctp_dbg_objcnt_bind_bucket;
0285 extern atomic_t sctp_dbg_objcnt_addr;
0286 extern atomic_t sctp_dbg_objcnt_datamsg;
0287 extern atomic_t sctp_dbg_objcnt_keys;
0288
0289
0290 #define SCTP_DBG_OBJCNT_INC(name) \
0291 atomic_inc(&sctp_dbg_objcnt_## name)
0292 #define SCTP_DBG_OBJCNT_DEC(name) \
0293 atomic_dec(&sctp_dbg_objcnt_## name)
0294 #define SCTP_DBG_OBJCNT(name) \
0295 atomic_t sctp_dbg_objcnt_## name = ATOMIC_INIT(0)
0296
0297
0298
0299
0300 #define SCTP_DBG_OBJCNT_ENTRY(name) \
0301 {.label= #name, .counter= &sctp_dbg_objcnt_## name}
0302
0303 void sctp_dbg_objcnt_init(struct net *);
0304
0305 #else
0306
0307 #define SCTP_DBG_OBJCNT_INC(name)
0308 #define SCTP_DBG_OBJCNT_DEC(name)
0309
0310 static inline void sctp_dbg_objcnt_init(struct net *net) { return; }
0311
0312 #endif
0313
0314 #if defined CONFIG_SYSCTL
0315 void sctp_sysctl_register(void);
0316 void sctp_sysctl_unregister(void);
0317 int sctp_sysctl_net_register(struct net *net);
0318 void sctp_sysctl_net_unregister(struct net *net);
0319 #else
0320 static inline void sctp_sysctl_register(void) { return; }
0321 static inline void sctp_sysctl_unregister(void) { return; }
0322 static inline int sctp_sysctl_net_register(struct net *net) { return 0; }
0323 static inline void sctp_sysctl_net_unregister(struct net *net) { return; }
0324 #endif
0325
0326
0327 #define SCTP_SAT_LEN(x) (sizeof(struct sctp_paramhdr) + (x) * sizeof(__u16))
0328
0329 #if IS_ENABLED(CONFIG_IPV6)
0330
0331 void sctp_v6_pf_init(void);
0332 void sctp_v6_pf_exit(void);
0333 int sctp_v6_protosw_init(void);
0334 void sctp_v6_protosw_exit(void);
0335 int sctp_v6_add_protocol(void);
0336 void sctp_v6_del_protocol(void);
0337
0338 #else
0339
0340 static inline void sctp_v6_pf_init(void) { return; }
0341 static inline void sctp_v6_pf_exit(void) { return; }
0342 static inline int sctp_v6_protosw_init(void) { return 0; }
0343 static inline void sctp_v6_protosw_exit(void) { return; }
0344 static inline int sctp_v6_add_protocol(void) { return 0; }
0345 static inline void sctp_v6_del_protocol(void) { return; }
0346
0347 #endif
0348
0349
0350
0351 static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc)
0352 {
0353 return asoc ? asoc->assoc_id : 0;
0354 }
0355
0356 static inline enum sctp_sstat_state
0357 sctp_assoc_to_state(const struct sctp_association *asoc)
0358 {
0359
0360
0361
0362
0363
0364
0365
0366 return asoc->state + 1;
0367 }
0368
0369
0370 struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id);
0371
0372 int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp);
0373
0374
0375 #define sctp_skb_for_each(pos, head, tmp) \
0376 skb_queue_walk_safe(head, pos, tmp)
0377
0378
0379
0380
0381
0382
0383
0384
0385
0386 static inline struct list_head *sctp_list_dequeue(struct list_head *list)
0387 {
0388 struct list_head *result = NULL;
0389
0390 if (!list_empty(list)) {
0391 result = list->next;
0392 list_del_init(result);
0393 }
0394 return result;
0395 }
0396
0397
0398
0399
0400
0401 static inline void sctp_skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
0402 {
0403 struct sctp_ulpevent *event = sctp_skb2event(skb);
0404
0405 skb_orphan(skb);
0406 skb->sk = sk;
0407 skb->destructor = sctp_sock_rfree;
0408 atomic_add(event->rmem_len, &sk->sk_rmem_alloc);
0409
0410
0411
0412 sk_mem_charge(sk, event->rmem_len);
0413 }
0414
0415
0416 static inline int sctp_list_single_entry(struct list_head *head)
0417 {
0418 return list_is_singular(head);
0419 }
0420
0421 static inline bool sctp_chunk_pending(const struct sctp_chunk *chunk)
0422 {
0423 return !list_empty(&chunk->list);
0424 }
0425
0426
0427
0428
0429
0430
0431 #define sctp_walk_params(pos, chunk, member)\
0432 _sctp_walk_params((pos), (chunk), ntohs((chunk)->chunk_hdr.length), member)
0433
0434 #define _sctp_walk_params(pos, chunk, end, member)\
0435 for (pos.v = chunk->member;\
0436 (pos.v + offsetof(struct sctp_paramhdr, length) + sizeof(pos.p->length) <=\
0437 (void *)chunk + end) &&\
0438 pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\
0439 ntohs(pos.p->length) >= sizeof(struct sctp_paramhdr);\
0440 pos.v += SCTP_PAD4(ntohs(pos.p->length)))
0441
0442 #define sctp_walk_errors(err, chunk_hdr)\
0443 _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length))
0444
0445 #define _sctp_walk_errors(err, chunk_hdr, end)\
0446 for (err = (struct sctp_errhdr *)((void *)chunk_hdr + \
0447 sizeof(struct sctp_chunkhdr));\
0448 ((void *)err + offsetof(struct sctp_errhdr, length) + sizeof(err->length) <=\
0449 (void *)chunk_hdr + end) &&\
0450 (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\
0451 ntohs(err->length) >= sizeof(struct sctp_errhdr); \
0452 err = (struct sctp_errhdr *)((void *)err + SCTP_PAD4(ntohs(err->length))))
0453
0454 #define sctp_walk_fwdtsn(pos, chunk)\
0455 _sctp_walk_fwdtsn((pos), (chunk), ntohs((chunk)->chunk_hdr->length) - sizeof(struct sctp_fwdtsn_chunk))
0456
0457 #define _sctp_walk_fwdtsn(pos, chunk, end)\
0458 for (pos = chunk->subh.fwdtsn_hdr->skip;\
0459 (void *)pos <= (void *)chunk->subh.fwdtsn_hdr->skip + end - sizeof(struct sctp_fwdtsn_skip);\
0460 pos++)
0461
0462
0463
0464 extern struct proto sctp_prot;
0465 extern struct proto sctpv6_prot;
0466 void sctp_put_port(struct sock *sk);
0467
0468 extern struct idr sctp_assocs_id;
0469 extern spinlock_t sctp_assocs_id_lock;
0470
0471
0472
0473
0474 static inline int ipver2af(__u8 ipver)
0475 {
0476 switch (ipver) {
0477 case 4:
0478 return AF_INET;
0479 case 6:
0480 return AF_INET6;
0481 default:
0482 return 0;
0483 }
0484 }
0485
0486
0487 static inline int param_type2af(__be16 type)
0488 {
0489 switch (type) {
0490 case SCTP_PARAM_IPV4_ADDRESS:
0491 return AF_INET;
0492 case SCTP_PARAM_IPV6_ADDRESS:
0493 return AF_INET6;
0494 default:
0495 return 0;
0496 }
0497 }
0498
0499
0500
0501 static inline int sctp_phashfn(struct net *net, __u16 lport)
0502 {
0503 return (net_hash_mix(net) + lport) & (sctp_port_hashsize - 1);
0504 }
0505
0506
0507 static inline int sctp_ep_hashfn(struct net *net, __u16 lport)
0508 {
0509 return (net_hash_mix(net) + lport) & (sctp_ep_hashsize - 1);
0510 }
0511
0512 #define sctp_for_each_hentry(ep, head) \
0513 hlist_for_each_entry(ep, head, node)
0514
0515
0516 #define sctp_style(sk, style) __sctp_style((sk), (SCTP_SOCKET_##style))
0517 static inline int __sctp_style(const struct sock *sk,
0518 enum sctp_socket_type style)
0519 {
0520 return sctp_sk(sk)->type == style;
0521 }
0522
0523
0524 #define sctp_state(asoc, state) __sctp_state((asoc), (SCTP_STATE_##state))
0525 static inline int __sctp_state(const struct sctp_association *asoc,
0526 enum sctp_state state)
0527 {
0528 return asoc->state == state;
0529 }
0530
0531
0532 #define sctp_sstate(sk, state) __sctp_sstate((sk), (SCTP_SS_##state))
0533 static inline int __sctp_sstate(const struct sock *sk,
0534 enum sctp_sock_state state)
0535 {
0536 return sk->sk_state == state;
0537 }
0538
0539
0540 static inline void sctp_v6_map_v4(union sctp_addr *addr)
0541 {
0542 addr->v4.sin_family = AF_INET;
0543 addr->v4.sin_port = addr->v6.sin6_port;
0544 addr->v4.sin_addr.s_addr = addr->v6.sin6_addr.s6_addr32[3];
0545 }
0546
0547
0548 static inline void sctp_v4_map_v6(union sctp_addr *addr)
0549 {
0550 __be16 port;
0551
0552 port = addr->v4.sin_port;
0553 addr->v6.sin6_addr.s6_addr32[3] = addr->v4.sin_addr.s_addr;
0554 addr->v6.sin6_port = port;
0555 addr->v6.sin6_family = AF_INET6;
0556 addr->v6.sin6_flowinfo = 0;
0557 addr->v6.sin6_scope_id = 0;
0558 addr->v6.sin6_addr.s6_addr32[0] = 0;
0559 addr->v6.sin6_addr.s6_addr32[1] = 0;
0560 addr->v6.sin6_addr.s6_addr32[2] = htonl(0x0000ffff);
0561 }
0562
0563
0564
0565
0566 static inline struct dst_entry *sctp_transport_dst_check(struct sctp_transport *t)
0567 {
0568 if (t->dst && !dst_check(t->dst, t->dst_cookie))
0569 sctp_transport_dst_release(t);
0570
0571 return t->dst;
0572 }
0573
0574
0575
0576
0577 static inline __u32 __sctp_mtu_payload(const struct sctp_sock *sp,
0578 const struct sctp_transport *t,
0579 __u32 mtu, __u32 extra)
0580 {
0581 __u32 overhead = sizeof(struct sctphdr) + extra;
0582
0583 if (sp) {
0584 overhead += sp->pf->af->net_header_len;
0585 if (sp->udp_port && (!t || t->encap_port))
0586 overhead += sizeof(struct udphdr);
0587 } else {
0588 overhead += sizeof(struct ipv6hdr);
0589 }
0590
0591 if (WARN_ON_ONCE(mtu && mtu <= overhead))
0592 mtu = overhead;
0593
0594 return mtu ? mtu - overhead : overhead;
0595 }
0596
0597 static inline __u32 sctp_mtu_payload(const struct sctp_sock *sp,
0598 __u32 mtu, __u32 extra)
0599 {
0600 return __sctp_mtu_payload(sp, NULL, mtu, extra);
0601 }
0602
0603 static inline __u32 sctp_dst_mtu(const struct dst_entry *dst)
0604 {
0605 return SCTP_TRUNC4(max_t(__u32, dst_mtu(dst),
0606 SCTP_DEFAULT_MINSEGMENT));
0607 }
0608
0609 static inline bool sctp_transport_pmtu_check(struct sctp_transport *t)
0610 {
0611 __u32 pmtu = sctp_dst_mtu(t->dst);
0612
0613 if (t->pathmtu == pmtu)
0614 return true;
0615
0616 t->pathmtu = pmtu;
0617
0618 return false;
0619 }
0620
0621 static inline __u32 sctp_min_frag_point(struct sctp_sock *sp, __u16 datasize)
0622 {
0623 return sctp_mtu_payload(sp, SCTP_DEFAULT_MINSEGMENT, datasize);
0624 }
0625
0626 static inline int sctp_transport_pl_hlen(struct sctp_transport *t)
0627 {
0628 return __sctp_mtu_payload(sctp_sk(t->asoc->base.sk), t, 0, 0) -
0629 sizeof(struct sctphdr);
0630 }
0631
0632 static inline void sctp_transport_pl_reset(struct sctp_transport *t)
0633 {
0634 if (t->probe_interval && (t->param_flags & SPP_PMTUD_ENABLE) &&
0635 (t->state == SCTP_ACTIVE || t->state == SCTP_UNKNOWN)) {
0636 if (t->pl.state == SCTP_PL_DISABLED) {
0637 t->pl.state = SCTP_PL_BASE;
0638 t->pl.pmtu = SCTP_BASE_PLPMTU;
0639 t->pl.probe_size = SCTP_BASE_PLPMTU;
0640 sctp_transport_reset_probe_timer(t);
0641 }
0642 } else {
0643 if (t->pl.state != SCTP_PL_DISABLED) {
0644 if (del_timer(&t->probe_timer))
0645 sctp_transport_put(t);
0646 t->pl.state = SCTP_PL_DISABLED;
0647 }
0648 }
0649 }
0650
0651 static inline void sctp_transport_pl_update(struct sctp_transport *t)
0652 {
0653 if (t->pl.state == SCTP_PL_DISABLED)
0654 return;
0655
0656 t->pl.state = SCTP_PL_BASE;
0657 t->pl.pmtu = SCTP_BASE_PLPMTU;
0658 t->pl.probe_size = SCTP_BASE_PLPMTU;
0659 sctp_transport_reset_probe_timer(t);
0660 }
0661
0662 static inline bool sctp_transport_pl_enabled(struct sctp_transport *t)
0663 {
0664 return t->pl.state != SCTP_PL_DISABLED;
0665 }
0666
0667 static inline bool sctp_newsk_ready(const struct sock *sk)
0668 {
0669 return sock_flag(sk, SOCK_DEAD) || sk->sk_socket;
0670 }
0671
0672 static inline void sctp_sock_set_nodelay(struct sock *sk)
0673 {
0674 lock_sock(sk);
0675 sctp_sk(sk)->nodelay = true;
0676 release_sock(sk);
0677 }
0678
0679 #endif