From: Waldemar Kozaczuk <jwkozac...@gmail.com>
Committer: Waldemar Kozaczuk <jwkozac...@gmail.com>
Branch: master

netlink: set negative errno in error responses

The netlink specfication requires that error field contains a negative
value of errno.

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>

---
diff --git a/bsd/sys/compat/linux/linux_netlink.cc 
b/bsd/sys/compat/linux/linux_netlink.cc
--- a/bsd/sys/compat/linux/linux_netlink.cc
+++ b/bsd/sys/compat/linux/linux_netlink.cc
@@ -506,7 +506,7 @@ netlink_senderr(struct socket *so, struct nlmsghdr *nlm, 
int error)
                return ENOBUFS;
        }
        err = (struct nlmsgerr *) nlmsg_data(hdr);
-       err->error = error;
+       err->error = -error; //Per netlink spec - "Negative errno or 0 for 
acknowledgements"
        if (nlm) {
                err->msg = *nlm;
        } else {

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/00000000000037e51605e1559823%40google.com.

Reply via email to