Rework SCTP debugging framework
Subsystems (6)
v2 cover Rework SCTP debugging framework
Please see patch 2 for a detailed description. Tested with lksctp-tools suite and other stress tests. For the changes between v1 and v2, please have a look into the individual patches.
Daniel Borkmann (2):
lib: vsprintf: add IPv4/v6 generic %piS/%pIS format specifier
net: sctp: rework debugging framework to use pr_debug and friends
Documentation/printk-formats.txt | 11 +++ include/net/sctp/sctp.h | 75 ----------------- lib/vsprintf.c | 16 +++- net/sctp/Kconfig | 12 +-- net/sctp/associola.c | 68 ++++++++-------- net/sctp/chunk.c | 5 +- net/sctp/debug.c | 4 - net/sctp/endpointola.c | 5 +- net/sctp/input.c | 6 +- net/sctp/inqueue.c | 9 +-- net/sctp/ipv6.c | 21 ++--- net/sctp/output.c | 40 ++++------ net/sctp/outqueue.c | 160 ++++++++++++++++--------------------- net/sctp/protocol.c | 48 +++++------ net/sctp/sm_make_chunk.c | 25 +++--- net/sctp/sm_sideeffect.c | 97 ++++++++++------------ net/sctp/sm_statefuns.c | 77 +++++++++++------- net/sctp/socket.c | 168 +++++++++++++++++++-------------------- net/sctp/transport.c | 49 ++++++------ 19 files changed, 410 insertions(+), 486 deletions(-)
Signature · 1 line
1.7.11.7
PATCH v2 1/2 lib: vsprintf: add IPv4/v6 generic %piS/%pIS format specifier
In order to avoid making code that deals with printing both, IPv4 and IPv6 addresses, unnecessary complicated as for example ...
if (sa.sa_family = AF_INET6)
printk("... %pI6 ...", sin6_addr);
else
printk("... %pI4 ...", sin_addr.s_addr);... it would be better to introduce a format specifier that can deal with those kind of situations internally; just as we have a "struct sockaddr" for generic mapping into "struct sockaddr_in" or "struct sockaddr_in6" as e.g. done in "union sctp_addr". Then, we could reduce the above statement into something like:
printk("... %pIS ..", &sockaddr);While we're at it, support for both %piS/%pIS, where 'S' stands for sockaddr, comes for free. In case our pointer is NULL, pointer() then deals with that already at an earlier point in time internally.
Likely, there are many other areas than just SCTP in the kernel to make use of this extension as well.
---
v1->v2:
- Added documentation into printk-formats.txt, thanks Vlad Yasevich
- Changed %pig/%pIg into %piS/%pIS, thanks Joe Perches
- Changed braces/indent in pointer(), thanks Joe Perches
- Also CC lkml, thanks Andy Shevchenko
Documentation/printk-formats.txt | 11 +++++++++++ lib/vsprintf.c | 16 ++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-)
Documentation/printk-formats.txt +11 -0
@@ -121,6 +121,17 @@ IPv6 addresses: print a compressed IPv6 address as described by http://tools.ietf.org/html/rfc5952 +Generic IPv4/IPv6 addresses: + + %pIS + %piS + + For printing an IP address without the need to distinguish weather it's + of type AF_INET or AF_INET6, a pointer to a 'struct sockaddr', specified + through 'IS' or 'iS', can be passed to this format specifier, which will + then be further processed by the above IPv4 ('I4', 'i4') or IPv6 ('I6', + 'i6') handler. + UUID/GUID addresses: %pUb 00010203-0405-0607-0809-0a0b0c0d0e0f
lib/vsprintf.c +14 -2
@@ -1004,10 +1004,10 @@ int kptr_restrict __read_mostly;* - 'MF' For a 6-byte MAC FDDI address, it prints the address * with a dash-separated hex notation * - '[mM]R' For a 6-byte MAC address, Reverse order (Bluetooth) -* - 'I' [46] for IPv4/IPv6 addresses printed in the usual way +* - 'I' [46S] for IPv4/IPv6 addresses printed in the usual way * IPv4 uses dot-separated decimal without leading 0's (1.2.3.4) * IPv6 uses colon separated network-order 16 bit hex with leading 0's -* - 'i' [46] for 'raw' IPv4/IPv6 addresses +* - 'i' [46S] for 'raw' IPv4/IPv6 addresses * IPv6 omits the colons (01020304...0f) * IPv4 uses dot-separated decimal with leading 0's (010.123.045.006) * - '[Ii]4[hnbl]' IPv4 addresses in host, network, big or little endian order
@@ -1093,6 +1093,16 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,return ip6_addr_string (buf, end, ptr, spec, fmt);case '4' :return ip4_addr_string (buf, end, ptr, spec, fmt); +case 'S' : { +const struct sockaddr *sa = ptr; + +if (sa->sa_family =AF_INET6 ) { + ptr = &((struct sockaddr_in6 *) sa)->sin6_addr; +return ip6_addr_string (buf, end, ptr, spec, fmt); + }else { + ptr = &((struct sockaddr_in *) sa)->sin_addr.s_addr; +return ip4_addr_string (buf, end, ptr, spec, fmt); + }} }break ;case 'U' :
@@ -1370,6 +1380,8 @@ qualifier:* %pI6 print an IPv6 address with colons * %pi6 print an IPv6 address without colons * %pI6c print an IPv6 address as specified by RFC 5952 +* %pIS depending on sa_family of 'struct sockaddr *' switch to %pI6/%pI4 +* %piS depending on sa_family of 'struct sockaddr *' switch to %pi6/%pi4 * %pU[bBlL] print a UUID/GUID in big or little endian using lower or upper * case. * %*ph[CDN] a variable-length hex string with a separator (supports up to 64
Signature · 1 line
1.7.11.7
PATCH v2 2/2 net: sctp: rework debugging framework to use pr_debug and friends
In reply to Daniel BorkmannWe should get rid of all own SCTP debug printk macros and use the ones that the kernel offers anyway instead. This makes the code more readable and conform to the kernel code, and offers all the features of dynamic debbuging that pr_debug() et al has, such as only turning on/off portions of debug messages at runtime through debugfs. The runtime cost of having CONFIG_DYNAMIC_DEBUG enabled, but none of the debug statements printing, is negligible [1]. If kernel debugging is completly turned off, then these statements will also compile into "empty" functions.
While we're at it, we also need to change the Kconfig option as it /now/ only refers to the ifdef'ed code portions in outqueue.c that enable further debugging/tracing of SCTP transaction fields. Also, since SCTP_ASSERT code was enabled with this Kconfig option and has now been removed, we transform those code parts into WARNs resp. where appropriate BUG_ONs so that those bugs can be more easily detected as probably not many people have SCTP debugging permanently turned on.
To turn on all SCTP debugging, the following steps are needed:
# mount -t debugfs none /sys/kernel/debug # echo -n 'module sctp +p' > /sys/kernel/debug/dynamic_debug/control
This can be done more fine-grained on a per file, per line basis and others as described in [2].
[1] https://www.kernel.org/doc/ols/2009/ols2009-pages-39-46.pdf
[2] Documentation/dynamic-debug-howto.txt
---
v1->v2:
- Changed WARN in sctp_assoc_rwnd_decrease() into pr_debug, thanks Vlad Yasevich
- Changed %pIg into %pIS, thanks Joe Perches
- Changed WARN in sctp_transport_update_rto() into pr_debug
(We do not have it when debugging is disabled, so pr_debug is better)
- Removed BUG_ON in sctp_transport_update_rto() since it's unnecessary (If it is NULL we would get a panic in the next instructions anyway)
- Rest is unchanged
future-work:
- Look for a way to get rid of SCTP_DBG_TSNS
include/net/sctp/sctp.h | 75 --------------------- net/sctp/Kconfig | 12 ++-- net/sctp/associola.c | 68 +++++++++---------- net/sctp/chunk.c | 5 +- net/sctp/debug.c | 4 -- net/sctp/endpointola.c | 5 +- net/sctp/input.c | 6 +- net/sctp/inqueue.c | 9 ++- net/sctp/ipv6.c | 21 +++--- net/sctp/output.c | 40 +++++------ net/sctp/outqueue.c | 160 ++++++++++++++++++++------------------------ net/sctp/protocol.c | 48 +++++++------- net/sctp/sm_make_chunk.c | 25 +++---- net/sctp/sm_sideeffect.c | 97 ++++++++++++--------------- net/sctp/sm_statefuns.c | 77 +++++++++++++--------- net/sctp/socket.c | 168 ++++++++++++++++++++++------------------------- net/sctp/transport.c | 49 +++++++------- 17 files changed, 385 insertions(+), 484 deletions(-)
include/net/sctp/sctp.h +0 -74
@@ -83,16 +83,6 @@#include <net/sctp/structs.h> #include <net/sctp/constants.h> - -/* Set SCTP_DEBUG flag via config if not already set. */ -#ifndef SCTP_DEBUG -#ifdef CONFIG_SCTP_DBG_MSG -#define SCTP_DEBUG 1 -#else -#define SCTP_DEBUG 0 -#endif /* CONFIG_SCTP_DBG */ -#endif /* SCTP_DEBUG */ -#ifdef CONFIG_IP_SCTP_MODULE #define SCTP_PROTOSW_FLAG 0#else /* static! */
@@ -270,61 +260,6 @@ static inline void sctp_max_rto(struct sctp_association *asoc, } } -/* Print debugging messages. */ -#if SCTP_DEBUG -extern int sctp_debug_flag; -#define SCTP_DEBUG_PRINTK(fmt, args...) \ -do { \ - if (sctp_debug_flag) \ - printk(KERN_DEBUG pr_fmt(fmt), ##args); \ -} while (0) -#define SCTP_DEBUG_PRINTK_CONT(fmt, args...) \ -do { \ - if (sctp_debug_flag) \ - pr_cont(fmt, ##args); \ -} while (0) -#define SCTP_DEBUG_PRINTK_IPADDR (fmt_lead, fmt_trail, \ - args_lead, addr, args_trail...) \ -do { \ - const union sctp_addr *_addr = (addr); \ - if (sctp_debug_flag) { \ - if (_addr->sa.sa_family = AF_INET6) { \ - printk(KERN_DEBUG \ - pr_fmt(fmt_lead "%pI6" fmt_trail), \ - args_lead, \ - &_addr->v6.sin6_addr, \ - args_trail); \ - } else { \ - printk(KERN_DEBUG \ - pr_fmt(fmt_lead "%pI4" fmt_trail), \ - args_lead, \ - &_addr->v4.sin_addr.s_addr, \ - args_trail); \ - } \ - } \ -} while (0) -#define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; } -#define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; } - -#define SCTP_ASSERT (expr, str, func) \ - if (!(expr)) { \ - SCTP_DEBUG_PRINTK("Assertion Failed: %s(%s) at %s:%s:%d\n", \ - str, (#expr), __FILE__, __func__, __LINE__); \ - func; \ - } - -#else /* SCTP_DEBUG */ - -#define SCTP_DEBUG_PRINTK(whatever...) -#define SCTP_DEBUG_PRINTK_CONT(fmt, args...) -#define SCTP_DEBUG_PRINTK_IPADDR(whatever...) -#define SCTP_ENABLE_DEBUG -#define SCTP_DISABLE_DEBUG -#define SCTP_ASSERT (expr, str, func) - -#endif /* SCTP_DEBUG */ - -/* * Macros for keeping a global reference of object allocations. */
@@ -597,16 +532,6 @@ static inline int param_type2af(__be16 type) } } -/* Perform some sanity checks. */ -static inline int sctp_sanity_check (void ) -{ -SCTP_ASSERT (sizeof (struct sctp_ulpevent ) <-sizeof (((struct sk_buff *)0 )->cb), - "SCTP: ulpevent does not fit in skb!\n", return 0); - -return 1 ; -} -/* Warning: The following hash functions assume a power of two 'size'. */ /* This is the hash function for the SCTP port hash table. */ static inline int sctp_phashfn (struct net *net,__u16 lport)
net/sctp/Kconfig +7 -5
@@ -30,7 +30,8 @@ menuconfig IP_SCTP homing at either or both ends of an association." To compile this protocol support as a module, choose M here: the - module will be called sctp. + module will be called sctp. Debug messages are handeled by the + kernel's dynamic debugging framework. If in doubt, say N.
@@ -48,13 +49,14 @@ config NET_SCTPPROBE To compile this code as a module, choose M here: the module will be called sctp_probe. -config SCTP_DBG_MSG - bool "SCTP: Debug messages" +config SCTP_DBG_TSNS + bool "SCTP: Debug transactions" help - If you say Y, this will enable verbose debugging messages. + If you say Y, this will enable transaction debugging, visible + from the kernel's dynamic debugging framework. If unsure, say N. However, if you are running into problems, use - this option to gather detailed trace information + this option to gather outqueue trace information. config SCTP_DBG_OBJCNT bool "SCTP: Debug object counts"
net/sctp/associola.c +34 -34
134 lines not on this page · raw message
net/sctp/chunk.c +3 -2
@@ -193,8 +193,9 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, msg->expires_at = jiffies +msecs_to_jiffies (sinfo->sinfo_timetolive); msg->can_abandon =1 ; -SCTP_DEBUG_PRINTK ("%s: msg:%p expires_at: %ld jiffies:%ld\n" , - __func__, msg, msg->expires_at, jiffies); + +pr_debug ("%s: msg:%p expires_at:%ld jiffies:%ld\n" , __func__, + msg, msg->expires_at, jiffies); }/* This is the biggest possible DATA chunk that can fit into
net/sctp/debug.c +0 -4
@@ -47,10 +47,6 @@#include <net/sctp/sctp.h> -#if SCTP_DEBUG -int sctp_debug_flag =1 ;/* Initially enable DEBUG */ -#endif /* SCTP_DEBUG */ -/* These are printable forms of Chunk ID's from section 3.1. */ static const char *const sctp_cid_tbl[SCTP_NUM_BASE_CHUNK_TYPES ] = {"DATA" ,
net/sctp/endpointola.c +4 -1
@@ -249,7 +249,10 @@ static void sctp_endpoint_destroy(struct sctp_endpoint *ep) {struct sock *sk; -SCTP_ASSERT (ep->base.dead,"Endpoint is not dead" , return); +if (unlikely (!ep->base.dead)) { +WARN (1 ,"Attempt to destroy undead endpoint %p!\n" , ep); +return ; + }/* Free the digest buffer */ kfree (ep->digest);
net/sctp/input.c +3 -3
@@ -454,8 +454,6 @@ void sctp_icmp_proto_unreachable(struct sock *sk, struct sctp_association *asoc, struct sctp_transport *t) { - SCTP_DEBUG_PRINTK("%s\n", __func__); - if (sock_owned_by_user(sk)) { if (timer_pending(&t->proto_unreach_timer)) return;
@@ -464,10 +462,12 @@ void sctp_icmp_proto_unreachable(struct sock *sk, jiffies + (HZ/20)))sctp_association_hold (asoc); } - }else {struct net *net =sock_net (sk); +pr_debug ("%s: unrecognized next header type " +"encountered!\n" , __func__); +if (del_timer (&t->proto_unreach_timer))sctp_association_put (asoc);
net/sctp/inqueue.c +4 -5
@@ -219,10 +219,10 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) chunk->end_of_packet =1 ; } -SCTP_DEBUG_PRINTK ("+++sctp_inq_pop+++ chunk %p[%s]," -" length %d, skb->len %d\n" ,chunk, -sctp_cname (SCTP_ST_CHUNK (chunk->chunk_hdr->type)), -ntohs (chunk->chunk_hdr->length), chunk->skb->len); +pr_debug ("+++sctp_inq_pop+++ chunk:%p[%s], length:%d, skb->len:%d\n" , + chunk,sctp_cname (SCTP_ST_CHUNK (chunk->chunk_hdr->type)), +ntohs (chunk->chunk_hdr->length), chunk->skb->len); +return chunk; }
@@ -238,4 +238,3 @@ void sctp_inq_set_th_handler(struct sctp_inq *q, work_func_t callback) {INIT_WORK (&q->immediate, callback); } -
net/sctp/ipv6.c +12 -9
@@ -239,9 +239,8 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport) fl6.daddr = *rt0->addr; } -SCTP_DEBUG_PRINTK ("%s: skb:%p, len:%d, src:%pI6 dst:%pI6\n" , - __func__, skb, skb->len, - &fl6.saddr, &fl6.daddr); +pr_debug ("%s: skb:%p, len:%d, src:%pI6 dst:%pI6\n" , __func__, skb, + skb->len, &fl6.saddr, &fl6.daddr);SCTP_INC_STATS (sock_net (sk),SCTP_MIB_OUTSCTPPACKS );
@@ -276,7 +275,7 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr,if (ipv6_addr_type (&daddr->v6.sin6_addr) &IPV6_ADDR_LINKLOCAL ) fl6->flowi6_oif = daddr->v6.sin6_scope_id; -SCTP_DEBUG_PRINTK ("%s: DST=%pI6 " , __func__, &fl6->daddr); +pr_debug ("%s: dst=%pI6 " , __func__, &fl6->daddr);if (asoc) fl6->fl6_sport =htons (asoc->base.bind_addr.port);
@@ -284,7 +283,8 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr,if (saddr) { fl6->saddr = saddr->v6.sin6_addr; fl6->fl6_sport = saddr->v6.sin6_port; -SCTP_DEBUG_PRINTK ("SRC=%pI6 - " , &fl6->saddr); + +pr_debug ("src=%pI6 - " , &fl6->saddr); } dst =ip6_dst_lookup_flow (sk, fl6,NULL , false);
@@ -348,13 +348,16 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr, out:if (!IS_ERR_OR_NULL (dst)) {struct rt6_info *rt; + rt = (struct rt6_info *)dst; t->dst = dst; -SCTP_DEBUG_PRINTK ("rt6_dst:%pI6 rt6_src:%pI6\n" , - &rt->rt6i_dst.addr, &fl6->saddr); + +pr_debug ("rt6_dst:%pI6 rt6_src:%pI6\n" , &rt->rt6i_dst.addr, + &fl6->saddr); }else { t->dst =NULL ; -SCTP_DEBUG_PRINTK ("NO ROUTE\n" ); + +pr_debug ("no route\n" ); } }
@@ -377,7 +380,7 @@ static void sctp_v6_get_saddr(struct sctp_sock *sk,struct flowi6 *fl6 = &fl->u.ip6;union sctp_addr *saddr = &t->saddr; -SCTP_DEBUG_PRINTK ("%s: asoc:%p dst:%p\n" , __func__, t->asoc, t->dst); +pr_debug ("%s: asoc:%p dst:%p\n" , __func__, t->asoc, t->dst);if (t->dst) { saddr->v6.sin6_family =AF_INET6 ;
net/sctp/output.c +17 -23
@@ -93,8 +93,7 @@ struct sctp_packet *sctp_packet_config(struct sctp_packet *packet, {struct sctp_chunk *chunk =NULL ; -SCTP_DEBUG_PRINTK ("%s: packet:%p vtag:0x%x\n" , __func__, - packet, vtag); +pr_debug ("%s: packet:%p vtag:0x%x\n" , __func__, packet, vtag); packet->vtag = vtag;
@@ -119,8 +118,7 @@ struct sctp_packet *sctp_packet_init(struct sctp_packet *packet,struct sctp_association *asoc = transport->asoc;size_t overhead; -SCTP_DEBUG_PRINTK ("%s: packet:%p transport:%p\n" , __func__, - packet, transport); +pr_debug ("%s: packet:%p transport:%p\n" , __func__, packet, transport); packet->transport = transport; packet->source_port = sport;
@@ -145,7 +143,7 @@ void sctp_packet_free(struct sctp_packet *packet) {struct sctp_chunk *chunk, *tmp; -SCTP_DEBUG_PRINTK ("%s: packet:%p\n" , __func__, packet); +pr_debug ("%s: packet:%p\n" , __func__, packet);list_for_each_entry_safe (chunk, tmp, &packet->chunk_list, list) {list_del_init (&chunk->list);
@@ -167,8 +165,7 @@ sctp_xmit_t sctp_packet_transmit_chunk(struct sctp_packet *packet,sctp_xmit_t retval;int error =0 ; -SCTP_DEBUG_PRINTK ("%s: packet:%p chunk:%p\n" , __func__, - packet, chunk); +pr_debug ("%s: packet:%p chunk:%p\n" , __func__, packet, chunk);switch ((retval = (sctp_packet_append_chunk (packet, chunk)))) {case SCTP_XMIT_PMTU_FULL :
@@ -334,8 +331,7 @@ sctp_xmit_t sctp_packet_append_chunk(struct sctp_packet *packet, {sctp_xmit_t retval =SCTP_XMIT_OK ; -SCTP_DEBUG_PRINTK ("%s: packet:%p chunk:%p\n" , __func__, packet, - chunk); +pr_debug ("%s: packet:%p chunk:%p\n" , __func__, packet, chunk);/* Data chunks are special. Before seeing what else we can * bundle into this packet, check to see if we are allowed to
@@ -402,7 +398,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)unsigned char *auth =NULL ;/* pointer to auth in skb data */ __u32 cksum_buf_len =sizeof (struct sctphdr ); -SCTP_DEBUG_PRINTK ("%s: packet:%p\n" , __func__, packet); +pr_debug ("%s: packet:%p\n" , __func__, packet);/* Do NOT generate a chunkless packet. */ if (list_empty (&packet->chunk_list))
@@ -472,7 +468,9 @@ int sctp_packet_transmit(struct sctp_packet *packet)* * [This whole comment explains WORD_ROUND() below.] */ -SCTP_DEBUG_PRINTK ("***sctp_transmit_packet***\n" ); + +pr_debug ("***sctp_transmit_packet***\n" ); +list_for_each_entry_safe (chunk, tmp, &packet->chunk_list, list) {list_del_init (&chunk->list);if (sctp_chunk_is_data (chunk)) {
@@ -505,16 +503,13 @@ int sctp_packet_transmit(struct sctp_packet *packet)memcpy (skb_put (nskb, chunk->skb->len), chunk->skb->data, chunk->skb->len); -SCTP_DEBUG_PRINTK ("%s %p[%s] %s 0x%x, %s %d, %s %d, %s %d\n" , -"*** Chunk" , chunk, -sctp_cname (SCTP_ST_CHUNK ( - chunk->chunk_hdr->type)), - chunk->has_tsn ?"TSN" :"No TSN" , - chunk->has_tsn ? -ntohl (chunk->subh.data_hdr->tsn) :0 , -"length" ,ntohs (chunk->chunk_hdr->length), -"chunk->skb->len" , chunk->skb->len, -"rtt_in_progress" , chunk->rtt_in_progress); +pr_debug ("*** Chunk:%p[%s] %s 0x%x, length:%d, chunk->skb->len:%d, " +"rtt_in_progress %d\n" , chunk, +sctp_cname (SCTP_ST_CHUNK (chunk->chunk_hdr->type)), + chunk->has_tsn ?"TSN" :"No TSN" , + chunk->has_tsn ?ntohl (chunk->subh.data_hdr->tsn) :0 , +ntohs (chunk->chunk_hdr->length), chunk->skb->len, + chunk->rtt_in_progress);/* * If this is a control chunk, this is our last
@@ -606,8 +601,7 @@ int sctp_packet_transmit(struct sctp_packet *packet) } } -SCTP_DEBUG_PRINTK ("***sctp_transmit_packet*** skb len %d\n" , - nskb->len); +pr_debug ("***sctp_transmit_packet*** skb->len:%d\n" , nskb->len); nskb->local_df = packet->ipfragok; (*tp->af_specific->sctp_xmit)(nskb, tp);
net/sctp/outqueue.c +70 -90
301 lines not on this page · raw message
net/sctp/protocol.c +25 -23
108 lines not on this page · raw message
net/sctp/sm_make_chunk.c +14 -11
@@ -741,7 +741,8 @@ struct sctp_chunk *sctp_make_sack(const struct sctp_association *asoc)memset (gabs,0 ,sizeof (gabs)); ctsn =sctp_tsnmap_get_ctsn (map); -SCTP_DEBUG_PRINTK ("sackCTSNAck sent: 0x%x.\n" , ctsn); + +pr_debug ("%s: sackCTSNAck sent:0x%x\n" , __func__, ctsn);/* How much room is needed in the chunk? */ num_gabs =sctp_tsnmap_num_gabs (map, gabs);
@@ -1287,10 +1288,8 @@ struct sctp_chunk *sctp_chunkify(struct sk_buff *skb,if (!retval) goto nodata; - -if (!sk) { -SCTP_DEBUG_PRINTK ("chunkifying skb %p w/o an sk\n" , skb); - } +if (!sk) +pr_debug ("%s: chunkifying skb:%p w/o an sk\n" , __func__, skb);INIT_LIST_HEAD (&retval->list); retval->skb = skb;
@@ -2191,8 +2190,9 @@ static sctp_ierror_t sctp_verify_param(struct net *net,break ; fallthrough:default : -SCTP_DEBUG_PRINTK ("Unrecognized param: %d for chunk %d.\n" , -ntohs (param.p->type), cid); +pr_debug ("%s: unrecognized param:%d for chunk:%d\n" , + __func__,ntohs (param.p->type), cid); + retval =sctp_process_unk_param (asoc, param, chunk, err_chunk);break ; }
@@ -2516,7 +2516,7 @@ do_addr_param:break ;case SCTP_PARAM_HOST_NAME_ADDRESS : -SCTP_DEBUG_PRINTK ("unimplemented SCTP_HOST_NAME_ADDRESS\n" ); +pr_debug ("%s: unimplemented SCTP_HOST_NAME_ADDRESS\n" , __func__);break ;case SCTP_PARAM_SUPPORTED_ADDRESS_TYPES :
@@ -2662,8 +2662,8 @@ fall_through:* called prior to this routine. Simply log the error * here. */ -SCTP_DEBUG_PRINTK ("Ignoring param: %d for association %p.\n" , -ntohs (param.p->type), asoc); +pr_debug ("%s: ignoring param:%d for association:%p.\n" , + __func__,ntohs (param.p->type), asoc);break ; }
@@ -2805,7 +2805,10 @@ struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *asoc, totallen += paramlen; totallen += addr_param_len; del_pickup =1 ; -SCTP_DEBUG_PRINTK ("mkasconf_update_ip: picked same-scope del_pending addr, totallen for all addresses is %d\n" , totallen); + +pr_debug ("%s: picked same-scope del_pending addr, " +"totallen for all addresses is %d\n" , + __func__, totallen); } }
net/sctp/sm_sideeffect.c +41 -56
190 lines not on this page · raw message
net/sctp/sm_statefuns.c +47 -30
205 lines not on this page · raw message
net/sctp/socket.c +80 -88
430 lines not on this page · raw message
net/sctp/transport.c +24 -25
85 lines not on this page · raw message
Signature · 1 line
1.7.11.7
Re: [PATCH net-next v2 2/2] net: sctp: rework debugging framework to use pr_debug and friends
Quoted 1 line · Daniel Borkmann
- Changed %pIg into %pIS, thanks Joe Perches
Hi Daniel.
net/sctp/associola.c
Quoted 1 line
net/sctp/associola.c +0
-0
[]
net/sctp/associola.c void sctp_assoc_rm_peer(struct sctp_association *asoc, · line 545
Quoted 3 lines
net/sctp/associola.c +3
-0+pr_debug ("%s: association:%p addr:%pIS port:%d\n" , + __func__, asoc, &peer->ipaddr.sa, +ntohs (peer->ipaddr.v4.sin_port));
This is why I think %pIS should have an option to print port/flow, etc.
In this case it's using v4 and you are mixing unknown and known forms. It looks untidy. You should probably use peer->sa.sin_port instead.
net/sctp/associola.c struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc, · line 642
Quoted 12 lines
net/sctp/associola.c +2
-6@@ -636,12 +638,8 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,/* AF_INET and AF_INET6 share common port field. */ port =ntohs (addr->v4.sin_port); -SCTP_DEBUG_PRINTK_IPADDR ("sctp_assoc_add_peer:association %p addr: " , -" port: %d state:%d\n" , - asoc, - addr, - port, - peer_state); +pr_debug ("%s: association:%p addr:%pIS port:%d state:%d\n" , __func__, + asoc, &addr->sa,port , peer_state);
here too, but port may be unused when !CONFIG_DEBUG
I didn't look at the rest of the patch.
Re: [PATCH net-next v2 2/2] net: sctp: rework debugging framework to use pr_debug and friends
Quoted 5 lines · Joe Perches
Quoted 1 line · Daniel Borkmann
- Changed %pIg into %pIS, thanks Joe Perches
Hi Daniel.
Quoted 8 lines
net/sctp/associola.c
Quoted 1 line
net/sctp/associola.c +0
-0[]
net/sctp/associola.c void sctp_assoc_rm_peer(struct sctp_association *asoc, · line 545
Quoted 3 lines
net/sctp/associola.c +3
-0+pr_debug ("%s: association:%p addr:%pIS port:%d\n" , + __func__, asoc, &peer->ipaddr.sa, +ntohs (peer->ipaddr.v4.sin_port));This is why I think %pIS should have an option to print port/flow, etc.
Ok, agreed, that will be more clean and can be applied there.
I'll work that in, and when finished send a 3rd version of the set.
Thanks Joe!
Quoted 20 lines
In this case it's using v4 and you are mixing unknown and known forms. It looks untidy. You should probably use
peer->sa.sin_portinstead.net/sctp/associola.c struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc, · line 642
Quoted 12 lines
net/sctp/associola.c +2
-6@@ -636,12 +638,8 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,/* AF_INET and AF_INET6 share common port field. */ port =ntohs (addr->v4.sin_port); -SCTP_DEBUG_PRINTK_IPADDR ("sctp_assoc_add_peer:association %p addr: " , -" port: %d state:%d\n" , - asoc, - addr, - port, - peer_state); +pr_debug ("%s: association:%p addr:%pIS port:%d state:%d\n" , __func__, + asoc, &addr->sa,port , peer_state);here too, but port may be unused when !CONFIG_DEBUG
I didn't look at the rest of the patch.