summaryrefslogtreecommitdiffhomepage
path: root/system-linux.c
diff options
context:
space:
mode:
authorStijn Tintel <stijn@linux-ipv6.be>2017-07-21 20:57:47 +0200
committerStijn Tintel <stijn@linux-ipv6.be>2017-07-21 21:04:26 +0200
commit34afb764077768a361d76256fb05cbba172de223 (patch)
treec8053e9e05f6cf83169e989d0e3b15008c137038 /system-linux.c
parentd397e8ca5dd492a1fac2e186e2a8b91ac8e463df (diff)
system-linux: fix GRE ikey/okey endianness
The kernel expects IFLA_GRE_IKEY and IFLA_GRE_OKEY to be in network byte order, so convert the values from host byte order. Fixes ikey/okey on little endian systems. Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Diffstat (limited to 'system-linux.c')
-rw-r--r--system-linux.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/system-linux.c b/system-linux.c
index f7704cf..483a98d 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -2446,10 +2446,10 @@ static int system_add_gre_tunnel(const char *name, const char *kind,
nla_put_u16(nlm, IFLA_GRE_IFLAGS, iflags);
if (okey)
- nla_put_u32(nlm, IFLA_GRE_OKEY, okey);
+ nla_put_u32(nlm, IFLA_GRE_OKEY, htonl(okey));
if (ikey)
- nla_put_u32(nlm, IFLA_GRE_IKEY, ikey);
+ nla_put_u32(nlm, IFLA_GRE_IKEY, htonl(ikey));
nla_nest_end(nlm, infodata);
nla_nest_end(nlm, linkinfo);