Do you know any way to print in readable format an ipv6 address and its port from the inet_sock struct?
My question has two parts. One is which are the structure members that have this information and the second is how to print them in readable format.
Thanks!
printkhas new modifiers which help printing inet addresses (I think since kernel 2.6.24). So you can try several ways, as an example:Here’s how many modifiers you have and how they print the IPv6 address. You can check http://www.kernel.org/doc/Documentation/printk-formats.txt for more info.
For older kernels you need to use NIP6 like this:
As a last note, you can check net/ipv6/tcp_ipv6.c from the kernel itself. It has tons of examples. Hope this helps you