]> granicus.if.org Git - strace/blob - rtnl_tc_action.c
tests: fix format warnings on x32
[strace] / rtnl_tc_action.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-2018 The strace developers.
5  * All rights reserved.
6  *
7  * SPDX-License-Identifier: LGPL-2.1-or-later
8  */
9
10 #include "defs.h"
11 #include "netlink_route.h"
12 #include "nlattr.h"
13 #include "print_fields.h"
14
15 #include "netlink.h"
16 #include <linux/rtnetlink.h>
17
18 #include "xlat/rtnl_tc_action_attrs.h"
19
20 static const nla_decoder_t tcamsg_nla_decoders[] = {
21         [TCA_ACT_KIND]          = decode_nla_str,
22         [TCA_ACT_OPTIONS]       = NULL, /* unimplemented */
23         [TCA_ACT_INDEX]         = decode_nla_u32,
24         [TCA_ACT_STATS]         = decode_nla_tc_stats,
25         [TCA_ACT_PAD]           = NULL,
26         [TCA_ACT_COOKIE]        = NULL /* default parser */
27 };
28
29 DECL_NETLINK_ROUTE_DECODER(decode_tcamsg)
30 {
31         struct tcamsg tca = { .tca_family = family };
32
33         PRINT_FIELD_XVAL("{", tca, tca_family, addrfams, "AF_???");
34         tprints("}");
35
36         const size_t offset = NLMSG_ALIGN(sizeof(tca));
37         if (len > offset) {
38                 tprints(", ");
39                 decode_nlattr(tcp, addr + offset, len - offset,
40                               rtnl_tc_action_attrs, "TCA_ACT_???",
41                               tcamsg_nla_decoders,
42                               ARRAY_SIZE(tcamsg_nla_decoders), NULL);
43         }
44 }