version 1.103.2.1, 2003/07/02 15:27:01 |
version 1.108, 2003/08/22 22:00:38 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* 3. Neither the name of the University nor the names of its contributors |
* must display the following acknowledgement: |
|
* This product includes software developed by the University of |
|
* California, Berkeley and its contributors. |
|
* 4. Neither the name of the University nor the names of its contributors |
|
* may be used to endorse or promote products derived from this software |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* without specific prior written permission. |
* |
* |
Line 119 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 115 __KERNEL_RCSID(0, "$NetBSD$"); |
|
|
|
#include <machine/stdarg.h> |
#include <machine/stdarg.h> |
|
|
|
#ifdef FAST_IPSEC |
|
#include <netipsec/ipsec.h> |
|
#ifdef INET6 |
|
#include <netipsec/ipsec6.h> |
|
#endif |
|
#endif /* FAST_IPSEC*/ |
|
|
#ifdef IPSEC |
#ifdef IPSEC |
#include <netinet6/ipsec.h> |
#include <netinet6/ipsec.h> |
#include <netkey/key.h> |
#include <netkey/key.h> |
Line 275 udp_input(m, va_alist) |
|
Line 278 udp_input(m, va_alist) |
|
UDP_CSUM_COUNTER_INCR(&udp_hwcsum_bad); |
UDP_CSUM_COUNTER_INCR(&udp_hwcsum_bad); |
goto badcsum; |
goto badcsum; |
|
|
case M_CSUM_UDPv4|M_CSUM_DATA: |
case M_CSUM_UDPv4|M_CSUM_DATA: { |
|
u_int32_t hw_csum = m->m_pkthdr.csum_data; |
UDP_CSUM_COUNTER_INCR(&udp_hwcsum_data); |
UDP_CSUM_COUNTER_INCR(&udp_hwcsum_data); |
if ((m->m_pkthdr.csum_data ^ 0xffff) != 0) |
if (m->m_pkthdr.csum_flags & M_CSUM_NO_PSEUDOHDR) |
|
hw_csum = in_cksum_phdr(ip->ip_src.s_addr, ip->ip_dst.s_addr, |
|
htonl(hw_csum + ntohs(ip->ip_len) + IPPROTO_UDP)); |
|
if ((hw_csum ^ 0xffff) != 0) |
goto badcsum; |
goto badcsum; |
break; |
break; |
|
} |
|
|
case M_CSUM_UDPv4: |
case M_CSUM_UDPv4: |
/* Checksum was okay. */ |
/* Checksum was okay. */ |
Line 490 udp4_sendup(m, off, src, so) |
|
Line 498 udp4_sendup(m, off, src, so) |
|
return; |
return; |
} |
} |
|
|
#ifdef IPSEC |
#if defined(IPSEC) || defined(FAST_IPSEC) |
/* check AH/ESP integrity. */ |
/* check AH/ESP integrity. */ |
if (so != NULL && ipsec4_in_reject_so(m, so)) { |
if (so != NULL && ipsec4_in_reject_so(m, so)) { |
ipsecstat.in_polvio++; |
ipsecstat.in_polvio++; |
Line 536 udp6_sendup(m, off, src, so) |
|
Line 544 udp6_sendup(m, off, src, so) |
|
return; |
return; |
in6p = sotoin6pcb(so); |
in6p = sotoin6pcb(so); |
|
|
#ifdef IPSEC |
#if defined(IPSEC) || defined(FAST_IPSEC) |
/* check AH/ESP integrity. */ |
/* check AH/ESP integrity. */ |
if (so != NULL && ipsec6_in_reject_so(m, so)) { |
if (so != NULL && ipsec6_in_reject_so(m, so)) { |
ipsec6stat.in_polvio++; |
ipsec6stat.in_polvio++; |
Line 898 udp_output(m, va_alist) |
|
Line 906 udp_output(m, va_alist) |
|
((struct ip *)ui)->ip_tos = inp->inp_ip.ip_tos; /* XXX */ |
((struct ip *)ui)->ip_tos = inp->inp_ip.ip_tos; /* XXX */ |
udpstat.udps_opackets++; |
udpstat.udps_opackets++; |
|
|
#ifdef IPSEC |
|
if (ipsec_setsocket(m, inp->inp_socket) != 0) { |
|
error = ENOBUFS; |
|
goto release; |
|
} |
|
#endif /*IPSEC*/ |
|
|
|
return (ip_output(m, inp->inp_options, &inp->inp_route, |
return (ip_output(m, inp->inp_options, &inp->inp_route, |
inp->inp_socket->so_options & (SO_DONTROUTE | SO_BROADCAST), |
inp->inp_socket->so_options & (SO_DONTROUTE | SO_BROADCAST), |
inp->inp_moptions)); |
inp->inp_moptions, inp->inp_socket)); |
|
|
release: |
release: |
m_freem(m); |
m_freem(m); |
Line 920 int udp_recvspace = 40 * (1024 + sizeof( |
|
Line 921 int udp_recvspace = 40 * (1024 + sizeof( |
|
|
|
/*ARGSUSED*/ |
/*ARGSUSED*/ |
int |
int |
udp_usrreq(so, req, m, nam, control, l) |
udp_usrreq(so, req, m, nam, control, p) |
struct socket *so; |
struct socket *so; |
int req; |
int req; |
struct mbuf *m, *nam, *control; |
struct mbuf *m, *nam, *control; |
struct lwp *l; |
struct proc *p; |
{ |
{ |
struct inpcb *inp; |
struct inpcb *inp; |
struct proc *p; |
|
int s; |
int s; |
int error = 0; |
int error = 0; |
|
|
p = l ? l->l_proc : NULL; |
|
if (req == PRU_CONTROL) |
if (req == PRU_CONTROL) |
return (in_control(so, (long)m, (caddr_t)nam, |
return (in_control(so, (long)m, (caddr_t)nam, |
(struct ifnet *)control, p)); |
(struct ifnet *)control, p)); |