diff options
author | YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org> | 2013-01-13 05:01:51 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-13 20:17:13 -0500 |
commit | 6502ca527f8ed2c3bb327d9db8e7e6e7dcbef511 (patch) | |
tree | ac76c5941e5ec45ab6ee8b0aa26db67eb67930f6 /net/ipv6/datagram.c | |
parent | 3e4e4c1f2da66b29ee9379ca29f8dd620c2b5a1f (diff) | |
download | op-kernel-dev-6502ca527f8ed2c3bb327d9db8e7e6e7dcbef511.zip op-kernel-dev-6502ca527f8ed2c3bb327d9db8e7e6e7dcbef511.tar.gz |
ipv6: Introduce ip6_flowinfo() to extract flowinfo (tclass + flowlabel).
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/datagram.c')
-rw-r--r-- | net/ipv6/datagram.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index 56b692b..7f65df4 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c @@ -360,7 +360,7 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len) struct ipv6hdr, daddr); sin->sin6_addr = ip6h->daddr; if (np->sndflow) - sin->sin6_flowinfo = *(__be32 *)ip6h & IPV6_FLOWINFO_MASK; + sin->sin6_flowinfo = ip6_flowinfo(ip6h); if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL) sin->sin6_scope_id = IP6CB(skb)->iif; } else { @@ -491,9 +491,10 @@ 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 && (*(__be32 *)nh & IPV6_FLOWINFO_MASK)) { - __be32 flowinfo = *(__be32 *)nh & IPV6_FLOWINFO_MASK; - put_cmsg(msg, SOL_IPV6, IPV6_FLOWINFO, sizeof(flowinfo), &flowinfo); + if (np->rxopt.bits.rxflow) { + __be32 flowinfo = ip6_flowinfo((struct ipv6hdr *)nh); + if (flowinfo) + put_cmsg(msg, SOL_IPV6, IPV6_FLOWINFO, sizeof(flowinfo), &flowinfo); } /* HbH is allowed only once */ |