Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 53503
b: refs/heads/master
c: ce5325c
h: refs/heads/master
i:
  53501: fa3946b
  53499: 5a6ecdf
  53495: 982e633
  53487: 5dae2ec
  53471: 41e6b32
  53439: e74f914
  53375: b493e10
  53247: 2f024ad
v: v3
  • Loading branch information
Vlad Yasevich authored and David S. Miller committed May 4, 2007
1 parent 350b4ab commit 0830845
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 16d00fb7765a43a1b05989062e985d283b3a1f2d
refs/heads/master: ce5325c1338acf965f4300f4976eac2129aeb439
32 changes: 22 additions & 10 deletions trunk/net/sctp/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -5020,7 +5020,8 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
struct hlist_node *node;

SCTP_DEBUG_PRINTK("sctp_get_port() found a possible match\n");
if (pp->fastreuse && sk->sk_reuse)
if (pp->fastreuse && sk->sk_reuse &&
sk->sk_state != SCTP_SS_LISTENING)
goto success;

/* Run through the list of sockets bound to the port
Expand All @@ -5037,7 +5038,8 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
struct sctp_endpoint *ep2;
ep2 = sctp_sk(sk2)->ep;

if (reuse && sk2->sk_reuse)
if (reuse && sk2->sk_reuse &&
sk2->sk_state != SCTP_SS_LISTENING)
continue;

if (sctp_bind_addr_match(&ep2->base.bind_addr, addr,
Expand All @@ -5058,18 +5060,22 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
* if sk->sk_reuse is too (that is, if the caller requested
* SO_REUSEADDR on this socket -sk-).
*/
if (hlist_empty(&pp->owner))
pp->fastreuse = sk->sk_reuse ? 1 : 0;
else if (pp->fastreuse && !sk->sk_reuse)
if (hlist_empty(&pp->owner)) {
if (sk->sk_reuse && sk->sk_state != SCTP_SS_LISTENING)
pp->fastreuse = 1;
else
pp->fastreuse = 0;
} else if (pp->fastreuse &&
(!sk->sk_reuse || sk->sk_state == SCTP_SS_LISTENING))
pp->fastreuse = 0;

/* We are set, so fill up all the data in the hash table
* entry, tie the socket list information with the rest of the
* sockets FIXME: Blurry, NPI (ipg).
*/
success:
inet_sk(sk)->num = snum;
if (!sctp_sk(sk)->bind_hash) {
inet_sk(sk)->num = snum;
sk_add_bind_node(sk, &pp->owner);
sctp_sk(sk)->bind_hash = pp;
}
Expand Down Expand Up @@ -5142,12 +5148,16 @@ SCTP_STATIC int sctp_seqpacket_listen(struct sock *sk, int backlog)
* This is not currently spelled out in the SCTP sockets
* extensions draft, but follows the practice as seen in TCP
* sockets.
*
* Additionally, turn off fastreuse flag since we are not listening
*/
sk->sk_state = SCTP_SS_LISTENING;
if (!ep->base.bind_addr.port) {
if (sctp_autobind(sk))
return -EAGAIN;
}
sk->sk_state = SCTP_SS_LISTENING;
} else
sctp_sk(sk)->bind_hash->fastreuse = 0;

sctp_hash_endpoint(ep);
return 0;
}
Expand Down Expand Up @@ -5185,11 +5195,13 @@ SCTP_STATIC int sctp_stream_listen(struct sock *sk, int backlog)
* extensions draft, but follows the practice as seen in TCP
* sockets.
*/
sk->sk_state = SCTP_SS_LISTENING;
if (!ep->base.bind_addr.port) {
if (sctp_autobind(sk))
return -EAGAIN;
}
sk->sk_state = SCTP_SS_LISTENING;
} else
sctp_sk(sk)->bind_hash->fastreuse = 0;

sk->sk_max_ack_backlog = backlog;
sctp_hash_endpoint(ep);
return 0;
Expand Down

0 comments on commit 0830845

Please sign in to comment.