| To: | "David S. Miller" <davem@xxxxxxxxxx> |
|---|---|
| Subject: | Re: [PATCH] ipv4 tcp autobind problem |
| From: | Kovacs Krisztian <hidden@xxxxxxxxxx> |
| Date: | Tue, 30 Sep 2003 09:14:59 +0200 |
| Cc: | netdev@xxxxxxxxxxx, linux-net@xxxxxxxxxxxxxxx |
| In-reply-to: | <20030929222209.4d02c542.davem@redhat.com> |
| References: | <3F782E1F.4030500@balabit.hu> <20030929222209.4d02c542.davem@redhat.com> |
| Sender: | netdev-bounce@xxxxxxxxxxx |
David S. Miller wrote: Once connect() has been called on a socket, you may not ever again perform any action that would try to connect that socket. Yes, I know that. Exactly this is why I felt it a problem that sk->num gets a new value if you call send() after an unsuccessful connect(). (I know that in theory one should not call send() in this case, but one _can_ call it in reality.) And, the problem occurs not only when send() is called after an unsuccessful connect(), but also when an RST is received between two send() calls, which is perfectly legal, and cannot be viewed as buggy user-space software. I don't really understand why the inet_sendmsg() calls inet_autobind() for SOCK_STREAM sockets: for these kind of sockets, one must call connect() anyway, before doing any other kind of operations. And, the side effect of the code /* We may need to bind the socket. */
if (!inet_sk(sk)->num && inet_autobind(sk))
return -EAGAIN;in inet_sendmsg() is that when an RST is received, sk->num is set to zero, and when the next inet_sendmsg() call occurs, the socket is rebound to a new port _before_ returning an error. In our transparent proxying patch, this causes problems, because it assumes that after a socket is bound (by connect(), for example), the local port (sk->sport) remains unchanged until the socket is closed. However, this is not true because of the mentioned side effect of inet_sendmsg(). This is why I proposed that inet_sendmsg() should call inet_autobind() only if it's not a SOCK_STREAM socket. --
Regards,
Krisztian KOVACS |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: Réf. : Fw: [BUG/PATCH] CONFIG_NET_HW_FLOWCONTROL and SMP, David S. Miller |
|---|---|
| Next by Date: | Re: RFC: [2.6 patch] disallow modular IPv6, David Woodhouse |
| Previous by Thread: | Re: [PATCH] ipv4 tcp autobind problem, David S. Miller |
| Next by Thread: | Re: Fw: Re: [PATCH] ipv4 tcp autobind problem, kuznet |
| Indexes: | [Date] [Thread] [Top] [All Lists] |