]> granicus.if.org Git - strace/blob - rtnl_netconf.c
bfin, csky, m68k, sh: fix build regression
[strace] / 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-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
12 #ifdef HAVE_STRUCT_NETCONFMSG
13
14 # include "netlink_route.h"
15 # include "nlattr.h"
16 # include "print_fields.h"
17
18 # include <linux/netconf.h>
19 # include "netlink.h"
20
21 # include "xlat/rtnl_netconf_attrs.h"
22
23 static const nla_decoder_t netconfmsg_nla_decoders[] = {
24         [NETCONFA_IFINDEX]                      = decode_nla_ifindex,
25         [NETCONFA_FORWARDING]                   = decode_nla_s32,
26         [NETCONFA_RP_FILTER]                    = decode_nla_s32,
27         [NETCONFA_MC_FORWARDING]                = decode_nla_s32,
28         [NETCONFA_PROXY_NEIGH]                  = decode_nla_s32,
29         [NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN]  = decode_nla_s32,
30         [NETCONFA_INPUT]                        = decode_nla_s32,
31         [NETCONFA_BC_FORWARDING]                = decode_nla_s32,
32 };
33
34 DECL_NETLINK_ROUTE_DECODER(decode_netconfmsg)
35 {
36         struct netconfmsg ncm = { .ncm_family = family };
37
38         PRINT_FIELD_XVAL("{", ncm, ncm_family, addrfams, "AF_???");
39         tprints("}");
40
41         const size_t offset = NLMSG_ALIGN(sizeof(ncm));
42         if (len > offset) {
43                 tprints(", ");
44                 decode_nlattr(tcp, addr + offset, len - offset,
45                               rtnl_netconf_attrs, "NETCONFA_???",
46                               netconfmsg_nla_decoders,
47                               ARRAY_SIZE(netconfmsg_nla_decoders), NULL);
48         }
49 }
50
51 #endif