diff options
| -rw-r--r-- | include/net/ipv6.h | 5 | ||||
| -rw-r--r-- | net/ipv6/datagram.c | 9 | ||||
| -rw-r--r-- | net/ipv6/route.c | 6 |
3 files changed, 13 insertions, 7 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index fcbc6464b014..ed672080c690 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
| @@ -555,6 +555,11 @@ static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass, | |||
| 555 | *(__be32 *)hdr = ntohl(0x60000000 | (tclass << 20)) | flowlabel; | 555 | *(__be32 *)hdr = ntohl(0x60000000 | (tclass << 20)) | flowlabel; |
| 556 | } | 556 | } |
| 557 | 557 | ||
| 558 | static inline __be32 ip6_flowinfo(const struct ipv6hdr *hdr) | ||
| 559 | { | ||
| 560 | return *(__be32 *)hdr & IPV6_FLOWINFO_MASK; | ||
| 561 | } | ||
| 562 | |||
| 558 | /* | 563 | /* |
| 559 | * Prototypes exported by ipv6 | 564 | * Prototypes exported by ipv6 |
| 560 | */ | 565 | */ |
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index 56b692bb94a7..7f65df41c396 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) | |||
| 360 | struct ipv6hdr, daddr); | 360 | struct ipv6hdr, daddr); |
| 361 | sin->sin6_addr = ip6h->daddr; | 361 | sin->sin6_addr = ip6h->daddr; |
| 362 | if (np->sndflow) | 362 | if (np->sndflow) |
| 363 | sin->sin6_flowinfo = *(__be32 *)ip6h & IPV6_FLOWINFO_MASK; | 363 | sin->sin6_flowinfo = ip6_flowinfo(ip6h); |
| 364 | if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL) | 364 | if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL) |
| 365 | sin->sin6_scope_id = IP6CB(skb)->iif; | 365 | sin->sin6_scope_id = IP6CB(skb)->iif; |
| 366 | } else { | 366 | } else { |
| @@ -491,9 +491,10 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb) | |||
| 491 | put_cmsg(msg, SOL_IPV6, IPV6_TCLASS, sizeof(tclass), &tclass); | 491 | put_cmsg(msg, SOL_IPV6, IPV6_TCLASS, sizeof(tclass), &tclass); |
| 492 | } | 492 | } |
| 493 | 493 | ||
| 494 | if (np->rxopt.bits.rxflow && (*(__be32 *)nh & IPV6_FLOWINFO_MASK)) { | 494 | if (np->rxopt.bits.rxflow) { |
| 495 | __be32 flowinfo = *(__be32 *)nh & IPV6_FLOWINFO_MASK; | 495 | __be32 flowinfo = ip6_flowinfo((struct ipv6hdr *)nh); |
| 496 | put_cmsg(msg, SOL_IPV6, IPV6_FLOWINFO, sizeof(flowinfo), &flowinfo); | 496 | if (flowinfo) |
| 497 | put_cmsg(msg, SOL_IPV6, IPV6_FLOWINFO, sizeof(flowinfo), &flowinfo); | ||
| 497 | } | 498 | } |
| 498 | 499 | ||
| 499 | /* HbH is allowed only once */ | 500 | /* HbH is allowed only once */ |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 621b68ecf16f..6238eb5037a7 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
| @@ -994,7 +994,7 @@ void ip6_route_input(struct sk_buff *skb) | |||
| 994 | .flowi6_iif = skb->dev->ifindex, | 994 | .flowi6_iif = skb->dev->ifindex, |
| 995 | .daddr = iph->daddr, | 995 | .daddr = iph->daddr, |
| 996 | .saddr = iph->saddr, | 996 | .saddr = iph->saddr, |
| 997 | .flowlabel = (* (__be32 *) iph) & IPV6_FLOWINFO_MASK, | 997 | .flowlabel = ip6_flowinfo(iph), |
| 998 | .flowi6_mark = skb->mark, | 998 | .flowi6_mark = skb->mark, |
| 999 | .flowi6_proto = iph->nexthdr, | 999 | .flowi6_proto = iph->nexthdr, |
| 1000 | }; | 1000 | }; |
| @@ -1159,7 +1159,7 @@ void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu, | |||
| 1159 | fl6.flowi6_flags = 0; | 1159 | fl6.flowi6_flags = 0; |
| 1160 | fl6.daddr = iph->daddr; | 1160 | fl6.daddr = iph->daddr; |
| 1161 | fl6.saddr = iph->saddr; | 1161 | fl6.saddr = iph->saddr; |
| 1162 | fl6.flowlabel = (*(__be32 *) iph) & IPV6_FLOWINFO_MASK; | 1162 | fl6.flowlabel = ip6_flowinfo(iph); |
| 1163 | 1163 | ||
| 1164 | dst = ip6_route_output(net, NULL, &fl6); | 1164 | dst = ip6_route_output(net, NULL, &fl6); |
| 1165 | if (!dst->error) | 1165 | if (!dst->error) |
| @@ -1187,7 +1187,7 @@ void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark) | |||
| 1187 | fl6.flowi6_flags = 0; | 1187 | fl6.flowi6_flags = 0; |
| 1188 | fl6.daddr = iph->daddr; | 1188 | fl6.daddr = iph->daddr; |
| 1189 | fl6.saddr = iph->saddr; | 1189 | fl6.saddr = iph->saddr; |
| 1190 | fl6.flowlabel = (*(__be32 *) iph) & IPV6_FLOWINFO_MASK; | 1190 | fl6.flowlabel = ip6_flowinfo(iph); |
| 1191 | 1191 | ||
| 1192 | dst = ip6_route_output(net, NULL, &fl6); | 1192 | dst = ip6_route_output(net, NULL, &fl6); |
| 1193 | if (!dst->error) | 1193 | if (!dst->error) |
