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.
7 * SPDX-License-Identifier: LGPL-2.1-or-later
12 #ifdef HAVE_STRUCT_IFADDRLBLMSG
14 # include "netlink_route.h"
16 # include "print_fields.h"
18 # include <linux/if_addrlabel.h>
21 # include "xlat/rtnl_addrlabel_attrs.h"
24 decode_ifal_address(struct tcb *const tcp,
25 const kernel_ulong_t addr,
26 const unsigned int len,
27 const void *const opaque_data)
29 const struct ifaddrlblmsg *const ifal = opaque_data;
31 decode_inet_addr(tcp, addr, len, ifal->ifal_family, NULL);
36 static const nla_decoder_t ifaddrlblmsg_nla_decoders[] = {
37 [IFAL_ADDRESS] = decode_ifal_address,
38 [IFAL_LABEL] = decode_nla_u32
41 DECL_NETLINK_ROUTE_DECODER(decode_ifaddrlblmsg)
43 struct ifaddrlblmsg ifal = { .ifal_family = family };
44 size_t offset = sizeof(ifal.ifal_family);
45 bool decode_nla = false;
47 PRINT_FIELD_XVAL("{", ifal, ifal_family, addrfams, "AF_???");
50 if (len >= sizeof(ifal)) {
51 if (!umoven_or_printaddr(tcp, addr + offset,
52 sizeof(ifal) - offset,
53 (char *) &ifal + offset)) {
54 PRINT_FIELD_U("", ifal, ifal_prefixlen);
55 PRINT_FIELD_U(", ", ifal, ifal_flags);
56 PRINT_FIELD_IFINDEX(", ", ifal, ifal_index);
57 PRINT_FIELD_U(", ", ifal, ifal_seq);
64 offset = NLMSG_ALIGN(sizeof(ifal));
65 if (decode_nla && len > offset) {
67 decode_nlattr(tcp, addr + offset, len - offset,
68 rtnl_addrlabel_attrs, "IFAL_???",
69 ifaddrlblmsg_nla_decoders,
70 ARRAY_SIZE(ifaddrlblmsg_nla_decoders), &ifal);