Skip to content

Commit df3d38c

Browse files
jukkarAnas Nashif
authored andcommitted
net: shell: Enhance IPv6 fragmentation debugging prints
Print also network buffers that are allocated by the IPv6 fragment handler. This is very useful in debugging. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 70253f2 commit df3d38c

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

subsys/net/ip/net_shell.c

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,17 +576,37 @@ static void ipv6_frag_cb(struct net_ipv6_reassembly *reass,
576576
{
577577
int *count = user_data;
578578
char src[ADDR_LEN];
579+
int i;
579580

580581
if (!*count) {
581-
printk("\nIPv6 reassembly Id Remain Src\t\t\t\tDst\n");
582+
printk("\nIPv6 reassembly Id Remain Src \tDst\n");
582583
}
583584

584585
snprintk(src, ADDR_LEN, "%s", net_sprint_ipv6_addr(&reass->src));
585586

586-
printk("%p 0x%08x %5d %s\t%s\n",
587+
printk("%p 0x%08x %5d %16s\t%16s\n",
587588
reass, reass->id, k_delayed_work_remaining_get(&reass->timer),
588589
src, net_sprint_ipv6_addr(&reass->dst));
589590

591+
for (i = 0; i < NET_IPV6_FRAGMENTS_MAX_PKT; i++) {
592+
if (reass->pkt[i]) {
593+
struct net_buf *frag = reass->pkt[i]->frags;
594+
595+
printk("[%d] pkt %p->", i, reass->pkt[i]);
596+
597+
while (frag) {
598+
printk("%p", frag);
599+
600+
frag = frag->frags;
601+
if (frag) {
602+
printk("->");
603+
}
604+
}
605+
606+
printk("\n");
607+
}
608+
}
609+
590610
(*count)++;
591611
}
592612
#endif /* CONFIG_NET_IPV6_FRAGMENT */

0 commit comments

Comments
 (0)