diff options
Diffstat (limited to 'include/net/sctp/sctp.h')
-rw-r--r-- | include/net/sctp/sctp.h | 60 |
1 files changed, 36 insertions, 24 deletions
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 65946bc43d00..505845ddb0be 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -275,24 +275,35 @@ struct sctp_mib { | |||
275 | /* Print debugging messages. */ | 275 | /* Print debugging messages. */ |
276 | #if SCTP_DEBUG | 276 | #if SCTP_DEBUG |
277 | extern int sctp_debug_flag; | 277 | extern int sctp_debug_flag; |
278 | #define SCTP_DEBUG_PRINTK(whatever...) \ | 278 | #define SCTP_DEBUG_PRINTK(fmt, args...) \ |
279 | ((void) (sctp_debug_flag && printk(KERN_DEBUG whatever))) | 279 | do { \ |
280 | #define SCTP_DEBUG_PRINTK_IPADDR(lead, trail, leadparm, saddr, otherparms...) \ | 280 | if (sctp_debug_flag) \ |
281 | if (sctp_debug_flag) { \ | 281 | printk(KERN_DEBUG pr_fmt(fmt), ##args); \ |
282 | if (saddr->sa.sa_family == AF_INET6) { \ | 282 | } while (0) |
283 | printk(KERN_DEBUG \ | 283 | #define SCTP_DEBUG_PRINTK_CONT(fmt, args...) \ |
284 | lead "%pI6" trail, \ | 284 | do { \ |
285 | leadparm, \ | 285 | if (sctp_debug_flag) \ |
286 | &saddr->v6.sin6_addr, \ | 286 | pr_cont(fmt, ##args); \ |
287 | otherparms); \ | 287 | } while (0) |
288 | } else { \ | 288 | #define SCTP_DEBUG_PRINTK_IPADDR(fmt_lead, fmt_trail, \ |
289 | printk(KERN_DEBUG \ | 289 | args_lead, saddr, args_trail...) \ |
290 | lead "%pI4" trail, \ | 290 | do { \ |
291 | leadparm, \ | 291 | if (sctp_debug_flag) { \ |
292 | &saddr->v4.sin_addr.s_addr, \ | 292 | if (saddr->sa.sa_family == AF_INET6) { \ |
293 | otherparms); \ | 293 | printk(KERN_DEBUG \ |
294 | } \ | 294 | pr_fmt(fmt_lead "%pI6" fmt_trail), \ |
295 | } | 295 | args_lead, \ |
296 | &saddr->v6.sin6_addr, \ | ||
297 | args_trail); \ | ||
298 | } else { \ | ||
299 | printk(KERN_DEBUG \ | ||
300 | pr_fmt(fmt_lead "%pI4" fmt_trail), \ | ||
301 | args_lead, \ | ||
302 | &saddr->v4.sin_addr.s_addr, \ | ||
303 | args_trail); \ | ||
304 | } \ | ||
305 | } \ | ||
306 | } while (0) | ||
296 | #define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; } | 307 | #define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; } |
297 | #define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; } | 308 | #define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; } |
298 | 309 | ||
@@ -306,6 +317,7 @@ extern int sctp_debug_flag; | |||
306 | #else /* SCTP_DEBUG */ | 317 | #else /* SCTP_DEBUG */ |
307 | 318 | ||
308 | #define SCTP_DEBUG_PRINTK(whatever...) | 319 | #define SCTP_DEBUG_PRINTK(whatever...) |
320 | #define SCTP_DEBUG_PRINTK_CONT(fmt, args...) | ||
309 | #define SCTP_DEBUG_PRINTK_IPADDR(whatever...) | 321 | #define SCTP_DEBUG_PRINTK_IPADDR(whatever...) |
310 | #define SCTP_ENABLE_DEBUG | 322 | #define SCTP_ENABLE_DEBUG |
311 | #define SCTP_DISABLE_DEBUG | 323 | #define SCTP_DISABLE_DEBUG |
@@ -393,7 +405,7 @@ static inline void sctp_v6_del_protocol(void) { return; } | |||
393 | /* Map an association to an assoc_id. */ | 405 | /* Map an association to an assoc_id. */ |
394 | static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc) | 406 | static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc) |
395 | { | 407 | { |
396 | return (asoc?asoc->assoc_id:0); | 408 | return asoc ? asoc->assoc_id : 0; |
397 | } | 409 | } |
398 | 410 | ||
399 | /* Look up the association by its id. */ | 411 | /* Look up the association by its id. */ |
@@ -461,7 +473,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. */ | 473 | /* Tests if the list has one and only one entry. */ |
462 | static inline int sctp_list_single_entry(struct list_head *head) | 474 | static inline int sctp_list_single_entry(struct list_head *head) |
463 | { | 475 | { |
464 | return ((head->next != head) && (head->next == head->prev)); | 476 | return (head->next != head) && (head->next == head->prev); |
465 | } | 477 | } |
466 | 478 | ||
467 | /* Generate a random jitter in the range of -50% ~ +50% of input RTO. */ | 479 | /* Generate a random jitter in the range of -50% ~ +50% of input RTO. */ |
@@ -619,13 +631,13 @@ static inline int sctp_sanity_check(void) | |||
619 | /* This is the hash function for the SCTP port hash table. */ | 631 | /* This is the hash function for the SCTP port hash table. */ |
620 | static inline int sctp_phashfn(__u16 lport) | 632 | static inline int sctp_phashfn(__u16 lport) |
621 | { | 633 | { |
622 | return (lport & (sctp_port_hashsize - 1)); | 634 | return lport & (sctp_port_hashsize - 1); |
623 | } | 635 | } |
624 | 636 | ||
625 | /* This is the hash function for the endpoint hash table. */ | 637 | /* This is the hash function for the endpoint hash table. */ |
626 | static inline int sctp_ep_hashfn(__u16 lport) | 638 | static inline int sctp_ep_hashfn(__u16 lport) |
627 | { | 639 | { |
628 | return (lport & (sctp_ep_hashsize - 1)); | 640 | return lport & (sctp_ep_hashsize - 1); |
629 | } | 641 | } |
630 | 642 | ||
631 | /* This is the hash function for the association hash table. */ | 643 | /* This is the hash function for the association hash table. */ |
@@ -633,7 +645,7 @@ static inline int sctp_assoc_hashfn(__u16 lport, __u16 rport) | |||
633 | { | 645 | { |
634 | int h = (lport << 16) + rport; | 646 | int h = (lport << 16) + rport; |
635 | h ^= h>>8; | 647 | h ^= h>>8; |
636 | return (h & (sctp_assoc_hashsize - 1)); | 648 | return h & (sctp_assoc_hashsize - 1); |
637 | } | 649 | } |
638 | 650 | ||
639 | /* This is the hash function for the association hash table. This is | 651 | /* This is the hash function for the association hash table. This is |
@@ -644,7 +656,7 @@ static inline int sctp_vtag_hashfn(__u16 lport, __u16 rport, __u32 vtag) | |||
644 | { | 656 | { |
645 | int h = (lport << 16) + rport; | 657 | int h = (lport << 16) + rport; |
646 | h ^= vtag; | 658 | h ^= vtag; |
647 | return (h & (sctp_assoc_hashsize-1)); | 659 | return h & (sctp_assoc_hashsize - 1); |
648 | } | 660 | } |
649 | 661 | ||
650 | #define sctp_for_each_hentry(epb, node, head) \ | 662 | #define sctp_for_each_hentry(epb, node, head) \ |