* nlattr.h (DECL_NLA(fd)): New prototype.
* nlattr.c (decode_nla_fd): New function.
* rtnl_link.c (ifla_xdp_nla_decoders) <IFLA_XDP_FD>: Use it.
(ifinfomsg_nla_decoders) <IFLA_NET_NS_FD>: Likewise.
* rtnl_nsid.c (rtgenmsg_nla_decoders) <NETNSA_FD>: Likewise.
* NEWS: Mention this.
Noteworthy changes in release ?.?? (????-??-??)
===============================================
+* Improvements
+ * Implemented decoding of netlink descriptor attributes as file descriptors.
+
Noteworthy changes in release 4.20 (2017-11-13)
===============================================
return true;
}
+bool
+decode_nla_fd(struct tcb *const tcp,
+ const kernel_ulong_t addr,
+ const unsigned int len,
+ const void *const opaque_data)
+{
+ int fd;
+
+ if (len < sizeof(fd))
+ return false;
+ else if (!umove_or_printaddr(tcp, addr, &fd))
+ printfd(tcp, fd);
+
+ return true;
+}
+
bool
decode_nla_ifindex(struct tcb *const tcp,
const kernel_ulong_t addr,
DECL_NLA(be64);
DECL_NLA(str);
DECL_NLA(strn);
+DECL_NLA(fd);
DECL_NLA(ifindex);
DECL_NLA(meminfo);
DECL_NLA(rt_class);
}
static const nla_decoder_t ifla_xdp_nla_decoders[] = {
- [IFLA_XDP_FD] = decode_nla_s32,
+ [IFLA_XDP_FD] = decode_nla_fd,
[IFLA_XDP_ATTACHED] = decode_nla_u8,
[IFLA_XDP_FLAGS] = decode_ifla_xdp_flags,
[IFLA_XDP_PROG_ID] = decode_nla_u32
[IFLA_PORT_SELF] = decode_ifla_port,
[IFLA_AF_SPEC] = NULL, /* unimplemented */
[IFLA_GROUP] = decode_nla_u32,
- [IFLA_NET_NS_FD] = decode_nla_u32,
+ [IFLA_NET_NS_FD] = decode_nla_fd,
[IFLA_EXT_MASK] = decode_nla_u32,
[IFLA_PROMISCUITY] = decode_nla_u32,
[IFLA_NUM_TX_QUEUES] = decode_nla_u32,
static const nla_decoder_t rtgenmsg_nla_decoders[] = {
[NETNSA_NSID] = decode_nla_s32,
[NETNSA_PID] = decode_nla_u32,
- [NETNSA_FD] = decode_nla_u32
+ [NETNSA_FD] = decode_nla_fd
};
DECL_NETLINK_ROUTE_DECODER(decode_rtgenmsg)