Mirror of strace – the linux syscall tracer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rtnl_netconf.c 1.3KB

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