[PATCH v2 01/25] netlink: add a basic rtnetlink parser of addr messages

Dmitry V. Levin ldv at altlinux.org
Mon Aug 14 00:55:28 UTC 2017


On Sun, Aug 13, 2017 at 10:22:19AM +0800, JingPiao Chen wrote:
> * rtnl_addr.c: New file.
> * Makefile.am (strace_SOURCES): Add it.
> * configure.ac (AC_CHECK_HEADERS): Add linux/if_addr.h.
> * netlink_route.h (decode_ifaddrmsg): New prototype.
> * netlink_route.c (route_decoders): Add RTM_DELADDR,
> RTM_GETADDR, RTM_GETANYCAST, RTM_GETMULTICAST add RTM_NEWADDR.
> * xlat/ifaddrflags.in: New file.
> * xlat/routing_scopes.in: Likewise.
[...]
> +#include "defs.h"
> +#include "netlink_route.h"
> +#include "print_fields.h"
> +
> +#ifdef HAVE_LINUX_IF_ADDR_H
> +# include <linux/if_addr.h>
> +#endif
> +
> +#include "xlat/ifaddrflags.h"
> +#include "xlat/routing_scopes.h"
> +
> +DECL_NETLINK_ROUTE_DECODER(decode_ifaddrmsg)
> +{
> +	struct ifaddrmsg ifaddr = { .ifa_family = family };

struct ifaddrmsg used to be defined in <linux/rtnetlink.h>.
If <linux/if_addr.h> is not available, then <linux/rtnetlink.h> has to be
used instead, otherwise the code won't compile on older systems.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170814/158a457e/attachment.bin>


More information about the Strace-devel mailing list