All of lore.kernel.org
 help / color / mirror / Atom feed
From: Grzegorz Chwesewicz <grzegorz.chwesewicz@retis.net.pl>
To: linux-kernel@vger.kernel.org
Subject: Problem with "tcp: bind() fix when many ports are bound" commit
Date: Wed, 28 Apr 2010 14:33:45 +0200	[thread overview]
Message-ID: <4BD82B29.3000105@retis.net.pl> (raw)

	Hi, I have a problem with binding to port with the latest git kernel
(my HEAD is at 1600f9def09de07c5dbeb539e978fa73880690dd). Please CC to
me as I'm not subscribed to the list.

Example with buggy kernel:

ensima-hp ~ # /etc/init.d/apache2 start
 * Starting apache2 ...
(98)Address already in use: make_sock: could not bind to address
127.0.0.1:80
no listening sockets available, shutting down
Unable to open logs

As you can see nothing is listening on port 80, but there are old
connections to port 80 with CLOSE_WAIT and FIN_WAIT2 state.

ensima-hp ~ # netstat -pan --inet|grep 80
netstat: no support for `AF INET (sctp)' on this system.
tcp        0      0 127.0.0.1:631           0.0.0.0:*
LISTEN      4806/cupsd
tcp        1      0 127.0.0.1:54040         127.0.0.1:80
CLOSE_WAIT  5814/konquerorHk573
tcp        0      0 127.0.0.1:80            127.0.0.1:54042
FIN_WAIT2   -
tcp        0      0 127.0.0.1:80            127.0.0.1:54040
FIN_WAIT2   -
tcp        1      0 127.0.0.1:54042         127.0.0.1:80
CLOSE_WAIT  6175/konquerordx573

So I can't start apache as long as these connections are not fully
closed, after that apache starts without problems.

ensima-hp ~ # netstat -pan --inet|grep 80
netstat: no support for `AF INET (sctp)' on this system.
tcp        0      0 127.0.0.1:631           0.0.0.0:*
LISTEN      4806/cupsd

ensima-hp ~ # /etc/init.d/apache2 start
 * Starting apache2 ...		[OK]

Problem occured between 2.6.34-rc4 and latest git, bisect shows that the
problem is caused by:

commit fda48a0d7a8412cedacda46a9c0bf8ef9cd13559
Author: Eric Dumazet <eric.dumazet@gmail.com>
Date:   Wed Apr 21 09:26:15 2010 +0000

tcp: bind() fix when many ports are bound

Reverting this commit from current HEAD, resolving conflict in
'net/ipv6/inet6_connection_sock.c' file, and compiling new kernel solves
the problem.

'net/ipv6/inet6_connection_sock.c' before resolving conflict:

 41         sk_for_each_bound(sk2, node, &tb->owners) {
 42                 if (sk != sk2 &&
 43                     (!sk->sk_bound_dev_if ||
 44                      !sk2->sk_bound_dev_if ||
 45 <<<<<<< HEAD
 46                      sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) {
 47                         if ((!sk->sk_reuse || !sk2->sk_reuse ||
 48                              sk2->sk_state == TCP_LISTEN) &&
 49                              ipv6_rcv_saddr_equal(sk, sk2))
 50                                 break;
 51                         else if (sk->sk_reuse && sk2->sk_reuse &&
 52                                 !ipv6_addr_any(inet6_rcv_saddr(sk)) &&
 53                                 ipv6_rcv_saddr_equal(sk, sk2))
 54                                 break;
 55                 }
 56 =======
 57                      sk->sk_bound_dev_if == sk2->sk_bound_dev_if) &&
 58                     (!sk->sk_reuse || !sk2->sk_reuse ||
 59                      sk2->sk_state == TCP_LISTEN) &&
 60                      ipv6_rcv_saddr_equal(sk, sk2))
 61                         break;
 62 >>>>>>> fda48a0... tcp: bind() fix when many ports are bound
 63         }
 64
 65         return node != NULL;



 66 }

'net/ipv6/inet6_connection_sock.c' after resolving conflict:

 41         sk_for_each_bound(sk2, node, &tb->owners) {
 42                 if (sk != sk2 &&
 43                     (!sk->sk_bound_dev_if ||
 44                      !sk2->sk_bound_dev_if ||
 45                      sk->sk_bound_dev_if == sk2->sk_bound_dev_if) &&
 46                     (!sk->sk_reuse || !sk2->sk_reuse ||
 47                      sk2->sk_state == TCP_LISTEN) &&
 48                      ipv6_rcv_saddr_equal(sk, sk2))
 49                         break;
 50         }



 51
 52         return node != NULL;
 53 }

-- 
Greetings
Grzegorz Chwesewicz
mailto:grzegorz.chwesewicz@retis.net.pl

             reply	other threads:[~2010-04-28 12:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-28 12:33 Grzegorz Chwesewicz [this message]
2010-04-28 16:50 ` Problem with "tcp: bind() fix when many ports are bound" commit David Miller
2010-04-28 17:34   ` Eric Dumazet
2010-04-28 17:44     ` Eric Dumazet
2010-04-28 17:51       ` David Miller
2010-04-28 17:59   ` Grzegorz Chwesewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BD82B29.3000105@retis.net.pl \
    --to=grzegorz.chwesewicz@retis.net.pl \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.