plaisthos has uploaded this change for review. (
http://gerrit.openvpn.net/c/openvpn/+/1547?usp=email )
Change subject: Fix setting DCO ifmode failing on big endian archs
......................................................................
Fix setting DCO ifmode failing on big endian archs
The problem is basically that SITNL_ADDATTR is not type safe and on
big endian architcutre passing a smaller size than the underlying
integer type of data causes only the more significant byte(s) to be passed
instead.
Change-Id: I560f45fb0011180be8ca2b0e7fbc63030fa10f35
---
M src/openvpn/networking_sitnl.c
1 file changed, 7 insertions(+), 1 deletion(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/47/1547/1
diff --git a/src/openvpn/networking_sitnl.c b/src/openvpn/networking_sitnl.c
index a5b2905..1214db2 100644
--- a/src/openvpn/networking_sitnl.c
+++ b/src/openvpn/networking_sitnl.c
@@ -1337,7 +1337,13 @@
{
dco_context_t *dco = arg;
struct rtattr *data = SITNL_NEST(&req.n, sizeof(req), IFLA_INFO_DATA);
- SITNL_ADDATTR(&req.n, sizeof(req), IFLA_OVPN_MODE, &dco->ifmode,
sizeof(uint8_t));
+
+ /* the netlink format is uint8_t for this and using something
+ * other than uint8_t here causes the values to be 0 when passed
+ * on big endian arch as we only take the byte directly at the address
+ */
+ uint8_t ifmode = (uint8_t)dco->ifmode;
+ SITNL_ADDATTR(&req.n, sizeof(req), IFLA_OVPN_MODE, &ifmode,
sizeof(uint8_t));
SITNL_NEST_END(&req.n, data);
}
#endif
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1547?usp=email
To unsubscribe, or for help writing mail filters, visit
http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I560f45fb0011180be8ca2b0e7fbc63030fa10f35
Gerrit-Change-Number: 1547
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel