diff options
Diffstat (limited to 'sys/netinet/sctp_peeloff.c')
-rw-r--r-- | sys/netinet/sctp_peeloff.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sys/netinet/sctp_peeloff.c b/sys/netinet/sctp_peeloff.c index e810e34..daded1f 100644 --- a/sys/netinet/sctp_peeloff.c +++ b/sys/netinet/sctp_peeloff.c @@ -55,10 +55,12 @@ sctp_can_peel_off(struct socket *head, sctp_assoc_t assoc_id) inp = (struct sctp_inpcb *)head->so_pcb; if (inp == NULL) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EFAULT); return (EFAULT); } stcb = sctp_findassociation_ep_asocid(inp, assoc_id, 1); if (stcb == NULL) { + SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_PEELOFF, ENOTCONN); return (ENOTCONN); } state = SCTP_GET_STATE((&stcb->asoc)); @@ -67,6 +69,7 @@ sctp_can_peel_off(struct socket *head, sctp_assoc_t assoc_id) (state == SCTP_STATE_COOKIE_WAIT) || (state == SCTP_STATE_COOKIE_ECHOED)) { SCTP_TCB_UNLOCK(stcb); + SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_PEELOFF, ENOTCONN); return (ENOTCONN); } SCTP_TCB_UNLOCK(stcb); @@ -82,18 +85,22 @@ sctp_do_peeloff(struct socket *head, struct socket *so, sctp_assoc_t assoc_id) uint32_t state; inp = (struct sctp_inpcb *)head->so_pcb; - if (inp == NULL) + if (inp == NULL) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EFAULT); return (EFAULT); + } stcb = sctp_findassociation_ep_asocid(inp, assoc_id, 1); - if (stcb == NULL) + if (stcb == NULL) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, ENOTCONN); return (ENOTCONN); - + } state = SCTP_GET_STATE((&stcb->asoc)); if ((state == SCTP_STATE_EMPTY) || (state == SCTP_STATE_INUSE) || (state == SCTP_STATE_COOKIE_WAIT) || (state == SCTP_STATE_COOKIE_ECHOED)) { SCTP_TCB_UNLOCK(stcb); + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, ENOTCONN); return (ENOTCONN); } n_inp = (struct sctp_inpcb *)so->so_pcb; @@ -133,11 +140,13 @@ sctp_get_peeloff(struct socket *head, sctp_assoc_t assoc_id, int *error) SCTPDBG(SCTP_DEBUG_PEEL1, "SCTP peel-off called\n"); inp = (struct sctp_inpcb *)head->so_pcb; if (inp == NULL) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EFAULT); *error = EFAULT; return (NULL); } stcb = sctp_findassociation_ep_asocid(inp, assoc_id, 1); if (stcb == NULL) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, ENOTCONN); *error = ENOTCONN; return (NULL); } @@ -145,6 +154,7 @@ sctp_get_peeloff(struct socket *head, sctp_assoc_t assoc_id, int *error) ); if (newso == NULL) { SCTPDBG(SCTP_DEBUG_PEEL1, "sctp_peeloff:sonewconn failed\n"); + SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_PEELOFF, ENOMEM); *error = ENOMEM; SCTP_TCB_UNLOCK(stcb); return (NULL); |