Annotation of src/sys/netinet/udp_usrreq.c, Revision 1.120
1.120 ! matt 1: /* $NetBSD: udp_usrreq.c,v 1.119 2004/04/18 23:35:56 matt Exp $ */
1.48 itojun 2:
3: /*
4: * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
5: * All rights reserved.
1.94 itojun 6: *
1.48 itojun 7: * Redistribution and use in source and binary forms, with or without
8: * modification, are permitted provided that the following conditions
9: * are met:
10: * 1. Redistributions of source code must retain the above copyright
11: * notice, this list of conditions and the following disclaimer.
12: * 2. Redistributions in binary form must reproduce the above copyright
13: * notice, this list of conditions and the following disclaimer in the
14: * documentation and/or other materials provided with the distribution.
15: * 3. Neither the name of the project nor the names of its contributors
16: * may be used to endorse or promote products derived from this software
17: * without specific prior written permission.
1.94 itojun 18: *
1.48 itojun 19: * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
20: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22: * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
23: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29: * SUCH DAMAGE.
30: */
1.14 cgd 31:
1.1 cgd 32: /*
1.44 thorpej 33: * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995
1.13 mycroft 34: * The Regents of the University of California. All rights reserved.
1.1 cgd 35: *
36: * Redistribution and use in source and binary forms, with or without
37: * modification, are permitted provided that the following conditions
38: * are met:
39: * 1. Redistributions of source code must retain the above copyright
40: * notice, this list of conditions and the following disclaimer.
41: * 2. Redistributions in binary form must reproduce the above copyright
42: * notice, this list of conditions and the following disclaimer in the
43: * documentation and/or other materials provided with the distribution.
1.104 agc 44: * 3. Neither the name of the University nor the names of its contributors
1.1 cgd 45: * may be used to endorse or promote products derived from this software
46: * without specific prior written permission.
47: *
48: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58: * SUCH DAMAGE.
59: *
1.44 thorpej 60: * @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95
1.1 cgd 61: */
1.91 lukem 62:
63: #include <sys/cdefs.h>
1.120 ! matt 64: __KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.119 2004/04/18 23:35:56 matt Exp $");
1.50 thorpej 65:
1.77 soda 66: #include "opt_inet.h"
1.50 thorpej 67: #include "opt_ipsec.h"
1.78 thorpej 68: #include "opt_inet_csum.h"
1.64 ws 69: #include "opt_ipkdb.h"
1.101 martin 70: #include "opt_mbuftrace.h"
1.1 cgd 71:
1.5 mycroft 72: #include <sys/param.h>
73: #include <sys/malloc.h>
74: #include <sys/mbuf.h>
75: #include <sys/protosw.h>
76: #include <sys/socket.h>
77: #include <sys/socketvar.h>
1.13 mycroft 78: #include <sys/errno.h>
1.5 mycroft 79: #include <sys/stat.h>
1.27 christos 80: #include <sys/systm.h>
81: #include <sys/proc.h>
1.53 itojun 82: #include <sys/domain.h>
1.27 christos 83: #include <sys/sysctl.h>
1.1 cgd 84:
1.5 mycroft 85: #include <net/if.h>
86: #include <net/route.h>
1.1 cgd 87:
1.5 mycroft 88: #include <netinet/in.h>
89: #include <netinet/in_systm.h>
1.15 cgd 90: #include <netinet/in_var.h>
1.5 mycroft 91: #include <netinet/ip.h>
92: #include <netinet/in_pcb.h>
93: #include <netinet/ip_var.h>
94: #include <netinet/ip_icmp.h>
95: #include <netinet/udp.h>
96: #include <netinet/udp_var.h>
1.1 cgd 97:
1.53 itojun 98: #ifdef INET6
99: #include <netinet/ip6.h>
100: #include <netinet/icmp6.h>
101: #include <netinet6/ip6_var.h>
102: #include <netinet6/in6_pcb.h>
103: #include <netinet6/udp6_var.h>
104: #endif
105:
106: #ifndef INET6
107: /* always need ip6.h for IP6_EXTHDR_GET */
108: #include <netinet/ip6.h>
109: #endif
110:
1.76 itojun 111: #include "faith.h"
112: #if defined(NFAITH) && NFAITH > 0
113: #include <net/if_faith.h>
114: #endif
115:
1.27 christos 116: #include <machine/stdarg.h>
117:
1.105 jonathan 118: #ifdef FAST_IPSEC
119: #include <netipsec/ipsec.h>
120: #ifdef INET6
121: #include <netipsec/ipsec6.h>
122: #endif
123: #endif /* FAST_IPSEC*/
124:
1.48 itojun 125: #ifdef IPSEC
126: #include <netinet6/ipsec.h>
127: #include <netkey/key.h>
128: #endif /*IPSEC*/
129:
1.64 ws 130: #ifdef IPKDB
131: #include <ipkdb/ipkdb.h>
132: #endif
133:
1.8 mycroft 134: /*
135: * UDP protocol implementation.
136: * Per RFC 768, August, 1980.
137: */
138: #ifndef COMPAT_42
139: int udpcksum = 1;
140: #else
141: int udpcksum = 0; /* XXX */
142: #endif
1.93 matt 143:
144: struct inpcbtable udbtable;
145: struct udpstat udpstat;
1.8 mycroft 146:
1.72 itojun 147: #ifdef INET
1.119 matt 148: static void udp4_sendup (struct mbuf *, int, struct sockaddr *,
149: struct socket *);
150: static int udp4_realinput (struct sockaddr_in *, struct sockaddr_in *,
151: struct mbuf *, int);
1.72 itojun 152: #endif
1.53 itojun 153: #ifdef INET6
1.119 matt 154: static void udp6_sendup (struct mbuf *, int, struct sockaddr *,
155: struct socket *);
156: static int udp6_realinput (int, struct sockaddr_in6 *,
157: struct sockaddr_in6 *, struct mbuf *, int);
1.53 itojun 158: #endif
1.72 itojun 159: #ifdef INET
1.119 matt 160: static void udp_notify (struct inpcb *, int);
1.72 itojun 161: #endif
1.7 mycroft 162:
1.26 mycroft 163: #ifndef UDBHASHSIZE
164: #define UDBHASHSIZE 128
165: #endif
166: int udbhashsize = UDBHASHSIZE;
167:
1.98 matt 168: #ifdef MBUFTRACE
169: struct mowner udp_mowner = { "udp" };
170: struct mowner udp_rx_mowner = { "udp", "rx" };
171: struct mowner udp_tx_mowner = { "udp", "tx" };
172: #endif
173:
1.78 thorpej 174: #ifdef UDP_CSUM_COUNTERS
175: #include <sys/device.h>
176:
177: struct evcnt udp_hwcsum_bad = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
178: NULL, "udp", "hwcsum bad");
179: struct evcnt udp_hwcsum_ok = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
180: NULL, "udp", "hwcsum ok");
181: struct evcnt udp_hwcsum_data = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
182: NULL, "udp", "hwcsum data");
183: struct evcnt udp_swcsum = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
184: NULL, "udp", "swcsum");
185:
186: #define UDP_CSUM_COUNTER_INCR(ev) (ev)->ev_count++
187:
1.120 ! matt 188: EVCNT_ATTACH_STATIC(udp_hwcsum_bad);
! 189: EVCNT_ATTACH_STATIC(udp_hwcsum_ok);
! 190: EVCNT_ATTACH_STATIC(udp_hwcsum_data);
! 191: EVCNT_ATTACH_STATIC(udp_swcsum);
! 192:
1.78 thorpej 193: #else
194:
195: #define UDP_CSUM_COUNTER_INCR(ev) /* nothing */
196:
197: #endif /* UDP_CSUM_COUNTERS */
198:
1.7 mycroft 199: void
1.119 matt 200: udp_init(void)
1.1 cgd 201: {
1.18 mycroft 202:
1.35 mycroft 203: in_pcbinit(&udbtable, udbhashsize, udbhashsize);
1.78 thorpej 204:
1.98 matt 205: MOWNER_ATTACH(&udp_tx_mowner);
206: MOWNER_ATTACH(&udp_rx_mowner);
207: MOWNER_ATTACH(&udp_mowner);
1.1 cgd 208: }
209:
1.72 itojun 210: #ifdef INET
1.7 mycroft 211: void
1.27 christos 212: udp_input(struct mbuf *m, ...)
1.1 cgd 213: {
1.53 itojun 214: va_list ap;
215: struct sockaddr_in src, dst;
216: struct ip *ip;
217: struct udphdr *uh;
1.97 simonb 218: int iphlen;
1.53 itojun 219: int len;
220: int n;
1.96 itojun 221: u_int16_t ip_len;
1.53 itojun 222:
223: va_start(ap, m);
224: iphlen = va_arg(ap, int);
1.97 simonb 225: (void)va_arg(ap, int); /* ignore value, advance ap */
1.53 itojun 226: va_end(ap);
227:
1.98 matt 228: MCLAIM(m, &udp_rx_mowner);
1.53 itojun 229: udpstat.udps_ipackets++;
230:
231: /*
232: * Get IP and UDP header together in first mbuf.
233: */
234: ip = mtod(m, struct ip *);
235: IP6_EXTHDR_GET(uh, struct udphdr *, m, iphlen, sizeof(struct udphdr));
236: if (uh == NULL) {
237: udpstat.udps_hdrops++;
238: return;
239: }
1.95 thorpej 240: KASSERT(UDP_HDR_ALIGNED_P(uh));
1.53 itojun 241:
1.57 itojun 242: /* destination port of 0 is illegal, based on RFC768. */
243: if (uh->uh_dport == 0)
244: goto bad;
245:
1.53 itojun 246: /*
247: * Make mbuf data length reflect UDP length.
248: * If not enough data to reflect UDP length, drop.
249: */
1.96 itojun 250: ip_len = ntohs(ip->ip_len);
1.53 itojun 251: len = ntohs((u_int16_t)uh->uh_ulen);
1.96 itojun 252: if (ip_len != iphlen + len) {
253: if (ip_len < iphlen + len || len < sizeof(struct udphdr)) {
1.53 itojun 254: udpstat.udps_badlen++;
255: goto bad;
256: }
1.96 itojun 257: m_adj(m, iphlen + len - ip_len);
1.53 itojun 258: }
259:
260: /*
261: * Checksum extended UDP header and data.
262: */
263: if (uh->uh_sum) {
1.78 thorpej 264: switch (m->m_pkthdr.csum_flags &
1.112 enami 265: ((m->m_pkthdr.rcvif->if_csum_flags_rx & M_CSUM_UDPv4) |
266: M_CSUM_TCP_UDP_BAD | M_CSUM_DATA)) {
1.78 thorpej 267: case M_CSUM_UDPv4|M_CSUM_TCP_UDP_BAD:
268: UDP_CSUM_COUNTER_INCR(&udp_hwcsum_bad);
269: goto badcsum;
270:
1.106 jonathan 271: case M_CSUM_UDPv4|M_CSUM_DATA: {
272: u_int32_t hw_csum = m->m_pkthdr.csum_data;
1.78 thorpej 273: UDP_CSUM_COUNTER_INCR(&udp_hwcsum_data);
1.106 jonathan 274: if (m->m_pkthdr.csum_flags & M_CSUM_NO_PSEUDOHDR)
1.112 enami 275: hw_csum = in_cksum_phdr(ip->ip_src.s_addr,
276: ip->ip_dst.s_addr,
1.115 drochner 277: htons(hw_csum + len + IPPROTO_UDP));
1.106 jonathan 278: if ((hw_csum ^ 0xffff) != 0)
1.78 thorpej 279: goto badcsum;
280: break;
1.106 jonathan 281: }
1.78 thorpej 282:
283: case M_CSUM_UDPv4:
284: /* Checksum was okay. */
285: UDP_CSUM_COUNTER_INCR(&udp_hwcsum_ok);
286: break;
287:
288: default:
289: /* Need to compute it ourselves. */
290: UDP_CSUM_COUNTER_INCR(&udp_swcsum);
291: if (in4_cksum(m, IPPROTO_UDP, iphlen, len) != 0)
292: goto badcsum;
293: break;
1.53 itojun 294: }
295: }
296:
297: /* construct source and dst sockaddrs. */
298: bzero(&src, sizeof(src));
299: src.sin_family = AF_INET;
300: src.sin_len = sizeof(struct sockaddr_in);
301: bcopy(&ip->ip_src, &src.sin_addr, sizeof(src.sin_addr));
302: src.sin_port = uh->uh_sport;
303: bzero(&dst, sizeof(dst));
304: dst.sin_family = AF_INET;
305: dst.sin_len = sizeof(struct sockaddr_in);
306: bcopy(&ip->ip_dst, &dst.sin_addr, sizeof(dst.sin_addr));
307: dst.sin_port = uh->uh_dport;
308:
309: n = udp4_realinput(&src, &dst, m, iphlen);
310: #ifdef INET6
311: if (IN_MULTICAST(ip->ip_dst.s_addr) || n == 0) {
312: struct sockaddr_in6 src6, dst6;
313:
314: bzero(&src6, sizeof(src6));
315: src6.sin6_family = AF_INET6;
316: src6.sin6_len = sizeof(struct sockaddr_in6);
317: src6.sin6_addr.s6_addr[10] = src6.sin6_addr.s6_addr[11] = 0xff;
318: bcopy(&ip->ip_src, &src6.sin6_addr.s6_addr[12],
319: sizeof(ip->ip_src));
320: src6.sin6_port = uh->uh_sport;
321: bzero(&dst6, sizeof(dst6));
322: dst6.sin6_family = AF_INET6;
323: dst6.sin6_len = sizeof(struct sockaddr_in6);
324: dst6.sin6_addr.s6_addr[10] = dst6.sin6_addr.s6_addr[11] = 0xff;
325: bcopy(&ip->ip_dst, &dst6.sin6_addr.s6_addr[12],
326: sizeof(ip->ip_dst));
327: dst6.sin6_port = uh->uh_dport;
328:
329: n += udp6_realinput(AF_INET, &src6, &dst6, m, iphlen);
330: }
331: #endif
332:
333: if (n == 0) {
334: if (m->m_flags & (M_BCAST | M_MCAST)) {
335: udpstat.udps_noportbcast++;
336: goto bad;
337: }
1.61 itojun 338: udpstat.udps_noport++;
1.64 ws 339: #ifdef IPKDB
1.53 itojun 340: if (checkipkdb(&ip->ip_src, uh->uh_sport, uh->uh_dport,
341: m, iphlen + sizeof(struct udphdr),
342: m->m_pkthdr.len - iphlen - sizeof(struct udphdr))) {
343: /*
344: * It was a debugger connect packet,
345: * just drop it now
346: */
347: goto bad;
348: }
349: #endif
350: icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PORT, 0, 0);
351: m = NULL;
352: }
353:
354: bad:
355: if (m)
356: m_freem(m);
1.78 thorpej 357: return;
358:
359: badcsum:
360: m_freem(m);
361: udpstat.udps_badsum++;
1.53 itojun 362: }
1.72 itojun 363: #endif
1.53 itojun 364:
365: #ifdef INET6
366: int
1.119 matt 367: udp6_input(struct mbuf **mp, int *offp, int proto)
1.53 itojun 368: {
369: struct mbuf *m = *mp;
370: int off = *offp;
371: struct sockaddr_in6 src, dst;
372: struct ip6_hdr *ip6;
373: struct udphdr *uh;
374: u_int32_t plen, ulen;
375:
1.76 itojun 376: ip6 = mtod(m, struct ip6_hdr *);
377:
1.53 itojun 378: #if defined(NFAITH) && 0 < NFAITH
1.76 itojun 379: if (faithprefix(&ip6->ip6_dst)) {
380: /* send icmp6 host unreach? */
381: m_freem(m);
382: return IPPROTO_DONE;
1.53 itojun 383: }
384: #endif
385:
386: udp6stat.udp6s_ipackets++;
387:
388: /* check for jumbogram is done in ip6_input. we can trust pkthdr.len */
389: plen = m->m_pkthdr.len - off;
390: IP6_EXTHDR_GET(uh, struct udphdr *, m, off, sizeof(struct udphdr));
391: if (uh == NULL) {
392: ip6stat.ip6s_tooshort++;
393: return IPPROTO_DONE;
394: }
1.95 thorpej 395: KASSERT(UDP_HDR_ALIGNED_P(uh));
1.53 itojun 396: ulen = ntohs((u_short)uh->uh_ulen);
1.69 itojun 397: /*
398: * RFC2675 section 4: jumbograms will have 0 in the UDP header field,
399: * iff payload length > 0xffff.
400: */
1.53 itojun 401: if (ulen == 0 && plen > 0xffff)
402: ulen = plen;
403:
404: if (plen != ulen) {
405: udp6stat.udp6s_badlen++;
1.54 itojun 406: goto bad;
407: }
408:
1.57 itojun 409: /* destination port of 0 is illegal, based on RFC768. */
410: if (uh->uh_dport == 0)
411: goto bad;
412:
1.54 itojun 413: /* Be proactive about malicious use of IPv4 mapped address */
414: if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) ||
415: IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) {
416: /* XXX stat */
1.53 itojun 417: goto bad;
418: }
419:
420: /*
421: * Checksum extended UDP header and data.
422: */
1.117 itojun 423: if (uh->uh_sum == 0) {
1.53 itojun 424: udp6stat.udp6s_nosum++;
1.117 itojun 425: goto bad;
1.118 itojun 426: }
427: if (in6_cksum(m, IPPROTO_UDP, off, ulen) != 0) {
1.53 itojun 428: udp6stat.udp6s_badsum++;
429: goto bad;
430: }
431:
432: /*
433: * Construct source and dst sockaddrs.
434: * Note that ifindex (s6_addr16[1]) is already filled.
435: */
436: bzero(&src, sizeof(src));
437: src.sin6_family = AF_INET6;
438: src.sin6_len = sizeof(struct sockaddr_in6);
1.69 itojun 439: /* KAME hack: recover scopeid */
440: (void)in6_recoverscope(&src, &ip6->ip6_src, m->m_pkthdr.rcvif);
1.53 itojun 441: src.sin6_port = uh->uh_sport;
442: bzero(&dst, sizeof(dst));
443: dst.sin6_family = AF_INET6;
444: dst.sin6_len = sizeof(struct sockaddr_in6);
1.69 itojun 445: /* KAME hack: recover scopeid */
446: (void)in6_recoverscope(&dst, &ip6->ip6_dst, m->m_pkthdr.rcvif);
1.53 itojun 447: dst.sin6_port = uh->uh_dport;
448:
449: if (udp6_realinput(AF_INET6, &src, &dst, m, off) == 0) {
450: if (m->m_flags & M_MCAST) {
451: udp6stat.udp6s_noportmcast++;
452: goto bad;
453: }
1.61 itojun 454: udp6stat.udp6s_noport++;
1.53 itojun 455: icmp6_error(m, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_NOPORT, 0);
456: m = NULL;
457: }
458:
459: bad:
460: if (m)
461: m_freem(m);
462: return IPPROTO_DONE;
463: }
464: #endif
465:
1.72 itojun 466: #ifdef INET
1.53 itojun 467: static void
1.119 matt 468: udp4_sendup(struct mbuf *m, int off /* offset of data portion */,
469: struct sockaddr *src, struct socket *so)
1.53 itojun 470: {
471: struct mbuf *opts = NULL;
472: struct mbuf *n;
473: struct inpcb *inp = NULL;
474:
475: if (!so)
476: return;
477: switch (so->so_proto->pr_domain->dom_family) {
478: case AF_INET:
479: inp = sotoinpcb(so);
480: break;
481: #ifdef INET6
482: case AF_INET6:
483: break;
484: #endif
485: default:
486: return;
487: }
488:
1.105 jonathan 489: #if defined(IPSEC) || defined(FAST_IPSEC)
1.53 itojun 490: /* check AH/ESP integrity. */
491: if (so != NULL && ipsec4_in_reject_so(m, so)) {
492: ipsecstat.in_polvio++;
1.110 itojun 493: if ((n = m_copy(m, 0, M_COPYALL)) != NULL)
494: icmp_error(n, ICMP_UNREACH, ICMP_UNREACH_ADMIN_PROHIBIT,
495: 0, 0);
1.53 itojun 496: return;
497: }
498: #endif /*IPSEC*/
499:
500: if ((n = m_copy(m, 0, M_COPYALL)) != NULL) {
501: if (inp && (inp->inp_flags & INP_CONTROLOPTS
502: || so->so_options & SO_TIMESTAMP)) {
503: struct ip *ip = mtod(n, struct ip *);
504: ip_savecontrol(inp, &opts, ip, n);
505: }
506:
507: m_adj(n, off);
508: if (sbappendaddr(&so->so_rcv, src, n,
509: opts) == 0) {
510: m_freem(n);
511: if (opts)
512: m_freem(opts);
1.81 enami 513: udpstat.udps_fullsock++;
1.53 itojun 514: } else
515: sorwakeup(so);
516: }
517: }
1.72 itojun 518: #endif
1.53 itojun 519:
520: #ifdef INET6
521: static void
1.119 matt 522: udp6_sendup(struct mbuf *m, int off /* offset of data portion */,
523: struct sockaddr *src, struct socket *so)
1.53 itojun 524: {
525: struct mbuf *opts = NULL;
526: struct mbuf *n;
527: struct in6pcb *in6p = NULL;
528:
529: if (!so)
530: return;
531: if (so->so_proto->pr_domain->dom_family != AF_INET6)
532: return;
533: in6p = sotoin6pcb(so);
534:
1.105 jonathan 535: #if defined(IPSEC) || defined(FAST_IPSEC)
1.53 itojun 536: /* check AH/ESP integrity. */
537: if (so != NULL && ipsec6_in_reject_so(m, so)) {
538: ipsec6stat.in_polvio++;
1.111 mycroft 539: if ((n = m_copy(m, 0, M_COPYALL)) != NULL)
1.110 itojun 540: icmp6_error(n, ICMP6_DST_UNREACH,
541: ICMP6_DST_UNREACH_ADMIN, 0);
1.53 itojun 542: return;
543: }
544: #endif /*IPSEC*/
545:
546: if ((n = m_copy(m, 0, M_COPYALL)) != NULL) {
547: if (in6p && (in6p->in6p_flags & IN6P_CONTROLOPTS
548: || in6p->in6p_socket->so_options & SO_TIMESTAMP)) {
549: struct ip6_hdr *ip6 = mtod(n, struct ip6_hdr *);
550: ip6_savecontrol(in6p, &opts, ip6, n);
551: }
552:
553: m_adj(n, off);
554: if (sbappendaddr(&so->so_rcv, src, n, opts) == 0) {
555: m_freem(n);
556: if (opts)
557: m_freem(opts);
558: udp6stat.udp6s_fullsock++;
559: } else
560: sorwakeup(so);
561: }
562: }
563: #endif
564:
1.72 itojun 565: #ifdef INET
1.53 itojun 566: static int
1.119 matt 567: udp4_realinput(struct sockaddr_in *src, struct sockaddr_in *dst,
568: struct mbuf *m, int off /* offset of udphdr */)
1.53 itojun 569: {
570: u_int16_t *sport, *dport;
571: int rcvcnt;
572: struct in_addr *src4, *dst4;
1.109 itojun 573: struct inpcb_hdr *inph;
1.53 itojun 574: struct inpcb *inp;
575:
576: rcvcnt = 0;
577: off += sizeof(struct udphdr); /* now, offset of payload */
578:
579: if (src->sin_family != AF_INET || dst->sin_family != AF_INET)
580: goto bad;
581:
582: src4 = &src->sin_addr;
583: sport = &src->sin_port;
584: dst4 = &dst->sin_addr;
585: dport = &dst->sin_port;
586:
1.73 itojun 587: if (IN_MULTICAST(dst4->s_addr) ||
1.53 itojun 588: in_broadcast(*dst4, m->m_pkthdr.rcvif)) {
589: /*
590: * Deliver a multicast or broadcast datagram to *all* sockets
591: * for which the local and remote addresses and ports match
592: * those of the incoming datagram. This allows more than
593: * one process to receive multi/broadcasts on the same port.
594: * (This really ought to be done for unicast datagrams as
595: * well, but that would cause problems with existing
596: * applications that open both address-specific sockets and
597: * a wildcard socket listening to the same port -- they would
598: * end up receiving duplicates of every unicast datagram.
599: * Those applications open the multiple sockets to overcome an
600: * inadequacy of the UDP socket interface, but for backwards
601: * compatibility we avoid the problem here rather than
602: * fixing the interface. Maybe 4.5BSD will remedy this?)
603: */
604:
605: /*
1.92 itojun 606: * KAME note: traditionally we dropped udpiphdr from mbuf here.
1.71 itojun 607: * we need udpiphdr for IPsec processing so we do that later.
1.53 itojun 608: */
609: /*
610: * Locate pcb(s) for datagram.
611: */
1.109 itojun 612: CIRCLEQ_FOREACH(inph, &udbtable.inpt_queue, inph_queue) {
613: inp = (struct inpcb *)inph;
614: if (inp->inp_af != AF_INET)
615: continue;
616:
1.53 itojun 617: if (inp->inp_lport != *dport)
618: continue;
619: if (!in_nullhost(inp->inp_laddr)) {
620: if (!in_hosteq(inp->inp_laddr, *dst4))
621: continue;
622: }
623: if (!in_nullhost(inp->inp_faddr)) {
624: if (!in_hosteq(inp->inp_faddr, *src4) ||
625: inp->inp_fport != *sport)
626: continue;
627: }
628:
629: udp4_sendup(m, off, (struct sockaddr *)src,
630: inp->inp_socket);
631: rcvcnt++;
632:
633: /*
634: * Don't look for additional matches if this one does
635: * not have either the SO_REUSEPORT or SO_REUSEADDR
636: * socket options set. This heuristic avoids searching
637: * through all pcbs in the common case of a non-shared
638: * port. It assumes that an application will never
639: * clear these options after setting them.
640: */
641: if ((inp->inp_socket->so_options &
642: (SO_REUSEPORT|SO_REUSEADDR)) == 0)
643: break;
644: }
645: } else {
646: /*
647: * Locate pcb for datagram.
648: */
649: inp = in_pcblookup_connect(&udbtable, *src4, *sport, *dst4, *dport);
650: if (inp == 0) {
651: ++udpstat.udps_pcbhashmiss;
652: inp = in_pcblookup_bind(&udbtable, *dst4, *dport);
1.82 itojun 653: if (inp == 0)
1.53 itojun 654: return rcvcnt;
655: }
656:
657: udp4_sendup(m, off, (struct sockaddr *)src, inp->inp_socket);
658: rcvcnt++;
659: }
660:
661: bad:
662: return rcvcnt;
663: }
1.72 itojun 664: #endif
1.53 itojun 665:
666: #ifdef INET6
667: static int
1.119 matt 668: udp6_realinput(int af, struct sockaddr_in6 *src, struct sockaddr_in6 *dst,
669: struct mbuf *m, int off)
1.53 itojun 670: {
1.79 itojun 671: u_int16_t sport, dport;
1.53 itojun 672: int rcvcnt;
1.79 itojun 673: struct in6_addr src6, dst6;
674: const struct in_addr *dst4;
1.109 itojun 675: struct inpcb_hdr *inph;
1.53 itojun 676: struct in6pcb *in6p;
677:
678: rcvcnt = 0;
679: off += sizeof(struct udphdr); /* now, offset of payload */
680:
681: if (af != AF_INET && af != AF_INET6)
682: goto bad;
683: if (src->sin6_family != AF_INET6 || dst->sin6_family != AF_INET6)
684: goto bad;
685:
1.79 itojun 686: in6_embedscope(&src6, src, NULL, NULL);
687: sport = src->sin6_port;
688: in6_embedscope(&dst6, dst, NULL, NULL);
689: dport = dst->sin6_port;
1.88 itojun 690: dst4 = (struct in_addr *)&dst->sin6_addr.s6_addr[12];
1.53 itojun 691:
1.79 itojun 692: if (IN6_IS_ADDR_MULTICAST(&dst6) ||
693: (af == AF_INET && IN_MULTICAST(dst4->s_addr))) {
1.53 itojun 694: /*
695: * Deliver a multicast or broadcast datagram to *all* sockets
696: * for which the local and remote addresses and ports match
697: * those of the incoming datagram. This allows more than
698: * one process to receive multi/broadcasts on the same port.
699: * (This really ought to be done for unicast datagrams as
700: * well, but that would cause problems with existing
701: * applications that open both address-specific sockets and
702: * a wildcard socket listening to the same port -- they would
703: * end up receiving duplicates of every unicast datagram.
704: * Those applications open the multiple sockets to overcome an
705: * inadequacy of the UDP socket interface, but for backwards
706: * compatibility we avoid the problem here rather than
707: * fixing the interface. Maybe 4.5BSD will remedy this?)
708: */
709:
710: /*
1.92 itojun 711: * KAME note: traditionally we dropped udpiphdr from mbuf here.
1.71 itojun 712: * we need udpiphdr for IPsec processing so we do that later.
1.53 itojun 713: */
714: /*
715: * Locate pcb(s) for datagram.
716: */
1.109 itojun 717: CIRCLEQ_FOREACH(inph, &udbtable.inpt_queue, inph_queue) {
718: in6p = (struct in6pcb *)inph;
719: if (in6p->in6p_af != AF_INET6)
720: continue;
721:
1.79 itojun 722: if (in6p->in6p_lport != dport)
1.53 itojun 723: continue;
724: if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr)) {
1.90 itojun 725: if (!IN6_ARE_ADDR_EQUAL(&in6p->in6p_laddr, &dst6))
1.53 itojun 726: continue;
1.92 itojun 727: } else {
1.79 itojun 728: if (IN6_IS_ADDR_V4MAPPED(&dst6) &&
1.85 itojun 729: (in6p->in6p_flags & IN6P_IPV6_V6ONLY))
1.55 itojun 730: continue;
731: }
1.53 itojun 732: if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr)) {
1.79 itojun 733: if (!IN6_ARE_ADDR_EQUAL(&in6p->in6p_faddr,
734: &src6) || in6p->in6p_fport != sport)
1.53 itojun 735: continue;
1.92 itojun 736: } else {
1.79 itojun 737: if (IN6_IS_ADDR_V4MAPPED(&src6) &&
1.85 itojun 738: (in6p->in6p_flags & IN6P_IPV6_V6ONLY))
1.55 itojun 739: continue;
740: }
1.53 itojun 741:
742: udp6_sendup(m, off, (struct sockaddr *)src,
743: in6p->in6p_socket);
744: rcvcnt++;
745:
746: /*
747: * Don't look for additional matches if this one does
748: * not have either the SO_REUSEPORT or SO_REUSEADDR
749: * socket options set. This heuristic avoids searching
750: * through all pcbs in the common case of a non-shared
751: * port. It assumes that an application will never
752: * clear these options after setting them.
753: */
754: if ((in6p->in6p_socket->so_options &
755: (SO_REUSEPORT|SO_REUSEADDR)) == 0)
756: break;
757: }
758: } else {
759: /*
760: * Locate pcb for datagram.
761: */
1.109 itojun 762: in6p = in6_pcblookup_connect(&udbtable, &src6, sport,
1.79 itojun 763: &dst6, dport, 0);
1.53 itojun 764: if (in6p == 0) {
765: ++udpstat.udps_pcbhashmiss;
1.109 itojun 766: in6p = in6_pcblookup_bind(&udbtable, &dst6, dport, 0);
1.82 itojun 767: if (in6p == 0)
1.53 itojun 768: return rcvcnt;
769: }
770:
771: udp6_sendup(m, off, (struct sockaddr *)src, in6p->in6p_socket);
772: rcvcnt++;
773: }
774:
775: bad:
776: return rcvcnt;
777: }
778: #endif
1.1 cgd 779:
1.72 itojun 780: #ifdef INET
1.1 cgd 781: /*
782: * Notify a udp user of an asynchronous error;
783: * just wake up so that he can collect error status.
784: */
1.7 mycroft 785: static void
1.119 matt 786: udp_notify(struct inpcb *inp, int errno)
1.1 cgd 787: {
788: inp->inp_socket->so_error = errno;
789: sorwakeup(inp->inp_socket);
790: sowwakeup(inp->inp_socket);
791: }
792:
1.27 christos 793: void *
1.119 matt 794: udp_ctlinput(int cmd, struct sockaddr *sa, void *v)
1.1 cgd 795: {
1.66 augustss 796: struct ip *ip = v;
797: struct udphdr *uh;
1.119 matt 798: void (*notify)(struct inpcb *, int) = udp_notify;
1.21 mycroft 799: int errno;
1.1 cgd 800:
1.53 itojun 801: if (sa->sa_family != AF_INET
802: || sa->sa_len != sizeof(struct sockaddr_in))
1.51 itojun 803: return NULL;
1.20 mycroft 804: if ((unsigned)cmd >= PRC_NCMDS)
1.27 christos 805: return NULL;
1.20 mycroft 806: errno = inetctlerrmap[cmd];
1.18 mycroft 807: if (PRC_IS_REDIRECT(cmd))
1.19 mycroft 808: notify = in_rtchange, ip = 0;
1.18 mycroft 809: else if (cmd == PRC_HOSTDEAD)
1.19 mycroft 810: ip = 0;
1.23 cgd 811: else if (errno == 0)
1.27 christos 812: return NULL;
1.19 mycroft 813: if (ip) {
1.1 cgd 814: uh = (struct udphdr *)((caddr_t)ip + (ip->ip_hl << 2));
1.34 mycroft 815: in_pcbnotify(&udbtable, satosin(sa)->sin_addr, uh->uh_dport,
816: ip->ip_src, uh->uh_sport, errno, notify);
1.53 itojun 817:
818: /* XXX mapped address case */
1.19 mycroft 819: } else
1.34 mycroft 820: in_pcbnotifyall(&udbtable, satosin(sa)->sin_addr, errno,
821: notify);
1.27 christos 822: return NULL;
1.1 cgd 823: }
824:
1.7 mycroft 825: int
1.27 christos 826: udp_output(struct mbuf *m, ...)
827: {
1.66 augustss 828: struct inpcb *inp;
829: struct udpiphdr *ui;
830: int len = m->m_pkthdr.len;
1.31 mycroft 831: int error = 0;
1.27 christos 832: va_list ap;
833:
1.98 matt 834: MCLAIM(m, &udp_tx_mowner);
1.27 christos 835: va_start(ap, m);
836: inp = va_arg(ap, struct inpcb *);
837: va_end(ap);
1.1 cgd 838:
839: /*
840: * Calculate data length and get a mbuf
841: * for UDP and IP headers.
842: */
1.13 mycroft 843: M_PREPEND(m, sizeof(struct udpiphdr), M_DONTWAIT);
844: if (m == 0) {
845: error = ENOBUFS;
1.39 thorpej 846: goto release;
847: }
848:
849: /*
850: * Compute the packet length of the IP header, and
851: * punt if the length looks bogus.
852: */
1.96 itojun 853: if (len + sizeof(struct udpiphdr) > IP_MAXPACKET) {
1.39 thorpej 854: error = EMSGSIZE;
1.13 mycroft 855: goto release;
856: }
1.1 cgd 857:
858: /*
859: * Fill in mbuf with extended UDP header
860: * and addresses and length put into network format.
861: */
862: ui = mtod(m, struct udpiphdr *);
863: ui->ui_pr = IPPROTO_UDP;
864: ui->ui_src = inp->inp_laddr;
865: ui->ui_dst = inp->inp_faddr;
866: ui->ui_sport = inp->inp_lport;
867: ui->ui_dport = inp->inp_fport;
1.78 thorpej 868: ui->ui_ulen = htons((u_int16_t)len + sizeof(struct udphdr));
1.1 cgd 869:
870: /*
1.78 thorpej 871: * Set up checksum and output datagram.
1.1 cgd 872: */
873: if (udpcksum) {
1.78 thorpej 874: /*
875: * XXX Cache pseudo-header checksum part for
876: * XXX "connected" UDP sockets.
877: */
878: ui->ui_sum = in_cksum_phdr(ui->ui_src.s_addr,
879: ui->ui_dst.s_addr, htons((u_int16_t)len +
880: sizeof(struct udphdr) + IPPROTO_UDP));
881: m->m_pkthdr.csum_flags = M_CSUM_UDPv4;
882: m->m_pkthdr.csum_data = offsetof(struct udphdr, uh_sum);
883: } else
884: ui->ui_sum = 0;
1.96 itojun 885: ((struct ip *)ui)->ip_len = htons(sizeof (struct udpiphdr) + len);
1.1 cgd 886: ((struct ip *)ui)->ip_ttl = inp->inp_ip.ip_ttl; /* XXX */
887: ((struct ip *)ui)->ip_tos = inp->inp_ip.ip_tos; /* XXX */
888: udpstat.udps_opackets++;
1.48 itojun 889:
1.31 mycroft 890: return (ip_output(m, inp->inp_options, &inp->inp_route,
1.12 mycroft 891: inp->inp_socket->so_options & (SO_DONTROUTE | SO_BROADCAST),
1.107 itojun 892: inp->inp_moptions, inp->inp_socket));
1.1 cgd 893:
894: release:
895: m_freem(m);
896: return (error);
897: }
898:
1.42 thorpej 899: int udp_sendspace = 9216; /* really max datagram size */
900: int udp_recvspace = 40 * (1024 + sizeof(struct sockaddr_in));
1.1 cgd 901: /* 40 1K datagrams */
902:
903: /*ARGSUSED*/
1.7 mycroft 904: int
1.119 matt 905: udp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
906: struct mbuf *control, struct proc *p)
1.1 cgd 907: {
1.66 augustss 908: struct inpcb *inp;
1.1 cgd 909: int s;
1.66 augustss 910: int error = 0;
1.1 cgd 911:
912: if (req == PRU_CONTROL)
1.31 mycroft 913: return (in_control(so, (long)m, (caddr_t)nam,
1.30 mycroft 914: (struct ifnet *)control, p));
1.59 thorpej 915:
1.60 thorpej 916: if (req == PRU_PURGEIF) {
1.80 itojun 917: in_pcbpurgeif0(&udbtable, (struct ifnet *)control);
1.60 thorpej 918: in_purgeif((struct ifnet *)control);
919: in_pcbpurgeif(&udbtable, (struct ifnet *)control);
1.59 thorpej 920: return (0);
921: }
1.31 mycroft 922:
923: s = splsoftnet();
924: inp = sotoinpcb(so);
1.32 mycroft 925: #ifdef DIAGNOSTIC
926: if (req != PRU_SEND && req != PRU_SENDOOB && control)
927: panic("udp_usrreq: unexpected control mbuf");
928: #endif
1.31 mycroft 929: if (inp == 0 && req != PRU_ATTACH) {
930: error = EINVAL;
931: goto release;
932: }
933:
1.1 cgd 934: /*
935: * Note: need to block udp_input while changing
936: * the udp pcb queue and/or pcb addresses.
937: */
938: switch (req) {
939:
940: case PRU_ATTACH:
1.31 mycroft 941: if (inp != 0) {
942: error = EISCONN;
1.1 cgd 943: break;
944: }
1.98 matt 945: #ifdef MBUFTRACE
946: so->so_mowner = &udp_mowner;
947: so->so_rcv.sb_mowner = &udp_rx_mowner;
948: so->so_snd.sb_mowner = &udp_tx_mowner;
949: #endif
1.31 mycroft 950: if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) {
951: error = soreserve(so, udp_sendspace, udp_recvspace);
952: if (error)
953: break;
954: }
1.18 mycroft 955: error = in_pcballoc(so, &udbtable);
1.1 cgd 956: if (error)
957: break;
1.31 mycroft 958: inp = sotoinpcb(so);
959: inp->inp_ip.ip_ttl = ip_defttl;
1.1 cgd 960: break;
961:
962: case PRU_DETACH:
1.31 mycroft 963: in_pcbdetach(inp);
1.1 cgd 964: break;
965:
966: case PRU_BIND:
1.31 mycroft 967: error = in_pcbbind(inp, nam, p);
1.1 cgd 968: break;
969:
970: case PRU_LISTEN:
971: error = EOPNOTSUPP;
972: break;
973:
974: case PRU_CONNECT:
1.31 mycroft 975: error = in_pcbconnect(inp, nam);
976: if (error)
1.1 cgd 977: break;
1.31 mycroft 978: soisconnected(so);
1.1 cgd 979: break;
980:
981: case PRU_CONNECT2:
982: error = EOPNOTSUPP;
983: break;
984:
985: case PRU_DISCONNECT:
1.31 mycroft 986: /*soisdisconnected(so);*/
987: so->so_state &= ~SS_ISCONNECTED; /* XXX */
1.1 cgd 988: in_pcbdisconnect(inp);
1.34 mycroft 989: inp->inp_laddr = zeroin_addr; /* XXX */
1.35 mycroft 990: in_pcbstate(inp, INP_BOUND); /* XXX */
1.1 cgd 991: break;
992:
993: case PRU_SHUTDOWN:
994: socantsendmore(so);
995: break;
996:
1.31 mycroft 997: case PRU_RCVD:
998: error = EOPNOTSUPP;
1.1 cgd 999: break;
1000:
1.31 mycroft 1001: case PRU_SEND:
1.32 mycroft 1002: if (control && control->m_len) {
1003: m_freem(control);
1004: m_freem(m);
1005: error = EINVAL;
1006: break;
1007: }
1.31 mycroft 1008: {
1.35 mycroft 1009: struct in_addr laddr; /* XXX */
1.1 cgd 1010:
1.31 mycroft 1011: if (nam) {
1.35 mycroft 1012: laddr = inp->inp_laddr; /* XXX */
1.31 mycroft 1013: if ((so->so_state & SS_ISCONNECTED) != 0) {
1014: error = EISCONN;
1.32 mycroft 1015: goto die;
1.31 mycroft 1016: }
1017: error = in_pcbconnect(inp, nam);
1.100 matt 1018: if (error)
1019: goto die;
1.31 mycroft 1020: } else {
1021: if ((so->so_state & SS_ISCONNECTED) == 0) {
1022: error = ENOTCONN;
1.32 mycroft 1023: goto die;
1.31 mycroft 1024: }
1025: }
1.33 mycroft 1026: error = udp_output(m, inp);
1.100 matt 1027: m = NULL;
1.31 mycroft 1028: if (nam) {
1029: in_pcbdisconnect(inp);
1.35 mycroft 1030: inp->inp_laddr = laddr; /* XXX */
1031: in_pcbstate(inp, INP_BOUND); /* XXX */
1.31 mycroft 1032: }
1.100 matt 1033: die:
1034: if (m)
1035: m_freem(m);
1.31 mycroft 1036: }
1.1 cgd 1037: break;
1038:
1039: case PRU_SENSE:
1040: /*
1041: * stat: don't bother with a blocksize.
1042: */
1.31 mycroft 1043: splx(s);
1.1 cgd 1044: return (0);
1045:
1.31 mycroft 1046: case PRU_RCVOOB:
1047: error = EOPNOTSUPP;
1048: break;
1049:
1.1 cgd 1050: case PRU_SENDOOB:
1.32 mycroft 1051: m_freem(control);
1.31 mycroft 1052: m_freem(m);
1.1 cgd 1053: error = EOPNOTSUPP;
1054: break;
1055:
1.31 mycroft 1056: case PRU_SOCKADDR:
1057: in_setsockaddr(inp, nam);
1058: break;
1059:
1060: case PRU_PEERADDR:
1061: in_setpeeraddr(inp, nam);
1062: break;
1.1 cgd 1063:
1064: default:
1065: panic("udp_usrreq");
1066: }
1067:
1068: release:
1.31 mycroft 1069: splx(s);
1.1 cgd 1070: return (error);
1.13 mycroft 1071: }
1072:
1073: /*
1074: * Sysctl for udp variables.
1075: */
1.114 atatat 1076: SYSCTL_SETUP(sysctl_net_inet_udp_setup, "sysctl net.inet.udp subtree setup")
1.13 mycroft 1077: {
1.114 atatat 1078:
1.116 atatat 1079: sysctl_createv(clog, 0, NULL, NULL,
1080: CTLFLAG_PERMANENT,
1.114 atatat 1081: CTLTYPE_NODE, "net", NULL,
1082: NULL, 0, NULL, 0,
1083: CTL_NET, CTL_EOL);
1.116 atatat 1084: sysctl_createv(clog, 0, NULL, NULL,
1085: CTLFLAG_PERMANENT,
1.114 atatat 1086: CTLTYPE_NODE, "inet", NULL,
1087: NULL, 0, NULL, 0,
1088: CTL_NET, PF_INET, CTL_EOL);
1.116 atatat 1089: sysctl_createv(clog, 0, NULL, NULL,
1090: CTLFLAG_PERMANENT,
1.114 atatat 1091: CTLTYPE_NODE, "udp", NULL,
1092: NULL, 0, NULL, 0,
1093: CTL_NET, PF_INET, IPPROTO_UDP, CTL_EOL);
1094:
1.116 atatat 1095: sysctl_createv(clog, 0, NULL, NULL,
1096: CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
1.114 atatat 1097: CTLTYPE_INT, "checksum", NULL,
1098: NULL, 0, &udpcksum, 0,
1099: CTL_NET, PF_INET, IPPROTO_UDP, UDPCTL_CHECKSUM,
1100: CTL_EOL);
1.116 atatat 1101: sysctl_createv(clog, 0, NULL, NULL,
1102: CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
1.114 atatat 1103: CTLTYPE_INT, "sendspace", NULL,
1104: NULL, 0, &udp_sendspace, 0,
1105: CTL_NET, PF_INET, IPPROTO_UDP, UDPCTL_SENDSPACE,
1106: CTL_EOL);
1.116 atatat 1107: sysctl_createv(clog, 0, NULL, NULL,
1108: CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
1.114 atatat 1109: CTLTYPE_INT, "recvspace", NULL,
1110: NULL, 0, &udp_recvspace, 0,
1111: CTL_NET, PF_INET, IPPROTO_UDP, UDPCTL_RECVSPACE,
1112: CTL_EOL);
1.1 cgd 1113: }
1.72 itojun 1114: #endif
CVSweb <webmaster@jp.NetBSD.org>