diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-11-08 03:25:17 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:21:21 -0500 |
commit | 90bcaf7b4a33bb9b100cc06869f0c033a870d4a0 (patch) | |
tree | fb8307b99fd9779d17fdfb0c35d836a8438d424a /net | |
parent | 92d9ece7af9c84bfbd1ff640926fac5b573a09f7 (diff) |
[IPV6]: flowlabels are net-endian
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/af_inet6.c | 2 | ||||
-rw-r--r-- | net/ipv6/datagram.c | 10 | ||||
-rw-r--r-- | net/ipv6/ip6_flowlabel.c | 8 | ||||
-rw-r--r-- | net/ipv6/ip6_output.c | 4 | ||||
-rw-r--r-- | net/ipv6/ip6_tunnel.c | 6 | ||||
-rw-r--r-- | net/ipv6/route.c | 2 |
6 files changed, 16 insertions, 16 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 858cae29581c..92bfccf62cb7 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -678,7 +678,7 @@ int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb) | |||
678 | if (np->rxopt.all) { | 678 | if (np->rxopt.all) { |
679 | if ((opt->hop && (np->rxopt.bits.hopopts || | 679 | if ((opt->hop && (np->rxopt.bits.hopopts || |
680 | np->rxopt.bits.ohopopts)) || | 680 | np->rxopt.bits.ohopopts)) || |
681 | ((IPV6_FLOWINFO_MASK & *(u32*)skb->nh.raw) && | 681 | ((IPV6_FLOWINFO_MASK & *(__be32*)skb->nh.raw) && |
682 | np->rxopt.bits.rxflow) || | 682 | np->rxopt.bits.rxflow) || |
683 | (opt->srcrt && (np->rxopt.bits.srcrt || | 683 | (opt->srcrt && (np->rxopt.bits.srcrt || |
684 | np->rxopt.bits.osrcrt)) || | 684 | np->rxopt.bits.osrcrt)) || |
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index 7206747022fc..a67434af691f 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c | |||
@@ -318,7 +318,7 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len) | |||
318 | ipv6_addr_copy(&sin->sin6_addr, | 318 | ipv6_addr_copy(&sin->sin6_addr, |
319 | (struct in6_addr *)(skb->nh.raw + serr->addr_offset)); | 319 | (struct in6_addr *)(skb->nh.raw + serr->addr_offset)); |
320 | if (np->sndflow) | 320 | if (np->sndflow) |
321 | sin->sin6_flowinfo = *(u32*)(skb->nh.raw + serr->addr_offset - 24) & IPV6_FLOWINFO_MASK; | 321 | sin->sin6_flowinfo = *(__be32*)(skb->nh.raw + serr->addr_offset - 24) & IPV6_FLOWINFO_MASK; |
322 | if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL) | 322 | if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL) |
323 | sin->sin6_scope_id = IP6CB(skb)->iif; | 323 | sin->sin6_scope_id = IP6CB(skb)->iif; |
324 | } else { | 324 | } else { |
@@ -401,8 +401,8 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb) | |||
401 | put_cmsg(msg, SOL_IPV6, IPV6_TCLASS, sizeof(tclass), &tclass); | 401 | put_cmsg(msg, SOL_IPV6, IPV6_TCLASS, sizeof(tclass), &tclass); |
402 | } | 402 | } |
403 | 403 | ||
404 | if (np->rxopt.bits.rxflow && (*(u32*)skb->nh.raw & IPV6_FLOWINFO_MASK)) { | 404 | if (np->rxopt.bits.rxflow && (*(__be32*)skb->nh.raw & IPV6_FLOWINFO_MASK)) { |
405 | u32 flowinfo = *(u32*)skb->nh.raw & IPV6_FLOWINFO_MASK; | 405 | __be32 flowinfo = *(__be32*)skb->nh.raw & IPV6_FLOWINFO_MASK; |
406 | put_cmsg(msg, SOL_IPV6, IPV6_FLOWINFO, sizeof(flowinfo), &flowinfo); | 406 | put_cmsg(msg, SOL_IPV6, IPV6_FLOWINFO, sizeof(flowinfo), &flowinfo); |
407 | } | 407 | } |
408 | 408 | ||
@@ -560,12 +560,12 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl, | |||
560 | } | 560 | } |
561 | 561 | ||
562 | if (fl->fl6_flowlabel&IPV6_FLOWINFO_MASK) { | 562 | if (fl->fl6_flowlabel&IPV6_FLOWINFO_MASK) { |
563 | if ((fl->fl6_flowlabel^*(u32 *)CMSG_DATA(cmsg))&~IPV6_FLOWINFO_MASK) { | 563 | if ((fl->fl6_flowlabel^*(__be32 *)CMSG_DATA(cmsg))&~IPV6_FLOWINFO_MASK) { |
564 | err = -EINVAL; | 564 | err = -EINVAL; |
565 | goto exit_f; | 565 | goto exit_f; |
566 | } | 566 | } |
567 | } | 567 | } |
568 | fl->fl6_flowlabel = IPV6_FLOWINFO_MASK & *(u32 *)CMSG_DATA(cmsg); | 568 | fl->fl6_flowlabel = IPV6_FLOWINFO_MASK & *(__be32 *)CMSG_DATA(cmsg); |
569 | break; | 569 | break; |
570 | 570 | ||
571 | case IPV6_2292HOPOPTS: | 571 | case IPV6_2292HOPOPTS: |
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index 6d4533b58dca..624fae251f4e 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c | |||
@@ -61,7 +61,7 @@ static DEFINE_RWLOCK(ip6_fl_lock); | |||
61 | static DEFINE_RWLOCK(ip6_sk_fl_lock); | 61 | static DEFINE_RWLOCK(ip6_sk_fl_lock); |
62 | 62 | ||
63 | 63 | ||
64 | static __inline__ struct ip6_flowlabel * __fl_lookup(u32 label) | 64 | static __inline__ struct ip6_flowlabel * __fl_lookup(__be32 label) |
65 | { | 65 | { |
66 | struct ip6_flowlabel *fl; | 66 | struct ip6_flowlabel *fl; |
67 | 67 | ||
@@ -72,7 +72,7 @@ static __inline__ struct ip6_flowlabel * __fl_lookup(u32 label) | |||
72 | return NULL; | 72 | return NULL; |
73 | } | 73 | } |
74 | 74 | ||
75 | static struct ip6_flowlabel * fl_lookup(u32 label) | 75 | static struct ip6_flowlabel * fl_lookup(__be32 label) |
76 | { | 76 | { |
77 | struct ip6_flowlabel *fl; | 77 | struct ip6_flowlabel *fl; |
78 | 78 | ||
@@ -153,7 +153,7 @@ static void ip6_fl_gc(unsigned long dummy) | |||
153 | write_unlock(&ip6_fl_lock); | 153 | write_unlock(&ip6_fl_lock); |
154 | } | 154 | } |
155 | 155 | ||
156 | static int fl_intern(struct ip6_flowlabel *fl, __u32 label) | 156 | static int fl_intern(struct ip6_flowlabel *fl, __be32 label) |
157 | { | 157 | { |
158 | fl->label = label & IPV6_FLOWLABEL_MASK; | 158 | fl->label = label & IPV6_FLOWLABEL_MASK; |
159 | 159 | ||
@@ -182,7 +182,7 @@ static int fl_intern(struct ip6_flowlabel *fl, __u32 label) | |||
182 | 182 | ||
183 | /* Socket flowlabel lists */ | 183 | /* Socket flowlabel lists */ |
184 | 184 | ||
185 | struct ip6_flowlabel * fl6_sock_lookup(struct sock *sk, u32 label) | 185 | struct ip6_flowlabel * fl6_sock_lookup(struct sock *sk, __be32 label) |
186 | { | 186 | { |
187 | struct ipv6_fl_socklist *sfl; | 187 | struct ipv6_fl_socklist *sfl; |
188 | struct ipv6_pinfo *np = inet6_sk(sk); | 188 | struct ipv6_pinfo *np = inet6_sk(sk); |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 66716911962e..9ff1be1bc2e7 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -217,7 +217,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, | |||
217 | if (tclass < 0) | 217 | if (tclass < 0) |
218 | tclass = 0; | 218 | tclass = 0; |
219 | 219 | ||
220 | *(u32 *)hdr = htonl(0x60000000 | (tclass << 20)) | fl->fl6_flowlabel; | 220 | *(__be32 *)hdr = htonl(0x60000000 | (tclass << 20)) | fl->fl6_flowlabel; |
221 | 221 | ||
222 | hdr->payload_len = htons(seg_len); | 222 | hdr->payload_len = htons(seg_len); |
223 | hdr->nexthdr = proto; | 223 | hdr->nexthdr = proto; |
@@ -1311,7 +1311,7 @@ int ip6_push_pending_frames(struct sock *sk) | |||
1311 | 1311 | ||
1312 | skb->nh.ipv6h = hdr = (struct ipv6hdr*) skb_push(skb, sizeof(struct ipv6hdr)); | 1312 | skb->nh.ipv6h = hdr = (struct ipv6hdr*) skb_push(skb, sizeof(struct ipv6hdr)); |
1313 | 1313 | ||
1314 | *(u32*)hdr = fl->fl6_flowlabel | | 1314 | *(__be32*)hdr = fl->fl6_flowlabel | |
1315 | htonl(0x60000000 | ((int)np->cork.tclass << 20)); | 1315 | htonl(0x60000000 | ((int)np->cork.tclass << 20)); |
1316 | 1316 | ||
1317 | if (skb->len <= sizeof(struct ipv6hdr) + IPV6_MAXPLEN) | 1317 | if (skb->len <= sizeof(struct ipv6hdr) + IPV6_MAXPLEN) |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 6a3026dd865a..4919f9294e2a 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -665,9 +665,9 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
665 | 665 | ||
666 | dsfield = ipv6_get_dsfield(ipv6h); | 666 | dsfield = ipv6_get_dsfield(ipv6h); |
667 | if ((t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)) | 667 | if ((t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)) |
668 | fl.fl6_flowlabel |= (*(__u32 *) ipv6h & IPV6_TCLASS_MASK); | 668 | fl.fl6_flowlabel |= (*(__be32 *) ipv6h & IPV6_TCLASS_MASK); |
669 | if ((t->parms.flags & IP6_TNL_F_USE_ORIG_FLOWLABEL)) | 669 | if ((t->parms.flags & IP6_TNL_F_USE_ORIG_FLOWLABEL)) |
670 | fl.fl6_flowlabel |= (*(__u32 *) ipv6h & IPV6_FLOWLABEL_MASK); | 670 | fl.fl6_flowlabel |= (*(__be32 *) ipv6h & IPV6_FLOWLABEL_MASK); |
671 | 671 | ||
672 | if (encap_limit >= 0 && (opt = create_tel(encap_limit)) == NULL) | 672 | if (encap_limit >= 0 && (opt = create_tel(encap_limit)) == NULL) |
673 | goto tx_err; | 673 | goto tx_err; |
@@ -735,7 +735,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
735 | 735 | ||
736 | skb->nh.raw = skb_push(skb, sizeof(struct ipv6hdr)); | 736 | skb->nh.raw = skb_push(skb, sizeof(struct ipv6hdr)); |
737 | ipv6h = skb->nh.ipv6h; | 737 | ipv6h = skb->nh.ipv6h; |
738 | *(u32*)ipv6h = fl.fl6_flowlabel | htonl(0x60000000); | 738 | *(__be32*)ipv6h = fl.fl6_flowlabel | htonl(0x60000000); |
739 | dsfield = INET_ECN_encapsulate(0, dsfield); | 739 | dsfield = INET_ECN_encapsulate(0, dsfield); |
740 | ipv6_change_dsfield(ipv6h, ~INET_ECN_MASK, dsfield); | 740 | ipv6_change_dsfield(ipv6h, ~INET_ECN_MASK, dsfield); |
741 | ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); | 741 | ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index b39ae99122d5..e9c1fc5f21b1 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -714,7 +714,7 @@ void ip6_route_input(struct sk_buff *skb) | |||
714 | #ifdef CONFIG_IPV6_ROUTE_FWMARK | 714 | #ifdef CONFIG_IPV6_ROUTE_FWMARK |
715 | .fwmark = skb->nfmark, | 715 | .fwmark = skb->nfmark, |
716 | #endif | 716 | #endif |
717 | .flowlabel = (* (u32 *) iph)&IPV6_FLOWINFO_MASK, | 717 | .flowlabel = (* (__be32 *) iph)&IPV6_FLOWINFO_MASK, |
718 | }, | 718 | }, |
719 | }, | 719 | }, |
720 | .proto = iph->nexthdr, | 720 | .proto = iph->nexthdr, |