mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									f70ea018da
								
							
						
					
					
						commit
						67800f9b1f
					
				
					 4 changed files with 9 additions and 7 deletions
				
			
		| 
						 | 
					@ -708,12 +708,13 @@ static inline void iph_to_flow_copy_v6addrs(struct flow_keys *flow,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if IS_ENABLED(CONFIG_IPV6)
 | 
					#if IS_ENABLED(CONFIG_IPV6)
 | 
				
			||||||
static inline __be32 ip6_make_flowlabel(struct net *net, struct sk_buff *skb,
 | 
					static inline __be32 ip6_make_flowlabel(struct net *net, struct sk_buff *skb,
 | 
				
			||||||
					__be32 flowlabel, bool autolabel)
 | 
										__be32 flowlabel, bool autolabel,
 | 
				
			||||||
 | 
										struct flowi6 *fl6)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (!flowlabel && (autolabel || net->ipv6.sysctl.auto_flowlabels)) {
 | 
						if (!flowlabel && (autolabel || net->ipv6.sysctl.auto_flowlabels)) {
 | 
				
			||||||
		u32 hash;
 | 
							u32 hash;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		hash = skb_get_hash(skb);
 | 
							hash = skb_get_hash_flowi6(skb, fl6);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* Since this is being sent on the wire obfuscate hash a bit
 | 
							/* Since this is being sent on the wire obfuscate hash a bit
 | 
				
			||||||
		 * to minimize possbility that any useful information to an
 | 
							 * to minimize possbility that any useful information to an
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -728,7 +728,7 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb,
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	ipv6h = ipv6_hdr(skb);
 | 
						ipv6h = ipv6_hdr(skb);
 | 
				
			||||||
	ip6_flow_hdr(ipv6h, INET_ECN_encapsulate(0, dsfield),
 | 
						ip6_flow_hdr(ipv6h, INET_ECN_encapsulate(0, dsfield),
 | 
				
			||||||
		     ip6_make_flowlabel(net, skb, fl6->flowlabel, false));
 | 
							     ip6_make_flowlabel(net, skb, fl6->flowlabel, false, fl6));
 | 
				
			||||||
	ipv6h->hop_limit = tunnel->parms.hop_limit;
 | 
						ipv6h->hop_limit = tunnel->parms.hop_limit;
 | 
				
			||||||
	ipv6h->nexthdr = proto;
 | 
						ipv6h->nexthdr = proto;
 | 
				
			||||||
	ipv6h->saddr = fl6->saddr;
 | 
						ipv6h->saddr = fl6->saddr;
 | 
				
			||||||
| 
						 | 
					@ -1182,7 +1182,8 @@ static int ip6gre_header(struct sk_buff *skb, struct net_device *dev,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ip6_flow_hdr(ipv6h, 0,
 | 
						ip6_flow_hdr(ipv6h, 0,
 | 
				
			||||||
		     ip6_make_flowlabel(dev_net(dev), skb,
 | 
							     ip6_make_flowlabel(dev_net(dev), skb,
 | 
				
			||||||
					t->fl.u.ip6.flowlabel, false));
 | 
										t->fl.u.ip6.flowlabel, false,
 | 
				
			||||||
 | 
										&t->fl.u.ip6));
 | 
				
			||||||
	ipv6h->hop_limit = t->parms.hop_limit;
 | 
						ipv6h->hop_limit = t->parms.hop_limit;
 | 
				
			||||||
	ipv6h->nexthdr = NEXTHDR_GRE;
 | 
						ipv6h->nexthdr = NEXTHDR_GRE;
 | 
				
			||||||
	ipv6h->saddr = t->parms.laddr;
 | 
						ipv6h->saddr = t->parms.laddr;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -207,7 +207,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
 | 
				
			||||||
		hlimit = ip6_dst_hoplimit(dst);
 | 
							hlimit = ip6_dst_hoplimit(dst);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ip6_flow_hdr(hdr, tclass, ip6_make_flowlabel(net, skb, fl6->flowlabel,
 | 
						ip6_flow_hdr(hdr, tclass, ip6_make_flowlabel(net, skb, fl6->flowlabel,
 | 
				
			||||||
						     np->autoflowlabel));
 | 
											     np->autoflowlabel, fl6));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	hdr->payload_len = htons(seg_len);
 | 
						hdr->payload_len = htons(seg_len);
 | 
				
			||||||
	hdr->nexthdr = proto;
 | 
						hdr->nexthdr = proto;
 | 
				
			||||||
| 
						 | 
					@ -1649,7 +1649,7 @@ struct sk_buff *__ip6_make_skb(struct sock *sk,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ip6_flow_hdr(hdr, v6_cork->tclass,
 | 
						ip6_flow_hdr(hdr, v6_cork->tclass,
 | 
				
			||||||
		     ip6_make_flowlabel(net, skb, fl6->flowlabel,
 | 
							     ip6_make_flowlabel(net, skb, fl6->flowlabel,
 | 
				
			||||||
					np->autoflowlabel));
 | 
										np->autoflowlabel, fl6));
 | 
				
			||||||
	hdr->hop_limit = v6_cork->hop_limit;
 | 
						hdr->hop_limit = v6_cork->hop_limit;
 | 
				
			||||||
	hdr->nexthdr = proto;
 | 
						hdr->nexthdr = proto;
 | 
				
			||||||
	hdr->saddr = fl6->saddr;
 | 
						hdr->saddr = fl6->saddr;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1095,7 +1095,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
 | 
				
			||||||
	skb_reset_network_header(skb);
 | 
						skb_reset_network_header(skb);
 | 
				
			||||||
	ipv6h = ipv6_hdr(skb);
 | 
						ipv6h = ipv6_hdr(skb);
 | 
				
			||||||
	ip6_flow_hdr(ipv6h, INET_ECN_encapsulate(0, dsfield),
 | 
						ip6_flow_hdr(ipv6h, INET_ECN_encapsulate(0, dsfield),
 | 
				
			||||||
		     ip6_make_flowlabel(net, skb, fl6->flowlabel, false));
 | 
							     ip6_make_flowlabel(net, skb, fl6->flowlabel, false, fl6));
 | 
				
			||||||
	ipv6h->hop_limit = t->parms.hop_limit;
 | 
						ipv6h->hop_limit = t->parms.hop_limit;
 | 
				
			||||||
	ipv6h->nexthdr = proto;
 | 
						ipv6h->nexthdr = proto;
 | 
				
			||||||
	ipv6h->saddr = fl6->saddr;
 | 
						ipv6h->saddr = fl6->saddr;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue