summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2013-03-08 01:19:46 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2013-03-08 01:19:46 +0000
commit4cbac4a1e998a5054e5e7389b5800aba7369fef1 (patch)
tree8aa71c488ef91a8fd1875eecd04d20a6fe3796ec /sys
parent1f3e2b4750b2c70e75216a3e1959b8ffa517a80f (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/sctp_usrreq.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c
index 2b31c831f9e2..48abc3bd1e17 100644
--- a/sys/netinet/sctp_usrreq.c
+++ b/sys/netinet/sctp_usrreq.c
@@ -547,27 +547,21 @@ try_again:
static int
sctp_bind(struct socket *so, struct sockaddr *addr, struct thread *p)
{
- struct sctp_inpcb *inp = NULL;
- int error;
+ struct sctp_inpcb *inp;
-#ifdef INET
- if (addr && addr->sa_family != AF_INET) {
- /* must be a v4 address! */
- SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
- return (EINVAL);
- }
-#endif /* INET6 */
- if (addr && (addr->sa_len != sizeof(struct sockaddr_in))) {
- SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
- return (EINVAL);
- }
inp = (struct sctp_inpcb *)so->so_pcb;
if (inp == NULL) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
return (EINVAL);
}
- error = sctp_inpcb_bind(so, addr, NULL, p);
- return (error);
+ if (addr != NULL) {
+ if ((addr->sa_family != AF_INET) ||
+ (addr->sa_len != sizeof(struct sockaddr_in))) {
+ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
+ return (EINVAL);
+ }
+ }
+ return (sctp_inpcb_bind(so, addr, NULL, p));
}
#endif