2017-08-13 05:27:28 +03:00
/*
* Copyright ( c ) 2016 Fabien Siron < fabien . siron @ epita . fr >
* Copyright ( c ) 2017 JingPiao Chen < chenjingpiao @ gmail . com >
2018-10-30 11:09:10 +03:00
* Copyright ( c ) 2016 - 2018 The strace developers .
2017-08-13 05:27:28 +03:00
* All rights reserved .
*
2018-12-10 03:00:00 +03:00
* SPDX - License - Identifier : LGPL - 2.1 - or - later
2017-08-13 05:27:28 +03:00
*/
# include "defs.h"
# ifdef HAVE_STRUCT_NETCONFMSG
# include "netlink_route.h"
2017-08-15 07:41:20 +03:00
# include "nlattr.h"
2017-08-13 05:27:28 +03:00
# include "print_fields.h"
# include <linux / netconf.h>
2017-08-15 07:41:20 +03:00
# include "netlink.h"
# include "xlat / rtnl_netconf_attrs.h"
2017-08-13 05:27:28 +03:00
2017-08-27 20:18:20 +03:00
static const nla_decoder_t netconfmsg_nla_decoders [ ] = {
[ NETCONFA_IFINDEX ] = decode_nla_ifindex ,
[ NETCONFA_FORWARDING ] = decode_nla_s32 ,
[ NETCONFA_RP_FILTER ] = decode_nla_s32 ,
[ NETCONFA_MC_FORWARDING ] = decode_nla_s32 ,
[ NETCONFA_PROXY_NEIGH ] = decode_nla_s32 ,
[ NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN ] = decode_nla_s32 ,
2018-08-19 16:29:06 +03:00
[ NETCONFA_INPUT ] = decode_nla_s32 ,
[ NETCONFA_BC_FORWARDING ] = decode_nla_s32 ,
2017-08-27 20:18:20 +03:00
} ;
2017-08-13 05:27:28 +03:00
DECL_NETLINK_ROUTE_DECODER ( decode_netconfmsg )
{
struct netconfmsg ncm = { . ncm_family = family } ;
PRINT_FIELD_XVAL ( " { " , ncm , ncm_family , addrfams , " AF_??? " ) ;
tprints ( " } " ) ;
2017-08-15 07:41:20 +03:00
const size_t offset = NLMSG_ALIGN ( sizeof ( ncm ) ) ;
if ( len > offset ) {
tprints ( " , " ) ;
decode_nlattr ( tcp , addr + offset , len - offset ,
rtnl_netconf_attrs , " NETCONFA_??? " ,
2017-08-27 20:18:20 +03:00
netconfmsg_nla_decoders ,
ARRAY_SIZE ( netconfmsg_nla_decoders ) , NULL ) ;
2017-08-15 07:41:20 +03:00
}
2017-08-13 05:27:28 +03:00
}
# endif