aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@parallels.com>2012-04-18 23:39:36 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-21 15:52:25 -0400
commit4a17fd5229c1b6066aa478f6b690f8293ce811a1 (patch)
treef6acd00935d2d7a990befb4c77f57fdf39f46689 /net/ipv4
parent59c55bdde856c4000bbeb33ba212c3df6f1997a4 (diff)
sock: Introduce named constants for sk_reuse
Name them in a "backward compatible" manner, i.e. reuse or not are still 1 and 0 respectively. The reuse value of 2 means that the socket with it will forcibly reuse everyone else's port. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/af_inet.c2
-rw-r--r--net/ipv4/inet_connection_sock.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 3744c1c0af5a..c8f7aee587d1 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -350,7 +350,7 @@ lookup_protocol:
350 err = 0; 350 err = 0;
351 sk->sk_no_check = answer_no_check; 351 sk->sk_no_check = answer_no_check;
352 if (INET_PROTOSW_REUSE & answer_flags) 352 if (INET_PROTOSW_REUSE & answer_flags)
353 sk->sk_reuse = 1; 353 sk->sk_reuse = SK_CAN_REUSE;
354 354
355 inet = inet_sk(sk); 355 inet = inet_sk(sk);
356 inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) != 0; 356 inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) != 0;
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 7d972f650a61..95e61596e605 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -182,6 +182,9 @@ have_snum:
182 goto tb_not_found; 182 goto tb_not_found;
183tb_found: 183tb_found:
184 if (!hlist_empty(&tb->owners)) { 184 if (!hlist_empty(&tb->owners)) {
185 if (sk->sk_reuse == SK_FORCE_REUSE)
186 goto success;
187
185 if (tb->fastreuse > 0 && 188 if (tb->fastreuse > 0 &&
186 sk->sk_reuse && sk->sk_state != TCP_LISTEN && 189 sk->sk_reuse && sk->sk_state != TCP_LISTEN &&
187 smallest_size == -1) { 190 smallest_size == -1) {