[IPV6]: flowlabels are net-endian
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
92d9ece7af
commit
90bcaf7b4a
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -27,7 +27,7 @@ struct flowi {
|
|||
struct in6_addr daddr;
|
||||
struct in6_addr saddr;
|
||||
__u32 fwmark;
|
||||
__u32 flowlabel;
|
||||
__be32 flowlabel;
|
||||
} ip6_u;
|
||||
|
||||
struct {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)) ||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue