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_tc_action.c 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. #include "netlink_route.h"
  11. #include "nlattr.h"
  12. #include "print_fields.h"
  13. #include "netlink.h"
  14. #include <linux/rtnetlink.h>
  15. #include "xlat/rtnl_tc_action_attrs.h"
  16. static const nla_decoder_t tcamsg_nla_decoders[] = {
  17. [TCA_ACT_KIND] = decode_nla_str,
  18. [TCA_ACT_OPTIONS] = NULL, /* unimplemented */
  19. [TCA_ACT_INDEX] = decode_nla_u32,
  20. [TCA_ACT_STATS] = decode_nla_tc_stats,
  21. [TCA_ACT_PAD] = NULL,
  22. [TCA_ACT_COOKIE] = NULL /* default parser */
  23. };
  24. DECL_NETLINK_ROUTE_DECODER(decode_tcamsg)
  25. {
  26. struct tcamsg tca = { .tca_family = family };
  27. PRINT_FIELD_XVAL("{", tca, tca_family, addrfams, "AF_???");
  28. tprints("}");
  29. const size_t offset = NLMSG_ALIGN(sizeof(tca));
  30. if (len > offset) {
  31. tprints(", ");
  32. decode_nlattr(tcp, addr + offset, len - offset,
  33. rtnl_tc_action_attrs, "TCA_ACT_???",
  34. tcamsg_nla_decoders,
  35. ARRAY_SIZE(tcamsg_nla_decoders), NULL);
  36. }
  37. }