(root)/
strace-6.5/
src/
rtnl_netconf.c
       1  /*
       2   * Copyright (c) 2016 Fabien Siron <fabien.siron@epita.fr>
       3   * Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com>
       4   * Copyright (c) 2016-2021 The strace developers.
       5   * All rights reserved.
       6   *
       7   * SPDX-License-Identifier: LGPL-2.1-or-later
       8   */
       9  
      10  #include "defs.h"
      11  
      12  #include "netlink_route.h"
      13  #include "nlattr.h"
      14  
      15  #include <linux/netconf.h>
      16  #include "netlink.h"
      17  
      18  #include "xlat/rtnl_netconf_attrs.h"
      19  
      20  static const nla_decoder_t netconfmsg_nla_decoders[] = {
      21  	[NETCONFA_IFINDEX]			= decode_nla_ifindex,
      22  	[NETCONFA_FORWARDING]			= decode_nla_s32,
      23  	[NETCONFA_RP_FILTER]			= decode_nla_s32,
      24  	[NETCONFA_MC_FORWARDING]		= decode_nla_s32,
      25  	[NETCONFA_PROXY_NEIGH]			= decode_nla_s32,
      26  	[NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN]	= decode_nla_s32,
      27  	[NETCONFA_INPUT]			= decode_nla_s32,
      28  	[NETCONFA_BC_FORWARDING]		= decode_nla_s32,
      29  };
      30  
      31  DECL_NETLINK_ROUTE_DECODER(decode_netconfmsg)
      32  {
      33  	struct netconfmsg ncm = { .ncm_family = family };
      34  
      35  	tprint_struct_begin();
      36  	PRINT_FIELD_XVAL(ncm, ncm_family, addrfams, "AF_???");
      37  	tprint_struct_end();
      38  
      39  	const size_t offset = NLMSG_ALIGN(sizeof(ncm));
      40  	if (len > offset) {
      41  		tprint_array_next();
      42  		decode_nlattr(tcp, addr + offset, len - offset,
      43  			      rtnl_netconf_attrs, "NETCONFA_???",
      44  			      netconfmsg_nla_decoders,
      45  			      ARRAY_SIZE(netconfmsg_nla_decoders), NULL);
      46  	}
      47  }