Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipv6: Call skb_get_hash_flowi6 to get skb->hash in ip6_make_flowlabel

We can't call skb_get_hash here since the packet is not complete to do
flow_dissector. Create hash based on flowi6 instead.

Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Tom Herbert and committed by
David S. Miller
67800f9b f70ea018

+9 -7
+3 -2
include/net/ipv6.h
··· 708 708 709 709 #if IS_ENABLED(CONFIG_IPV6) 710 710 static inline __be32 ip6_make_flowlabel(struct net *net, struct sk_buff *skb, 711 - __be32 flowlabel, bool autolabel) 711 + __be32 flowlabel, bool autolabel, 712 + struct flowi6 *fl6) 712 713 { 713 714 if (!flowlabel && (autolabel || net->ipv6.sysctl.auto_flowlabels)) { 714 715 u32 hash; 715 716 716 - hash = skb_get_hash(skb); 717 + hash = skb_get_hash_flowi6(skb, fl6); 717 718 718 719 /* Since this is being sent on the wire obfuscate hash a bit 719 720 * to minimize possbility that any useful information to an
+3 -2
net/ipv6/ip6_gre.c
··· 728 728 */ 729 729 ipv6h = ipv6_hdr(skb); 730 730 ip6_flow_hdr(ipv6h, INET_ECN_encapsulate(0, dsfield), 731 - ip6_make_flowlabel(net, skb, fl6->flowlabel, false)); 731 + ip6_make_flowlabel(net, skb, fl6->flowlabel, false, fl6)); 732 732 ipv6h->hop_limit = tunnel->parms.hop_limit; 733 733 ipv6h->nexthdr = proto; 734 734 ipv6h->saddr = fl6->saddr; ··· 1182 1182 1183 1183 ip6_flow_hdr(ipv6h, 0, 1184 1184 ip6_make_flowlabel(dev_net(dev), skb, 1185 - t->fl.u.ip6.flowlabel, false)); 1185 + t->fl.u.ip6.flowlabel, false, 1186 + &t->fl.u.ip6)); 1186 1187 ipv6h->hop_limit = t->parms.hop_limit; 1187 1188 ipv6h->nexthdr = NEXTHDR_GRE; 1188 1189 ipv6h->saddr = t->parms.laddr;
+2 -2
net/ipv6/ip6_output.c
··· 207 207 hlimit = ip6_dst_hoplimit(dst); 208 208 209 209 ip6_flow_hdr(hdr, tclass, ip6_make_flowlabel(net, skb, fl6->flowlabel, 210 - np->autoflowlabel)); 210 + np->autoflowlabel, fl6)); 211 211 212 212 hdr->payload_len = htons(seg_len); 213 213 hdr->nexthdr = proto; ··· 1649 1649 1650 1650 ip6_flow_hdr(hdr, v6_cork->tclass, 1651 1651 ip6_make_flowlabel(net, skb, fl6->flowlabel, 1652 - np->autoflowlabel)); 1652 + np->autoflowlabel, fl6)); 1653 1653 hdr->hop_limit = v6_cork->hop_limit; 1654 1654 hdr->nexthdr = proto; 1655 1655 hdr->saddr = fl6->saddr;
+1 -1
net/ipv6/ip6_tunnel.c
··· 1095 1095 skb_reset_network_header(skb); 1096 1096 ipv6h = ipv6_hdr(skb); 1097 1097 ip6_flow_hdr(ipv6h, INET_ECN_encapsulate(0, dsfield), 1098 - ip6_make_flowlabel(net, skb, fl6->flowlabel, false)); 1098 + ip6_make_flowlabel(net, skb, fl6->flowlabel, false, fl6)); 1099 1099 ipv6h->hop_limit = t->parms.hop_limit; 1100 1100 ipv6h->nexthdr = proto; 1101 1101 ipv6h->saddr = fl6->saddr;