gather stats on raw ip6 socket. sync with kame
This commit is contained in:
parent
51a9c75998
commit
68fbfa26e8
@ -1,4 +1,4 @@
|
|||||||
# $NetBSD: mi,v 1.383 2001/10/17 05:22:32 jmc Exp $
|
# $NetBSD: mi,v 1.384 2001/10/18 09:12:13 itojun Exp $
|
||||||
./sys comp-sysutil-root
|
./sys comp-sysutil-root
|
||||||
./usr/bin/addr2line comp-debug-bin
|
./usr/bin/addr2line comp-debug-bin
|
||||||
./usr/bin/ar comp-util-bin
|
./usr/bin/ar comp-util-bin
|
||||||
@ -583,6 +583,7 @@
|
|||||||
./usr/include/netinet6/nd6.h comp-c-include
|
./usr/include/netinet6/nd6.h comp-c-include
|
||||||
./usr/include/netinet6/pim6.h comp-c-include
|
./usr/include/netinet6/pim6.h comp-c-include
|
||||||
./usr/include/netinet6/pim6_var.h comp-c-include
|
./usr/include/netinet6/pim6_var.h comp-c-include
|
||||||
|
./usr/include/netinet6/raw_ip6.h comp-c-include
|
||||||
./usr/include/netinet6/udp6.h comp-c-include
|
./usr/include/netinet6/udp6.h comp-c-include
|
||||||
./usr/include/netinet6/udp6_var.h comp-c-include
|
./usr/include/netinet6/udp6_var.h comp-c-include
|
||||||
./usr/include/netisdn/i4b_cause.h comp-c-include
|
./usr/include/netisdn/i4b_cause.h comp-c-include
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
# $NetBSD: Makefile,v 1.4 2000/06/04 11:52:10 itojun Exp $
|
# $NetBSD: Makefile,v 1.5 2001/10/18 09:12:14 itojun Exp $
|
||||||
|
|
||||||
KDIR= /sys/netinet6
|
KDIR= /sys/netinet6
|
||||||
INCSDIR= /usr/include/netinet6
|
INCSDIR= /usr/include/netinet6
|
||||||
|
|
||||||
INCS= ah.h esp.h in6.h in6_gif.h in6_ifattach.h in6_pcb.h \
|
INCS= ah.h esp.h in6.h in6_gif.h in6_ifattach.h in6_pcb.h \
|
||||||
in6_var.h ip6_mroute.h ip6_var.h ip6protosw.h \
|
in6_var.h ip6_mroute.h ip6_var.h ip6protosw.h \
|
||||||
ipcomp.h ipsec.h mld6_var.h nd6.h pim6.h pim6_var.h udp6.h udp6_var.h
|
ipcomp.h ipsec.h mld6_var.h nd6.h pim6.h pim6_var.h \
|
||||||
|
raw_ip6.h udp6.h udp6_var.h
|
||||||
|
|
||||||
.include <bsd.kinc.mk>
|
.include <bsd.kinc.mk>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: raw_ip6.c,v 1.36 2001/10/18 07:44:35 itojun Exp $ */
|
/* $NetBSD: raw_ip6.c,v 1.37 2001/10/18 09:12:14 itojun Exp $ */
|
||||||
/* $KAME: raw_ip6.c,v 1.82 2001/07/23 18:57:56 jinmei Exp $ */
|
/* $KAME: raw_ip6.c,v 1.82 2001/07/23 18:57:56 jinmei Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -93,6 +93,7 @@
|
|||||||
#ifdef ENABLE_DEFAULT_SCOPE
|
#ifdef ENABLE_DEFAULT_SCOPE
|
||||||
#include <netinet6/scope6_var.h>
|
#include <netinet6/scope6_var.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <netinet6/raw_ip6.h>
|
||||||
|
|
||||||
#ifdef IPSEC
|
#ifdef IPSEC
|
||||||
#include <netinet6/ipsec.h>
|
#include <netinet6/ipsec.h>
|
||||||
@ -112,6 +113,8 @@ struct in6pcb rawin6pcb;
|
|||||||
* Raw interface to IP6 protocol.
|
* Raw interface to IP6 protocol.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
struct rip6stat rip6stat;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize raw connection block queue.
|
* Initialize raw connection block queue.
|
||||||
*/
|
*/
|
||||||
@ -138,6 +141,8 @@ rip6_input(mp, offp, proto)
|
|||||||
struct sockaddr_in6 rip6src;
|
struct sockaddr_in6 rip6src;
|
||||||
struct mbuf *opts = NULL;
|
struct mbuf *opts = NULL;
|
||||||
|
|
||||||
|
rip6stat.rip6s_ipackets++;
|
||||||
|
|
||||||
#if defined(NFAITH) && 0 < NFAITH
|
#if defined(NFAITH) && 0 < NFAITH
|
||||||
if (faithprefix(&ip6->ip6_dst)) {
|
if (faithprefix(&ip6->ip6_dst)) {
|
||||||
/* send icmp6 host unreach? */
|
/* send icmp6 host unreach? */
|
||||||
@ -170,16 +175,18 @@ rip6_input(mp, offp, proto)
|
|||||||
in6p->in6p_ip6.ip6_nxt != proto)
|
in6p->in6p_ip6.ip6_nxt != proto)
|
||||||
continue;
|
continue;
|
||||||
if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr) &&
|
if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr) &&
|
||||||
!IN6_ARE_ADDR_EQUAL(&in6p->in6p_laddr, &ip6->ip6_dst))
|
!IN6_ARE_ADDR_EQUAL(&in6p->in6p_laddr, &ip6->ip6_dst))
|
||||||
continue;
|
continue;
|
||||||
if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr) &&
|
if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr) &&
|
||||||
!IN6_ARE_ADDR_EQUAL(&in6p->in6p_faddr, &ip6->ip6_src))
|
!IN6_ARE_ADDR_EQUAL(&in6p->in6p_faddr, &ip6->ip6_src))
|
||||||
continue;
|
|
||||||
if (in6p->in6p_cksum != -1
|
|
||||||
&& in6_cksum(m, ip6->ip6_nxt, *offp, m->m_pkthdr.len - *offp))
|
|
||||||
{
|
|
||||||
/* XXX bark something */
|
|
||||||
continue;
|
continue;
|
||||||
|
if (in6p->in6p_cksum != -1) {
|
||||||
|
rip6stat.rip6s_isum++;
|
||||||
|
if (in6_cksum(m, ip6->ip6_nxt, *offp,
|
||||||
|
m->m_pkthdr.len - *offp)) {
|
||||||
|
rip6stat.rip6s_badsum++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (last) {
|
if (last) {
|
||||||
struct mbuf *n;
|
struct mbuf *n;
|
||||||
@ -205,6 +212,7 @@ rip6_input(mp, offp, proto)
|
|||||||
m_freem(n);
|
m_freem(n);
|
||||||
if (opts)
|
if (opts)
|
||||||
m_freem(opts);
|
m_freem(opts);
|
||||||
|
rip6stat.rip6s_fullsock++;
|
||||||
} else
|
} else
|
||||||
sorwakeup(last->in6p_socket);
|
sorwakeup(last->in6p_socket);
|
||||||
opts = NULL;
|
opts = NULL;
|
||||||
@ -233,9 +241,13 @@ rip6_input(mp, offp, proto)
|
|||||||
m_freem(m);
|
m_freem(m);
|
||||||
if (opts)
|
if (opts)
|
||||||
m_freem(opts);
|
m_freem(opts);
|
||||||
|
rip6stat.rip6s_fullsock++;
|
||||||
} else
|
} else
|
||||||
sorwakeup(last->in6p_socket);
|
sorwakeup(last->in6p_socket);
|
||||||
} else {
|
} else {
|
||||||
|
rip6stat.rip6s_nosock++;
|
||||||
|
if (m->m_flags & M_MCAST)
|
||||||
|
rip6stat.rip6s_nosockmcast++;
|
||||||
if (proto == IPPROTO_NONE)
|
if (proto == IPPROTO_NONE)
|
||||||
m_freem(m);
|
m_freem(m);
|
||||||
else {
|
else {
|
||||||
@ -511,7 +523,8 @@ rip6_output(m, va_alist)
|
|||||||
if (oifp)
|
if (oifp)
|
||||||
icmp6_ifoutstat_inc(oifp, type, code);
|
icmp6_ifoutstat_inc(oifp, type, code);
|
||||||
icmp6stat.icp6s_outhist[type]++;
|
icmp6stat.icp6s_outhist[type]++;
|
||||||
}
|
} else
|
||||||
|
rip6stat.rip6s_opackets++;
|
||||||
|
|
||||||
goto freectl;
|
goto freectl;
|
||||||
|
|
||||||
|
54
sys/netinet6/raw_ip6.h
Normal file
54
sys/netinet6/raw_ip6.h
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/* $NetBSD: raw_ip6.h,v 1.1 2001/10/18 09:12:14 itojun Exp $ */
|
||||||
|
/* $KAME: raw_ip6.h,v 1.2 2001/05/27 13:28:35 itojun Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2001 WIDE Project.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. Neither the name of the project nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _NETINET6_RAW_IP6_H_
|
||||||
|
#define _NETINET6_RAW_IP6_H_
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ICMPv6 stat is counted separately. see netinet/icmp6.h
|
||||||
|
*/
|
||||||
|
struct rip6stat {
|
||||||
|
u_quad_t rip6s_ipackets; /* total input packets */
|
||||||
|
u_quad_t rip6s_isum; /* input checksum computations */
|
||||||
|
u_quad_t rip6s_badsum; /* of above, checksum error */
|
||||||
|
u_quad_t rip6s_nosock; /* no matching socket */
|
||||||
|
u_quad_t rip6s_nosockmcast; /* of above, arrived as multicast */
|
||||||
|
u_quad_t rip6s_fullsock; /* not delivered, input socket full */
|
||||||
|
|
||||||
|
u_quad_t rip6s_opackets; /* total output packets */
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
|
extern struct rip6stat rip6stat;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user