mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	net: core: handle encapsulation offloads when computing segment lengths
if ->encapsulation is set we have to use inner_tcp_hdrlen and add the size of the inner network headers too. This is 'mostly harmless'; tbf might send skb that is slightly over quota or drop skb even if it would have fit. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									330966e501
								
							
						
					
					
						commit
						f993bc25e5
					
				
					 1 changed files with 10 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -4070,15 +4070,22 @@ EXPORT_SYMBOL_GPL(skb_scrub_packet);
 | 
			
		|||
unsigned int skb_gso_transport_seglen(const struct sk_buff *skb)
 | 
			
		||||
{
 | 
			
		||||
	const struct skb_shared_info *shinfo = skb_shinfo(skb);
 | 
			
		||||
	unsigned int thlen = 0;
 | 
			
		||||
 | 
			
		||||
	if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)))
 | 
			
		||||
		return tcp_hdrlen(skb) + shinfo->gso_size;
 | 
			
		||||
	if (skb->encapsulation) {
 | 
			
		||||
		thlen = skb_inner_transport_header(skb) -
 | 
			
		||||
			skb_transport_header(skb);
 | 
			
		||||
 | 
			
		||||
		if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)))
 | 
			
		||||
			thlen += inner_tcp_hdrlen(skb);
 | 
			
		||||
	} else if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))) {
 | 
			
		||||
		thlen = tcp_hdrlen(skb);
 | 
			
		||||
	}
 | 
			
		||||
	/* UFO sets gso_size to the size of the fragmentation
 | 
			
		||||
	 * payload, i.e. the size of the L4 (UDP) header is already
 | 
			
		||||
	 * accounted for.
 | 
			
		||||
	 */
 | 
			
		||||
	return shinfo->gso_size;
 | 
			
		||||
	return thlen + shinfo->gso_size;
 | 
			
		||||
}
 | 
			
		||||
EXPORT_SYMBOL_GPL(skb_gso_transport_seglen);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue