diff mbox series

[ovs-dev,1/2] netlink linux: account for the netnsid netlink attr.

Message ID 20190326171500.9174-2-fbl@sysclose.org
State Accepted
Headers show
Series netdev-linux: fix update via netlink | expand

Commit Message

Flavio Leitner March 26, 2019, 5:14 p.m. UTC
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.")
Signed-off-by: Flavio Leitner <fbl@sysclose.org>
---
 lib/netdev-linux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Aaron Conole March 26, 2019, 6:47 p.m. UTC | #1
Flavio Leitner <fbl@sysclose.org> writes:

> 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.")
> Signed-off-by: Flavio Leitner <fbl@sysclose.org>
> ---

Acked-by: Aaron Conole <aconole@redhat.com>
diff mbox series

Patch

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index deedc6954..965e7eee8 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -6045,8 +6045,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,