forked from mirrors/linux
		
	ipv4: tcp: clean up tcp_v4_early_demux()
Use same header helpers than tcp_v6_early_demux() because they are a bit faster, and as they make IPv4/IPv6 versions look the same. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Neal Cardwell <ncardwell@google.com> Acked-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									f3f121359c
								
							
						
					
					
						commit
						45f00f99d6
					
				
					 1 changed files with 3 additions and 4 deletions
				
			
		| 
						 | 
					@ -1918,7 +1918,6 @@ EXPORT_SYMBOL(tcp_v4_do_rcv);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void tcp_v4_early_demux(struct sk_buff *skb)
 | 
					void tcp_v4_early_demux(struct sk_buff *skb)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct net *net = dev_net(skb->dev);
 | 
					 | 
				
			||||||
	const struct iphdr *iph;
 | 
						const struct iphdr *iph;
 | 
				
			||||||
	const struct tcphdr *th;
 | 
						const struct tcphdr *th;
 | 
				
			||||||
	struct sock *sk;
 | 
						struct sock *sk;
 | 
				
			||||||
| 
						 | 
					@ -1926,16 +1925,16 @@ void tcp_v4_early_demux(struct sk_buff *skb)
 | 
				
			||||||
	if (skb->pkt_type != PACKET_HOST)
 | 
						if (skb->pkt_type != PACKET_HOST)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!pskb_may_pull(skb, ip_hdrlen(skb) + sizeof(struct tcphdr)))
 | 
						if (!pskb_may_pull(skb, skb_transport_offset(skb) + sizeof(struct tcphdr)))
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	iph = ip_hdr(skb);
 | 
						iph = ip_hdr(skb);
 | 
				
			||||||
	th = (struct tcphdr *) ((char *)iph + ip_hdrlen(skb));
 | 
						th = tcp_hdr(skb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (th->doff < sizeof(struct tcphdr) / 4)
 | 
						if (th->doff < sizeof(struct tcphdr) / 4)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sk = __inet_lookup_established(net, &tcp_hashinfo,
 | 
						sk = __inet_lookup_established(dev_net(skb->dev), &tcp_hashinfo,
 | 
				
			||||||
				       iph->saddr, th->source,
 | 
									       iph->saddr, th->source,
 | 
				
			||||||
				       iph->daddr, ntohs(th->dest),
 | 
									       iph->daddr, ntohs(th->dest),
 | 
				
			||||||
				       skb->skb_iif);
 | 
									       skb->skb_iif);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue