Can i stop tcp handshake by send icmp of unreachable host

icmpnetworkingtcp

This is what happened:

client – send syn

server – send icmp (unreachable host [i also try to add code =10] )
wait for 100 ms
send syn-ack

client – send ack in response to the syn-ack.

Dosnt the client should reset the tcp handshake ,when icmp of unreachable host was sent?
Is there any way to cause the client to reset the connection by sending some kind of ICMP?

The test was done on 2 Ubunto machine connected directly. In wireshark i see that icmp was revived before syn-ack and the connection was not reset.
The client run telnet (on port 80) to server.
In server run apache.
I simulate the icmp before the synack by using python scapy.

Thank you

Best Answer

Yes the client should stop attempting the connection... but:

  1. Many brain-dead ISPs block ICMP, or a subset of ICMP messages.
  2. Many NATs do not pass ICMP messages inward correctly.
  3. Many OSes block ICMP at their firewall.
  4. Many "security" suites block ICMP.
  5. Not all IP stacks respond to ICMP correctly.
  6. Not all applications/APIs respond to ICMP correctly.

With all that, the situation you described is not only more common than it should be but very common.