sndrst - a program to send ipv4 tcp reset packets

The need for this arose out of the open solaris vps I rented had a kernel bug somewhere. The ipf filter rule was this:
block return-rst in quick proto tcp ...
Which would block the packets but not send back a rst. Others too had this problem while some others had got it to work. There are other packet generators out there that compiled on linux but not OS. So I took another's tool and modified it to my needs.

Use the program in this way. Needs root privileges.
./sndrst 22 40123 1000222000
* source ip
* source port
* dest ip
* dest port
* acknowledgement number

Wireshark is an indispensable tool for debugging.
tshark -n -T fields -o tcp.relative_sequence_numbers:FALSE -e ip.src \
-e tcp.srcport -e tcp.seq -f 'port 22 and tcp[13] = 0x02'
With bourne foo the above can be tied together. Take the sequence number from shark, add one, feed it to sndrst as ack number.

The code compiled fine on linux with no arguments. OS needed -lsocket -lnsl.


Back to my code page.