]> git.proxmox.com Git - mirror_lxc.git/commitdiff
fix wrong nlmsg_len
authorShuai Zhang <zs.broccoli@gmail.com>
Thu, 27 Nov 2014 12:38:01 +0000 (20:38 +0800)
committerStéphane Graber <stgraber@ubuntu.com>
Thu, 27 Nov 2014 22:48:25 +0000 (17:48 -0500)
nlmsg_len is the length of message including header.

Signed-off-by: Shuai Zhang <zs.broccoli@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/nl.c

index 7c0f1e53b6482d701b2850a9674515d27ad3bb93..132a907f77134877718cb21b509b092fc1c5c001 100644 (file)
@@ -107,14 +107,14 @@ void nla_end_nested(struct nlmsg *nlmsg, struct rtattr *attr)
 extern struct nlmsg *nlmsg_alloc(size_t size)
 {
        struct nlmsg *nlmsg;
-       size_t len = NLMSG_ALIGN(size) + NLMSG_ALIGN(sizeof(struct nlmsghdr *));
+       size_t len = NLMSG_HDRLEN + NLMSG_ALIGN(size);
 
        nlmsg = (struct nlmsg *)malloc(len);
        if (!nlmsg)
                return NULL;
 
        memset(nlmsg, 0, len);
-       nlmsg->nlmsghdr.nlmsg_len = NLMSG_ALIGN(size);
+       nlmsg->nlmsghdr.nlmsg_len = NLMSG_HDRLEN;
 
        return nlmsg;
 }