[squid-users] Squid Question regarding tcp handshake
Alex Rousskov
rousskov at measurement-factory.com
Fri Feb 25 16:18:45 UTC 2022
On 2/24/22 10:03, Felipe Polanco wrote:
> Does squid first complete the tcp handshake on its users and then a
> second handshake on the destination IP
Yes, kind of. Keep in mind that Squid pretty much does not know anything
about TCP handshakes, SYN packets, etc. Nearly all TCP-level work is
done by the kernel and system libraries. Squid uses TCP socket I/O.
Also, there may be no corresponding Squid-server connection at all
(e.g., errors and cache hits) or, as Amos has already noted, multiple
Squid-server connections (e.g., trying different IP addresses associated
with the same DNS name in HTTP request target).
> or as soon as it receives the TCP
> SYN flag it does the same with the destination.
No, Squid does not known anything about the SYN flag. Squid does not act
on the incoming TCP connection until a successful accept(2) system call
announces/gives that connection to Squid. That system call extracts an
already established (i.e. post-handshake) TCP connection from the
queue(s) of TCP connections maintained by the kernel. The TCP handshake
completes before Squid gets control back from accept() and, in the vast
majority of cases, before Squid even calls accept().
HTH,
Alex.
More information about the squid-users
mailing list