| version 1.168, 2008/04/15 04:43:25 |
version 1.169, 2008/04/23 06:09:05 |
| 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> |
| Line 622 udp4_sendup(struct mbuf *m, int off /* o |
|
| Line 624 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 671 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); |
|
|
| 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; |
netstat_sysctl_context ctx; |
| uint64_t udps[UDP_NSTATS]; |
uint64_t udps[UDP_NSTATS]; |
| |
|
| udpstat_convert_to_user(udps); |
ctx.ctx_stat = udpstat_percpu; |
| node = *rnode; |
ctx.ctx_counters = udps; |
| node.sysctl_data = udps; |
ctx.ctx_ncounters = UDP_NSTATS; |
| node.sysctl_size = sizeof(udps); |
return (NETSTAT_SYSCTL(&ctx)); |
| return (sysctl_lookup(SYSCTLFN_CALL(&node))); |
|
| } |
} |
| |
|
| /* |
/* |