]> git.proxmox.com Git - mirror_ovs.git/commitdiff
netlink linux: account for the netnsid netlink attr.
authorFlavio Leitner <fbl@sysclose.org>
Tue, 26 Mar 2019 17:14:59 +0000 (14:14 -0300)
committerBen Pfaff <blp@ovn.org>
Tue, 16 Apr 2019 22:48:50 +0000 (15:48 -0700)
The buffer needs to be reallocated and data copied when
the netnsid netlink attribute is included, so avoid that
by accounting the attribute when the buffer is initially
allocated.

Fixes: 756819ddd788 ("netdev-linux: use netlink to update netdev.")
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
lib/netdev-linux.c

index 776d938eee8a170b4ca0ee2a8042bbef0bbf124e..7c0f5170067aab9e3cb06d01d76f05842a360e68 100644 (file)
@@ -6047,8 +6047,8 @@ netdev_linux_update_via_netlink(struct netdev_linux *netdev)
 
     ofpbuf_init(&request, 0);
     nl_msg_put_nlmsghdr(&request,
-                        sizeof(struct ifinfomsg) + NL_ATTR_SIZE(IFNAMSIZ),
-                        RTM_GETLINK, NLM_F_REQUEST);
+                        sizeof(struct ifinfomsg) + NL_ATTR_SIZE(IFNAMSIZ) +
+                        NL_A_U32_SIZE, RTM_GETLINK, NLM_F_REQUEST);
     ofpbuf_put_zeros(&request, sizeof(struct ifinfomsg));
 
     /* The correct identifiers for a Linux device are netnsid and ifindex,