connect(2) behavior with unreacheable hosts

Barney Wolff barney at pit.databus.com
Sun Apr 13 18:15:37 PDT 2003


On Sun, Apr 13, 2003 at 02:23:54PM -0500, Mike Silbersack wrote:
> Barney, have you tried doing some sort of test where sendmail or ftpd
> tries making a connection to a TTL exceeded IP?  I'm curious if they
> handle the situation gracefully or not.  (If they don't, then maybe this
> is serious enough to require security branch merges.)

Here's ftp's behavior, first from an unpatched system:
mob:/root# ftp 1.2.3.4
ftp: getsockname: Connection reset by peer
ftp> quit
mob:/root# ftp 1.2.3.5
ftp: connect: No route to host
ftp> quit
(1.2.3.4 is the looped address, and the getsockname comes back instantly,
since the loop is over GigE.  1.2.3.5 times out before getting EHOSTUNREACH.)

Here's the same on a patched system:
lab:/home/barney $ ftp 1.2.3.4
ftp: connect: No route to host
ftp> quit
lab:/home/barney $ ftp 1.2.3.5
ftp: connect: Operation timed out
ftp> quit

Here are maillog entries, first from the unpatched system:
Apr 13 20:58:26 mob sm-mta[76502]: h3E0wQZ3076500: to=<nemo at bogus.no.such.domain>, ctladdr=<barney at mob.databus.com> (202/1004), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=30354, relay=bogus.no.such.domain. [1.2.3.4], dsn=4.0.0, stat=Deferred: Connection reset by bogus.no.such.domain.

and the patched system:
Apr 13 20:56:56 lab sm-mta[40480]: h3E0uunO040478: to=<nemo at bogus.no.such.domain>, ctladdr=<barney at lab.databus.com> (202/1004), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=30355, relay=bogus.no.such.domain. [1.2.3.4], dsn=4.0.0, stat=Deferred: bogus.no.such.domain.: No route to host

(In each case I put 1.2.3.4 bogus.no.such.domain in /etc/hosts.)

Mike, I don't think this is a security issue - the client gets an instant
SIGPIPE if it tries to write on the socket.  I think telnet gets this.

I did try traceroute, since it depends on time-exceeded.  Worked fine.
Barney

-- 
Barney Wolff         http://www.databus.com/bwresume.pdf
I'm available by contract or FT, in the NYC metro area or via the 'Net.


More information about the freebsd-net mailing list