lkml.org 
[lkml]   [2000]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: getpeername broken? ( was Re: probably problem with "lo" interface (Re: Strange problem with 2.3.42) )
On Fri, Feb 04, 2000 at 08:34:55AM +0200, I wrote:
> 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 :(
[snip, strace of strobe deleted]
> 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?

Me again ...

The socket seems to have been in TCP_CLOSE. The following patch works for
me with no immediately obvious bad side effects:

--- /usr/src/linux/net/ipv4/af_inet.c 2000/02/03 17:33:26 1.1
+++ /usr/src/linux/net/ipv4/af_inet.c 2000/02/04 14:58:44
@@ -675,7 +675,7 @@

sin->sin_family = AF_INET;
if (peer) {
- if (!sk->dport)
+ if (!sk->dport || sk->state == TCP_SYN_SENT || sk->state == TCP_CLOSE)
return -ENOTCONN;
sin->sin_port = sk->dport;
sin->sin_addr.s_addr = sk->daddr;
Cheers,

--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/

\
 
 \ /
  Last update: 2005-03-22 13:56    [W:0.031 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site