strace/rtnl_nsid.c
Dmitry V. Levin 17a1b88f8e xlat: update NETNSA_* constants
* xlat/rtnl_nsid_attrs.in (NETNSA_TARGET_NSID, NETNSA_CURRENT_NSID): New
constants introduced by Linux kernel commits v5.0-rc1~129^2~201^2~2
and v5.0-rc1~129^2~201^2, respectively.
* rtnl_nsid.c (rtgenmsg_nla_decoders): Add NETNSA_TARGET_NSID
and NETNSA_CURRENT_NSID.
* NEWS: Mention this.
2019-01-05 21:14:42 +00:00

44 lines
1.1 KiB
C

/*
* Copyright (c) 2016 Fabien Siron <fabien.siron@epita.fr>
* Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com>
* Copyright (c) 2016-2018 The strace developers.
* All rights reserved.
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "defs.h"
#include "netlink_route.h"
#include "nlattr.h"
#include "print_fields.h"
#include "netlink.h"
#include <linux/rtnetlink.h>
#include "xlat/rtnl_nsid_attrs.h"
static const nla_decoder_t rtgenmsg_nla_decoders[] = {
[NETNSA_NSID] = decode_nla_s32,
[NETNSA_PID] = decode_nla_u32,
[NETNSA_FD] = decode_nla_fd,
[NETNSA_TARGET_NSID] = decode_nla_s32,
[NETNSA_CURRENT_NSID] = decode_nla_s32
};
DECL_NETLINK_ROUTE_DECODER(decode_rtgenmsg)
{
struct rtgenmsg rtgenmsg = { .rtgen_family = family };
PRINT_FIELD_XVAL("{", rtgenmsg, rtgen_family, addrfams, "AF_???");
tprints("}");
const size_t offset = NLMSG_ALIGN(sizeof(rtgenmsg));
if (len > offset) {
tprints(", ");
decode_nlattr(tcp, addr + offset, len - offset,
rtnl_nsid_attrs, "NETNSA_???",
rtgenmsg_nla_decoders,
ARRAY_SIZE(rtgenmsg_nla_decoders), NULL);
}
}