fix rtnl_link_info_parse() and rtnl_link_fill_info()
So that the veth peer could be parsed correctly. Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
This commit is contained in:
parent
b50a36bf34
commit
8b87ae5516
1 changed files with 18 additions and 12 deletions
|
@ -458,6 +458,16 @@ int rtnl_link_info_parse(struct rtnl_link *link, struct nlattr **tb)
|
|||
link->ce_mask |= LINK_ATTR_IFALIAS;
|
||||
}
|
||||
|
||||
if (tb[IFLA_NET_NS_FD]) {
|
||||
link->l_ns_fd = nla_get_u32(tb[IFLA_NET_NS_FD]);
|
||||
link->ce_mask |= LINK_ATTR_NS_FD;
|
||||
}
|
||||
|
||||
if (tb[IFLA_NET_NS_PID]) {
|
||||
link->l_ns_pid = nla_get_u32(tb[IFLA_NET_NS_PID]);
|
||||
link->ce_mask |= LINK_ATTR_NS_PID;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -612,16 +622,6 @@ static int link_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who,
|
|||
link->ce_mask |= LINK_ATTR_GROUP;
|
||||
}
|
||||
|
||||
if (tb[IFLA_NET_NS_FD]) {
|
||||
link->l_ns_fd = nla_get_u32(tb[IFLA_NET_NS_FD]);
|
||||
link->ce_mask |= LINK_ATTR_NS_FD;
|
||||
}
|
||||
|
||||
if (tb[IFLA_NET_NS_FD]) {
|
||||
link->l_ns_pid = nla_get_u32(tb[IFLA_NET_NS_PID]);
|
||||
link->ce_mask |= LINK_ATTR_NS_PID;
|
||||
}
|
||||
|
||||
if (tb[IFLA_PHYS_PORT_ID]) {
|
||||
link->l_phys_port_id = nl_data_alloc_attr(tb[IFLA_PHYS_PORT_ID]);
|
||||
if (link->l_phys_port_id == NULL) {
|
||||
|
@ -1287,8 +1287,11 @@ int rtnl_link_fill_info(struct nl_msg *msg, struct rtnl_link *link)
|
|||
if (link->ce_mask & LINK_ATTR_NUM_RX_QUEUES)
|
||||
NLA_PUT_U32(msg, IFLA_NUM_RX_QUEUES, link->l_num_rx_queues);
|
||||
|
||||
if (link->ce_mask & LINK_ATTR_GROUP)
|
||||
NLA_PUT_U32(msg, IFLA_GROUP, link->l_group);
|
||||
if (link->ce_mask & LINK_ATTR_NS_FD)
|
||||
NLA_PUT_U32(msg, IFLA_NET_NS_FD, link->l_ns_fd);
|
||||
|
||||
if (link->ce_mask & LINK_ATTR_NS_PID)
|
||||
NLA_PUT_U32(msg, IFLA_NET_NS_PID, link->l_ns_pid);
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -1312,6 +1315,9 @@ static int build_link_msg(int cmd, struct ifinfomsg *hdr,
|
|||
if (rtnl_link_fill_info(msg, link))
|
||||
goto nla_put_failure;
|
||||
|
||||
if (link->ce_mask & LINK_ATTR_GROUP)
|
||||
NLA_PUT_U32(msg, IFLA_GROUP, link->l_group);
|
||||
|
||||
if (link->ce_mask & LINK_ATTR_LINKINFO) {
|
||||
struct nlattr *info;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue