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_dcb.c 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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_DCBMSG
  11. # include "netlink_route.h"
  12. # include "nlattr.h"
  13. # include "print_fields.h"
  14. # include <linux/dcbnl.h>
  15. # include "netlink.h"
  16. # include "xlat/dcb_commands.h"
  17. # include "xlat/rtnl_dcb_attrs.h"
  18. DECL_NETLINK_ROUTE_DECODER(decode_dcbmsg)
  19. {
  20. struct dcbmsg dcb = { .dcb_family = family };
  21. size_t offset = sizeof(dcb.dcb_family);
  22. bool decode_nla = false;
  23. PRINT_FIELD_XVAL("{", dcb, dcb_family, addrfams, "AF_???");
  24. tprints(", ");
  25. if (len >= sizeof(dcb)) {
  26. if (!umoven_or_printaddr(tcp, addr + offset,
  27. sizeof(dcb) - offset,
  28. (char *) &dcb + offset)) {
  29. PRINT_FIELD_XVAL("", dcb, cmd,
  30. dcb_commands, "DCB_CMD_???");
  31. decode_nla = true;
  32. }
  33. } else
  34. tprints("...");
  35. tprints("}");
  36. offset = NLMSG_ALIGN(sizeof(dcb));
  37. if (decode_nla && len > offset) {
  38. tprints(", ");
  39. decode_nlattr(tcp, addr + offset, len - offset,
  40. rtnl_dcb_attrs, "DCB_ATTR_???", NULL, 0, NULL);
  41. }
  42. }
  43. #endif