]> err.no Git - linux-2.6/commitdiff
[IPV6]: flowlabels are net-endian
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 8 Nov 2006 08:25:17 +0000 (00:25 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 3 Dec 2006 05:21:21 +0000 (21:21 -0800)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/in6.h
include/linux/ip6_tunnel.h
include/linux/ipv6.h
include/net/flow.h
include/net/ipv6.h
net/ipv6/af_inet6.c
net/ipv6/datagram.c
net/ipv6/ip6_flowlabel.c
net/ipv6/ip6_output.c
net/ipv6/ip6_tunnel.c
net/ipv6/route.c

index f28621f638e0ce1727ed25f6271ca95482b5dc4a..4e8350ae886975b3a043109d4019816bacf8b495 100644 (file)
@@ -54,7 +54,7 @@ extern const struct in6_addr in6addr_loopback;
 struct sockaddr_in6 {
        unsigned short int      sin6_family;    /* AF_INET6 */
        __be16                  sin6_port;      /* Transport layer port # */
-       __u32                   sin6_flowinfo;  /* IPv6 flow information */
+       __be32                  sin6_flowinfo;  /* IPv6 flow information */
        struct in6_addr         sin6_addr;      /* IPv6 address */
        __u32                   sin6_scope_id;  /* scope id (new in RFC2553) */
 };
@@ -72,7 +72,7 @@ struct ipv6_mreq {
 struct in6_flowlabel_req
 {
        struct in6_addr flr_dst;
-       __u32   flr_label;
+       __be32  flr_label;
        __u8    flr_action;
        __u8    flr_share;
        __u16   flr_flags;
index 5c23aeb104cad3ad77486ac2250621186acb49eb..af3f4a70f3df63ecb04c5bc69efa2013965553bf 100644 (file)
@@ -25,7 +25,7 @@ struct ip6_tnl_parm {
        __u8 proto;             /* tunnel protocol */
        __u8 encap_limit;       /* encapsulation limit for tunnel */
        __u8 hop_limit;         /* hop limit for tunnel */
-       __u32 flowinfo;         /* traffic class and flowlabel for tunnel */
+       __be32 flowinfo;        /* traffic class and flowlabel for tunnel */
        __u32 flags;            /* tunnel flags */
        struct in6_addr laddr;  /* local tunnel end-point address */
        struct in6_addr raddr;  /* remote tunnel end-point address */
index 4f435c59de06775b5a1a5ba831ca3f0089006b80..f8241130f5eade5232b3fb5e4a4c8984767d9a59 100644 (file)
@@ -274,7 +274,7 @@ struct ipv6_pinfo {
        struct in6_addr         *saddr_cache;
 #endif
 
-       __u32                   flow_label;
+       __be32                  flow_label;
        __u32                   frag_size;
        __s16                   hop_limit;
        __s16                   mcast_hops;
index 5cda27cd9debdbaa59afd05ec151b61badf9e4e5..270d4c1761af478badd4da3e86bc590ccf9ae773 100644 (file)
@@ -27,7 +27,7 @@ struct flowi {
                        struct in6_addr         daddr;
                        struct in6_addr         saddr;
                        __u32                   fwmark;
-                       __u32                   flowlabel;
+                       __be32                  flowlabel;
                } ip6_u;
 
                struct {
index 4953fac1d070267c4f98c40cf6124936e03730e2..0b8c9b990ac4a115a790ed3b9a183fe9a9d2f8b8 100644 (file)
@@ -191,7 +191,7 @@ struct ipv6_txoptions
 struct ip6_flowlabel
 {
        struct ip6_flowlabel    *next;
-       u32                     label;
+       __be32                  label;
        struct in6_addr         dst;
        struct ipv6_txoptions   *opt;
        atomic_t                users;
@@ -211,7 +211,7 @@ struct ipv6_fl_socklist
        struct ip6_flowlabel    *fl;
 };
 
-extern struct ip6_flowlabel    *fl6_sock_lookup(struct sock *sk, u32 label);
+extern struct ip6_flowlabel    *fl6_sock_lookup(struct sock *sk, __be32 label);
 extern struct ipv6_txoptions   *fl6_merge_options(struct ipv6_txoptions * opt_space,
                                                   struct ip6_flowlabel * fl,
                                                   struct ipv6_txoptions * fopt);
index 858cae29581c8e129289ce09cf644fd5d70c9184..92bfccf62cb7f5af9f3d90d289043175ce348961 100644 (file)
@@ -678,7 +678,7 @@ int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb)
        if (np->rxopt.all) {
                if ((opt->hop && (np->rxopt.bits.hopopts ||
                                  np->rxopt.bits.ohopopts)) ||
-                   ((IPV6_FLOWINFO_MASK & *(u32*)skb->nh.raw) &&
+                   ((IPV6_FLOWINFO_MASK & *(__be32*)skb->nh.raw) &&
                     np->rxopt.bits.rxflow) ||
                    (opt->srcrt && (np->rxopt.bits.srcrt ||
                     np->rxopt.bits.osrcrt)) ||
index 7206747022fcf6407e71cedaf49be827badf0cdb..a67434af691f6ec46eee1fd72df0125e0b7bac09 100644 (file)
@@ -318,7 +318,7 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len)
                        ipv6_addr_copy(&sin->sin6_addr,
                          (struct in6_addr *)(skb->nh.raw + serr->addr_offset));
                        if (np->sndflow)
-                               sin->sin6_flowinfo = *(u32*)(skb->nh.raw + serr->addr_offset - 24) & IPV6_FLOWINFO_MASK;
+                               sin->sin6_flowinfo = *(__be32*)(skb->nh.raw + serr->addr_offset - 24) & IPV6_FLOWINFO_MASK;
                        if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL)
                                sin->sin6_scope_id = IP6CB(skb)->iif;
                } else {
@@ -401,8 +401,8 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
                put_cmsg(msg, SOL_IPV6, IPV6_TCLASS, sizeof(tclass), &tclass);
        }
 
-       if (np->rxopt.bits.rxflow && (*(u32*)skb->nh.raw & IPV6_FLOWINFO_MASK)) {
-               u32 flowinfo = *(u32*)skb->nh.raw & IPV6_FLOWINFO_MASK;
+       if (np->rxopt.bits.rxflow && (*(__be32*)skb->nh.raw & IPV6_FLOWINFO_MASK)) {
+               __be32 flowinfo = *(__be32*)skb->nh.raw & IPV6_FLOWINFO_MASK;
                put_cmsg(msg, SOL_IPV6, IPV6_FLOWINFO, sizeof(flowinfo), &flowinfo);
        }
 
@@ -560,12 +560,12 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
                        }
 
                        if (fl->fl6_flowlabel&IPV6_FLOWINFO_MASK) {
-                               if ((fl->fl6_flowlabel^*(u32 *)CMSG_DATA(cmsg))&~IPV6_FLOWINFO_MASK) {
+                               if ((fl->fl6_flowlabel^*(__be32 *)CMSG_DATA(cmsg))&~IPV6_FLOWINFO_MASK) {
                                        err = -EINVAL;
                                        goto exit_f;
                                }
                        }
-                       fl->fl6_flowlabel = IPV6_FLOWINFO_MASK & *(u32 *)CMSG_DATA(cmsg);
+                       fl->fl6_flowlabel = IPV6_FLOWINFO_MASK & *(__be32 *)CMSG_DATA(cmsg);
                        break;
 
                case IPV6_2292HOPOPTS:
index 6d4533b58dcad4100dd8ca853ce07d69912f5f4c..624fae251f4e227c21dd8d8abd420f143910e70f 100644 (file)
@@ -61,7 +61,7 @@ static DEFINE_RWLOCK(ip6_fl_lock);
 static DEFINE_RWLOCK(ip6_sk_fl_lock);
 
 
-static __inline__ struct ip6_flowlabel * __fl_lookup(u32 label)
+static __inline__ struct ip6_flowlabel * __fl_lookup(__be32 label)
 {
        struct ip6_flowlabel *fl;
 
@@ -72,7 +72,7 @@ static __inline__ struct ip6_flowlabel * __fl_lookup(u32 label)
        return NULL;
 }
 
-static struct ip6_flowlabel * fl_lookup(u32 label)
+static struct ip6_flowlabel * fl_lookup(__be32 label)
 {
        struct ip6_flowlabel *fl;
 
@@ -153,7 +153,7 @@ static void ip6_fl_gc(unsigned long dummy)
        write_unlock(&ip6_fl_lock);
 }
 
-static int fl_intern(struct ip6_flowlabel *fl, __u32 label)
+static int fl_intern(struct ip6_flowlabel *fl, __be32 label)
 {
        fl->label = label & IPV6_FLOWLABEL_MASK;
 
@@ -182,7 +182,7 @@ static int fl_intern(struct ip6_flowlabel *fl, __u32 label)
 
 /* Socket flowlabel lists */
 
-struct ip6_flowlabel * fl6_sock_lookup(struct sock *sk, u32 label)
+struct ip6_flowlabel * fl6_sock_lookup(struct sock *sk, __be32 label)
 {
        struct ipv6_fl_socklist *sfl;
        struct ipv6_pinfo *np = inet6_sk(sk);
index 66716911962eb967aa487b964895548c3542ea8c..9ff1be1bc2e7b1d2d6b9fab786cec4bdd70db234 100644 (file)
@@ -217,7 +217,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
        if (tclass < 0)
                tclass = 0;
 
-       *(u32 *)hdr = htonl(0x60000000 | (tclass << 20)) | fl->fl6_flowlabel;
+       *(__be32 *)hdr = htonl(0x60000000 | (tclass << 20)) | fl->fl6_flowlabel;
 
        hdr->payload_len = htons(seg_len);
        hdr->nexthdr = proto;
@@ -1311,7 +1311,7 @@ int ip6_push_pending_frames(struct sock *sk)
 
        skb->nh.ipv6h = hdr = (struct ipv6hdr*) skb_push(skb, sizeof(struct ipv6hdr));
        
-       *(u32*)hdr = fl->fl6_flowlabel |
+       *(__be32*)hdr = fl->fl6_flowlabel |
                     htonl(0x60000000 | ((int)np->cork.tclass << 20));
 
        if (skb->len <= sizeof(struct ipv6hdr) + IPV6_MAXPLEN)
index 6a3026dd865ab680f5ae6b0bd6bc31fc8bed3819..4919f9294e2a3bf4c105fdb2d089d19279eac136 100644 (file)
@@ -665,9 +665,9 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
 
        dsfield = ipv6_get_dsfield(ipv6h);
        if ((t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS))
-               fl.fl6_flowlabel |= (*(__u32 *) ipv6h & IPV6_TCLASS_MASK);
+               fl.fl6_flowlabel |= (*(__be32 *) ipv6h & IPV6_TCLASS_MASK);
        if ((t->parms.flags & IP6_TNL_F_USE_ORIG_FLOWLABEL))
-               fl.fl6_flowlabel |= (*(__u32 *) ipv6h & IPV6_FLOWLABEL_MASK);
+               fl.fl6_flowlabel |= (*(__be32 *) ipv6h & IPV6_FLOWLABEL_MASK);
 
        if (encap_limit >= 0 && (opt = create_tel(encap_limit)) == NULL)
                goto tx_err;
@@ -735,7 +735,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
 
        skb->nh.raw = skb_push(skb, sizeof(struct ipv6hdr));
        ipv6h = skb->nh.ipv6h;
-       *(u32*)ipv6h = fl.fl6_flowlabel | htonl(0x60000000);
+       *(__be32*)ipv6h = fl.fl6_flowlabel | htonl(0x60000000);
        dsfield = INET_ECN_encapsulate(0, dsfield);
        ipv6_change_dsfield(ipv6h, ~INET_ECN_MASK, dsfield);
        ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
index b39ae99122d54a3844f2183130854a45eb459e19..e9c1fc5f21b189eec4c0530a43b9a68675a621ce 100644 (file)
@@ -714,7 +714,7 @@ void ip6_route_input(struct sk_buff *skb)
 #ifdef CONFIG_IPV6_ROUTE_FWMARK
                                .fwmark = skb->nfmark,
 #endif
-                               .flowlabel = (* (u32 *) iph)&IPV6_FLOWINFO_MASK,
+                               .flowlabel = (* (__be32 *) iph)&IPV6_FLOWINFO_MASK,
                        },
                },
                .proto = iph->nexthdr,