tunnel: use the correct endian for some fields
Subsystems (3)
PATCH 1/1 tunnel: use the correct endian for some fields
Fengguang reported:
net/ipv6/ip6_tunnel.c:1571:33: sparse: incorrect type in assignment (different base types)net/ipv6/ip6_tunnel.c:1571:33: expected restricted __be32 [usertype] flowinfonet/ipv6/ip6_tunnel.c:1571:33: got unsigned int
for these fields, we need to use the correct endian wrapers.
---
net/ipv4/ipip.c +1 -1
@@ -864,7 +864,7 @@ static void ipip_netlink_parms(struct nlattr *data[], parms->link =nla_get_u32 (data[IFLA_IPTUN_LINK ]);if (data[IFLA_IPTUN_LOCAL ]) - parms->iph.saddr =nla_get_u32 (data[IFLA_IPTUN_LOCAL ]); + parms->iph.saddr =nla_get_be32 (data[IFLA_IPTUN_LOCAL ]);if (data[IFLA_IPTUN_REMOTE ]) parms->iph.daddr =nla_get_u32 (data[IFLA_IPTUN_REMOTE ]);
net/ipv6/ip6_tunnel.c +1 -1
@@ -1568,7 +1568,7 @@ static void ip6_tnl_netlink_parms(struct nlattr *data[], parms->encap_limit =nla_get_u8 (data[IFLA_IPTUN_ENCAP_LIMIT ]);if (data[IFLA_IPTUN_FLOWINFO ]) - parms->flowinfo =nla_get_u32 (data[IFLA_IPTUN_FLOWINFO ]); + parms->flowinfo =nla_get_be32 (data[IFLA_IPTUN_FLOWINFO ]);if (data[IFLA_IPTUN_FLAGS ]) parms->flags =nla_get_u32 (data[IFLA_IPTUN_FLAGS ]);
net/ipv6/sit.c +2 -2
@@ -1240,7 +1240,7 @@ static void ipip6_netlink_parms(struct nlattr *data[], parms->link =nla_get_u32 (data[IFLA_IPTUN_LINK ]);if (data[IFLA_IPTUN_LOCAL ]) - parms->iph.saddr =nla_get_u32 (data[IFLA_IPTUN_LOCAL ]); + parms->iph.saddr =nla_get_be32 (data[IFLA_IPTUN_LOCAL ]);if (data[IFLA_IPTUN_REMOTE ]) parms->iph.daddr =nla_get_u32 (data[IFLA_IPTUN_REMOTE ]);
@@ -1337,7 +1337,7 @@ static int ipip6_fill_info(struct sk_buff *skb, const struct net_device *dev)nla_put_u8 (skb,IFLA_IPTUN_TOS , parm->iph.tos) ||nla_put_u8 (skb,IFLA_IPTUN_PMTUDISC , !!(parm->iph.frag_off &htons (IP_DF ))) || - nla_put_u16(skb, IFLA_IPTUN_FLAGS, parm->i_flags)) + nla_put_be16(skb, IFLA_IPTUN_FLAGS, parm->i_flags)) goto nla_put_failure;return 0 ;
Quoted 6 lines · Cong Wang
Fengguang reported:
net/ipv6/ip6_tunnel.c:1571:33: sparse: incorrect type in assignment (different base types)net/ipv6/ip6_tunnel.c:1571:33: expected restricted__be32[usertype] flowinfonet/ipv6/ip6_tunnel.c:1571:33: got unsigned int
Quoted 6 lines
for these fields, we need to use the correct endian wrapers.
Reported-by Fengguang Wu <[email protected]>Cc Nicolas Dichtel <[email protected]>Cc David S. Miller <[email protected]>Signed-off-by Cong Wang <[email protected]>
Just one minute before my patch.
Your patch does not fix all warnings (i_flags & SIT_ISATAP in ip6_tunnel.c).
Quoted 7 lines · Nicolas Dichtel
Quoted 6 lines · Cong Wang
Fengguang reported:
net/ipv6/ip6_tunnel.c:1571:33: sparse: incorrect type in assignment (different base types)net/ipv6/ip6_tunnel.c:1571:33: expected restricted__be32[usertype] flowinfonet/ipv6/ip6_tunnel.c:1571:33: got unsigned int
Quoted 8 lines
Quoted 6 lines
for these fields, we need to use the correct endian wrapers.
Reported-by Fengguang Wu <[email protected]>Cc Nicolas Dichtel <[email protected]>Cc David S. Miller <[email protected]>Signed-off-by Cong Wang <[email protected]>Just one minute before my patch.
Your patch does not fix all warnings (i_flags&SIT_ISATAPinip6_tunnel.c).
Yeah, then ignore this patch. :)
Quoted 10 lines · On Thu, 15 Nov 2012 17:04:35 +0800 Cong Wang <[email protected]> wrote:
Quoted 9 lines · Nicolas Dichtel
Quoted 8 lines · Cong Wang
Fengguang reported:
net/ipv6/ip6_tunnel.c:1571:33: sparse: incorrect type in assignment (different base types)net/ipv6/ip6_tunnel.c:1571:33: expected restricted__be32[usertype] flowinfonet/ipv6/ip6_tunnel.c:1571:33: got unsigned intfor these fields, we need to use the correct endian wrapers.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Reported-by Fengguang Wu <[email protected]>Cc Nicolas Dichtel <[email protected]>Cc David S. Miller <[email protected]>Signed-off-by Cong Wang <[email protected]>Just one minute before my patch.
Your patch does not fix all warnings (i_flags&SIT_ISATAPinip6_tunnel.c).Yeah, then ignore this patch. :)
i_flags is a mess right now, it mixed host and bigendian values in the same field. Also SIT and VTI flags overlap.