[1.] Large amount of outgoing tcp connections fail to bind properly to their ip/ports [2.] Full description of the problem/report: I'm trying to establish huge amount of outgoing tcp connections (over several 100000-s) on a single machine. I need to test load a server, which could process that amount of connections :) The number of connections which are possible to establish from single ip is regulated by net.ipv4.ip_local_port_range = 32768 61000, which gives 28232 connections. Good. I expect that each socket is identified on a local side as unique pair of local_ip:local_port . Thus I've added some more IP addresses (say 10) to the machine (aliases to the same network interface). I expect to be able to establish 10 times more connections than before (I know about file descriptor limits, system limit of total number of file descriptors and so on - which are tuned to high values already). And the fun part begins - I have 28232 on a first source IP (all in established state, say 10.0.0.10) and now I'm trying to establish one more connection with nc, specifying 10.0.0.11 as a source IP -- and getting "unable to bind error" Notes about example; 10.0.0.1:8192 is a server which just accepts a connections and listens forever on them. It's in erlang and it can handle great loads -- so there is not problems on that side. Using the same script I was able to establish more than 20.000 connections without any problems (having a standard local port range set) To make experiment easily reproducible I've done the following things: Decrease number of local ports available to 1001 - net.ipv4.ip_local_port_range = 60000 61000 I have script like this (writing from memory) #!/bin/sh I=0 IP=10.0.0.10 # connection stats before run netstat -n | grep ESTABLISHED | fgrep "$IP" | wc -l while [ $I -le 1000 ]; do # run nc in background, supress any output nc -s $IP 10.0.0.1 8192 > /dev/null 2>&1 & I=$(($I + 1)) done # connection stats after ...
Its doable, only if you bind() your sockets before connect() For each socket, you'll need to chose an (local IP, local port) not already in use. kernel wont magically select one source IP from the pool you have. --
I expect that I should select source IP and kernel should find some unused local_port for me. I'm binding before the connect, of course ;) -- Gaspar Chilingarov --
Yes, you bind the IP, but let kernel choose the port.
In this case, kernel is a bit dumb (or too smart ?)
If you want to check source, its in file net/ipv4/inet_connection_sock.c
function inet_csk_get_port()
you can remove the
if (atomic_read(&hashinfo->bsockets) > (high - low) + 1) {
spin_unlock(&head->lock);
snum = smallest_rover;
goto have_snum;
}
It will solve your problem (but bind() will probably be slow)
--
Hi. Netcat uses SO_REUSEADDR, so its the code path which generates an error, but this part actually returns a port number not en error. I suppose what happend is 'attempts' check faired and thus system failed to find a small enough bucket which does not conflict. To test this we can remove 'smallest_size = tb->num_owners;' assignment, but bind() can be damn slow in this case indeed. -- Evgeniy Polyakov --
I've opened 40,000 connections to/from my machine (over external interfaces) on a slightly hacked .31 kernel. This is 80,000 sockets total. I bind to local IP and port range, as well as SO_BINDTODEVICE. I'm using a 64-bit system with 12GB of RAM, quad-core i7 3.3Ghz, etc. It takes a lot of RAM to do this but you can probably use less RAM in user-space than I am. Be sure to set your socket buffer sizes small. Thanks, Ben -- Ben Greear <greearb@candelatech.com> Candela Technologies Inc http://www.candelatech.com --
Opening that amount of incoming connections in not a problem at all. I'm speaking of outgoing connections. What kind of hack do you have on your kernel? Thanks in advance, Gaspar --
Opening that amount of incoming connections in not a problem at all. I'm speaking of outgoing connections. What kind of hack do you have on your kernel? Thanks in advance, Gaspar -- Gaspar Chilingarov --
send-to-self logic and similar..but nothing that should be better at doing lots of sockets than the default kernel. I have 40,000 out-going connections to myself..basically I'm acting as both client and server. So, I'd expect you to be able to do around 80,000 connections to some external system on similar hardware and efficient client software. At least with my software, I'd need more RAM to scale much beyond that, but I'm trying to generate traffic on these sockets (which requires user-space buffers per socket in my implementation), and I have a decent bit of overhead gathering stats and such. A simpler application with less overhead should do more sockets. Be sure to use lots of processes so you don't end up with a poll loop with 80,000 fd entries. I found that 10k sockets per process was a good upper limit..but it's not a hard upper limit. And be sure to do the bind logic correctly as Eric pointed out in an earlier email. Thanks, Ben -- Ben Greear <greearb@candelatech.com> Candela Technologies Inc http://www.candelatech.com --
What is yours sysctl -a | grep local_port_range -- Gaspar Chilingarov --
[root@ct503-10G-09 ~]# sysctl -a | grep local_port_range net.ipv4.ip_local_port_range = 10000 61000 I'm explicitly binding to local ports as well as local IPs, btw. Thanks, Ben -- Ben Greear <greearb@candelatech.com> Candela Technologies Inc http://www.candelatech.com --
Ohhh, see my bug report again, please :) The problem arises when used port count is close to or more than the number of local ports available on the system (in your case 40000 client connections is smaller than 51000 of available ports). I think that if you choose to go with default settings and try to bind half of your ports to one local IP and half of your ports - to another one -- you will hit this bug as well. If you explicitly bind to the local ports as well - it _may_ solve a problem - I will this today (it's just a workaround, but in fact not the solution :), but if you let kernel automatically find local ports - you will get the errors. /Gaspar -- Gaspar Chilingarov --
Yes, I posted a preliminar patch to solve this problem, please test it ;) But beware bind(port=0) time might be long. This is why high perf programs prefer to give the exact port at bind(IP, port) time. Algo will scan the whole range to find the port used by minimum number of connection. Then it'll check if the selected IP was already in use. If not -> ok, port found If yes -> redo five time the same loop (I guess this redo should be changed too, to use something else. --
I believe the bsockets 'optimization' is a bug, we should remove it.
This is a stable candidate (2.6.30+)
[PATCH net-next-2.6] tcp: remove bsockets count
Counting number of bound sockets to avoid a loop is buggy, since we cant
know how many IP addresses are in use. When threshold is reached, we try
5 random slots and can fail while there are plenty available ports.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
include/net/inet_hashtables.h | 2 --
net/ipv4/inet_connection_sock.c | 5 -----
net/ipv4/inet_hashtables.c | 5 -----
3 files changed, 12 deletions(-)
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 74358d1..e0f3a05 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -150,8 +150,6 @@ struct inet_hashinfo {
*/
struct inet_listen_hashbucket listening_hash[INET_LHTABLE_SIZE]
____cacheline_aligned_in_smp;
-
- atomic_t bsockets;
};
static inline struct inet_ehash_bucket *inet_ehash_bucket(
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 8da6429..0bbfd00 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -119,11 +119,6 @@ again:
(tb->num_owners < smallest_size || smallest_size == -1)) {
smallest_size = tb->num_owners;
smallest_rover = rover;
- if (atomic_read(&hashinfo->bsockets) > (high - low) + 1) {
- spin_unlock(&head->lock);
- snum = smallest_rover;
- goto have_snum;
- }
}
goto next;
}
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index 2b79377..4bc921f 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -62,8 +62,6 @@ void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb,
{
struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo;
- atomic_inc(&hashinfo->bsockets);
-
inet_sk(sk)->inet_num = snum;
sk_add_bind_node(sk, ...Thank you a lot for the patch - I will try it. In FreeBSD I was able to add about 32 C classes (8192 ips) on the single interface (never tried to do that in Linux yet :) - so you really never know how much IP's are there available. Tens and even up to hundred IPs on the single machine are not that usual in hosting environment at all. /Gaspar --
From: Eric Dumazet <eric.dumazet@gmail.com> Hmmm, yes indeed it seems there are improper assumptions made by this scheme. This is a tricky area, so I'll wait for some test results from the reporter and study the code over a few times myself to make sure we get this right. --
To return back to exponential bind() times you need to revert the whole original patch including magic 5 number, not only bsockets. But actual problem is not in this digit, but in a deeper logic. Previously we scanned the whole table, now we have 5 attempts to find out at least one bucket (without conflict) we will insert new socket into. Apparently for large number of addresses it is possible that all 5 times we will randomly select those buckets which conflicts. As dumb solution we can increase 'attempt' number to infinite one, or fallback to whole-table-search after several random attempts, which is a bit more clever I think. -- Evgeniy Polyakov --
From: Evgeniy Polyakov <zbr@ioremap.net> Indeed, if we keep that '5' thing there it's just going to still fail If random number generator is not too terrible, just using infinite limit would be roughly equivalent. --
Hmm, maybe I am blind, but on the case the threshold is reached, we dont
have 5 attempts "to find out at least one bucket (without conflict)"
We just take the first entry from the random starting point, _without_
checking we have a conflict.
if (net_eq(ib_net(tb), net) && tb->port == rover) {
if (tb->fastreuse > 0 &&
sk->sk_reuse &&
sk->sk_state != TCP_LISTEN &&
(tb->num_owners < smallest_size || smallest_size == -1)) {
smallest_size = tb->num_owners;
smallest_rover = rover;
if (atomic_read(&hashinfo->bsockets) > (high-low)+1) {
spin_unlock(&head->lock);
snum = smallest_rover; // We select this, without checking for
conflicts.
goto have_snum;
}
}
Then we goto to "have_snum" label
Then we realize (selected_IP, randomport) is already in use.
End of first try.
We redo the thing 5 times, so we only look at 5 slots out of
32000-64000.
Maybe the fix would need to check if there is a conflict before doing
the "goto have_snum"
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index e0a3e35..0498daf 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -120,9 +120,11 @@ again:
smallest_size = tb->num_owners;
smallest_rover = rover;
if (atomic_read(&hashinfo->bsockets) > (high - low) + 1) {
- spin_unlock(&head->lock);
- snum = smallest_rover;
- goto have_snum;
+ if (!inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb))
+ spin_unlock(&head->lock);
+ snum = smallest_rover;
+ goto have_snum;
+ }
}
}
goto next;
--
We only break out of the loop in above case when number of sockets is already more than our range limit. If we would just try 5 random times out of 1000 in Gaspar's case, we would not be able to select all 1000 I believe this is a useful patch, but it addresses a different issue. -- Evgeniy Polyakov --
Well, the real problem is that following sequence can happen :
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 5
setsockopt(5, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(5, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.2")}, 16) = 0
getsockname(5, {sa_family=AF_INET, sin_port=htons(34000), sin_addr=inet_addr("127.0.0.2")}, [16]) = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 6
setsockopt(6, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(6, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.2")}, 16) = 0
getsockname(6, {sa_family=AF_INET, sin_port=htons(34002), sin_addr=inet_addr("127.0.0.2")}, [16]) = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 7
setsockopt(7, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(7, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.2")}, 16) = 0
getsockname(7, {sa_family=AF_INET, sin_port=htons(34001), sin_addr=inet_addr("127.0.0.2")}, [16]) = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 8
setsockopt(8, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(8, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.2")}, 16) = 0
getsockname(8, {sa_family=AF_INET, sin_port=htons(34002), sin_addr=inet_addr("127.0.0.2")}, [16]) = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 9
setsockopt(9, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(9, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.2")}, 16) = 0
getsockname(9, {sa_family=AF_INET, sin_port=htons(34000), sin_addr=inet_addr("127.0.0.2")}, [16]) = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 10
setsockopt(10, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(10, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.2")}, 16) = 0
getsockname(10, {sa_family=AF_INET, sin_port=htons(34002), sin_addr=inet_addr("127.0.0.2")}, [16]) = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 11
setsockopt(11, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(11, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.2")}, 16) = 0
getsockname(11, ...That's kind of weird, since address is the same. I'm curious why bind conflict does not resolve that. Likely because socket is not yet Yup. But isn't it a different problem from what Gaspar observed? Netcat connects after bind so it should not be an issue here. -- Evgeniy Polyakov --
Well, just replace the "#if 0" in program, and i'll connect, and
reproduce same problem
conflict only checks :
if (!reuse || !sk2->sk_reuse ||
sk2->sk_state == TCP_LISTEN) {
const __be32 sk2_rcv_saddr =
inet_rcv_saddr(sk2);
if (!sk2_rcv_saddr || !sk_rcv_saddr ||
sk2_rcv_saddr == sk_rcv_saddr)
break;
}
ie it wont re-allocate a port only if a listener uses this port.
If sk2 is connected or close, it doesnt matter, and port can be reused.
--
Here is the patch I use now and my test application is now able to open
and connect 1000000 sockets (ulimit -n 1000000)
Trick is bind_conflict() must refuse a socket to bind to a port on a non
null IP if another socket already uses same port on same IP.
Plus the previous patch sent (check a conflict before exiting the search
loop)
What do you think ?
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index e0a3e35..78cbc39 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -70,13 +70,17 @@ int inet_csk_bind_conflict(const struct sock *sk,
(!sk->sk_bound_dev_if ||
!sk2->sk_bound_dev_if ||
sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) {
+ const __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2);
+
if (!reuse || !sk2->sk_reuse ||
sk2->sk_state == TCP_LISTEN) {
- const __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2);
if (!sk2_rcv_saddr || !sk_rcv_saddr ||
sk2_rcv_saddr == sk_rcv_saddr)
break;
- }
+ } else if (reuse && sk2->sk_reuse &&
+ sk2_rcv_saddr &&
+ sk2_rcv_saddr == sk_rcv_saddr)
+ break;
}
}
return node != NULL;
@@ -120,9 +124,11 @@ again:
smallest_size = tb->num_owners;
smallest_rover = rover;
if (atomic_read(&hashinfo->bsockets) > (high - low) + 1) {
- spin_unlock(&head->lock);
- snum = smallest_rover;
- goto have_snum;
+ if (!inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb)) {
+ spin_unlock(&head->lock);
+ snum = smallest_rover;
+ goto have_snum;
+ }
}
}
goto next;
--
I believe we hit this very yesterday in our test lab. We had a stress test running of one of our applications with about a dozen instances of it running on the box. Suddenly dns requests began failing with the complaint that it couldn't make a request out because there were no sockets. root@champagne:/proc/sys/net/ipv4> host gh host: isc_socket_bind: address in use Netstat showed 61580 total sockets (UDP and TCP) on the address being used by the above dns request. (local port range 1025 65535). That dns request should not have been failing. I noticed that the number of UDP sockets was close to the maximum allowed by the port range, but they were across different IP addresses, no one IP address had too many and there should have been available ports on all IP addresses. Further, the number of udp sockets in use seemed to hit the wall at a little above 64,000 and I never got above that number. If that is the normal behavior of the kernel, it could be a big problem for scaling the application. --
Looks good, but do we want to check only reused socket's address there? What if one of the sockets does not have reuse option turned on, will it break? -- Evgeniy Polyakov --
Well, if one socket doesnt have reuse option turned on, the previous
test already works ?
if (!reuse || !sk2->sk_reuse || sk2->sk_state == TCP_LISTEN) {
if (!sk2_rcv_saddr || !sk_rcv_saddr ||
sk2_rcv_saddr == sk_rcv_saddr)
break;
} else if (reuse && sk2->sk_reuse &&
sk2_rcv_saddr &&
sk2_rcv_saddr == sk_rcv_saddr)
break;
I failed to factorize this complex test :(
--
Damn it, I tried multiple times :) You are right of course! -- Evgeniy Polyakov --
Here is a formal patch then :)
[PATCH] tcp: bind() fix when many ports are bound
Port autoselection done by kernel only works when number of bound
sockets is under a threshold (typically 30000).
When this threshold is over, we must check if there is a conflict before
exiting first loop in inet_csk_get_port()
Change inet_csk_bind_conflict() to forbid two reuse-enabled sockets to
bind on same (address,port) tuple (with a non ANY address)
Same change for inet6_csk_bind_conflict()
Reported-by: Gaspar Chilingarov <gasparch@gmail.com>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
net/ipv4/inet_connection_sock.c | 16 +++++++++++-----
net/ipv6/inet6_connection_sock.c | 15 ++++++++++-----
2 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index e0a3e35..78cbc39 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -70,13 +70,17 @@ int inet_csk_bind_conflict(const struct sock *sk,
(!sk->sk_bound_dev_if ||
!sk2->sk_bound_dev_if ||
sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) {
+ const __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2);
+
if (!reuse || !sk2->sk_reuse ||
sk2->sk_state == TCP_LISTEN) {
- const __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2);
if (!sk2_rcv_saddr || !sk_rcv_saddr ||
sk2_rcv_saddr == sk_rcv_saddr)
break;
- }
+ } else if (reuse && sk2->sk_reuse &&
+ sk2_rcv_saddr &&
+ sk2_rcv_saddr == sk_rcv_saddr)
+ break;
}
}
return node != NULL;
@@ -120,9 +124,11 @@ again:
smallest_size = tb->num_owners;
smallest_rover = rover;
if (atomic_read(&hashinfo->bsockets) > (high - low) + 1) {
- spin_unlock(&head->lock);
- snum = smallest_rover;
- goto have_snum;
+ if (!inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb)) {
+ spin_unlock(&head->lock);
+ snum = smallest_rover;
+ goto ...Ack. Thank you Eric! -- Evgeniy Polyakov --
From: Evgeniy Polyakov <zbr@ioremap.net> This code is way too complex :-) Applied, thanks everyone! --
With this applied, my box crashes on boot: rhel6 beta userspace, v2.6.34-rc5-204-gddc9b34 kernel. 2.6.34-rc5 kernel boots fine. the crash seems to be around net/ipv6/inet6_connection_sock.c:50 after reverting fda48a0d7a8412cedacda46a9c0bf8ef9cd13559, the crash goes away. I created https://bugzilla.kernel.org/show_bug.cgi?id=15847 to track this. Oops below: BUG: unable to handle kernel NULL pointer dereference at 0000000000000004 IP: [<ffffffffa02b99aa>] inet6_csk_bind_conflict+0x6a/0x110 [ipv6] PGD 0 Oops: 0000 [#1] SMP last sysfs file: /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/net/eth0/ifindex CPU 9 Modules linked in: ip6t_REJECT nf_conntrack_ipv6 ip6table_filter ip6_tables ipv6 dm_mirror dm_region_hash dm_log igb i2c_i801 sg iTCO_wdt iTCO_vendor_support shpchp ioatdma dca pcspkr sr_mod cdrom ext4 mbcache jbd2 sd_mod ata_generic crc_t10dif pata_acpi ahci pata_jmicron radeon ttm drm_kms_helper drm i2c_algo_bit i2c_core dm_mod [last unloaded: scsi_wait_scan] Pid: 1640, comm: master Not tainted 2.6.34-rc5-mst #1 X8DTN/X8DTN RIP: 0010:[<ffffffffa02b99aa>] [<ffffffffa02b99aa>] inet6_csk_bind_conflict+0x6a/0x110 [ipv6] RSP: 0018:ffff8803357a7d98 EFLAGS: 00010293 RAX: 0000000000000000 RBX: ffff880335709440 RCX: 0000000000000000 RDX: 0000000000020011 RSI: ffff880335709440 RDI: ffff880334c61e78 RBP: ffff8803357a7db8 R08: 0000000000000019 R09: 0000000000000019 R10: 00000000000000d4 R11: 0000000000000400 R12: ffff880335709468 R13: ffff880334c61800 R14: ffff880335489500 R15: ffffffff8225d700 FS: 00007feacd26f7c0(0000) GS:ffff8801c5700000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000004 CR3: 00000003341ef000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process master (pid: 1640, threadinfo ffff8803357a6000, task ffff880334225540) Stack: 0000000000000000 ffffffff8225b500 ffffc9001251ced0 ...
I suppose above line is guilty when inet6_rcv_saddr() returns NULL? -- Evgeniy Polyakov --
Oh its a typo we should test ipv6_addr_any(inet6_rcv_saddr(sk)) instead of ipv6_addr_any(inet6_rcv_saddr(sk2)) (sk is AF_INET6, while sk2 could be AF_INET) I'll submit a patch promptly --
Sorry, I cant test this at this moment (I am travelling) Evgeniy, David could you double check ? Michael, could you test this patch ? Thanks ! [PATCH] ipv6: Fix inet6_csk_bind_conflict() Commit fda48a0d7a84 (tcp: bind() fix when many ports are bound) introduced a bug on IPV6 part. We should not call ipv6_addr_any(inet6_rcv_saddr(sk2)) but ipv6_addr_any(inet6_rcv_saddr(sk)) because sk2 can be IPV4, while sk is IPV6. Reported-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> --- diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index b4b7d40..3a4d92b 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c @@ -48,7 +48,7 @@ int inet6_csk_bind_conflict(const struct sock *sk, ipv6_rcv_saddr_equal(sk, sk2)) break; else if (sk->sk_reuse && sk2->sk_reuse && - !ipv6_addr_any(inet6_rcv_saddr(sk2)) && + !ipv6_addr_any(inet6_rcv_saddr(sk)) && ipv6_rcv_saddr_equal(sk, sk2)) break; } --
works for me Tested-by: Michael S. Tsirkin <mst@redhat.com> --
From: "Michael S. Tsirkin" <mst@redhat.com> Applied, thanks everyone. --
use the following command this will help you out to more connetions #ip link set eth0 mtu 69 and increase the size of buffer[] I think this will helps you ( I am student yet now ) --
