Re: getpeername broken? ( was Re: probably problem with "lo" interface (Re: Strange problem with 2.3.42) )

From: Craig Schlenter (craig@qualica.com)
Date: Fri Feb 04 2000 - 01:34:55 EST


On Thu, Feb 03, 2000 at 05:58:37PM -0800, David S. Miller wrote:
>
> Can people try this patch? Thanks.
[snip]
> - if (!sk->dport)
> + if (!sk->dport || sk->state == TCP_SYN_SENT)

getpeername still seems to report success :(

Here is the relevant strace snippet from strobe -p 300 localhost
(with nothing listening on 300)

socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4
gettimeofday({949644506, 133251}, NULL) = 0
fcntl(4, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0
setsockopt(4, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
setsockopt(4, SOL_SOCKET, SO_OOBINLINE, [1], 4) = 0
setsockopt(4, SOL_SOCKET, SO_LINGER, [0], 8) = 0
connect(4, {sin_family=AF_INET, sin_port=htons(300), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress)
fcntl(4, F_GETFL) = 0x802 (flags O_RDWR|O_NONBLOCK)
fcntl(4, F_SETFL, O_RDWR) = 0
time(NULL) = 949644506
time(NULL) = 949644506
select(1024, [4], [4], NULL, {0, 250000}) = 2 (in [4], out [4], left {0, 250000})
time(NULL) = 949644506
getpeername(4, {sin_family=AF_INET, sin_port=htons(300), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
fstat(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0
mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40014000
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
write(1, "localhost u"..., 69localhost unknown 300/tcp unassigned) = 69

I'll stick some prink's in sometime tonight to see what state the socket is
in. Perhaps it is already in TCP_CLOSE or something by the time getpeername
is called?

Thank you,

--Craig

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Feb 07 2000 - 21:00:10 EST