| version 1.168, 2008/04/15 04:43:25 |
version 1.168.2.1, 2008/05/18 12:35:30 |
| Line 121 __KERNEL_RCSID(0, "$NetBSD$"); |
|
| Line 121 __KERNEL_RCSID(0, "$NetBSD$"); |
|
| |
|
| #ifdef FAST_IPSEC |
#ifdef FAST_IPSEC |
| #include <netipsec/ipsec.h> |
#include <netipsec/ipsec.h> |
| #include <netipsec/ipsec_var.h> /* XXX ipsecstat namespace */ |
#include <netipsec/ipsec_var.h> |
| |
#include <netipsec/ipsec_private.h> |
| #include <netipsec/esp.h> |
#include <netipsec/esp.h> |
| #ifdef INET6 |
#ifdef INET6 |
| #include <netipsec/ipsec6.h> |
#include <netipsec/ipsec6.h> |
| #endif |
#endif |
| #endif /* FAST_IPSEC*/ |
#endif /* FAST_IPSEC */ |
| |
|
| #ifdef IPSEC |
#ifdef IPSEC |
| #include <netinet6/ipsec.h> |
#include <netinet6/ipsec.h> |
| |
#include <netinet6/ipsec_private.h> |
| #include <netinet6/esp.h> |
#include <netinet6/esp.h> |
| #include <netkey/key.h> |
#include <netkey/key.h> |
| #endif /*IPSEC*/ |
#endif /* IPSEC */ |
| |
|
| #ifdef IPKDB |
#ifdef IPKDB |
| #include <ipkdb/ipkdb.h> |
#include <ipkdb/ipkdb.h> |
|
|
| MOWNER_ATTACH(&udp_rx_mowner); |
MOWNER_ATTACH(&udp_rx_mowner); |
| MOWNER_ATTACH(&udp_mowner); |
MOWNER_ATTACH(&udp_mowner); |
| |
|
| |
#ifdef INET |
| udpstat_percpu = percpu_alloc(sizeof(uint64_t) * UDP_NSTATS); |
udpstat_percpu = percpu_alloc(sizeof(uint64_t) * UDP_NSTATS); |
| |
#endif |
| |
#ifdef INET6 |
| |
udp6stat_percpu = percpu_alloc(sizeof(uint64_t) * UDP6_NSTATS); |
| |
#endif |
| } |
} |
| |
|
| /* |
/* |
| Line 622 udp4_sendup(struct mbuf *m, int off /* o |
|
| Line 629 udp4_sendup(struct mbuf *m, int off /* o |
|
| #if defined(IPSEC) || defined(FAST_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++; |
IPSEC_STATINC(IPSEC_STAT_IN_POLVIO); |
| if ((n = m_copypacket(m, M_DONTWAIT)) != NULL) |
if ((n = m_copypacket(m, M_DONTWAIT)) != NULL) |
| icmp_error(n, ICMP_UNREACH, ICMP_UNREACH_ADMIN_PROHIBIT, |
icmp_error(n, ICMP_UNREACH, ICMP_UNREACH_ADMIN_PROHIBIT, |
| 0, 0); |
0, 0); |
| Line 669 udp6_sendup(struct mbuf *m, int off /* o |
|
| Line 676 udp6_sendup(struct mbuf *m, int off /* o |
|
| #if defined(IPSEC) || defined(FAST_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++; |
IPSEC6_STATINC(IPSEC_STAT_IN_POLVIO); |
| if ((n = m_copypacket(m, M_DONTWAIT)) != NULL) |
if ((n = m_copypacket(m, M_DONTWAIT)) != NULL) |
| icmp6_error(n, ICMP6_DST_UNREACH, |
icmp6_error(n, ICMP6_DST_UNREACH, |
| ICMP6_DST_UNREACH_ADMIN, 0); |
ICMP6_DST_UNREACH_ADMIN, 0); |
| Line 1179 udp_usrreq(struct socket *so, int req, s |
|
| Line 1186 udp_usrreq(struct socket *so, int req, s |
|
| s = splsoftnet(); |
s = splsoftnet(); |
| |
|
| if (req == PRU_PURGEIF) { |
if (req == PRU_PURGEIF) { |
| |
mutex_enter(softnet_lock); |
| in_pcbpurgeif0(&udbtable, (struct ifnet *)control); |
in_pcbpurgeif0(&udbtable, (struct ifnet *)control); |
| in_purgeif((struct ifnet *)control); |
in_purgeif((struct ifnet *)control); |
| in_pcbpurgeif(&udbtable, (struct ifnet *)control); |
in_pcbpurgeif(&udbtable, (struct ifnet *)control); |
| |
mutex_exit(softnet_lock); |
| splx(s); |
splx(s); |
| return (0); |
return (0); |
| } |
} |
| Line 1191 udp_usrreq(struct socket *so, int req, s |
|
| Line 1200 udp_usrreq(struct socket *so, int req, s |
|
| if (req != PRU_SEND && req != PRU_SENDOOB && control) |
if (req != PRU_SEND && req != PRU_SENDOOB && control) |
| panic("udp_usrreq: unexpected control mbuf"); |
panic("udp_usrreq: unexpected control mbuf"); |
| #endif |
#endif |
| if (inp == 0 && req != PRU_ATTACH) { |
if (req == PRU_ATTACH) { |
| |
sosetlock(so); |
| |
} else if (inp == 0) { |
| error = EINVAL; |
error = EINVAL; |
| goto release; |
goto release; |
| } |
} |
|
|
| return (error); |
return (error); |
| } |
} |
| |
|
| static void |
|
| udpstat_convert_to_user_cb(void *v1, void *v2, struct cpu_info *ci) |
|
| { |
|
| uint64_t *udpsc = v1; |
|
| uint64_t *udps = v2; |
|
| u_int i; |
|
| |
|
| for (i = 0; i < UDP_NSTATS; i++) |
|
| udps[i] += udpsc[i]; |
|
| } |
|
| |
|
| static void |
|
| udpstat_convert_to_user(uint64_t *udps) |
|
| { |
|
| |
|
| memset(udps, 0, sizeof(uint64_t) * UDP_NSTATS); |
|
| percpu_foreach(udpstat_percpu, udpstat_convert_to_user_cb, udps); |
|
| } |
|
| |
|
| static int |
static int |
| sysctl_net_inet_udp_stats(SYSCTLFN_ARGS) |
sysctl_net_inet_udp_stats(SYSCTLFN_ARGS) |
| { |
{ |
| struct sysctlnode node; |
|
| uint64_t udps[UDP_NSTATS]; |
|
| |
|
| udpstat_convert_to_user(udps); |
return (NETSTAT_SYSCTL(udpstat_percpu, UDP_NSTATS)); |
| node = *rnode; |
|
| node.sysctl_data = udps; |
|
| node.sysctl_size = sizeof(udps); |
|
| return (sysctl_lookup(SYSCTLFN_CALL(&node))); |
|
| } |
} |
| |
|
| /* |
/* |