[PATCH v2 07/25] netlink: add a basic rtnetlink parser of neigh messages

Dmitry V. Levin ldv at altlinux.org
Mon Aug 14 01:22:09 UTC 2017


On Sun, Aug 13, 2017 at 10:22:25AM +0800, JingPiao Chen wrote:
> * rtnl_neigh.c: New file.
> * Makefile.am (strace_SOURCES): Add it.
> * netlink_route.h (decode_ndmsg, decode_rtm_getneigh): New prototypes.
> * configure.ac (AC_CHECK_HEADERS): Add linux/neighbour.h.
> * netlink_route.c (route_decoders): Add RTM_DELNEIGH,
> RTM_DELNEIGH and RTM_NEWNEIGH.
> * xlat/nda_types.in: New file.
> * xlat/neighbor_cache_entry_flags.in: Likewise.
> * xlat/neighbor_cache_entry_states.in: Likewise.
[...]
> +#include "defs.h"
> +#include "netlink_route.h"
> +#include "print_fields.h"
> +
> +#include <sys/socket.h>
> +#ifdef HAVE_LINUX_NEIGHBOUR_H
> +# include <linux/neighbour.h>
> +#endif
> +
> +#include "xlat/nda_types.h"
> +#include "xlat/neighbor_cache_entry_flags.h"
> +#include "xlat/neighbor_cache_entry_states.h"
> +
> +DECL_NETLINK_ROUTE_DECODER(decode_ndmsg)
> +{
> +	struct ndmsg ndmsg = { .ndm_family = family };

If <linux/neighbour.h> is not available, then <linux/rtnetlink.h>
has to be used, 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/5a74e0c5/attachment.bin>


More information about the Strace-devel mailing list