Do sctp_connectx() handling using ioctl() for IPv6 as well.

This commit is contained in:
rjs 2020-04-27 19:21:43 +00:00
parent ec663b7139
commit 7cd04caf48
3 changed files with 28 additions and 16 deletions

View File

@ -1,5 +1,5 @@
/* $KAME: sctp_usrreq.c,v 1.50 2005/06/16 20:45:29 jinmei Exp $ */
/* $NetBSD: sctp_usrreq.c,v 1.19 2019/06/25 15:33:56 rjs Exp $ */
/* $NetBSD: sctp_usrreq.c,v 1.20 2020/04/27 19:21:43 rjs Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
@ -33,7 +33,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sctp_usrreq.c,v 1.19 2019/06/25 15:33:56 rjs Exp $");
__KERNEL_RCSID(0, "$NetBSD: sctp_usrreq.c,v 1.20 2020/04/27 19:21:43 rjs Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -1143,7 +1143,7 @@ sctp_count_max_addresses(struct sctp_inpcb *inp)
return (cnt);
}
static int
int
sctp_do_connect_x(struct socket *so, struct sctp_connectx_addrs *sca,
struct lwp *l, int delay)
{

View File

@ -1,5 +1,5 @@
/* $KAME: sctp_var.h,v 1.24 2005/03/06 16:04:19 itojun Exp $ */
/* $NetBSD: sctp_var.h,v 1.3 2018/09/14 05:09:51 maxv Exp $ */
/* $NetBSD: sctp_var.h,v 1.4 2020/04/27 19:21:43 rjs Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
@ -161,6 +161,8 @@ void ip_2_ip6_hdr(struct ip6_hdr *, struct ip *);
int sctp_bindx(struct socket *, int, struct sockaddr_storage *,
int, int, struct lwp *);
int sctp_do_connect_x(struct socket *, struct sctp_connectx_addrs *,
struct lwp *, int);
/* can't use sctp_assoc_t here */
int sctp_peeloff(struct socket *, struct socket *, int, vaddr_t, int *);

View File

@ -1,5 +1,5 @@
/* $KAME: sctp6_usrreq.c,v 1.38 2005/08/24 08:08:56 suz Exp $ */
/* $NetBSD: sctp6_usrreq.c,v 1.20 2019/06/25 15:33:56 rjs Exp $ */
/* $NetBSD: sctp6_usrreq.c,v 1.21 2020/04/27 19:21:43 rjs Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
@ -33,7 +33,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sctp6_usrreq.c,v 1.20 2019/06/25 15:33:56 rjs Exp $");
__KERNEL_RCSID(0, "$NetBSD: sctp6_usrreq.c,v 1.21 2020/04/27 19:21:43 rjs Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -1244,20 +1244,30 @@ sctp6_ioctl(struct socket *so, u_long cmd, void *nam, struct ifnet *ifp)
int error = 0;
int family;
family = so->so_proto->pr_domain->dom_family;
switch (family) {
if (cmd == SIOCCONNECTX) {
solock(so);
error = sctp_do_connect_x(so, nam, curlwp, 0);
sounlock(so);
} else if (cmd == SIOCCONNECTXDEL) {
solock(so);
error = sctp_do_connect_x(so, nam, curlwp, 1);
sounlock(so);
} else {
family = so->so_proto->pr_domain->dom_family;
switch (family) {
#ifdef INET
case PF_INET:
error = in_control(so, cmd, nam, ifp);
break;
case PF_INET:
error = in_control(so, cmd, nam, ifp);
break;
#endif
#ifdef INET6
case PF_INET6:
error = in6_control(so, cmd, nam, ifp);
break;
case PF_INET6:
error = in6_control(so, cmd, nam, ifp);
break;
#endif
default:
error = EAFNOSUPPORT;
default:
error = EAFNOSUPPORT;
}
}
return (error);
}