| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: udp_usrreq.c,v 1.222 2015/08/24 22:21:26 pooka Exp $ */ | | 1 | /* $NetBSD: udp_usrreq.c,v 1.223 2016/01/20 22:01:18 riastradh Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | | 4 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -56,27 +56,27 @@ | | | @@ -56,27 +56,27 @@ |
56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 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 | | 57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
58 | * SUCH DAMAGE. | | 58 | * SUCH DAMAGE. |
59 | * | | 59 | * |
60 | * @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95 | | 60 | * @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95 |
61 | */ | | 61 | */ |
62 | | | 62 | |
63 | /* | | 63 | /* |
64 | * UDP protocol implementation. | | 64 | * UDP protocol implementation. |
65 | * Per RFC 768, August, 1980. | | 65 | * Per RFC 768, August, 1980. |
66 | */ | | 66 | */ |
67 | | | 67 | |
68 | #include <sys/cdefs.h> | | 68 | #include <sys/cdefs.h> |
69 | __KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.222 2015/08/24 22:21:26 pooka Exp $"); | | 69 | __KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.223 2016/01/20 22:01:18 riastradh Exp $"); |
70 | | | 70 | |
71 | #ifdef _KERNEL_OPT | | 71 | #ifdef _KERNEL_OPT |
72 | #include "opt_inet.h" | | 72 | #include "opt_inet.h" |
73 | #include "opt_compat_netbsd.h" | | 73 | #include "opt_compat_netbsd.h" |
74 | #include "opt_ipsec.h" | | 74 | #include "opt_ipsec.h" |
75 | #include "opt_inet_csum.h" | | 75 | #include "opt_inet_csum.h" |
76 | #include "opt_ipkdb.h" | | 76 | #include "opt_ipkdb.h" |
77 | #include "opt_mbuftrace.h" | | 77 | #include "opt_mbuftrace.h" |
78 | #endif | | 78 | #endif |
79 | | | 79 | |
80 | #include <sys/param.h> | | 80 | #include <sys/param.h> |
81 | #include <sys/mbuf.h> | | 81 | #include <sys/mbuf.h> |
82 | #include <sys/once.h> | | 82 | #include <sys/once.h> |
| @@ -765,39 +765,34 @@ udp_ctloutput(int op, struct socket *so, | | | @@ -765,39 +765,34 @@ udp_ctloutput(int op, struct socket *so, |
765 | | | 765 | |
766 | default: | | 766 | default: |
767 | error = EINVAL; | | 767 | error = EINVAL; |
768 | break; | | 768 | break; |
769 | } | | 769 | } |
770 | | | 770 | |
771 | end: | | 771 | end: |
772 | splx(s); | | 772 | splx(s); |
773 | return error; | | 773 | return error; |
774 | } | | 774 | } |
775 | | | 775 | |
776 | | | 776 | |
777 | int | | 777 | int |
778 | udp_output(struct mbuf *m, ...) | | 778 | udp_output(struct mbuf *m, struct inpcb *inp) |
779 | { | | 779 | { |
780 | struct inpcb *inp; | | | |
781 | struct udpiphdr *ui; | | 780 | struct udpiphdr *ui; |
782 | struct route *ro; | | 781 | struct route *ro; |
783 | int len = m->m_pkthdr.len; | | 782 | int len = m->m_pkthdr.len; |
784 | int error = 0; | | 783 | int error = 0; |
785 | va_list ap; | | | |
786 | | | 784 | |
787 | MCLAIM(m, &udp_tx_mowner); | | 785 | MCLAIM(m, &udp_tx_mowner); |
788 | va_start(ap, m); | | | |
789 | inp = va_arg(ap, struct inpcb *); | | | |
790 | va_end(ap); | | | |
791 | | | 786 | |
792 | /* | | 787 | /* |
793 | * Calculate data length and get a mbuf | | 788 | * Calculate data length and get a mbuf |
794 | * for UDP and IP headers. | | 789 | * for UDP and IP headers. |
795 | */ | | 790 | */ |
796 | M_PREPEND(m, sizeof(struct udpiphdr), M_DONTWAIT); | | 791 | M_PREPEND(m, sizeof(struct udpiphdr), M_DONTWAIT); |
797 | if (m == 0) { | | 792 | if (m == 0) { |
798 | error = ENOBUFS; | | 793 | error = ENOBUFS; |
799 | goto release; | | 794 | goto release; |
800 | } | | 795 | } |
801 | | | 796 | |
802 | /* | | 797 | /* |
803 | * Compute the packet length of the IP header, and | | 798 | * Compute the packet length of the IP header, and |