Rework SCTP debugging framework
Subsystems (6)
v4 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-v4 please have a look into the individual patches.
Thanks for feedback/comments to Vlad Yasevich, Neil Horman, Joe Perches, Andy Shevchenko.
Daniel Borkmann (2):
lib: vsprintf: add IPv4/v6 generic %p[Ii]S[pfs] format specifier
net: sctp: rework debugging framework to use pr_debug and friends
Documentation/printk-formats.txt | 32 ++++++++ include/net/sctp/sctp.h | 75 ----------------- lib/vsprintf.c | 124 ++++++++++++++++++++++++++++- net/sctp/Kconfig | 12 +-- net/sctp/associola.c | 67 ++++++++-------- 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 | 96 ++++++++++------------ net/sctp/sm_statefuns.c | 77 +++++++++++------- net/sctp/socket.c | 168 +++++++++++++++++++-------------------- net/sctp/transport.c | 49 ++++++------ 19 files changed, 537 insertions(+), 486 deletions(-)
Signature · 1 line
1.7.11.7
PATCH v4 1/2 lib: vsprintf: add IPv4/v6 generic %p[Ii]S[pfs] 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);In case our pointer is NULL, pointer() then deals with that already at an earlier point in time internally. While we're at it, support for both %piS/%pIS, where 'S' stands for sockaddr, comes (almost) for free.
Additionally to that, postfix specifiers 'p', 'f' and 's' are supported as suggested and initially implemented in 2009 by Joe Perches [1]. Handling of those additional specifiers orientate on the initial RFC that was proposed. Also we support IPv6 compressed format specified by 'c' and various other IPv4 extensions as stated in the documentation part.
Likely, there are many other areas than just SCTP in the kernel to make use of this extension as well.
[1] http://patchwork.ozlabs.org/patch/31480/
---
v1->v2:
- Added documentation into printk-formats.txt
- Changed %pig/%pIg into %piS/%pIS
- Changed braces/indent in pointer()
- Also CC lkml
v2->v3:
- Reworked entire patch to include port, flowinfo, scope and others
- Various printk tests with these new specifiers
- Improved documentation
v3->v4:
- Applied Joe's feedback, 'p' et al can be on various positions in v4 print handler, so make it similar to v6
Documentation/printk-formats.txt | 32 ++++++++++ lib/vsprintf.c | 124 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 154 insertions(+), 2 deletions(-)
Documentation/printk-formats.txt +32 -0
@@ -121,6 +121,38 @@ IPv6 addresses: print a compressed IPv6 address as described by http://tools.ietf.org/html/rfc5952 +IPv4/IPv6 addresses (generic, with port, flowinfo, scope): + + %pIS 1.2.3.4 or 0001:0002:0003:0004:0005:0006:0007:0008 + %piS 001.002.003.004 or 00010002000300040005000600070008 + %pISc 1.2.3.4 or 1:2:3:4:5:6:7:8 + %pISpc 1.2.3.4:12345 or [1:2:3:4:5:6:7:8]:12345 + %p[Ii]S[pfschnbl] + + For printing an IP address without the need to distinguish whether it's + of type AF_INET or AF_INET6, a pointer to a valid 'struct sockaddr', + specified through 'IS' or 'iS', can be passed to this format specifier. + + The additional 'p', 'f', and 's' specifiers are used to specify port + (IPv4, IPv6), flowinfo (IPv6) and scope (IPv6). Ports have a ':' prefix, + flowinfo a '/' and scope a '%', each followed by the actual value. + + In case of an IPv6 address the compressed IPv6 address as described by + http://tools.ietf.org/html/rfc5952 is being used if the additional + specifier 'c' is given. The IPv6 address is surrounded by '[', ']' in + case of additional specifiers 'p', 'f' or 's' as suggested by + https://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-07 + + In case of IPv4 addresses, the additional 'h', 'n', 'b', and 'l' + specifiers can be used as well and are ignored in case of an IPv6 + address. + + Further examples: + + %pISfc 1.2.3.4 or [1:2:3:4:5:6:7:8]/123456789 + %pISsc 1.2.3.4 or [1:2:3:4:5:6:7:8]%1234567890 + %pISpfc 1.2.3.4:12345 or [1:2:3:4:5:6:7:8]:12345/123456789 + UUID/GUID addresses: %pUb 00010203-0405-0607-0809-0a0b0c0d0e0f
lib/vsprintf.c +122 -2
151 lines not on this page · raw message
Signature · 1 line
1.7.11.7
Re: [PATCH net-next v4 1/2] lib: vsprintf: add IPv4/v6 generic %p[Ii]S[pfs] format specifier
Quoted 2 lines · Daniel Borkmann
In order to avoid making code that deals with printing both, IPv4 and IPv6 addresses, unnecessary complicated as for example ...
Looks good to me.
Thanks Daniel for keeping at it.
PATCH v4 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 %pIg into %pIS
- Changed WARN in sctp_assoc_rwnd_decrease() into pr_debug
- 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
v2->v3:
- Updated %pIS occurences to include port where appropriate
v3->v4:
- Unchanged
follow-up work next week:
- Get rid of Kconfig option 'SCTP_DBG_TSNS' and see if we can remove most of that ifdef'd code (already discussed with Vlad and Neil)
include/net/sctp/sctp.h | 75 --------------------- net/sctp/Kconfig | 12 ++-- net/sctp/associola.c | 67 ++++++++++--------- 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 | 96 +++++++++++---------------- net/sctp/sm_statefuns.c | 77 +++++++++++++--------- net/sctp/socket.c | 168 ++++++++++++++++++++++------------------------- net/sctp/transport.c | 49 +++++++------- 17 files changed, 383 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 +33 -34
133 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 +40 -56
189 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 v4 2/2] net: sctp: rework debugging framework to use pr_debug and friends
net/sctp/associola.c void sctp_assoc_rm_peer(struct sctp_association *asoc, · line 544
Quoted 11 lines · Daniel Borkmann
net/sctp/associola.c +2
-5@@ -536,11 +540,8 @@ void sctp_assoc_rm_peer(struct sctp_association *asoc,struct list_head *pos;struct sctp_transport *transport; -SCTP_DEBUG_PRINTK_IPADDR ("sctp_assoc_rm_peer:association %p addr: " , -" port: %d\n" , - asoc, - (&peer->ipaddr), -ntohs (peer->ipaddr.v4.sin_port)); +pr_debug ("%s: association:%p addr:%pISpc\n" , + __func__, asoc, &peer->ipaddr.sa);
Hi again Daniel.
Perhaps the format is better written as "%pIScp" with the port after the compression as that's how the actual output would be produced.
Review struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
Quoted 1 line
(quoted diff) +0
-0@@ -636,12 +637,8 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
[]
net/sctp/associola.c struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc, · line 641
Quoted 2 lines
net/sctp/associola.c +2
-0+pr_debug ("%s: association:%p addr:%pISpc state:%d\n" , __func__, + asoc, &addr->sa, peer_state);
etc...
net/sctp/associola.c void sctp_assoc_rwnd_increase(struct sctp_association *asoc, unsigned int len) · line 1464
Quoted 2 lines
net/sctp/associola.c +2
-0+ pr_debug("%s: sending window update SACK- asoc:%p rwnd:%u " + "a_rwnd:%u\n", __func__, asoc, asoc->rwnd,
Please coalesce formats. It doesn't matter if the coalesced format exceeds 80 cols.
pr_debug("%s: sending window update SACK - asoc:%p rwnd:%u a_rwnd:%u\n",
__func__, asoc, asoc->rwnd, asoc->a_rwnd);btw: what I try to do with formats and args is to use a single line when it fits 80 cols and otherwise put all arguments after the format on a separate line.
etc...
Re: [PATCH net-next v4 2/2] net: sctp: rework debugging framework to use pr_debug and friends
Quoted 16 lines · Joe Perches
net/sctp/associola.c void sctp_assoc_rm_peer(struct sctp_association *asoc, · line 544
Quoted 11 lines · Daniel Borkmann
net/sctp/associola.c +2
-5@@ -536,11 +540,8 @@ void sctp_assoc_rm_peer(struct sctp_association *asoc,struct list_head *pos;struct sctp_transport *transport; -SCTP_DEBUG_PRINTK_IPADDR ("sctp_assoc_rm_peer:association %p addr: " , -" port: %d\n" , - asoc, - (&peer->ipaddr), -ntohs (peer->ipaddr.v4.sin_port)); +pr_debug ("%s: association:%p addr:%pISpc\n" , + __func__, asoc, &peer->ipaddr.sa);Hi again Daniel.
Quoted 3 lines
Perhaps the format is better written as "%pIScp" with the port after the compression as that's how the actual output would be produced.
Actually it really doesn't matter. One could also argue that this way it's from generic to specific ... i.e. "%pISp" is the generic part as it's valid for both IPv4/IPv6, and "c" is a IPv6-specific appendix.
Quoted 13 lines
Review struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
Quoted 1 line
(quoted diff) +0
-0@@ -636,12 +637,8 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,[]
net/sctp/associola.c struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc, · line 641
Quoted 2 lines
net/sctp/associola.c +2
-0+pr_debug ("%s: association:%p addr:%pISpc state:%d\n" , __func__, + asoc, &addr->sa, peer_state);etc...
net/sctp/associola.c void sctp_assoc_rwnd_increase(struct sctp_association *asoc, unsigned int len) · line 1464
Quoted 2 lines
net/sctp/associola.c +2
-0+ pr_debug("%s: sending window update SACK- asoc:%p rwnd:%u " + "a_rwnd:%u\n", __func__, asoc, asoc->rwnd,Please coalesce formats. It doesn't matter if the coalesced format exceeds 80 cols.
Quoted 7 lines
pr_debug("%s: sending window update SACK - asoc:%p rwnd:%u a_rwnd:%u\n", __func__, asoc, asoc->rwnd, asoc->a_rwnd);btw: what I try to do with formats and args is to use a single line when it fits 80 cols and otherwise put all arguments after the format on a separate line.
Hm, as this is something cosmetic, really really minor and does not concern all pr_debugs, are you okay if I "fix" some of them (where appropriate) as a follow-up? Thanks !
Re: [PATCH net-next v4 2/2] net: sctp: rework debugging framework to use pr_debug and friends
Quoted 17 lines · Daniel Borkmann
Quoted 16 lines · Joe Perches
net/sctp/associola.c void sctp_assoc_rm_peer(struct sctp_association *asoc, · line 544
Quoted 11 lines · Daniel Borkmann
net/sctp/associola.c +2
-5@@ -536,11 +540,8 @@ void sctp_assoc_rm_peer(struct sctp_association *asoc,struct list_head *pos;struct sctp_transport *transport; -SCTP_DEBUG_PRINTK_IPADDR ("sctp_assoc_rm_peer:association %p addr: " , -" port: %d\n" , - asoc, - (&peer->ipaddr), -ntohs (peer->ipaddr.v4.sin_port)); +pr_debug ("%s: association:%p addr:%pISpc\n" , + __func__, asoc, &peer->ipaddr.sa);Hi again Daniel.
Quoted 7 lines
Quoted 3 lines
Perhaps the format is better written as "%pIScp" with the port after the compression as that's how the actual output would be produced.
Actually it really doesn't matter. One could also argue that this way it's from generic to specific ... i.e. "%pISp" is the generic part as it's valid for both IPv4/IPv6, and "c" is a IPv6-specific appendix.
<shrug> I read left to right. The ipv6 bit comes first. Also, I'm not demanding, just suggesting.
Quoted 7 lines
Quoted 7 lines
Review struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
Quoted 1 line
(quoted diff) +0
-0@@ -636,12 +637,8 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,[]
net/sctp/associola.c struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc, · line 641
Quoted 2 lines
net/sctp/associola.c +2
-0+pr_debug ("%s: association:%p addr:%pISpc state:%d\n" , __func__, + asoc, &addr->sa, peer_state);etc...
Quoted 5 lines
Quoted 5 lines
net/sctp/associola.c void sctp_assoc_rwnd_increase(struct sctp_association *asoc, unsigned int len) · line 1464
Quoted 2 lines
net/sctp/associola.c +2
-0+ pr_debug("%s: sending window update SACK- asoc:%p rwnd:%u " + "a_rwnd:%u\n", __func__, asoc, asoc->rwnd,Please coalesce formats. It doesn't matter if the coalesced format exceeds 80 cols.
[]
Quoted 3 lines
Hm, as this is something cosmetic, really really minor and does not concern all
pr_debugs, are you okay if I "fix" some of them (where appropriate) as a follow-up? Thanks !
'course.
Please do run your patches through checkpatch though.
David Miller
maintainerFrom: Daniel Borkmann <[email protected]>
Date: Fri, 28 Jun 2013 19:49:38 +0200
Quoted 6 lines
Please see patch 2 for a detailed description. Tested with lksctp-tools suite and other stress tests. For the changes between v1-v4 please have a look into the individual patches.
Thanks for feedback/comments to Vlad Yasevich, Neil Horman, Joe Perches, Andy Shevchenko.
Both applied, thanks Daniel.