aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/sit.c
diff options
context:
space:
mode:
authorNicolas Dichtel <nicolas.dichtel@6wind.com>2012-11-14 23:06:41 -0500
committerDavid S. Miller <davem@davemloft.net>2012-11-15 13:46:29 -0500
commitd440b72068bb8dff3cc1c2a05b61e60843d82494 (patch)
treed88dd49557e063e7cab3ff9442a3c2c3a4b0cf15 /net/ipv6/sit.c
parentfea379b2db31f5c44f2a24645de5ea29721f22aa (diff)
sit: fix sparse warnings
This change fixes several sparse warnings about endianness problem. The wrong nla_*() functions were used. It also fix a sparse warning about a flag test (field i_flags). This field is used in this file like a local flag only, so it is more an u16 (gre uses it as a be16). This sparse warning was already there before the patch that add netlink management, the code has just been moved. Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/sit.c')
-rw-r--r--net/ipv6/sit.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 7bd2a061e511..ca6c2c8e71d2 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -228,7 +228,7 @@ static int ipip6_tunnel_create(struct net_device *dev)
228 goto out; 228 goto out;
229 ipip6_tunnel_clone_6rd(dev, sitn); 229 ipip6_tunnel_clone_6rd(dev, sitn);
230 230
231 if (t->parms.i_flags & SIT_ISATAP) 231 if ((__force u16)t->parms.i_flags & SIT_ISATAP)
232 dev->priv_flags |= IFF_ISATAP; 232 dev->priv_flags |= IFF_ISATAP;
233 233
234 err = register_netdevice(dev); 234 err = register_netdevice(dev);
@@ -1240,10 +1240,10 @@ static void ipip6_netlink_parms(struct nlattr *data[],
1240 parms->link = nla_get_u32(data[IFLA_IPTUN_LINK]); 1240 parms->link = nla_get_u32(data[IFLA_IPTUN_LINK]);
1241 1241
1242 if (data[IFLA_IPTUN_LOCAL]) 1242 if (data[IFLA_IPTUN_LOCAL])
1243 parms->iph.saddr = nla_get_u32(data[IFLA_IPTUN_LOCAL]); 1243 parms->iph.saddr = nla_get_be32(data[IFLA_IPTUN_LOCAL]);
1244 1244
1245 if (data[IFLA_IPTUN_REMOTE]) 1245 if (data[IFLA_IPTUN_REMOTE])
1246 parms->iph.daddr = nla_get_u32(data[IFLA_IPTUN_REMOTE]); 1246 parms->iph.daddr = nla_get_be32(data[IFLA_IPTUN_REMOTE]);
1247 1247
1248 if (data[IFLA_IPTUN_TTL]) { 1248 if (data[IFLA_IPTUN_TTL]) {
1249 parms->iph.ttl = nla_get_u8(data[IFLA_IPTUN_TTL]); 1249 parms->iph.ttl = nla_get_u8(data[IFLA_IPTUN_TTL]);
@@ -1258,7 +1258,7 @@ static void ipip6_netlink_parms(struct nlattr *data[],
1258 parms->iph.frag_off = htons(IP_DF); 1258 parms->iph.frag_off = htons(IP_DF);
1259 1259
1260 if (data[IFLA_IPTUN_FLAGS]) 1260 if (data[IFLA_IPTUN_FLAGS])
1261 parms->i_flags = nla_get_u16(data[IFLA_IPTUN_FLAGS]); 1261 parms->i_flags = nla_get_be16(data[IFLA_IPTUN_FLAGS]);
1262} 1262}
1263 1263
1264static int ipip6_newlink(struct net *src_net, struct net_device *dev, 1264static int ipip6_newlink(struct net *src_net, struct net_device *dev,
@@ -1337,7 +1337,7 @@ static int ipip6_fill_info(struct sk_buff *skb, const struct net_device *dev)
1337 nla_put_u8(skb, IFLA_IPTUN_TOS, parm->iph.tos) || 1337 nla_put_u8(skb, IFLA_IPTUN_TOS, parm->iph.tos) ||
1338 nla_put_u8(skb, IFLA_IPTUN_PMTUDISC, 1338 nla_put_u8(skb, IFLA_IPTUN_PMTUDISC,
1339 !!(parm->iph.frag_off & htons(IP_DF))) || 1339 !!(parm->iph.frag_off & htons(IP_DF))) ||
1340 nla_put_u16(skb, IFLA_IPTUN_FLAGS, parm->i_flags)) 1340 nla_put_be16(skb, IFLA_IPTUN_FLAGS, parm->i_flags))
1341 goto nla_put_failure; 1341 goto nla_put_failure;
1342 return 0; 1342 return 0;
1343 1343