net: shell: Add IPv6 fragmentation info printing

If the IPv6 fragmentation support is enabled, then print current
status of the IPv6 packet reassembly in "net conn" command.

Change-Id: I384e35928b67dd39ac720c77683b1767e2a1ce88
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2017-03-29 15:42:37 +03:00
commit 70cdaba202

View file

@ -484,6 +484,27 @@ static void tcp_cb(struct net_tcp *tcp, void *user_data)
}
#endif
#if defined(CONFIG_NET_IPV6_FRAGMENT)
static void ipv6_frag_cb(struct net_ipv6_reassembly *reass,
void *user_data)
{
int *count = user_data;
char src[ADDR_LEN];
if (!*count) {
printk("\nIPv6 reassembly Id Remain Src\t\t\t\tDst\n");
}
snprintk(src, ADDR_LEN, "%s", net_sprint_ipv6_addr(&reass->src));
printk("%p 0x%08x %5d %s\t%s\n",
reass, reass->id, k_delayed_work_remaining_get(&reass->timer),
src, net_sprint_ipv6_addr(&reass->dst));
(*count)++;
}
#endif /* CONFIG_NET_IPV6_FRAGMENT */
#if defined(CONFIG_NET_DEBUG_NET_BUF)
static void allocs_cb(struct net_buf *buf,
const char *func_alloc,
@ -566,6 +587,14 @@ static int shell_cmd_conn(int argc, char *argv[])
}
#endif
#if defined(CONFIG_NET_IPV6_FRAGMENT)
count = 0;
net_ipv6_frag_foreach(ipv6_frag_cb, &count);
/* Do not print anything if no fragments are pending atm */
#endif
return 0;
}