1 /* $FreeBSD: src/sys/netinet6/udp6_usrreq.c,v 1.6.2.6 2001/07/29 19:32:40 ume Exp $ */
2 /* $KAME: udp6_usrreq.c,v 1.27 2001/05/21 05:45:10 jinmei Exp $ */
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the project nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * Copyright (c) 1982, 1986, 1989, 1993
35 * The Regents of the University of California. All rights reserved.
37 * Redistribution and use in source and binary forms, with or without
38 * modification, are permitted provided that the following conditions
40 * 1. Redistributions of source code must retain the above copyright
41 * notice, this list of conditions and the following disclaimer.
42 * 2. Redistributions in binary form must reproduce the above copyright
43 * notice, this list of conditions and the following disclaimer in the
44 * documentation and/or other materials provided with the distribution.
45 * 3. All advertising materials mentioning features or use of this software
46 * must display the following acknowledgement:
47 * This product includes software developed by the University of
48 * California, Berkeley and its contributors.
49 * 4. Neither the name of the University nor the names of its contributors
50 * may be used to endorse or promote products derived from this software
51 * without specific prior written permission.
53 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
54 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
55 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
56 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
57 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
58 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
59 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
60 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
61 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
62 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
65 * @(#)udp_var.h 8.1 (Berkeley) 6/10/93
68 #include <sys/param.h>
69 #include <sys/kernel.h>
70 #include <sys/malloc.h>
72 #include <sys/protosw.h>
73 #include <sys/socket.h>
74 #include <sys/socketvar.h>
75 #include <sys/sysctl.h>
76 #include <sys/errno.h>
78 #include <sys/systm.h>
79 #include <sys/syslog.h>
81 #include <sys/kauth.h>
84 #include <net/route.h>
85 #include <net/if_types.h>
87 #include <netinet/in.h>
88 #include <netinet/in_systm.h>
89 #include <netinet/ip.h>
90 #include <netinet/in_pcb.h>
91 #include <netinet/in_var.h>
92 #include <netinet/ip_var.h>
93 #include <netinet/udp.h>
94 #include <netinet/udp_var.h>
95 #include <netinet/ip6.h>
96 #include <netinet6/ip6_var.h>
97 #include <netinet6/in6_pcb.h>
98 #include <netinet/icmp6.h>
99 #include <netinet6/udp6_var.h>
100 #include <netinet6/ip6protosw.h>
103 #include <netinet6/ipsec.h>
104 #include <netinet6/ipsec6.h>
105 extern int ipsec_bypass
;
107 extern lck_mtx_t
*nd6_mutex
;
110 * UDP protocol inplementation.
111 * Per RFC 768, August, 1980.
114 extern struct protosw inetsw
[];
115 static int in6_mcmatch(struct inpcb
*, struct in6_addr
*, struct ifnet
*);
116 static int udp6_detach(struct socket
*so
);
117 static void udp6_append(struct inpcb
*, struct ip6_hdr
*,
118 struct sockaddr_in6
*, struct mbuf
*, int);
120 extern void ipfwsyslog( int level
, const char *format
,...);
121 extern int fw_verbose
;
124 #define log_in_vain_log( a ) { \
125 if ( (log_in_vain == 3 ) && (fw_verbose == 2)) { /* Apple logging, log to ipfw.log */ \
131 #define log_in_vain_log( a ) { log a; }
137 register struct in6_addr
*ia6
,
140 struct ip6_moptions
*im6o
= in6p
->in6p_moptions
;
141 struct in6_multi_mship
*imm
;
146 lck_mtx_lock(nd6_mutex
);
147 for (imm
= im6o
->im6o_memberships
.lh_first
; imm
!= NULL
;
148 imm
= imm
->i6mm_chain
.le_next
) {
150 imm
->i6mm_maddr
->in6m_ifp
== ifp
) &&
151 IN6_ARE_ADDR_EQUAL(&imm
->i6mm_maddr
->in6m_addr
,
153 lck_mtx_unlock(nd6_mutex
);
157 lck_mtx_unlock(nd6_mutex
);
162 * subroutine of udp6_input(), mainly for source code readability.
165 udp6_append(struct inpcb
*last
, struct ip6_hdr
*ip6
,
166 struct sockaddr_in6
*udp_in6
, struct mbuf
*n
, int off
)
168 struct mbuf
*opts
= NULL
;
171 if (mac_inpcb_check_deliver(last
, n
, AF_INET6
, SOCK_DGRAM
) != 0) {
176 if (last
->in6p_flags
& IN6P_CONTROLOPTS
||
177 last
->in6p_socket
->so_options
& SO_TIMESTAMP
)
178 ip6_savecontrol(last
, &opts
, ip6
, n
);
181 if (sbappendaddr(&last
->in6p_socket
->so_rcv
,
182 (struct sockaddr
*)udp_in6
, n
, opts
, NULL
) == 0)
183 udpstat
.udps_fullsock
++;
185 sorwakeup(last
->in6p_socket
);
193 struct mbuf
*m
= *mp
;
194 register struct ip6_hdr
*ip6
;
195 register struct udphdr
*uh
;
196 register struct inpcb
*in6p
;
197 struct mbuf
*opts
= NULL
;
200 struct sockaddr_in6 udp_in6
;
201 struct inpcbinfo
*pcbinfo
= &udbinfo
;
203 IP6_EXTHDR_CHECK(m
, off
, sizeof(struct udphdr
), return IPPROTO_DONE
);
205 ip6
= mtod(m
, struct ip6_hdr
*);
207 #if defined(NFAITH) && 0 < NFAITH
208 if (faithprefix(&ip6
->ip6_dst
)) {
209 /* XXX send icmp6 host/port unreach? */
215 udpstat
.udps_ipackets
++;
217 plen
= ntohs(ip6
->ip6_plen
) - off
+ sizeof(*ip6
);
218 uh
= (struct udphdr
*)((caddr_t
)ip6
+ off
);
219 ulen
= ntohs((u_short
)uh
->uh_ulen
);
222 udpstat
.udps_badlen
++;
227 * Checksum extended UDP header and data.
231 udpstat
.udps_nosum
++;
233 else if (in6_cksum(m
, IPPROTO_UDP
, off
, ulen
) != 0) {
234 udpstat
.udps_badsum
++;
238 if (IN6_IS_ADDR_MULTICAST(&ip6
->ip6_dst
)) {
239 int reuse_sock
= 0, mcast_delivered
= 0;
240 struct mbuf
*n
= NULL
;
243 * Deliver a multicast datagram to all sockets
244 * for which the local and remote addresses and ports match
245 * those of the incoming datagram. This allows more than
246 * one process to receive multicasts on the same port.
247 * (This really ought to be done for unicast datagrams as
248 * well, but that would cause problems with existing
249 * applications that open both address-specific sockets and
250 * a wildcard socket listening to the same port -- they would
251 * end up receiving duplicates of every unicast datagram.
252 * Those applications open the multiple sockets to overcome an
253 * inadequacy of the UDP socket interface, but for backwards
254 * compatibility we avoid the problem here rather than
255 * fixing the interface. Maybe 4.5BSD will remedy this?)
259 * In a case that laddr should be set to the link-local
260 * address (this happens in RIPng), the multicast address
261 * specified in the received packet does not match with
262 * laddr. To cure this situation, the matching is relaxed
263 * if the receiving interface is the same as one specified
264 * in the socket and if the destination multicast address
265 * matches one of the multicast groups specified in the socket.
269 * Construct sockaddr format source address.
271 init_sin6(&udp_in6
, m
); /* general init */
272 udp_in6
.sin6_port
= uh
->uh_sport
;
274 * KAME note: usually we drop udphdr from mbuf here.
275 * We need udphdr for IPsec processing so we do that later.
279 * Locate pcb(s) for datagram.
280 * (Algorithm copied from raw_intr().)
282 lck_rw_lock_shared(pcbinfo
->mtx
);
284 LIST_FOREACH(in6p
, &udb
, inp_list
) {
286 if ((in6p
->inp_vflag
& INP_IPV6
) == 0)
289 if (in_pcb_checkstate(in6p
, WNT_ACQUIRE
, 0) == WNT_STOPUSING
)
292 udp_lock(in6p
->in6p_socket
, 1, 0);
294 if (in_pcb_checkstate(in6p
, WNT_RELEASE
, 1) == WNT_STOPUSING
) {
295 udp_unlock(in6p
->in6p_socket
, 1, 0);
298 if (in6p
->in6p_lport
!= uh
->uh_dport
) {
299 udp_unlock(in6p
->in6p_socket
, 1, 0);
302 if (!IN6_IS_ADDR_UNSPECIFIED(&in6p
->in6p_laddr
)) {
303 if (!IN6_ARE_ADDR_EQUAL(&in6p
->in6p_laddr
,
305 !in6_mcmatch(in6p
, &ip6
->ip6_dst
,
306 m
->m_pkthdr
.rcvif
)) {
307 udp_unlock(in6p
->in6p_socket
, 1, 0);
311 if (!IN6_IS_ADDR_UNSPECIFIED(&in6p
->in6p_faddr
)) {
312 if (!IN6_ARE_ADDR_EQUAL(&in6p
->in6p_faddr
,
314 in6p
->in6p_fport
!= uh
->uh_sport
) {
315 udp_unlock(in6p
->in6p_socket
, 1, 0);
320 reuse_sock
= in6p
->inp_socket
->so_options
&
321 (SO_REUSEPORT
| SO_REUSEADDR
);
326 /* Check AH/ESP integrity. */
327 if (ipsec_bypass
== 0) {
328 if (ipsec6_in_reject_so(m
, in6p
->inp_socket
)) {
329 IPSEC_STAT_INCREMENT(ipsec6stat
.in_polvio
);
330 /* do not inject data to pcb */
339 * m_copy(m, offset, ...) below.
340 * sbappendaddr() expects M_PKTHDR,
341 * and m_copy() will copy M_PKTHDR
342 * only if offset is 0.
345 n
= m_copy(m
, 0, M_COPYALL
);
346 udp6_append(in6p
, ip6
, &udp_in6
, m
,
347 off
+ sizeof (struct udphdr
));
350 udp_unlock(in6p
->in6p_socket
, 1, 0);
353 * Don't look for additional matches if this one does
354 * not have either the SO_REUSEPORT or SO_REUSEADDR
355 * socket options set. This heuristic avoids searching
356 * through all pcbs in the common case of a non-shared
357 * port. It assumes that an application will never
358 * clear these options after setting them.
360 if (reuse_sock
== 0 || ((m
= n
) == NULL
))
363 * Recompute IP and UDP header pointers for new mbuf
365 ip6
= mtod(m
, struct ip6_hdr
*);
366 uh
= (struct udphdr
*)((caddr_t
)ip6
+ off
);
368 lck_rw_done(pcbinfo
->mtx
);
370 if (mcast_delivered
== 0) {
372 * No matching pcb found; discard datagram.
373 * (No need to send an ICMP Port Unreachable
374 * for a broadcast or multicast datgram.)
376 udpstat
.udps_noport
++;
378 udpstat
.udps_noportmcast
++;
383 if (reuse_sock
!= 0) /* free the extra copy of mbuf */
388 * Locate pcb for datagram.
390 in6p
= in6_pcblookup_hash(&udbinfo
, &ip6
->ip6_src
, uh
->uh_sport
,
391 &ip6
->ip6_dst
, uh
->uh_dport
, 1,
395 char buf
[INET6_ADDRSTRLEN
];
397 strlcpy(buf
, ip6_sprintf(&ip6
->ip6_dst
), sizeof(buf
));
398 if (log_in_vain
!= 3)
400 "Connection attempt to UDP %s:%d from %s:%d\n",
401 buf
, ntohs(uh
->uh_dport
),
402 ip6_sprintf(&ip6
->ip6_src
), ntohs(uh
->uh_sport
));
403 else if (!(m
->m_flags
& (M_BCAST
| M_MCAST
)) &&
404 !IN6_ARE_ADDR_EQUAL(&ip6
->ip6_dst
, &ip6
->ip6_src
))
405 log_in_vain_log((LOG_INFO
,
406 "Connection attempt to UDP %s:%d from %s:%d\n",
407 buf
, ntohs(uh
->uh_dport
),
408 ip6_sprintf(&ip6
->ip6_src
), ntohs(uh
->uh_sport
)));
410 udpstat
.udps_noport
++;
411 if (m
->m_flags
& M_MCAST
) {
412 printf("UDP6: M_MCAST is set in a unicast packet.\n");
414 udpstat
.udps_noportmcast
++;
418 icmp6_error(m
, ICMP6_DST_UNREACH
, ICMP6_DST_UNREACH_NOPORT
, 0);
423 * Check AH/ESP integrity.
425 if (ipsec_bypass
== 0) {
426 if (ipsec6_in_reject_so(m
, in6p
->in6p_socket
)) {
427 IPSEC_STAT_INCREMENT(ipsec6stat
.in_polvio
);
428 in_pcb_checkstate(in6p
, WNT_RELEASE
, 0);
435 * Construct sockaddr format source address.
436 * Stuff source address and datagram in user buffer.
438 udp_lock(in6p
->in6p_socket
, 1, 0);
440 if (in_pcb_checkstate(in6p
, WNT_RELEASE
, 1) == WNT_STOPUSING
) {
441 udp_unlock(in6p
->in6p_socket
, 1, 0);
445 init_sin6(&udp_in6
, m
); /* general init */
446 udp_in6
.sin6_port
= uh
->uh_sport
;
447 if (in6p
->in6p_flags
& IN6P_CONTROLOPTS
448 || in6p
->in6p_socket
->so_options
& SO_TIMESTAMP
)
449 ip6_savecontrol(in6p
, &opts
, ip6
, m
);
450 m_adj(m
, off
+ sizeof(struct udphdr
));
451 if (sbappendaddr(&in6p
->in6p_socket
->so_rcv
,
452 (struct sockaddr
*)&udp_in6
,
453 m
, opts
, NULL
) == 0) {
456 udpstat
.udps_fullsock
++;
457 udp_unlock(in6p
->in6p_socket
, 1, 0);
460 sorwakeup(in6p
->in6p_socket
);
461 udp_unlock(in6p
->in6p_socket
, 1, 0);
481 struct ip6ctlparam
*ip6cp
= NULL
;
482 const struct sockaddr_in6
*sa6_src
= NULL
;
483 void (*notify
)(struct inpcb
*, int) = udp_notify
;
484 struct udp_portonly
{
489 if (sa
->sa_family
!= AF_INET6
||
490 sa
->sa_len
!= sizeof(struct sockaddr_in6
))
493 if ((unsigned)cmd
>= PRC_NCMDS
)
495 if (PRC_IS_REDIRECT(cmd
))
496 notify
= in6_rtchange
, d
= NULL
;
497 else if (cmd
== PRC_HOSTDEAD
)
499 else if (inet6ctlerrmap
[cmd
] == 0)
502 /* if the parameter is from icmp6, decode it. */
504 ip6cp
= (struct ip6ctlparam
*)d
;
506 ip6
= ip6cp
->ip6c_ip6
;
507 off
= ip6cp
->ip6c_off
;
508 sa6_src
= ip6cp
->ip6c_src
;
517 * XXX: We assume that when IPV6 is non NULL,
518 * M and OFF are valid.
521 /* check if we can safely examine src and dst ports */
522 if (m
->m_pkthdr
.len
< off
+ sizeof(*uhp
))
525 bzero(&uh
, sizeof(uh
));
526 m_copydata(m
, off
, sizeof(*uhp
), (caddr_t
)&uh
);
528 (void) in6_pcbnotify(&udbinfo
, sa
, uh
.uh_dport
,
529 (struct sockaddr
*)ip6cp
->ip6c_src
,
530 uh
.uh_sport
, cmd
, notify
);
532 (void) in6_pcbnotify(&udbinfo
, sa
, 0, (struct sockaddr
*)&sa6_src
,
538 udp6_getcred SYSCTL_HANDLER_ARGS
540 struct sockaddr_in6 addrs
[2];
544 error
= proc_suser(req
->p
);
548 if (req
->newlen
!= sizeof(addrs
))
550 if (req
->oldlen
!= sizeof(*(kauth_cred_t
)0))
552 error
= SYSCTL_IN(req
, addrs
, sizeof(addrs
));
556 inp
= in6_pcblookup_hash(&udbinfo
, &addrs
[1].sin6_addr
,
558 &addrs
[0].sin6_addr
, addrs
[0].sin6_port
,
560 if (!inp
|| !inp
->inp_socket
|| !inp
->inp_socket
->so_cred
) {
564 error
= SYSCTL_OUT(req
, inp
->inp_socket
->so_cred
->pc_ucred
,
565 sizeof(*(kauth_cred_t
)0));
572 SYSCTL_PROC(_net_inet6_udp6
, OID_AUTO
, getcred
, CTLTYPE_OPAQUE
|CTLFLAG_RW
,
574 udp6_getcred
, "S,ucred", "Get the ucred of a UDP6 connection");
578 udp6_abort(struct socket
*so
)
584 return EINVAL
; /* ??? possible? panic instead? */
585 soisdisconnected(so
);
591 udp6_attach(struct socket
*so
, __unused
int proto
, struct proc
*p
)
600 error
= in_pcballoc(so
, &udbinfo
, p
);
604 if (so
->so_snd
.sb_hiwat
== 0 || so
->so_rcv
.sb_hiwat
== 0) {
605 error
= soreserve(so
, udp_sendspace
, udp_recvspace
);
609 inp
= (struct inpcb
*)so
->so_pcb
;
610 inp
->inp_vflag
|= INP_IPV6
;
611 if (ip6_mapped_addr_on
)
612 inp
->inp_vflag
|= INP_IPV4
;
613 inp
->in6p_hops
= -1; /* use kernel default */
614 inp
->in6p_cksum
= -1; /* just to be sure */
617 * IPv4 TTL initialization is necessary for an IPv6 socket as well,
618 * because the socket may be bound to an IPv6 wildcard address,
619 * which may match an IPv4-mapped IPv6 address.
621 inp
->inp_ip_ttl
= ip_defttl
;
626 udp6_bind(struct socket
*so
, struct sockaddr
*nam
, struct proc
*p
)
635 inp
->inp_vflag
&= ~INP_IPV4
;
636 inp
->inp_vflag
|= INP_IPV6
;
637 if ((inp
->inp_flags
& IN6P_IPV6_V6ONLY
) == 0) {
638 struct sockaddr_in6
*sin6_p
;
640 sin6_p
= (struct sockaddr_in6
*)nam
;
642 if (IN6_IS_ADDR_UNSPECIFIED(&sin6_p
->sin6_addr
))
643 inp
->inp_vflag
|= INP_IPV4
;
644 else if (IN6_IS_ADDR_V4MAPPED(&sin6_p
->sin6_addr
)) {
645 struct sockaddr_in sin
;
647 in6_sin6_2_sin(&sin
, sin6_p
);
648 inp
->inp_vflag
|= INP_IPV4
;
649 inp
->inp_vflag
&= ~INP_IPV6
;
650 error
= in_pcbbind(inp
, (struct sockaddr
*)&sin
, p
);
655 error
= in6_pcbbind(inp
, nam
, p
);
660 udp6_connect(struct socket
*so
, struct sockaddr
*nam
, struct proc
*p
)
669 if ((inp
->inp_flags
& IN6P_IPV6_V6ONLY
) == 0) {
670 struct sockaddr_in6
*sin6_p
;
672 sin6_p
= (struct sockaddr_in6
*)nam
;
673 if (IN6_IS_ADDR_V4MAPPED(&sin6_p
->sin6_addr
)) {
674 struct sockaddr_in sin
;
676 if (inp
->inp_faddr
.s_addr
!= INADDR_ANY
)
678 in6_sin6_2_sin(&sin
, sin6_p
);
679 error
= in_pcbconnect(inp
, (struct sockaddr
*)&sin
, p
);
681 inp
->inp_vflag
|= INP_IPV4
;
682 inp
->inp_vflag
&= ~INP_IPV6
;
689 if (!IN6_IS_ADDR_UNSPECIFIED(&inp
->in6p_faddr
))
691 error
= in6_pcbconnect(inp
, nam
, p
);
693 if (ip6_mapped_addr_on
|| (inp
->inp_flags
& IN6P_IPV6_V6ONLY
) == 0) { /* should be non mapped addr */
694 inp
->inp_vflag
&= ~INP_IPV4
;
695 inp
->inp_vflag
|= INP_IPV6
;
703 udp6_detach(struct socket
*so
)
715 udp6_disconnect(struct socket
*so
)
723 if (inp
->inp_vflag
& INP_IPV4
) {
724 struct pr_usrreqs
*pru
;
726 pru
= ip_protox
[IPPROTO_UDP
]->pr_usrreqs
;
727 return ((*pru
->pru_disconnect
)(so
));
730 if (IN6_IS_ADDR_UNSPECIFIED(&inp
->in6p_faddr
))
733 in6_pcbdisconnect(inp
);
734 inp
->in6p_laddr
= in6addr_any
;
735 so
->so_state
&= ~SS_ISCONNECTED
; /* XXX */
740 udp6_send(struct socket
*so
, int flags
, struct mbuf
*m
, struct sockaddr
*addr
,
741 struct mbuf
*control
, struct proc
*p
)
753 if (addr
->sa_len
!= sizeof(struct sockaddr_in6
)) {
757 if (addr
->sa_family
!= AF_INET6
) {
758 error
= EAFNOSUPPORT
;
763 if (ip6_mapped_addr_on
|| (inp
->inp_flags
& IN6P_IPV6_V6ONLY
) == 0) {
765 struct sockaddr_in6
*sin6
= 0;
768 hasv4addr
= (inp
->inp_vflag
& INP_IPV4
);
770 sin6
= (struct sockaddr_in6
*)addr
;
771 hasv4addr
= IN6_IS_ADDR_V4MAPPED(&sin6
->sin6_addr
)
775 struct pr_usrreqs
*pru
;
778 in6_sin6_2_sin_in_sock(addr
);
779 pru
= ip_protox
[IPPROTO_UDP
]->pr_usrreqs
;
780 error
= ((*pru
->pru_send
)(so
, flags
, m
, addr
, control
,
782 /* addr will just be freed in sendit(). */
787 return udp6_output(inp
, m
, addr
, control
, p
);
794 struct pr_usrreqs udp6_usrreqs
= {
795 udp6_abort
, pru_accept_notsupp
, udp6_attach
, udp6_bind
, udp6_connect
,
796 pru_connect2_notsupp
, in6_control
, udp6_detach
, udp6_disconnect
,
797 pru_listen_notsupp
, in6_mapped_peeraddr
, pru_rcvd_notsupp
,
798 pru_rcvoob_notsupp
, udp6_send
, pru_sense_null
, udp_shutdown
,
799 in6_mapped_sockaddr
, sosend
, soreceive
, pru_sopoll_notsupp