Commit 16321c0b authored by Sridhar Samudrala's avatar Sridhar Samudrala

[SCTP] draft 07 API changes: Disable listening when backlog is 0.

parent aca9dc23
...@@ -3346,9 +3346,19 @@ SCTP_STATIC int sctp_seqpacket_listen(struct sock *sk, int backlog) ...@@ -3346,9 +3346,19 @@ SCTP_STATIC int sctp_seqpacket_listen(struct sock *sk, int backlog)
if (!sctp_style(sk, UDP)) if (!sctp_style(sk, UDP))
return -EINVAL; return -EINVAL;
/* If backlog is zero, disable listening. */
if (!backlog) {
if (sctp_sstate(sk, CLOSED))
return 0;
sctp_unhash_endpoint(ep);
sk->sk_state = SCTP_SS_CLOSED;
}
/* Return if we are already listening. */
if (sctp_sstate(sk, LISTENING)) if (sctp_sstate(sk, LISTENING))
return 0; return 0;
/* /*
* If a bind() or sctp_bindx() is not called prior to a listen() * If a bind() or sctp_bindx() is not called prior to a listen()
* call that allows new associations to be accepted, the system * call that allows new associations to be accepted, the system
...@@ -3379,6 +3389,15 @@ SCTP_STATIC int sctp_stream_listen(struct sock *sk, int backlog) ...@@ -3379,6 +3389,15 @@ SCTP_STATIC int sctp_stream_listen(struct sock *sk, int backlog)
struct sctp_opt *sp = sctp_sk(sk); struct sctp_opt *sp = sctp_sk(sk);
struct sctp_endpoint *ep = sp->ep; struct sctp_endpoint *ep = sp->ep;
/* If backlog is zero, disable listening. */
if (!backlog) {
if (sctp_sstate(sk, CLOSED))
return 0;
sctp_unhash_endpoint(ep);
sk->sk_state = SCTP_SS_CLOSED;
}
if (sctp_sstate(sk, LISTENING)) if (sctp_sstate(sk, LISTENING))
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment