diff --git a/src/openvpn/networking_sitnl.c b/src/openvpn/networking_sitnl.c index c08f2e98..8d7c7f56 100644 --- a/src/openvpn/networking_sitnl.c +++ b/src/openvpn/networking_sitnl.c @@ -1356,7 +1356,15 @@ net_iface_new(openvpn_net_ctx_t *ctx, const char *iface, const char *type, { 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, + + /* the netlink format is uint8_t for this and using something + * other than uint8_t here (enum underlying type is undefined but + * commonly int) causes the values to be 0 when passed + * on big endian arch as we only take the (biggest endian) 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); }