Home | History | Annotate | Line # | Download | only in netinet6
dccp6_usrreq.c revision 1.2
      1  1.1  rjs /*	$KAME: dccp6_usrreq.c,v 1.13 2005/07/27 08:42:56 nishida Exp $	*/
      2  1.2  rtr /*	$NetBSD: dccp6_usrreq.c,v 1.2 2015/04/04 04:33:39 rtr Exp $ */
      3  1.1  rjs 
      4  1.1  rjs /*
      5  1.1  rjs  * Copyright (C) 2003 WIDE Project.
      6  1.1  rjs  * All rights reserved.
      7  1.1  rjs  *
      8  1.1  rjs  * Redistribution and use in source and binary forms, with or without
      9  1.1  rjs  * modification, are permitted provided that the following conditions
     10  1.1  rjs  * are met:
     11  1.1  rjs  * 1. Redistributions of source code must retain the above copyright
     12  1.1  rjs  *    notice, this list of conditions and the following disclaimer.
     13  1.1  rjs  * 2. Redistributions in binary form must reproduce the above copyright
     14  1.1  rjs  *    notice, this list of conditions and the following disclaimer in the
     15  1.1  rjs  *    documentation and/or other materials provided with the distribution.
     16  1.1  rjs  * 3. Neither the name of the project nor the names of its contributors
     17  1.1  rjs  *    may be used to endorse or promote products derived from this software
     18  1.1  rjs  *    without specific prior written permission.
     19  1.1  rjs  *
     20  1.1  rjs  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
     21  1.1  rjs  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     22  1.1  rjs  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     23  1.1  rjs  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
     24  1.1  rjs  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     25  1.1  rjs  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     26  1.1  rjs  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     27  1.1  rjs  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     28  1.1  rjs  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     29  1.1  rjs  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     30  1.1  rjs  * SUCH DAMAGE.
     31  1.1  rjs  */
     32  1.1  rjs 
     33  1.1  rjs #include <sys/cdefs.h>
     34  1.2  rtr __KERNEL_RCSID(0, "$NetBSD: dccp6_usrreq.c,v 1.2 2015/04/04 04:33:39 rtr Exp $");
     35  1.1  rjs 
     36  1.1  rjs #include "opt_inet.h"
     37  1.1  rjs #include "opt_dccp.h"
     38  1.1  rjs 
     39  1.1  rjs #include <sys/param.h>
     40  1.1  rjs #include <sys/systm.h>
     41  1.1  rjs #include <sys/domain.h>
     42  1.1  rjs #include <sys/kernel.h>
     43  1.1  rjs #include <sys/pool.h>
     44  1.1  rjs #include <sys/lock.h>
     45  1.1  rjs #include <sys/malloc.h>
     46  1.1  rjs #include <sys/mbuf.h>
     47  1.1  rjs #include <sys/proc.h>
     48  1.1  rjs #include <sys/protosw.h>
     49  1.1  rjs #include <sys/signalvar.h>
     50  1.1  rjs #include <sys/socket.h>
     51  1.1  rjs #include <sys/socketvar.h>
     52  1.1  rjs #include <sys/mutex.h>
     53  1.1  rjs #include <sys/sysctl.h>
     54  1.1  rjs #include <sys/syslog.h>
     55  1.1  rjs #include <sys/queue.h>
     56  1.1  rjs 
     57  1.1  rjs #include <net/if.h>
     58  1.1  rjs #include <net/route.h>
     59  1.1  rjs 
     60  1.1  rjs #include <netinet/in.h>
     61  1.1  rjs #include <netinet/in_systm.h>
     62  1.1  rjs #include <netinet/ip.h>
     63  1.1  rjs #include <netinet/in_pcb.h>
     64  1.1  rjs #include <netinet/in_var.h>
     65  1.1  rjs #include <netinet/ip6.h>
     66  1.1  rjs #include <netinet/ip_icmp.h>
     67  1.1  rjs #include <netinet/icmp_var.h>
     68  1.1  rjs #include <netinet/ip_var.h>
     69  1.1  rjs #include <netinet6/in6_pcb.h>
     70  1.1  rjs #include <netinet6/ip6_var.h>
     71  1.1  rjs #include <netinet6/nd6.h>
     72  1.1  rjs #include <netinet/dccp.h>
     73  1.1  rjs #include <netinet/dccp_var.h>
     74  1.1  rjs #include <netinet6/dccp6_var.h>
     75  1.1  rjs #include <netinet/dccp_cc_sw.h>
     76  1.1  rjs 
     77  1.1  rjs #if !defined(__FreeBSD__) || __FreeBSD_version < 500000
     78  1.1  rjs #define	INP_INFO_LOCK_INIT(x,y)
     79  1.1  rjs #define	INP_INFO_WLOCK(x)
     80  1.1  rjs #define INP_INFO_WUNLOCK(x)
     81  1.1  rjs #define	INP_INFO_RLOCK(x)
     82  1.1  rjs #define INP_INFO_RUNLOCK(x)
     83  1.1  rjs #define	INP_LOCK(x)
     84  1.1  rjs #define INP_UNLOCK(x)
     85  1.1  rjs #endif
     86  1.1  rjs 
     87  1.1  rjs #define PULLDOWN_TEST
     88  1.1  rjs 
     89  1.1  rjs int
     90  1.1  rjs dccp6_input(struct mbuf **mp, int *offp, int proto)
     91  1.1  rjs {
     92  1.1  rjs 	struct mbuf *m = *mp;
     93  1.1  rjs 	DCCP_DEBUG((LOG_INFO, "In dccp6_input!\n"));
     94  1.1  rjs #ifndef PULLDOWN_TEST
     95  1.1  rjs 	IP6_EXTHDR_CHECK(m, *offp, sizeof(struct dccphdr), IPPROTO_DONE);
     96  1.1  rjs #endif
     97  1.1  rjs 
     98  1.1  rjs 	dccp_input(m, *offp);
     99  1.1  rjs 	return IPPROTO_DONE;
    100  1.1  rjs }
    101  1.1  rjs 
    102  1.1  rjs void *
    103  1.1  rjs dccp6_ctlinput(int cmd, const struct sockaddr *sa, void *d)
    104  1.1  rjs {
    105  1.1  rjs 	if (sa->sa_family != AF_INET6 ||
    106  1.1  rjs 	    sa->sa_len != sizeof(struct sockaddr_in6))
    107  1.1  rjs 		return NULL;
    108  1.1  rjs 
    109  1.1  rjs 	/* FIX LATER */
    110  1.1  rjs 	return NULL;
    111  1.1  rjs }
    112  1.1  rjs 
    113  1.1  rjs int
    114  1.2  rtr dccp6_bind(struct socket *so, struct sockaddr *nam, struct lwp *td)
    115  1.1  rjs {
    116  1.1  rjs 	struct in6pcb *in6p;
    117  1.1  rjs 	int error;
    118  1.2  rtr 	struct sockaddr_in6 *sin6p = (struct sockaddr_in6 *)nam;
    119  1.1  rjs 
    120  1.1  rjs 	DCCP_DEBUG((LOG_INFO, "Entering dccp6_bind!\n"));
    121  1.1  rjs 	INP_INFO_WLOCK(&dccpbinfo);
    122  1.1  rjs 	in6p = sotoin6pcb(so);
    123  1.1  rjs 	if (in6p == 0) {
    124  1.1  rjs 		INP_INFO_WUNLOCK(&dccpbinfo);
    125  1.1  rjs 		DCCP_DEBUG((LOG_INFO, "dccp6_bind: in6p == 0!\n"));
    126  1.1  rjs 		return EINVAL;
    127  1.1  rjs 	}
    128  1.1  rjs 	/* Do not bind to multicast addresses! */
    129  1.1  rjs 	if (sin6p->sin6_family == AF_INET6 &&
    130  1.1  rjs 	    IN6_IS_ADDR_MULTICAST(&sin6p->sin6_addr)) {
    131  1.1  rjs 		INP_INFO_WUNLOCK(&dccpbinfo);
    132  1.1  rjs 		return EAFNOSUPPORT;
    133  1.1  rjs 	}
    134  1.1  rjs 	INP_LOCK(inp);
    135  1.1  rjs 
    136  1.1  rjs 	in6todccpcb(in6p)->inp_vflag &= ~INP_IPV4;
    137  1.1  rjs 	in6todccpcb(in6p)->inp_vflag |= INP_IPV6;
    138  1.1  rjs 
    139  1.2  rtr 	error = in6_pcbbind(in6p, sin6p, td);
    140  1.1  rjs 	INP_UNLOCK(inp);
    141  1.1  rjs 	INP_INFO_WUNLOCK(&dccpbinfo);
    142  1.1  rjs 	return error;
    143  1.1  rjs }
    144  1.1  rjs 
    145  1.1  rjs int
    146  1.1  rjs dccp6_connect(struct socket *so, struct mbuf *m, struct lwp *l)
    147  1.1  rjs {
    148  1.1  rjs 	struct in6pcb *in6p;
    149  1.1  rjs 	struct dccpcb *dp;
    150  1.1  rjs 	int error;
    151  1.1  rjs 	struct sockaddr_in6 *sin6;
    152  1.1  rjs 	struct sockaddr *nam;
    153  1.1  rjs 	char test[2];
    154  1.1  rjs 
    155  1.1  rjs 	DCCP_DEBUG((LOG_INFO, "Entering dccp6_connect!\n"));
    156  1.1  rjs 
    157  1.1  rjs #ifndef __NetBSD__
    158  1.1  rjs 	INP_INFO_WLOCK(&dccpbinfo);
    159  1.1  rjs 	inp = sotoinpcb(so);
    160  1.1  rjs 	if (inp == 0) {
    161  1.1  rjs 		INP_INFO_WUNLOCK(&dccpbinfo);
    162  1.1  rjs 		return EINVAL;
    163  1.1  rjs 	}
    164  1.1  rjs 	INP_LOCK(inp);
    165  1.1  rjs 	if (inp->inp_faddr.s_addr != INADDR_ANY) {
    166  1.1  rjs 		INP_UNLOCK(inp);
    167  1.1  rjs 		INP_INFO_WUNLOCK(&dccpbinfo);
    168  1.1  rjs 		return EISCONN;
    169  1.1  rjs 	}
    170  1.1  rjs 
    171  1.1  rjs 	dp = (struct dccpcb *)inp->inp_ppcb;
    172  1.1  rjs #else
    173  1.1  rjs 	in6p = sotoin6pcb(so);
    174  1.1  rjs 	if (in6p == 0) {
    175  1.1  rjs 		return EINVAL;
    176  1.1  rjs 	}
    177  1.1  rjs 	if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr)) {
    178  1.1  rjs 		return EISCONN;
    179  1.1  rjs 	}
    180  1.1  rjs 
    181  1.1  rjs 	dp = (struct dccpcb *)in6p->in6p_ppcb;
    182  1.1  rjs #endif
    183  1.1  rjs 	if (dp->state == DCCPS_ESTAB) {
    184  1.1  rjs 		DCCP_DEBUG((LOG_INFO, "Why are we in connect when we already have a established connection?\n"));
    185  1.1  rjs 	}
    186  1.1  rjs 
    187  1.1  rjs 	dp->who = DCCP_CLIENT;
    188  1.1  rjs 	dp->seq_snd = (((u_int64_t)random() << 32) | random()) % 281474976710656LL;
    189  1.1  rjs 
    190  1.1  rjs 	nam = mtod(m, struct sockaddr *);
    191  1.1  rjs 	sin6 = (struct sockaddr_in6 *)nam;
    192  1.1  rjs 	if (sin6->sin6_family == AF_INET6
    193  1.1  rjs 	    && IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) {
    194  1.1  rjs 		error = EAFNOSUPPORT;
    195  1.1  rjs 		goto bad;
    196  1.1  rjs 	}
    197  1.1  rjs 
    198  1.1  rjs 	dp->inp_vflag &= ~INP_IPV4;
    199  1.1  rjs 	dp->inp_vflag |= INP_IPV6;
    200  1.1  rjs 
    201  1.1  rjs 	error = dccp_doconnect(so, m, l, 1);
    202  1.1  rjs 
    203  1.1  rjs 	if (error != 0)
    204  1.1  rjs 		goto bad;
    205  1.1  rjs 
    206  1.1  rjs 	callout_reset(&dp->retrans_timer, dp->retrans, dccp_retrans_t, dp);
    207  1.1  rjs 	callout_reset(&dp->connect_timer, DCCP_CONNECT_TIMER, dccp_connect_t, dp);
    208  1.1  rjs 
    209  1.1  rjs 	test[0] = dp->pref_cc;
    210  1.1  rjs #if 0
    211  1.1  rjs 	/* FIX THIS LATER */
    212  1.1  rjs 	if (dp->pref_cc == 2) {
    213  1.1  rjs 		test[1] = 3;
    214  1.1  rjs 	} else {
    215  1.1  rjs 		test[1] = 2;
    216  1.1  rjs 	}
    217  1.1  rjs 	dccp_add_feature(dp, DCCP_OPT_CHANGE, DCCP_FEATURE_CC, test, 2);
    218  1.1  rjs 	dccp_add_feature(dp, DCCP_OPT_PREFER, DCCP_FEATURE_CC, test, 2);
    219  1.1  rjs #else
    220  1.1  rjs 	 /* we only support CCID2 at this moment */
    221  1.1  rjs 	dccp_add_feature(dp, DCCP_OPT_CHANGE_R, DCCP_FEATURE_CC, test, 1);
    222  1.1  rjs #endif
    223  1.1  rjs 
    224  1.1  rjs 	error = dccp_output(dp, 0);
    225  1.1  rjs 
    226  1.1  rjs bad:
    227  1.1  rjs 	INP_UNLOCK(inp);
    228  1.1  rjs 	INP_INFO_WUNLOCK(&dccpbinfo);
    229  1.1  rjs 	return error;
    230  1.1  rjs }
    231  1.1  rjs 
    232  1.1  rjs 
    233  1.1  rjs int
    234  1.1  rjs dccp6_listen(struct socket *so, struct lwp *l)
    235  1.1  rjs {
    236  1.1  rjs 	struct in6pcb *in6p;
    237  1.1  rjs 	struct dccpcb *dp;
    238  1.1  rjs 	int error = 0;
    239  1.1  rjs 
    240  1.1  rjs 	DCCP_DEBUG((LOG_INFO, "Entering dccp6_listen!\n"));
    241  1.1  rjs 
    242  1.1  rjs 	INP_INFO_RLOCK(&dccpbinfo);
    243  1.1  rjs 	in6p = sotoin6pcb(so);
    244  1.1  rjs 	if (in6p == 0) {
    245  1.1  rjs 		INP_INFO_RUNLOCK(&dccpbinfo);
    246  1.1  rjs 		return EINVAL;
    247  1.1  rjs 	}
    248  1.1  rjs 	INP_LOCK(inp);
    249  1.1  rjs 	INP_INFO_RUNLOCK(&dccpbinfo);
    250  1.1  rjs 	dp = in6todccpcb(in6p);
    251  1.1  rjs 	DCCP_DEBUG((LOG_INFO, "Checking in6p->in6p_lport!\n"));
    252  1.1  rjs 	if (in6p->in6p_lport == 0) {
    253  1.2  rtr 		error = in6_pcbbind(in6p, NULL, l);
    254  1.1  rjs 	}
    255  1.1  rjs 	if (error == 0) {
    256  1.1  rjs 		dp->state = DCCPS_LISTEN;
    257  1.1  rjs 		dp->who = DCCP_LISTENER;
    258  1.1  rjs 		dp->seq_snd = 512;
    259  1.1  rjs 	}
    260  1.1  rjs 	INP_UNLOCK(inp);
    261  1.1  rjs 	return error;
    262  1.1  rjs }
    263  1.1  rjs 
    264  1.1  rjs int
    265  1.1  rjs dccp6_accept(struct socket *so, struct mbuf *m)
    266  1.1  rjs {
    267  1.1  rjs 	struct in6pcb *in6p = NULL;
    268  1.1  rjs 	int error = 0;
    269  1.1  rjs 
    270  1.1  rjs 	DCCP_DEBUG((LOG_INFO, "Entering dccp6_accept!\n"));
    271  1.1  rjs 	if (m == NULL) {
    272  1.1  rjs 		return EINVAL;
    273  1.1  rjs 	}
    274  1.1  rjs 	if (so->so_state & SS_ISDISCONNECTED) {
    275  1.1  rjs 		DCCP_DEBUG((LOG_INFO, "so_state && SS_ISDISCONNECTED!, so->state = %i\n", so->so_state));
    276  1.1  rjs 		return ECONNABORTED;
    277  1.1  rjs 	}
    278  1.1  rjs 
    279  1.1  rjs 	INP_INFO_RLOCK(&dccpbinfo);
    280  1.1  rjs 	in6p = sotoin6pcb(so);
    281  1.1  rjs 	if (in6p == 0) {
    282  1.1  rjs 		INP_INFO_RUNLOCK(&dccpbinfo);
    283  1.1  rjs 		return EINVAL;
    284  1.1  rjs 	}
    285  1.1  rjs 	INP_LOCK(inp);
    286  1.1  rjs 	INP_INFO_RUNLOCK(&dccpbinfo);
    287  1.1  rjs 	in6_setpeeraddr(in6p, m);
    288  1.1  rjs 
    289  1.1  rjs 	INP_UNLOCK(inp);
    290  1.1  rjs 	return error;
    291  1.1  rjs }
    292  1.1  rjs 
    293  1.1  rjs static int
    294  1.1  rjs dccp6_ioctl(struct socket *so, u_long cmd, void *nam, struct ifnet *ifp)
    295  1.1  rjs {
    296  1.1  rjs 	int error = 0;
    297  1.1  rjs 	int family;
    298  1.1  rjs 
    299  1.1  rjs 	family = so->so_proto->pr_domain->dom_family;
    300  1.1  rjs 	switch (family) {
    301  1.1  rjs 	case PF_INET6:
    302  1.1  rjs 		error = in6_control(so, cmd, nam, ifp);
    303  1.1  rjs 		break;
    304  1.1  rjs 	default:
    305  1.1  rjs 		error =	 EAFNOSUPPORT;
    306  1.1  rjs 	}
    307  1.1  rjs 	return (error);
    308  1.1  rjs }
    309  1.1  rjs 
    310  1.1  rjs static int
    311  1.1  rjs dccp6_stat(struct socket *so, struct stat *ub)
    312  1.1  rjs {
    313  1.1  rjs 	return 0;
    314  1.1  rjs }
    315  1.1  rjs 
    316  1.1  rjs static int
    317  1.1  rjs dccp6_purgeif(struct socket *so, struct ifnet *ifp)
    318  1.1  rjs {
    319  1.1  rjs 	int s;
    320  1.1  rjs 
    321  1.1  rjs 	s = splsoftnet();
    322  1.1  rjs 	mutex_enter(softnet_lock);
    323  1.1  rjs 	in6_pcbpurgeif0(&dccpbtable, ifp);
    324  1.1  rjs 	in6_purgeif(ifp);
    325  1.1  rjs 	in6_pcbpurgeif(&dccpbtable, ifp);
    326  1.1  rjs 	mutex_exit(softnet_lock);
    327  1.1  rjs 	splx(s);
    328  1.1  rjs 
    329  1.1  rjs 	return 0;
    330  1.1  rjs }
    331  1.1  rjs 
    332  1.1  rjs int
    333  1.1  rjs dccp6_usrreq(struct socket *so, int req, struct mbuf *m,
    334  1.1  rjs 	     struct mbuf *nam, struct mbuf *control, struct lwp *l)
    335  1.1  rjs {
    336  1.1  rjs 	int error = 0;
    337  1.1  rjs 
    338  1.1  rjs 	KASSERT(req != PRU_ATTACH);
    339  1.1  rjs 	KASSERT(req != PRU_DETACH);
    340  1.1  rjs 	KASSERT(req != PRU_ACCEPT);
    341  1.1  rjs 	KASSERT(req != PRU_BIND);
    342  1.1  rjs 	KASSERT(req != PRU_LISTEN);
    343  1.1  rjs 	KASSERT(req != PRU_CONNECT);
    344  1.1  rjs 	KASSERT(req != PRU_CONNECT2);
    345  1.1  rjs 	KASSERT(req != PRU_DISCONNECT);
    346  1.1  rjs 	KASSERT(req != PRU_SHUTDOWN);
    347  1.1  rjs 	KASSERT(req != PRU_ABORT);
    348  1.1  rjs 	KASSERT(req != PRU_CONTROL);
    349  1.1  rjs 	KASSERT(req != PRU_SENSE);
    350  1.1  rjs 	KASSERT(req != PRU_PEERADDR);
    351  1.1  rjs 	KASSERT(req != PRU_SOCKADDR);
    352  1.1  rjs 	KASSERT(req != PRU_RCVD);
    353  1.1  rjs 	KASSERT(req != PRU_RCVOOB);
    354  1.1  rjs 	KASSERT(req != PRU_SEND);
    355  1.1  rjs 	KASSERT(req != PRU_SENDOOB);
    356  1.1  rjs 	KASSERT(req != PRU_PURGEIF);
    357  1.1  rjs 
    358  1.1  rjs 	if (sotoin6pcb(so) == NULL) {
    359  1.1  rjs 		error = EINVAL;
    360  1.1  rjs 		goto release;
    361  1.1  rjs 	}
    362  1.1  rjs 
    363  1.1  rjs 	switch (req) {
    364  1.1  rjs 	case PRU_FASTTIMO:
    365  1.1  rjs 	case PRU_SLOWTIMO:
    366  1.1  rjs 	case PRU_PROTORCV:
    367  1.1  rjs 	case PRU_PROTOSEND:
    368  1.1  rjs 		error = EOPNOTSUPP;
    369  1.1  rjs 		break;
    370  1.1  rjs 
    371  1.1  rjs 	default:
    372  1.1  rjs 		panic("dccp6_usrreq");
    373  1.1  rjs 	}
    374  1.1  rjs 
    375  1.1  rjs release:
    376  1.1  rjs 	if (control != NULL)
    377  1.1  rjs 		m_freem(control);
    378  1.1  rjs 	if (m != NULL)
    379  1.1  rjs 		m_freem(m);
    380  1.1  rjs 	return error;
    381  1.1  rjs }
    382  1.1  rjs 
    383  1.1  rjs static int
    384  1.1  rjs dccp6_attach(struct socket *so, int proto)
    385  1.1  rjs {
    386  1.1  rjs 	return dccp_attach(so, proto);
    387  1.1  rjs }
    388  1.1  rjs 
    389  1.1  rjs static int
    390  1.1  rjs dccp6_detach(struct socket *so)
    391  1.1  rjs {
    392  1.1  rjs 	return dccp_detach(so);
    393  1.1  rjs }
    394  1.1  rjs 
    395  1.1  rjs static int
    396  1.1  rjs dccp6_connect2(struct socket *so, struct socket *so2)
    397  1.1  rjs {
    398  1.1  rjs 	KASSERT(solocked(so));
    399  1.1  rjs 
    400  1.1  rjs 	return EOPNOTSUPP;
    401  1.1  rjs }
    402  1.1  rjs 
    403  1.1  rjs static int
    404  1.1  rjs dccp6_disconnect(struct socket *so)
    405  1.1  rjs {
    406  1.1  rjs 	return dccp_disconnect(so);
    407  1.1  rjs }
    408  1.1  rjs 
    409  1.1  rjs static int
    410  1.1  rjs dccp6_shutdown(struct socket *so)
    411  1.1  rjs {
    412  1.1  rjs 	return dccp_shutdown(so);
    413  1.1  rjs }
    414  1.1  rjs 
    415  1.1  rjs static int
    416  1.1  rjs dccp6_abort(struct socket *so)
    417  1.1  rjs {
    418  1.1  rjs 	return dccp_abort(so);
    419  1.1  rjs }
    420  1.1  rjs 
    421  1.1  rjs 
    422  1.1  rjs static int
    423  1.1  rjs dccp6_peeraddr(struct socket *so, struct mbuf *nam)
    424  1.1  rjs {
    425  1.1  rjs 	KASSERT(solocked(so));
    426  1.1  rjs 	KASSERT(sotoinpcb(so) != NULL);
    427  1.1  rjs 	KASSERT(nam != NULL);
    428  1.1  rjs 
    429  1.1  rjs 	in6_setpeeraddr(sotoin6pcb(so), nam);
    430  1.1  rjs 	return 0;
    431  1.1  rjs }
    432  1.1  rjs 
    433  1.1  rjs static int
    434  1.1  rjs dccp6_sockaddr(struct socket *so, struct mbuf *nam)
    435  1.1  rjs {
    436  1.1  rjs 	KASSERT(solocked(so));
    437  1.1  rjs 	KASSERT(sotoinpcb(so) != NULL);
    438  1.1  rjs 	KASSERT(nam != NULL);
    439  1.1  rjs 
    440  1.1  rjs 	in6_setsockaddr(sotoin6pcb(so), nam);
    441  1.1  rjs 	return 0;
    442  1.1  rjs }
    443  1.1  rjs 
    444  1.1  rjs static int
    445  1.1  rjs dccp6_recvoob(struct socket *so, struct mbuf *m, int flags)
    446  1.1  rjs {
    447  1.1  rjs 	KASSERT(solocked(so));
    448  1.1  rjs 
    449  1.1  rjs 	return EOPNOTSUPP;
    450  1.1  rjs }
    451  1.1  rjs 
    452  1.1  rjs static int
    453  1.1  rjs dccp6_rcvd(struct socket *so, int flags, struct lwp *l)
    454  1.1  rjs {
    455  1.1  rjs 	KASSERT(solocked(so));
    456  1.1  rjs 
    457  1.1  rjs 	return EOPNOTSUPP;
    458  1.1  rjs }
    459  1.1  rjs 
    460  1.1  rjs static int
    461  1.1  rjs dccp6_send(struct socket *so, struct mbuf *m, struct mbuf *nam,
    462  1.1  rjs     struct mbuf *control, struct lwp *l)
    463  1.1  rjs {
    464  1.1  rjs 	return dccp_send(so, m, nam, control, l);
    465  1.1  rjs }
    466  1.1  rjs 
    467  1.1  rjs static int
    468  1.1  rjs dccp6_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control)
    469  1.1  rjs {
    470  1.1  rjs 	KASSERT(solocked(so));
    471  1.1  rjs 
    472  1.1  rjs 	m_freem(m);
    473  1.1  rjs 	m_freem(control);
    474  1.1  rjs 
    475  1.1  rjs 	return EOPNOTSUPP;
    476  1.1  rjs }
    477  1.1  rjs 
    478  1.1  rjs 
    479  1.1  rjs PR_WRAP_USRREQS(dccp6)
    480  1.1  rjs #define	dccp6_attach		dccp6_attach_wrapper
    481  1.1  rjs #define	dccp6_detach		dccp6_detach_wrapper
    482  1.1  rjs #define dccp6_accept		dccp6_accept_wrapper
    483  1.1  rjs #define	dccp6_bind		dccp6_bind_wrapper
    484  1.1  rjs #define	dccp6_listen		dccp6_listen_wrapper
    485  1.1  rjs #define	dccp6_connect		dccp6_connect_wrapper
    486  1.1  rjs #define	dccp6_connect2		dccp6_connect2_wrapper
    487  1.1  rjs #define	dccp6_disconnect	dccp6_disconnect_wrapper
    488  1.1  rjs #define	dccp6_shutdown		dccp6_shutdown_wrapper
    489  1.1  rjs #define	dccp6_abort		dccp6_abort_wrapper
    490  1.1  rjs #define	dccp6_ioctl		dccp6_ioctl_wrapper
    491  1.1  rjs #define	dccp6_stat		dccp6_stat_wrapper
    492  1.1  rjs #define	dccp6_peeraddr		dccp6_peeraddr_wrapper
    493  1.1  rjs #define	dccp6_sockaddr		dccp6_sockaddr_wrapper
    494  1.1  rjs #define	dccp6_rcvd		dccp6_rcvd_wrapper
    495  1.1  rjs #define	dccp6_recvoob		dccp6_recvoob_wrapper
    496  1.1  rjs #define	dccp6_send		dccp6_send_wrapper
    497  1.1  rjs #define	dccp6_sendoob		dccp6_sendoob_wrapper
    498  1.1  rjs #define	dccp6_purgeif		dccp6_purgeif_wrapper
    499  1.1  rjs #define	dccp6_usrreq		dccp6_usrreq_wrapper
    500  1.1  rjs 
    501  1.1  rjs const struct pr_usrreqs dccp6_usrreqs = {
    502  1.1  rjs 	.pr_attach	= dccp6_attach,
    503  1.1  rjs 	.pr_detach	= dccp6_detach,
    504  1.1  rjs 	.pr_accept	= dccp6_accept,
    505  1.1  rjs 	.pr_bind	= dccp6_bind,
    506  1.1  rjs 	.pr_listen	= dccp6_listen,
    507  1.1  rjs 	.pr_connect	= dccp6_connect,
    508  1.1  rjs 	.pr_connect2	= dccp6_connect2,
    509  1.1  rjs 	.pr_disconnect	= dccp6_disconnect,
    510  1.1  rjs 	.pr_shutdown	= dccp6_shutdown,
    511  1.1  rjs 	.pr_abort	= dccp6_abort,
    512  1.1  rjs 	.pr_ioctl	= dccp6_ioctl,
    513  1.1  rjs 	.pr_stat	= dccp6_stat,
    514  1.1  rjs 	.pr_peeraddr	= dccp6_peeraddr,
    515  1.1  rjs 	.pr_sockaddr	= dccp6_sockaddr,
    516  1.1  rjs 	.pr_rcvd	= dccp6_rcvd,
    517  1.1  rjs 	.pr_recvoob	= dccp6_recvoob,
    518  1.1  rjs 	.pr_send	= dccp6_send,
    519  1.1  rjs 	.pr_sendoob	= dccp6_sendoob,
    520  1.1  rjs 	.pr_purgeif	= dccp6_purgeif,
    521  1.1  rjs 	.pr_generic	= dccp6_usrreq,
    522  1.1  rjs };
    523