diff options
Diffstat (limited to 'include/net/sctp/sctp.h')
-rw-r--r-- | include/net/sctp/sctp.h | 63 |
1 files changed, 36 insertions, 27 deletions
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 65946bc43d00..b2c2366676a7 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -115,7 +115,6 @@ | |||
115 | * sctp/protocol.c | 115 | * sctp/protocol.c |
116 | */ | 116 | */ |
117 | extern struct sock *sctp_get_ctl_sock(void); | 117 | extern struct sock *sctp_get_ctl_sock(void); |
118 | extern void sctp_local_addr_free(struct rcu_head *head); | ||
119 | extern int sctp_copy_local_addr_list(struct sctp_bind_addr *, | 118 | extern int sctp_copy_local_addr_list(struct sctp_bind_addr *, |
120 | sctp_scope_t, gfp_t gfp, | 119 | sctp_scope_t, gfp_t gfp, |
121 | int flags); | 120 | int flags); |
@@ -275,24 +274,35 @@ struct sctp_mib { | |||
275 | /* Print debugging messages. */ | 274 | /* Print debugging messages. */ |
276 | #if SCTP_DEBUG | 275 | #if SCTP_DEBUG |
277 | extern int sctp_debug_flag; | 276 | extern int sctp_debug_flag; |
278 | #define SCTP_DEBUG_PRINTK(whatever...) \ | 277 | #define SCTP_DEBUG_PRINTK(fmt, args...) \ |
279 | ((void) (sctp_debug_flag && printk(KERN_DEBUG whatever))) | 278 | do { \ |
280 | #define SCTP_DEBUG_PRINTK_IPADDR(lead, trail, leadparm, saddr, otherparms...) \ | 279 | if (sctp_debug_flag) \ |
281 | if (sctp_debug_flag) { \ | 280 | printk(KERN_DEBUG pr_fmt(fmt), ##args); \ |
282 | if (saddr->sa.sa_family == AF_INET6) { \ | 281 | } while (0) |
283 | printk(KERN_DEBUG \ | 282 | #define SCTP_DEBUG_PRINTK_CONT(fmt, args...) \ |
284 | lead "%pI6" trail, \ | 283 | do { \ |
285 | leadparm, \ | 284 | if (sctp_debug_flag) \ |
286 | &saddr->v6.sin6_addr, \ | 285 | pr_cont(fmt, ##args); \ |
287 | otherparms); \ | 286 | } while (0) |
288 | } else { \ | 287 | #define SCTP_DEBUG_PRINTK_IPADDR(fmt_lead, fmt_trail, \ |
289 | printk(KERN_DEBUG \ | 288 | args_lead, saddr, args_trail...) \ |
290 | lead "%pI4" trail, \ | 289 | do { \ |
291 | leadparm, \ | 290 | if (sctp_debug_flag) { \ |
292 | &saddr->v4.sin_addr.s_addr, \ | 291 | if (saddr->sa.sa_family == AF_INET6) { \ |
293 | otherparms); \ | 292 | printk(KERN_DEBUG \ |
294 | } \ | 293 | pr_fmt(fmt_lead "%pI6" fmt_trail), \ |
295 | } | 294 | args_lead, \ |
295 | &saddr->v6.sin6_addr, \ | ||
296 | args_trail); \ | ||
297 | } else { \ | ||
298 | printk(KERN_DEBUG \ | ||
299 | pr_fmt(fmt_lead "%pI4" fmt_trail), \ | ||
300 | args_lead, \ | ||
301 | &saddr->v4.sin_addr.s_addr, \ | ||
302 | args_trail); \ | ||
303 | } \ | ||
304 | } \ | ||
305 | } while (0) | ||
296 | #define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; } | 306 | #define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; } |
297 | #define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; } | 307 | #define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; } |
298 | 308 | ||
@@ -306,6 +316,7 @@ extern int sctp_debug_flag; | |||
306 | #else /* SCTP_DEBUG */ | 316 | #else /* SCTP_DEBUG */ |
307 | 317 | ||
308 | #define SCTP_DEBUG_PRINTK(whatever...) | 318 | #define SCTP_DEBUG_PRINTK(whatever...) |
319 | #define SCTP_DEBUG_PRINTK_CONT(fmt, args...) | ||
309 | #define SCTP_DEBUG_PRINTK_IPADDR(whatever...) | 320 | #define SCTP_DEBUG_PRINTK_IPADDR(whatever...) |
310 | #define SCTP_ENABLE_DEBUG | 321 | #define SCTP_ENABLE_DEBUG |
311 | #define SCTP_DISABLE_DEBUG | 322 | #define SCTP_DISABLE_DEBUG |
@@ -393,7 +404,7 @@ static inline void sctp_v6_del_protocol(void) { return; } | |||
393 | /* Map an association to an assoc_id. */ | 404 | /* Map an association to an assoc_id. */ |
394 | static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc) | 405 | static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc) |
395 | { | 406 | { |
396 | return (asoc?asoc->assoc_id:0); | 407 | return asoc ? asoc->assoc_id : 0; |
397 | } | 408 | } |
398 | 409 | ||
399 | /* Look up the association by its id. */ | 410 | /* Look up the association by its id. */ |
@@ -461,7 +472,7 @@ static inline void sctp_skb_set_owner_r(struct sk_buff *skb, struct sock *sk) | |||
461 | /* Tests if the list has one and only one entry. */ | 472 | /* Tests if the list has one and only one entry. */ |
462 | static inline int sctp_list_single_entry(struct list_head *head) | 473 | static inline int sctp_list_single_entry(struct list_head *head) |
463 | { | 474 | { |
464 | return ((head->next != head) && (head->next == head->prev)); | 475 | return (head->next != head) && (head->next == head->prev); |
465 | } | 476 | } |
466 | 477 | ||
467 | /* Generate a random jitter in the range of -50% ~ +50% of input RTO. */ | 478 | /* Generate a random jitter in the range of -50% ~ +50% of input RTO. */ |
@@ -519,7 +530,6 @@ _sctp_walk_params((pos), (chunk), ntohs((chunk)->chunk_hdr.length), member) | |||
519 | 530 | ||
520 | #define _sctp_walk_params(pos, chunk, end, member)\ | 531 | #define _sctp_walk_params(pos, chunk, end, member)\ |
521 | for (pos.v = chunk->member;\ | 532 | for (pos.v = chunk->member;\ |
522 | pos.v <= (void *)chunk + end - sizeof(sctp_paramhdr_t) &&\ | ||
523 | pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\ | 533 | pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\ |
524 | ntohs(pos.p->length) >= sizeof(sctp_paramhdr_t);\ | 534 | ntohs(pos.p->length) >= sizeof(sctp_paramhdr_t);\ |
525 | pos.v += WORD_ROUND(ntohs(pos.p->length))) | 535 | pos.v += WORD_ROUND(ntohs(pos.p->length))) |
@@ -530,7 +540,6 @@ _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length)) | |||
530 | #define _sctp_walk_errors(err, chunk_hdr, end)\ | 540 | #define _sctp_walk_errors(err, chunk_hdr, end)\ |
531 | for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ | 541 | for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ |
532 | sizeof(sctp_chunkhdr_t));\ | 542 | sizeof(sctp_chunkhdr_t));\ |
533 | (void *)err <= (void *)chunk_hdr + end - sizeof(sctp_errhdr_t) &&\ | ||
534 | (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ | 543 | (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ |
535 | ntohs(err->length) >= sizeof(sctp_errhdr_t); \ | 544 | ntohs(err->length) >= sizeof(sctp_errhdr_t); \ |
536 | err = (sctp_errhdr_t *)((void *)err + WORD_ROUND(ntohs(err->length)))) | 545 | err = (sctp_errhdr_t *)((void *)err + WORD_ROUND(ntohs(err->length)))) |
@@ -619,13 +628,13 @@ static inline int sctp_sanity_check(void) | |||
619 | /* This is the hash function for the SCTP port hash table. */ | 628 | /* This is the hash function for the SCTP port hash table. */ |
620 | static inline int sctp_phashfn(__u16 lport) | 629 | static inline int sctp_phashfn(__u16 lport) |
621 | { | 630 | { |
622 | return (lport & (sctp_port_hashsize - 1)); | 631 | return lport & (sctp_port_hashsize - 1); |
623 | } | 632 | } |
624 | 633 | ||
625 | /* This is the hash function for the endpoint hash table. */ | 634 | /* This is the hash function for the endpoint hash table. */ |
626 | static inline int sctp_ep_hashfn(__u16 lport) | 635 | static inline int sctp_ep_hashfn(__u16 lport) |
627 | { | 636 | { |
628 | return (lport & (sctp_ep_hashsize - 1)); | 637 | return lport & (sctp_ep_hashsize - 1); |
629 | } | 638 | } |
630 | 639 | ||
631 | /* This is the hash function for the association hash table. */ | 640 | /* This is the hash function for the association hash table. */ |
@@ -633,7 +642,7 @@ static inline int sctp_assoc_hashfn(__u16 lport, __u16 rport) | |||
633 | { | 642 | { |
634 | int h = (lport << 16) + rport; | 643 | int h = (lport << 16) + rport; |
635 | h ^= h>>8; | 644 | h ^= h>>8; |
636 | return (h & (sctp_assoc_hashsize - 1)); | 645 | return h & (sctp_assoc_hashsize - 1); |
637 | } | 646 | } |
638 | 647 | ||
639 | /* This is the hash function for the association hash table. This is | 648 | /* This is the hash function for the association hash table. This is |
@@ -644,7 +653,7 @@ static inline int sctp_vtag_hashfn(__u16 lport, __u16 rport, __u32 vtag) | |||
644 | { | 653 | { |
645 | int h = (lport << 16) + rport; | 654 | int h = (lport << 16) + rport; |
646 | h ^= vtag; | 655 | h ^= vtag; |
647 | return (h & (sctp_assoc_hashsize-1)); | 656 | return h & (sctp_assoc_hashsize - 1); |
648 | } | 657 | } |
649 | 658 | ||
650 | #define sctp_for_each_hentry(epb, node, head) \ | 659 | #define sctp_for_each_hentry(epb, node, head) \ |