c - Drop an open TCP connection without sending RST -
looking nginx: ignore requests without proper host header got me thinking it's not possible close(2)
tcp connection without os terminating underlying tcp connection sending rst
(and/or fin
) other end.
one workaround use turns out, openbsd's tcpdrop(8)
, however, can seen usr.sbin/tcpdrop/tcpdrop.c
on openbsd , freebsd, it's implemented through sysctl-based interface, , may have portability issues outside of bsds. (in fact, looks sysctl-based implementation may different enough between openbsd , freebsd require porting layer -- openbsd uses tcp_ident_mapping
structure (which, subsequently, contains 2 sockaddr_storage
elements, plus other info), whereas freebsd, dragonfly , netbsd use array of 2 sockaddr_storage
elements directly.)tcpdrop
appear send r
packet per tcpdump(8)
, , can confirmed looking @ /sys/netinet/tcp_subr.c :: tcp_drop()
, calls tcp_close()
in end (and tcp_close()
is confirmed send rst
elsewhere on so), so, appears wouldn't work, either.
if i'm establishing connection myself through c, there way subsequently drop without acknowledgement other side, e.g., without initiating rst
?
if i'm establishing connection myself through c, there way subsequently drop without acknowledgement other side, e.g., without initiating rst?
no. if there was, if peer subseqently sent answered rst.
nb normal tcp termination uses fin, not rst.
Comments
Post a Comment