Monthly Archives: December 2015
Define your own custom conversion specifiers for printf.

In this example we define two specifiers: %P, %W.
%P -> prints IPv4 address from struct in_addr.
%W -> prints IPv6 address from struct in6_addr.

Example code: ( The GNU C Library only. )

Check that network interface is in Promiscuous mode

ifconfig or ip link does not show actual interface promisc status, but we can use this:

if 0 -> not
if 1 -> interface is in promisc mode