[PATCH v2 05/25] netlink: add a basic rtnetlink parser of rule messages

Dmitry V. Levin ldv at altlinux.org
Mon Aug 14 01:19:16 UTC 2017


On Sun, Aug 13, 2017 at 10:22:23AM +0800, JingPiao Chen wrote:
> * defs.h (routing_table_ids): New xlat prototype.
> * netlink_route.c: New file.
> * Makefile.am (strace_SOURCES): Add it.
> * defs.h (ip_type_of_services,
> routing_table_ids): New xlat prototypes.
> * netlink_route.h (decode_fib_rule_hdr): New prototype.
> * configure.ac (AC_CHECK_HEADERS): Add linux/fib_rules.h.
> * netlink_route.c (route_decoders): Add RTM_DELRULE,
> RTM_GETRULE and RTM_NEWRULE.
> * xlat/fib_rule_actions.in: New file.
> * xlat/fib_rule_flags.in: Likewise.
[...]
> +#include "defs.h"
> +
> +#include "netlink_route.h"
> +#include "print_fields.h"
> +
> +#ifdef HAVE_LINUX_FIB_RULES_H
> +# include <linux/fib_rules.h>
> +#endif
> +
> +#include "xlat/fib_rule_actions.h"
> +#include "xlat/fib_rule_flags.h"
> +
> +DECL_NETLINK_ROUTE_DECODER(decode_fib_rule_hdr)
> +{
> +	/*
> +	 * struct rtmsg and struct fib_rule_hdr are essentially
> +	 * the same structure, use struct rtmsg but treat it as
> +	 * struct fib_rule_hdr.
> +	 */
> +	struct rtmsg msg = { .rtm_family = family };

If <linux/fib_rules.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/c6c113ef/attachment.bin>


More information about the Strace-devel mailing list