aboutgitcodebugslistschat
path: root/netlink.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-10-21 20:14:52 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-10-21 20:14:52 +0200
commitd36e429bc6964a40845bd1e386e2ee4f3790e342 (patch)
treedfd4b63edaacb296c510a2d4671463ad9b0ca809 /netlink.c
parent875550b9733eb35b25de3b70569bcc7233ae52cb (diff)
downloadpasst-d36e429bc6964a40845bd1e386e2ee4f3790e342.tar
passt-d36e429bc6964a40845bd1e386e2ee4f3790e342.tar.gz
passt-d36e429bc6964a40845bd1e386e2ee4f3790e342.tar.bz2
passt-d36e429bc6964a40845bd1e386e2ee4f3790e342.tar.lz
passt-d36e429bc6964a40845bd1e386e2ee4f3790e342.tar.xz
passt-d36e429bc6964a40845bd1e386e2ee4f3790e342.tar.zst
passt-d36e429bc6964a40845bd1e386e2ee4f3790e342.zip
netlink: Fix length of address attribute
...I broke this while playing with clang-tidy, and didn't add tests for pasta's --config-net yet. Reported-by: Giuseppe Scrivano <gscrivan@redhat.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'netlink.c')
-rw-r--r--netlink.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/netlink.c b/netlink.c
index 54e218d..cea32fd 100644
--- a/netlink.c
+++ b/netlink.c
@@ -398,7 +398,7 @@ void nl_addr(int ns, unsigned int ifi, sa_family_t af,
if (set) {
if (af == AF_INET6) {
- size_t rta_len = sizeof(req.set.a6.l);
+ size_t rta_len = RTA_LENGTH(sizeof(req.set.a6.l));
req.nlh.nlmsg_len = sizeof(req);
@@ -409,7 +409,7 @@ void nl_addr(int ns, unsigned int ifi, sa_family_t af,
req.set.a6.rta_a.rta_len = rta_len;
req.set.a6.rta_a.rta_type = IFA_ADDRESS;
} else {
- size_t rta_len = sizeof(req.set.a4.l);
+ size_t rta_len = RTA_LENGTH(sizeof(req.set.a4.l));
req.nlh.nlmsg_len = offsetof(struct req_t, set.a4.end);