system-linux: Fix VTI ikey/okey on little endian systems
authorJo-Philipp Wich <jow@openwrt.org>
Fri, 4 Mar 2016 17:43:54 +0000 (18:43 +0100)
committerJo-Philipp Wich <jow@openwrt.org>
Fri, 4 Mar 2016 17:46:03 +0000 (18:46 +0100)
The kernel expects the IFLA_VTI_IKEY and IFLA_VTI_OKEY netlink attributes to
be in network byte order, so ensure that the values are stored accordingly.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
system-linux.c

index 86e373c06efd3de46e09662101b4e0bf60fe028d..2d568089b8e7d7aea06921ee17e8d27cad767159 100644 (file)
@@ -2224,10 +2224,10 @@ static int system_add_vti_tunnel(const char *name, const char *kind,
        }
 
        if (okey)
-               nla_put_u32(nlm, IFLA_VTI_OKEY, okey);
+               nla_put_be32(nlm, IFLA_VTI_OKEY, okey);
 
        if (ikey)
-               nla_put_u32(nlm, IFLA_VTI_IKEY, ikey);
+               nla_put_be32(nlm, IFLA_VTI_IKEY, ikey);
 
        nla_nest_end(nlm, infodata);
        nla_nest_end(nlm, linkinfo);