Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Do sctp_connectx() handling using ioctl() for IPv6 as well.



details:   https://anonhg.NetBSD.org/src/rev/1717ed29e7d4
branches:  trunk
changeset: 1009586:1717ed29e7d4
user:      rjs <rjs%NetBSD.org@localhost>
date:      Mon Apr 27 19:21:43 2020 +0000

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

diffstat:

 sys/netinet/sctp_usrreq.c   |   6 +++---
 sys/netinet/sctp_var.h      |   4 +++-
 sys/netinet6/sctp6_usrreq.c |  34 ++++++++++++++++++++++------------
 3 files changed, 28 insertions(+), 16 deletions(-)

diffs (107 lines):

diff -r ad3ae82dda79 -r 1717ed29e7d4 sys/netinet/sctp_usrreq.c
--- a/sys/netinet/sctp_usrreq.c Mon Apr 27 18:08:25 2020 +0000
+++ b/sys/netinet/sctp_usrreq.c Mon Apr 27 19:21:43 2020 +0000
@@ -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 @@
        return (cnt);
 }
 
-static int
+int
 sctp_do_connect_x(struct socket *so, struct sctp_connectx_addrs *sca,
     struct lwp *l, int delay)
 {
diff -r ad3ae82dda79 -r 1717ed29e7d4 sys/netinet/sctp_var.h
--- a/sys/netinet/sctp_var.h    Mon Apr 27 18:08:25 2020 +0000
+++ b/sys/netinet/sctp_var.h    Mon Apr 27 19:21:43 2020 +0000
@@ -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 @@
 
 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 *);
diff -r ad3ae82dda79 -r 1717ed29e7d4 sys/netinet6/sctp6_usrreq.c
--- a/sys/netinet6/sctp6_usrreq.c       Mon Apr 27 18:08:25 2020 +0000
+++ b/sys/netinet6/sctp6_usrreq.c       Mon Apr 27 19:21:43 2020 +0000
@@ -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 @@
        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);
 }



Home | Main Index | Thread Index | Old Index