lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 23 Jan 2007 16:44:10 +1100
From:	Herbert Xu <>
To: (dean gaudet)
Subject: Re: why would EPIPE cause socket port to change?

dean gaudet <> wrote:
> in the test program below the getsockname result on a TCP socket changes 
> across a write which produces EPIPE... here's a fragment of the strace:
> getsockname(3, {sa_family=AF_INET, sin_port=htons(37636), sin_addr=inet_addr("")}, [17863593746633850896]) = 0
> ...
> write(3, "hi!\n", 4)                    = 4
> write(3, "hi!\n", 4)                    = -1 EPIPE (Broken pipe)
> --- SIGPIPE (Broken pipe) @ 0 (0) ---
> getsockname(3, {sa_family=AF_INET, sin_port=htons(59882), sin_addr=inet_addr("")}, [16927060683038654480]) = 0
> why does the port# change?  this is on

Prior to the last write, the socket entered the CLOSED state meaning
that the old port is no longer allocated to it.  As a result, the
last write operates on an unconnected socket which causes a new local
port to be allocated as an autobind.  It then fails because the socket
is still not connected.

So any attempt to run getsockname after an error on the socket is
simply buggy.

Visit Openswan at
Email: Herbert Xu ~{PmV>HI~} <>
Home Page:
PGP Key:
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to
More majordomo info at

Powered by blists - more mailing lists