* [PATCH net-next] tunnel: use the correct endian for some fields
@ 2012-11-15 8:51 Cong Wang
2012-11-15 8:57 ` Nicolas Dichtel
0 siblings, 1 reply; 4+ messages in thread
From: Cong Wang @ 2012-11-15 8:51 UTC (permalink / raw)
To: netdev; +Cc: Nicolas Dichtel, David S. Miller, 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] flowinfo
net/ipv6/ip6_tunnel.c:1571:33: got unsigned int
for these fields, we need to use the correct endian wrapers.
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 64686e1..54477d8 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -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]);
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index ab4d056..bf3a549 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -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]);
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 7bd2a06..e137750 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -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;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] tunnel: use the correct endian for some fields
2012-11-15 8:51 [PATCH net-next] tunnel: use the correct endian for some fields Cong Wang
@ 2012-11-15 8:57 ` Nicolas Dichtel
2012-11-15 9:04 ` Cong Wang
0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Dichtel @ 2012-11-15 8:57 UTC (permalink / raw)
To: Cong Wang; +Cc: netdev, David S. Miller
Le 15/11/2012 09:51, Cong Wang a écrit :
> 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] flowinfo
> net/ipv6/ip6_tunnel.c:1571:33: got unsigned int
>
> for these fields, we need to use the correct endian wrapers.
>
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Cong Wang <amwang@redhat.com>
Just one minute before my patch.
Your patch does not fix all warnings (i_flags & SIT_ISATAP in ip6_tunnel.c).
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] tunnel: use the correct endian for some fields
2012-11-15 8:57 ` Nicolas Dichtel
@ 2012-11-15 9:04 ` Cong Wang
2012-11-15 17:08 ` Stephen Hemminger
0 siblings, 1 reply; 4+ messages in thread
From: Cong Wang @ 2012-11-15 9:04 UTC (permalink / raw)
To: nicolas.dichtel; +Cc: netdev, David S. Miller
On Thu, 2012-11-15 at 09:57 +0100, Nicolas Dichtel wrote:
> Le 15/11/2012 09:51, Cong Wang a écrit :
> > 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] flowinfo
> > net/ipv6/ip6_tunnel.c:1571:33: got unsigned int
> >
> > for these fields, we need to use the correct endian wrapers.
> >
> > Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> > Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> > Cc: David S. Miller <davem@davemloft.net>
> > Signed-off-by: Cong Wang <amwang@redhat.com>
> Just one minute before my patch.
> Your patch does not fix all warnings (i_flags & SIT_ISATAP in ip6_tunnel.c).
Yeah, then ignore this patch. :)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] tunnel: use the correct endian for some fields
2012-11-15 9:04 ` Cong Wang
@ 2012-11-15 17:08 ` Stephen Hemminger
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2012-11-15 17:08 UTC (permalink / raw)
To: Cong Wang; +Cc: nicolas.dichtel, netdev, David S. Miller
On Thu, 15 Nov 2012 17:04:35 +0800
Cong Wang <amwang@redhat.com> wrote:
> On Thu, 2012-11-15 at 09:57 +0100, Nicolas Dichtel wrote:
> > Le 15/11/2012 09:51, Cong Wang a écrit :
> > > 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] flowinfo
> > > net/ipv6/ip6_tunnel.c:1571:33: got unsigned int
> > >
> > > for these fields, we need to use the correct endian wrapers.
> > >
> > > Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> > > Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> > > Cc: David S. Miller <davem@davemloft.net>
> > > Signed-off-by: Cong Wang <amwang@redhat.com>
> > Just one minute before my patch.
> > Your patch does not fix all warnings (i_flags & SIT_ISATAP in ip6_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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-11-15 17:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-15 8:51 [PATCH net-next] tunnel: use the correct endian for some fields Cong Wang
2012-11-15 8:57 ` Nicolas Dichtel
2012-11-15 9:04 ` Cong Wang
2012-11-15 17:08 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).