diff options
author | Lance Richardson <lrichard@redhat.com> | 2016-01-06 17:22:45 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-01-08 21:30:43 -0500 |
commit | 30d3d83a7dcef7a26c5c48e548bdd6a76754cbcd (patch) | |
tree | 61e55315684ce363d2bb7c2f20281709bbedc696 /net | |
parent | 9b59377b756670d9516e72276b6c4efa92137b5f (diff) |
ipv4: fix endianness warnings in ip_tunnel_core.c
Eliminate endianness mismatch warnings (reported by sparse) in this file by
using appropriate nla_put_*()/nla_get_*() calls.
Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/ip_tunnel_core.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c index eb52ce950c27..859d415c0b2d 100644 --- a/net/ipv4/ip_tunnel_core.c +++ b/net/ipv4/ip_tunnel_core.c | |||
@@ -251,7 +251,7 @@ static int ip_tun_build_state(struct net_device *dev, struct nlattr *attr, | |||
251 | tun_info = lwt_tun_info(new_state); | 251 | tun_info = lwt_tun_info(new_state); |
252 | 252 | ||
253 | if (tb[LWTUNNEL_IP_ID]) | 253 | if (tb[LWTUNNEL_IP_ID]) |
254 | tun_info->key.tun_id = nla_get_u64(tb[LWTUNNEL_IP_ID]); | 254 | tun_info->key.tun_id = nla_get_be64(tb[LWTUNNEL_IP_ID]); |
255 | 255 | ||
256 | if (tb[LWTUNNEL_IP_DST]) | 256 | if (tb[LWTUNNEL_IP_DST]) |
257 | tun_info->key.u.ipv4.dst = nla_get_be32(tb[LWTUNNEL_IP_DST]); | 257 | tun_info->key.u.ipv4.dst = nla_get_be32(tb[LWTUNNEL_IP_DST]); |
@@ -266,7 +266,7 @@ static int ip_tun_build_state(struct net_device *dev, struct nlattr *attr, | |||
266 | tun_info->key.tos = nla_get_u8(tb[LWTUNNEL_IP_TOS]); | 266 | tun_info->key.tos = nla_get_u8(tb[LWTUNNEL_IP_TOS]); |
267 | 267 | ||
268 | if (tb[LWTUNNEL_IP_FLAGS]) | 268 | if (tb[LWTUNNEL_IP_FLAGS]) |
269 | tun_info->key.tun_flags = nla_get_u16(tb[LWTUNNEL_IP_FLAGS]); | 269 | tun_info->key.tun_flags = nla_get_be16(tb[LWTUNNEL_IP_FLAGS]); |
270 | 270 | ||
271 | tun_info->mode = IP_TUNNEL_INFO_TX; | 271 | tun_info->mode = IP_TUNNEL_INFO_TX; |
272 | tun_info->options_len = 0; | 272 | tun_info->options_len = 0; |
@@ -281,12 +281,12 @@ static int ip_tun_fill_encap_info(struct sk_buff *skb, | |||
281 | { | 281 | { |
282 | struct ip_tunnel_info *tun_info = lwt_tun_info(lwtstate); | 282 | struct ip_tunnel_info *tun_info = lwt_tun_info(lwtstate); |
283 | 283 | ||
284 | if (nla_put_u64(skb, LWTUNNEL_IP_ID, tun_info->key.tun_id) || | 284 | if (nla_put_be64(skb, LWTUNNEL_IP_ID, tun_info->key.tun_id) || |
285 | nla_put_be32(skb, LWTUNNEL_IP_DST, tun_info->key.u.ipv4.dst) || | 285 | nla_put_be32(skb, LWTUNNEL_IP_DST, tun_info->key.u.ipv4.dst) || |
286 | nla_put_be32(skb, LWTUNNEL_IP_SRC, tun_info->key.u.ipv4.src) || | 286 | nla_put_be32(skb, LWTUNNEL_IP_SRC, tun_info->key.u.ipv4.src) || |
287 | nla_put_u8(skb, LWTUNNEL_IP_TOS, tun_info->key.tos) || | 287 | nla_put_u8(skb, LWTUNNEL_IP_TOS, tun_info->key.tos) || |
288 | nla_put_u8(skb, LWTUNNEL_IP_TTL, tun_info->key.ttl) || | 288 | nla_put_u8(skb, LWTUNNEL_IP_TTL, tun_info->key.ttl) || |
289 | nla_put_u16(skb, LWTUNNEL_IP_FLAGS, tun_info->key.tun_flags)) | 289 | nla_put_be16(skb, LWTUNNEL_IP_FLAGS, tun_info->key.tun_flags)) |
290 | return -ENOMEM; | 290 | return -ENOMEM; |
291 | 291 | ||
292 | return 0; | 292 | return 0; |
@@ -346,7 +346,7 @@ static int ip6_tun_build_state(struct net_device *dev, struct nlattr *attr, | |||
346 | tun_info = lwt_tun_info(new_state); | 346 | tun_info = lwt_tun_info(new_state); |
347 | 347 | ||
348 | if (tb[LWTUNNEL_IP6_ID]) | 348 | if (tb[LWTUNNEL_IP6_ID]) |
349 | tun_info->key.tun_id = nla_get_u64(tb[LWTUNNEL_IP6_ID]); | 349 | tun_info->key.tun_id = nla_get_be64(tb[LWTUNNEL_IP6_ID]); |
350 | 350 | ||
351 | if (tb[LWTUNNEL_IP6_DST]) | 351 | if (tb[LWTUNNEL_IP6_DST]) |
352 | tun_info->key.u.ipv6.dst = nla_get_in6_addr(tb[LWTUNNEL_IP6_DST]); | 352 | tun_info->key.u.ipv6.dst = nla_get_in6_addr(tb[LWTUNNEL_IP6_DST]); |
@@ -361,7 +361,7 @@ static int ip6_tun_build_state(struct net_device *dev, struct nlattr *attr, | |||
361 | tun_info->key.tos = nla_get_u8(tb[LWTUNNEL_IP6_TC]); | 361 | tun_info->key.tos = nla_get_u8(tb[LWTUNNEL_IP6_TC]); |
362 | 362 | ||
363 | if (tb[LWTUNNEL_IP6_FLAGS]) | 363 | if (tb[LWTUNNEL_IP6_FLAGS]) |
364 | tun_info->key.tun_flags = nla_get_u16(tb[LWTUNNEL_IP6_FLAGS]); | 364 | tun_info->key.tun_flags = nla_get_be16(tb[LWTUNNEL_IP6_FLAGS]); |
365 | 365 | ||
366 | tun_info->mode = IP_TUNNEL_INFO_TX | IP_TUNNEL_INFO_IPV6; | 366 | tun_info->mode = IP_TUNNEL_INFO_TX | IP_TUNNEL_INFO_IPV6; |
367 | tun_info->options_len = 0; | 367 | tun_info->options_len = 0; |
@@ -376,12 +376,12 @@ static int ip6_tun_fill_encap_info(struct sk_buff *skb, | |||
376 | { | 376 | { |
377 | struct ip_tunnel_info *tun_info = lwt_tun_info(lwtstate); | 377 | struct ip_tunnel_info *tun_info = lwt_tun_info(lwtstate); |
378 | 378 | ||
379 | if (nla_put_u64(skb, LWTUNNEL_IP6_ID, tun_info->key.tun_id) || | 379 | if (nla_put_be64(skb, LWTUNNEL_IP6_ID, tun_info->key.tun_id) || |
380 | nla_put_in6_addr(skb, LWTUNNEL_IP6_DST, &tun_info->key.u.ipv6.dst) || | 380 | nla_put_in6_addr(skb, LWTUNNEL_IP6_DST, &tun_info->key.u.ipv6.dst) || |
381 | nla_put_in6_addr(skb, LWTUNNEL_IP6_SRC, &tun_info->key.u.ipv6.src) || | 381 | nla_put_in6_addr(skb, LWTUNNEL_IP6_SRC, &tun_info->key.u.ipv6.src) || |
382 | nla_put_u8(skb, LWTUNNEL_IP6_HOPLIMIT, tun_info->key.tos) || | 382 | nla_put_u8(skb, LWTUNNEL_IP6_HOPLIMIT, tun_info->key.tos) || |
383 | nla_put_u8(skb, LWTUNNEL_IP6_TC, tun_info->key.ttl) || | 383 | nla_put_u8(skb, LWTUNNEL_IP6_TC, tun_info->key.ttl) || |
384 | nla_put_u16(skb, LWTUNNEL_IP6_FLAGS, tun_info->key.tun_flags)) | 384 | nla_put_be16(skb, LWTUNNEL_IP6_FLAGS, tun_info->key.tun_flags)) |
385 | return -ENOMEM; | 385 | return -ENOMEM; |
386 | 386 | ||
387 | return 0; | 387 | return 0; |