Adopt <net/if_stats.h>.
This commit is contained in:
parent
70b554e641
commit
d99f8f369a
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ieee8023ad_lacp.c,v 1.10 2011/07/01 02:46:24 joerg Exp $ */
|
||||
/* $NetBSD: ieee8023ad_lacp.c,v 1.11 2020/01/29 04:30:41 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)2005 YAMAMOTO Takashi,
|
||||
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee8023ad_lacp.c,v 1.10 2011/07/01 02:46:24 joerg Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee8023ad_lacp.c,v 1.11 2020/01/29 04:30:41 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/callout.h>
|
||||
@ -503,7 +503,7 @@ ieee8023ad_select_tx_port(struct agr_softc *sc, struct mbuf *m)
|
||||
if (__predict_false(lsc->lsc_suppress_distributing &&
|
||||
!AGR_ROUNDROBIN(sc))) {
|
||||
LACP_DPRINTF((NULL, "%s: waiting transit\n", __func__));
|
||||
sc->sc_if.if_collisions++; /* XXX abuse */
|
||||
if_statinc(&sc->sc_if, if_collisions); /* XXX abuse */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_agr.c,v 1.50 2019/10/06 15:11:17 uwe Exp $ */
|
||||
/* $NetBSD: if_agr.c,v 1.51 2020/01/29 04:30:41 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)2005 YAMAMOTO Takashi,
|
||||
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_agr.c,v 1.50 2019/10/06 15:11:17 uwe Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_agr.c,v 1.51 2020/01/29 04:30:41 thorpej Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_inet.h"
|
||||
@ -156,7 +156,7 @@ agr_input(struct ifnet *ifp_port, struct mbuf *m)
|
||||
ifp = port->port_agrifp;
|
||||
if ((port->port_flags & AGRPORT_COLLECTING) == 0) {
|
||||
m_freem(m);
|
||||
ifp->if_ierrors++;
|
||||
if_statinc(ifp, if_ierrors);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -390,19 +390,21 @@ agr_start(struct ifnet *ifp)
|
||||
}
|
||||
bpf_mtap(ifp, m, BPF_D_OUT);
|
||||
port = agr_select_tx_port(sc, m);
|
||||
net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
|
||||
if (port) {
|
||||
int error;
|
||||
|
||||
error = agr_xmit_frame(port->port_ifp, m);
|
||||
if (error) {
|
||||
ifp->if_oerrors++;
|
||||
if_statinc_ref(nsr, if_oerrors);
|
||||
} else {
|
||||
ifp->if_opackets++;
|
||||
if_statinc_ref(nsr, if_opackets);
|
||||
}
|
||||
} else {
|
||||
m_freem(m);
|
||||
ifp->if_oerrors++;
|
||||
if_statinc_ref(nsr, if_oerrors);
|
||||
}
|
||||
IF_STAT_PUTREF(ifp);
|
||||
}
|
||||
|
||||
AGR_UNLOCK(sc);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_ipsec.c,v 1.25 2019/11/01 04:28:14 knakahara Exp $ */
|
||||
/* $NetBSD: if_ipsec.c,v 1.26 2020/01/29 04:34:10 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2017 Internet Initiative Japan Inc.
|
||||
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.25 2019/11/01 04:28:14 knakahara Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.26 2020/01/29 04:34:10 thorpej Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_inet.h"
|
||||
@ -538,7 +538,7 @@ end:
|
||||
curlwp_bindx(bound);
|
||||
noref_end:
|
||||
if (error)
|
||||
ifp->if_oerrors++;
|
||||
if_statinc(ifp, if_oerrors);
|
||||
|
||||
return error;
|
||||
}
|
||||
@ -566,8 +566,7 @@ if_ipsec_out_direct(struct ipsec_variant *var, struct mbuf *m, int family)
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
ifp->if_opackets++;
|
||||
ifp->if_obytes += len;
|
||||
if_statadd2(ifp, if_opackets, 1, if_obytes, len);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -609,7 +608,7 @@ if_ipsec_in_enqueue(struct mbuf *m, int af, struct ifnet *ifp)
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
ifp->if_ierrors++;
|
||||
if_statinc(ifp, if_ierrors);
|
||||
m_freem(m);
|
||||
return;
|
||||
}
|
||||
@ -621,10 +620,9 @@ if_ipsec_in_enqueue(struct mbuf *m, int af, struct ifnet *ifp)
|
||||
#endif
|
||||
pktlen = m->m_pkthdr.len;
|
||||
if (__predict_true(pktq_enqueue(pktq, m, h))) {
|
||||
ifp->if_ibytes += pktlen;
|
||||
ifp->if_ipackets++;
|
||||
if_statadd2(ifp, if_ibytes, pktlen, if_ipackets, 1);
|
||||
} else {
|
||||
ifp->if_iqdrops++;
|
||||
if_statinc(ifp, if_iqdrops);
|
||||
m_freem(m);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_ppp.c,v 1.166 2019/09/20 08:45:29 maxv Exp $ */
|
||||
/* $NetBSD: if_ppp.c,v 1.167 2020/01/29 04:28:27 thorpej Exp $ */
|
||||
/* Id: if_ppp.c,v 1.6 1997/03/04 03:33:00 paulus Exp */
|
||||
|
||||
/*
|
||||
@ -102,7 +102,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.166 2019/09/20 08:45:29 maxv Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.167 2020/01/29 04:28:27 thorpej Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "ppp.h"
|
||||
@ -1013,14 +1013,13 @@ pppoutput(struct ifnet *ifp, struct mbuf *m0, const struct sockaddr *dst,
|
||||
ifq = (m0->m_flags & M_HIGHPRI) ? &sc->sc_fastq : NULL;
|
||||
if ((error = ifq_enqueue2(&sc->sc_if, ifq, m0)) != 0) {
|
||||
splx(s);
|
||||
sc->sc_if.if_oerrors++;
|
||||
if_statinc(&sc->sc_if, if_oerrors);
|
||||
sc->sc_stats.ppp_oerrors++;
|
||||
return (error);
|
||||
}
|
||||
ppp_restart(sc);
|
||||
}
|
||||
ifp->if_opackets++;
|
||||
ifp->if_obytes += len;
|
||||
if_statadd2(ifp, if_opackets, 1, if_obytes, len);
|
||||
|
||||
splx(s);
|
||||
return (0);
|
||||
@ -1065,7 +1064,7 @@ ppp_requeue(struct ppp_softc *sc)
|
||||
m->m_nextpkt = NULL;
|
||||
ifq = (m->m_flags & M_HIGHPRI) ? &sc->sc_fastq : NULL;
|
||||
if ((error = ifq_enqueue2(&sc->sc_if, ifq, m)) != 0) {
|
||||
sc->sc_if.if_oerrors++;
|
||||
if_statinc(&sc->sc_if, if_oerrors);
|
||||
sc->sc_stats.ppp_oerrors++;
|
||||
}
|
||||
break;
|
||||
@ -1715,11 +1714,10 @@ ppp_inproc(struct ppp_softc *sc, struct mbuf *m)
|
||||
if (__predict_true(pktq)) {
|
||||
if (__predict_false(!pktq_enqueue(pktq, m, 0))) {
|
||||
splx(s);
|
||||
ifp->if_iqdrops++;
|
||||
if_statinc(ifp, if_iqdrops);
|
||||
goto bad;
|
||||
}
|
||||
ifp->if_ipackets++;
|
||||
ifp->if_ibytes += ilen;
|
||||
if_statadd2(ifp, if_ipackets, 1, if_ibytes, ilen);
|
||||
splx(s);
|
||||
return;
|
||||
}
|
||||
@ -1734,13 +1732,12 @@ ppp_inproc(struct ppp_softc *sc, struct mbuf *m)
|
||||
splx(s);
|
||||
if (sc->sc_flags & SC_DEBUG)
|
||||
printf("%s: input queue full\n", ifp->if_xname);
|
||||
ifp->if_iqdrops++;
|
||||
if_statinc(ifp, if_iqdrops);
|
||||
goto bad;
|
||||
}
|
||||
IF_ENQUEUE(inq, m);
|
||||
splx(s);
|
||||
ifp->if_ipackets++;
|
||||
ifp->if_ibytes += ilen;
|
||||
if_statadd2(ifp, if_ipackets, 1, if_ibytes, ilen);
|
||||
|
||||
(*sc->sc_ctlp)(sc);
|
||||
|
||||
@ -1748,7 +1745,7 @@ ppp_inproc(struct ppp_softc *sc, struct mbuf *m)
|
||||
|
||||
bad:
|
||||
m_freem(m);
|
||||
sc->sc_if.if_ierrors++;
|
||||
if_statinc(&sc->sc_if, if_ierrors);
|
||||
sc->sc_stats.ppp_ierrors++;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_pppoe.c,v 1.147 2019/03/18 11:38:03 msaitoh Exp $ */
|
||||
/* $NetBSD: if_pppoe.c,v 1.148 2020/01/29 04:28:27 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
|
||||
@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.147 2019/03/18 11:38:03 msaitoh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.148 2020/01/29 04:28:27 thorpej Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "pppoe.h"
|
||||
@ -1125,7 +1125,7 @@ pppoe_data_input(struct mbuf *m)
|
||||
m_set_rcvif(m, &sc->sc_sppp.pp_if);
|
||||
|
||||
/* pass packet up and account for it */
|
||||
sc->sc_sppp.pp_if.if_ipackets++;
|
||||
if_statinc(&sc->sc_sppp.pp_if, if_ipackets);
|
||||
sppp_input(&sc->sc_sppp.pp_if, m);
|
||||
return;
|
||||
|
||||
@ -1161,7 +1161,7 @@ pppoe_output(struct pppoe_softc *sc, struct mbuf *m)
|
||||
#endif
|
||||
|
||||
m->m_flags &= ~(M_BCAST|M_MCAST);
|
||||
sc->sc_sppp.pp_if.if_opackets++;
|
||||
if_statinc(&sc->sc_sppp.pp_if, if_opackets);
|
||||
return if_output_lock(sc->sc_eth_if, sc->sc_eth_if, m, &dst, NULL);
|
||||
}
|
||||
|
||||
@ -1865,7 +1865,7 @@ pppoe_start(struct ifnet *ifp)
|
||||
len = m->m_pkthdr.len;
|
||||
M_PREPEND(m, PPPOE_HEADERLEN, M_DONTWAIT);
|
||||
if (m == NULL) {
|
||||
ifp->if_oerrors++;
|
||||
if_statinc(ifp, if_oerrors);
|
||||
continue;
|
||||
}
|
||||
p = mtod(m, uint8_t *);
|
||||
@ -1901,7 +1901,7 @@ pppoe_transmit(struct ifnet *ifp, struct mbuf *m)
|
||||
M_PREPEND(m, PPPOE_HEADERLEN, M_DONTWAIT);
|
||||
if (m == NULL) {
|
||||
PPPOE_UNLOCK(sc);
|
||||
ifp->if_oerrors++;
|
||||
if_statinc(ifp, if_oerrors);
|
||||
return ENETDOWN;
|
||||
}
|
||||
p = mtod(m, uint8_t *);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_sl.c,v 1.131 2019/01/24 09:33:03 knakahara Exp $ */
|
||||
/* $NetBSD: if_sl.c,v 1.132 2020/01/29 04:28:27 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1989, 1992, 1993
|
||||
@ -60,7 +60,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_sl.c,v 1.131 2019/01/24 09:33:03 knakahara Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_sl.c,v 1.132 2020/01/29 04:28:27 thorpej Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_inet.h"
|
||||
@ -485,7 +485,7 @@ sloutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
|
||||
printf("%s: af%d not supported\n", sc->sc_if.if_xname,
|
||||
dst->sa_family);
|
||||
m_freem(m);
|
||||
sc->sc_if.if_noproto++;
|
||||
if_statinc(&sc->sc_if, if_noproto);
|
||||
return EAFNOSUPPORT;
|
||||
}
|
||||
|
||||
@ -625,7 +625,7 @@ slinput(int c, struct tty *tp)
|
||||
}
|
||||
c &= TTY_CHARMASK;
|
||||
|
||||
++sc->sc_if.if_ibytes;
|
||||
if_statinc(&sc->sc_if, if_ibytes);
|
||||
|
||||
if (sc->sc_if.if_flags & IFF_DEBUG) {
|
||||
if (c == ABT_ESC) {
|
||||
@ -697,7 +697,7 @@ slinput(int c, struct tty *tp)
|
||||
sc->sc_flags |= SC_ERROR;
|
||||
|
||||
error:
|
||||
sc->sc_if.if_ierrors++;
|
||||
if_statinc(&sc->sc_if, if_ierrors);
|
||||
newpack:
|
||||
sc->sc_mp = sc->sc_pktstart = (u_char *)sc->sc_mbuf->m_ext.ext_buf +
|
||||
BUFOFFSET;
|
||||
@ -746,7 +746,7 @@ slintr(void *arg)
|
||||
s = splnet();
|
||||
IF_DEQUEUE(&sc->sc_fastq, m);
|
||||
if (m)
|
||||
sc->sc_if.if_omcasts++; /* XXX */
|
||||
if_statinc(&sc->sc_if, if_omcasts); /* XXX */
|
||||
else
|
||||
IFQ_DEQUEUE(&sc->sc_if.if_snd, m);
|
||||
splx(s);
|
||||
@ -794,7 +794,7 @@ slintr(void *arg)
|
||||
* some time.
|
||||
*/
|
||||
if (tp->t_outq.c_cc == 0) {
|
||||
sc->sc_if.if_obytes++;
|
||||
if_statinc(&sc->sc_if, if_obytes);
|
||||
(void)putc(FRAME_END, &tp->t_outq);
|
||||
}
|
||||
|
||||
@ -825,7 +825,8 @@ slintr(void *arg)
|
||||
*/
|
||||
if (b_to_q(bp, cp - bp, &tp->t_outq))
|
||||
break;
|
||||
sc->sc_if.if_obytes += cp - bp;
|
||||
if_statadd(&sc->sc_if, if_obytes,
|
||||
cp - bp);
|
||||
}
|
||||
/*
|
||||
* If there are characters left in
|
||||
@ -843,7 +844,7 @@ slintr(void *arg)
|
||||
(void)unputc(&tp->t_outq);
|
||||
break;
|
||||
}
|
||||
sc->sc_if.if_obytes += 2;
|
||||
if_statadd(&sc->sc_if, if_obytes, 2);
|
||||
}
|
||||
bp = cp;
|
||||
}
|
||||
@ -861,10 +862,9 @@ slintr(void *arg)
|
||||
*/
|
||||
(void)unputc(&tp->t_outq);
|
||||
(void)putc(FRAME_END, &tp->t_outq);
|
||||
sc->sc_if.if_collisions++;
|
||||
if_statinc(&sc->sc_if, if_collisions);
|
||||
} else {
|
||||
sc->sc_if.if_obytes++;
|
||||
sc->sc_if.if_opackets++;
|
||||
if_statadd2(&sc->sc_if, if_obytes, 1, if_opackets, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -959,14 +959,13 @@ slintr(void *arg)
|
||||
m = n;
|
||||
}
|
||||
|
||||
sc->sc_if.if_ipackets++;
|
||||
if_statinc(&sc->sc_if, if_ipackets);
|
||||
getbinuptime(&sc->sc_lastpacket);
|
||||
|
||||
#ifdef INET
|
||||
s = splnet();
|
||||
if (__predict_false(!pktq_enqueue(ip_pktq, m, 0))) {
|
||||
sc->sc_if.if_ierrors++;
|
||||
sc->sc_if.if_iqdrops++;
|
||||
if_statadd2(&sc->sc_if, if_ierrors, 1, if_iqdrops, 1);
|
||||
m_freem(m);
|
||||
}
|
||||
splx(s);
|
||||
@ -1032,15 +1031,18 @@ slioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
}
|
||||
break;
|
||||
|
||||
case SIOCGPPPSTATS:
|
||||
case SIOCGPPPSTATS: {
|
||||
struct if_data ifi;
|
||||
|
||||
if_export_if_data(&sc->sc_if, &ifi, false);
|
||||
psp = &((struct ifpppstatsreq *) data)->stats;
|
||||
(void)memset(psp, 0, sizeof(*psp));
|
||||
psp->p.ppp_ibytes = sc->sc_if.if_ibytes;
|
||||
psp->p.ppp_ipackets = sc->sc_if.if_ipackets;
|
||||
psp->p.ppp_ierrors = sc->sc_if.if_ierrors;
|
||||
psp->p.ppp_obytes = sc->sc_if.if_obytes;
|
||||
psp->p.ppp_opackets = sc->sc_if.if_opackets;
|
||||
psp->p.ppp_oerrors = sc->sc_if.if_oerrors;
|
||||
psp->p.ppp_ibytes = ifi.ifi_ibytes;
|
||||
psp->p.ppp_ipackets = ifi.ifi_ipackets;
|
||||
psp->p.ppp_ierrors = ifi.ifi_ierrors;
|
||||
psp->p.ppp_obytes = ifi.ifi_obytes;
|
||||
psp->p.ppp_opackets = ifi.ifi_opackets;
|
||||
psp->p.ppp_oerrors = ifi.ifi_oerrors;
|
||||
#ifdef INET
|
||||
psp->vj.vjs_packets = sc->sc_comp.sls_packets;
|
||||
psp->vj.vjs_compressed = sc->sc_comp.sls_compressed;
|
||||
@ -1051,6 +1053,7 @@ slioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
psp->vj.vjs_errorin = sc->sc_comp.sls_errorin;
|
||||
psp->vj.vjs_tossed = sc->sc_comp.sls_tossed;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
case SIOCGPPPCSTATS:
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_spppsubr.c,v 1.184 2019/09/13 07:55:07 msaitoh Exp $ */
|
||||
/* $NetBSD: if_spppsubr.c,v 1.185 2020/01/29 04:28:27 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Synchronous PPP/Cisco link level subroutines.
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.184 2019/09/13 07:55:07 msaitoh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.185 2020/01/29 04:28:27 thorpej Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_inet.h"
|
||||
@ -532,7 +532,7 @@ sppp_input(struct ifnet *ifp, struct mbuf *m)
|
||||
|
||||
if (ifp->if_flags & IFF_UP) {
|
||||
/* Count received bytes, add hardware framing */
|
||||
ifp->if_ibytes += m->m_pkthdr.len + sp->pp_framebytes;
|
||||
if_statadd(ifp, if_ibytes, m->m_pkthdr.len + sp->pp_framebytes);
|
||||
/* Note time of last receive */
|
||||
sp->pp_last_receive = time_uptime;
|
||||
}
|
||||
@ -544,8 +544,7 @@ sppp_input(struct ifnet *ifp, struct mbuf *m)
|
||||
"%s: input packet is too small, %d bytes\n",
|
||||
ifp->if_xname, m->m_pkthdr.len);
|
||||
drop:
|
||||
++ifp->if_ierrors;
|
||||
++ifp->if_iqdrops;
|
||||
if_statadd2(ifp, if_ierrors, 1, if_iqdrops, 1);
|
||||
m_freem(m);
|
||||
SPPP_UNLOCK(sp);
|
||||
return;
|
||||
@ -589,7 +588,7 @@ sppp_input(struct ifnet *ifp, struct mbuf *m)
|
||||
}
|
||||
switch (ntohs(h->protocol)) {
|
||||
default:
|
||||
++ifp->if_noproto;
|
||||
if_statinc(ifp, if_noproto);
|
||||
goto invalid;
|
||||
case CISCO_KEEPALIVE:
|
||||
SPPP_UNLOCK(sp);
|
||||
@ -636,7 +635,7 @@ sppp_input(struct ifnet *ifp, struct mbuf *m)
|
||||
log(LOG_DEBUG,
|
||||
"%s: invalid input protocol "
|
||||
"<proto=0x%x>\n", ifp->if_xname, ntohs(protocol));
|
||||
++ifp->if_noproto;
|
||||
if_statinc(ifp, if_noproto);
|
||||
goto drop;
|
||||
case PPP_LCP:
|
||||
SPPP_UNLOCK(sp);
|
||||
@ -850,7 +849,7 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
|
||||
if (ifp->if_flags & IFF_DEBUG)
|
||||
log(LOG_DEBUG, "%s: no memory for transmit header\n",
|
||||
ifp->if_xname);
|
||||
++ifp->if_oerrors;
|
||||
if_statinc(ifp, if_oerrors);
|
||||
SPPP_UNLOCK(sp);
|
||||
splx(s);
|
||||
return (ENOBUFS);
|
||||
@ -912,7 +911,7 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
|
||||
#endif
|
||||
default:
|
||||
m_freem(m);
|
||||
++ifp->if_oerrors;
|
||||
if_statinc(ifp, if_oerrors);
|
||||
SPPP_UNLOCK(sp);
|
||||
splx(s);
|
||||
return (EAFNOSUPPORT);
|
||||
@ -924,7 +923,7 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
|
||||
if (ifp->if_flags & IFF_DEBUG)
|
||||
log(LOG_DEBUG, "%s: no memory for transmit header\n",
|
||||
ifp->if_xname);
|
||||
++ifp->if_oerrors;
|
||||
if_statinc(ifp, if_oerrors);
|
||||
SPPP_UNLOCK(sp);
|
||||
splx(s);
|
||||
return (ENOBUFS);
|
||||
@ -940,7 +939,7 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
|
||||
error = if_transmit_lock(ifp, m);
|
||||
SPPP_LOCK(sp, RW_READER);
|
||||
if (error == 0)
|
||||
ifp->if_obytes += pktlen + sp->pp_framebytes;
|
||||
if_statadd(ifp, if_obytes, pktlen + sp->pp_framebytes);
|
||||
#else /* !SPPPSUBR_MPSAFE */
|
||||
error = ifq_enqueue2(ifp, ifq, m);
|
||||
|
||||
@ -955,7 +954,7 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
|
||||
if_start_lock(ifp);
|
||||
SPPP_LOCK(sp, RW_READER);
|
||||
}
|
||||
ifp->if_obytes += pktlen + sp->pp_framebytes;
|
||||
if_statadd(ifp, if_obytes, pktlen + sp->pp_framebytes);
|
||||
}
|
||||
#endif /* !SPPPSUBR_MPSAFE */
|
||||
SPPP_UNLOCK(sp);
|
||||
@ -1419,11 +1418,11 @@ sppp_cisco_send(struct sppp *sp, int type, int32_t par1, int32_t par2)
|
||||
IF_DROP(&sp->pp_fastq);
|
||||
IF_DROP(&ifp->if_snd);
|
||||
m_freem(m);
|
||||
++ifp->if_oerrors;
|
||||
if_statinc(ifp, if_oerrors);
|
||||
return;
|
||||
}
|
||||
|
||||
ifp->if_obytes += m->m_pkthdr.len + sp->pp_framebytes;
|
||||
if_statadd(ifp, if_obytes, m->m_pkthdr.len + sp->pp_framebytes);
|
||||
IF_ENQUEUE(&sp->pp_cpq, m);
|
||||
|
||||
if (! (ifp->if_flags & IFF_OACTIVE)) {
|
||||
@ -1492,11 +1491,11 @@ sppp_cp_send(struct sppp *sp, u_short proto, u_char type,
|
||||
IF_DROP(&sp->pp_fastq);
|
||||
IF_DROP(&ifp->if_snd);
|
||||
m_freem(m);
|
||||
++ifp->if_oerrors;
|
||||
if_statinc(ifp, if_oerrors);
|
||||
return;
|
||||
}
|
||||
|
||||
ifp->if_obytes += m->m_pkthdr.len + sp->pp_framebytes;
|
||||
if_statadd(ifp, if_obytes, m->m_pkthdr.len + sp->pp_framebytes);
|
||||
IF_ENQUEUE(&sp->pp_cpq, m);
|
||||
|
||||
|
||||
@ -1554,7 +1553,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m)
|
||||
addlog("%s: %s invalid conf-req length %d\n",
|
||||
ifp->if_xname, cp->name,
|
||||
len);
|
||||
++ifp->if_ierrors;
|
||||
if_statinc(ifp, if_ierrors);
|
||||
break;
|
||||
}
|
||||
/* handle states where RCR doesn't get a SCA/SCN */
|
||||
@ -1609,7 +1608,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m)
|
||||
ifp->if_xname, cp->name,
|
||||
sppp_cp_type_name(h->type),
|
||||
sppp_state_name(sp->state[cp->protoidx]));
|
||||
++ifp->if_ierrors;
|
||||
if_statinc(ifp, if_ierrors);
|
||||
}
|
||||
break;
|
||||
case CONF_ACK:
|
||||
@ -1618,7 +1617,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m)
|
||||
addlog("%s: %s id mismatch 0x%x != 0x%x\n",
|
||||
ifp->if_xname, cp->name,
|
||||
h->ident, sp->confid[cp->protoidx]);
|
||||
++ifp->if_ierrors;
|
||||
if_statinc(ifp, if_ierrors);
|
||||
break;
|
||||
}
|
||||
switch (sp->state[cp->protoidx]) {
|
||||
@ -1653,7 +1652,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m)
|
||||
ifp->if_xname, cp->name,
|
||||
sppp_cp_type_name(h->type),
|
||||
sppp_state_name(sp->state[cp->protoidx]));
|
||||
++ifp->if_ierrors;
|
||||
if_statinc(ifp, if_ierrors);
|
||||
}
|
||||
break;
|
||||
case CONF_NAK:
|
||||
@ -1663,7 +1662,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m)
|
||||
addlog("%s: %s id mismatch 0x%x != 0x%x\n",
|
||||
ifp->if_xname, cp->name,
|
||||
h->ident, sp->confid[cp->protoidx]);
|
||||
++ifp->if_ierrors;
|
||||
if_statinc(ifp, if_ierrors);
|
||||
break;
|
||||
}
|
||||
if (h->type == CONF_NAK)
|
||||
@ -1696,7 +1695,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m)
|
||||
ifp->if_xname, cp->name,
|
||||
sppp_cp_type_name(h->type),
|
||||
sppp_state_name(sp->state[cp->protoidx]));
|
||||
++ifp->if_ierrors;
|
||||
if_statinc(ifp, if_ierrors);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1728,7 +1727,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m)
|
||||
ifp->if_xname, cp->name,
|
||||
sppp_cp_type_name(h->type),
|
||||
sppp_state_name(sp->state[cp->protoidx]));
|
||||
++ifp->if_ierrors;
|
||||
if_statinc(ifp, if_ierrors);
|
||||
}
|
||||
break;
|
||||
case TERM_ACK:
|
||||
@ -1761,7 +1760,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m)
|
||||
ifp->if_xname, cp->name,
|
||||
sppp_cp_type_name(h->type),
|
||||
sppp_state_name(sp->state[cp->protoidx]));
|
||||
++ifp->if_ierrors;
|
||||
if_statinc(ifp, if_ierrors);
|
||||
}
|
||||
break;
|
||||
case CODE_REJ:
|
||||
@ -1788,7 +1787,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m)
|
||||
ifp->if_xname, cp->name,
|
||||
sppp_cp_type_name(h->type),
|
||||
sppp_state_name(sp->state[cp->protoidx]));
|
||||
++ifp->if_ierrors;
|
||||
if_statinc(ifp, if_ierrors);
|
||||
}
|
||||
break;
|
||||
case PROTO_REJ:
|
||||
@ -1847,7 +1846,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m)
|
||||
ifp->if_xname, cp->name,
|
||||
sppp_cp_type_name(h->type),
|
||||
sppp_state_name(sp->state[cp->protoidx]));
|
||||
++ifp->if_ierrors;
|
||||
if_statinc(ifp, if_ierrors);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1863,7 +1862,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m)
|
||||
if (debug)
|
||||
addlog("%s: lcp echo req but lcp closed\n",
|
||||
ifp->if_xname);
|
||||
++ifp->if_ierrors;
|
||||
if_statinc(ifp, if_ierrors);
|
||||
break;
|
||||
}
|
||||
if (len < 8) {
|
||||
@ -1901,7 +1900,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m)
|
||||
if (cp->proto != PPP_LCP)
|
||||
goto illegal;
|
||||
if (h->ident != sp->lcp.echoid) {
|
||||
++ifp->if_ierrors;
|
||||
if_statinc(ifp, if_ierrors);
|
||||
break;
|
||||
}
|
||||
if (len < 8) {
|
||||
@ -1926,7 +1925,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m)
|
||||
ifp->if_xname, cp->name, h->type);
|
||||
sppp_cp_send(sp, cp->proto, CODE_REJ,
|
||||
++sp->pp_seq[cp->protoidx], m->m_pkthdr.len, h);
|
||||
++ifp->if_ierrors;
|
||||
if_statinc(ifp, if_ierrors);
|
||||
}
|
||||
|
||||
SPPP_UNLOCK(sp);
|
||||
@ -5094,11 +5093,11 @@ sppp_auth_send(const struct cp *cp, struct sppp *sp,
|
||||
IF_DROP(&sp->pp_fastq);
|
||||
IF_DROP(&ifp->if_snd);
|
||||
m_freem(m);
|
||||
++ifp->if_oerrors;
|
||||
if_statinc(ifp, if_oerrors);
|
||||
return;
|
||||
}
|
||||
|
||||
ifp->if_obytes += m->m_pkthdr.len + sp->pp_framebytes;
|
||||
if_statadd(ifp, if_obytes, m->m_pkthdr.len + sp->pp_framebytes);
|
||||
IF_ENQUEUE(&sp->pp_cpq, m);
|
||||
|
||||
if (! (ifp->if_flags & IFF_OACTIVE)) {
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* $NetBSD: if_srt.c,v 1.30 2019/04/27 06:18:15 pgoyette Exp $ */
|
||||
/* $NetBSD: if_srt.c,v 1.31 2020/01/29 04:28:27 thorpej Exp $ */
|
||||
/* This file is in the public domain. */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_srt.c,v 1.30 2019/04/27 06:18:15 pgoyette Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_srt.c,v 1.31 2020/01/29 04:28:27 thorpej Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_inet.h"
|
||||
@ -246,9 +246,9 @@ srt_if_output(
|
||||
}
|
||||
/* XXX Do we need to bpf_tap? Or do higher layers now handle that? */
|
||||
/* if_gif.c seems to imply the latter. */
|
||||
ifp->if_opackets ++;
|
||||
if_statinc(ifp, if_opackets);
|
||||
if (! r) {
|
||||
ifp->if_oerrors ++;
|
||||
if_statinc(ifp, if_oerrors);
|
||||
m_freem(m);
|
||||
return 0;
|
||||
}
|
||||
@ -257,7 +257,7 @@ srt_if_output(
|
||||
m_freem(m);
|
||||
return 0;
|
||||
}
|
||||
ifp->if_obytes += m->m_pkthdr.len;
|
||||
if_statadd(ifp, if_obytes, m->m_pkthdr.len);
|
||||
if (! (r->u.dstifp->if_flags & IFF_UP)) {
|
||||
m_freem(m);
|
||||
return 0; /* XXX ENETDOWN? */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_stf.c,v 1.106 2019/04/26 11:51:56 pgoyette Exp $ */
|
||||
/* $NetBSD: if_stf.c,v 1.107 2020/01/29 04:28:27 thorpej Exp $ */
|
||||
/* $KAME: if_stf.c,v 1.62 2001/06/07 22:32:16 itojun Exp $ */
|
||||
|
||||
/*
|
||||
@ -75,7 +75,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_stf.c,v 1.106 2019/04/26 11:51:56 pgoyette Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_stf.c,v 1.107 2020/01/29 04:28:27 thorpej Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_inet.h"
|
||||
@ -392,14 +392,14 @@ stf_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
|
||||
ia6 = stf_getsrcifa6(ifp);
|
||||
if (ia6 == NULL) {
|
||||
m_freem(m);
|
||||
ifp->if_oerrors++;
|
||||
if_statinc(ifp, if_oerrors);
|
||||
return ENETDOWN;
|
||||
}
|
||||
|
||||
if (m->m_len < sizeof(*ip6)) {
|
||||
m = m_pullup(m, sizeof(*ip6));
|
||||
if (m == NULL) {
|
||||
ifp->if_oerrors++;
|
||||
if_statinc(ifp, if_oerrors);
|
||||
return ENOBUFS;
|
||||
}
|
||||
}
|
||||
@ -416,7 +416,7 @@ stf_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
|
||||
in4 = GET_V4(&dst6->sin6_addr);
|
||||
else {
|
||||
m_freem(m);
|
||||
ifp->if_oerrors++;
|
||||
if_statinc(ifp, if_oerrors);
|
||||
return ENETUNREACH;
|
||||
}
|
||||
|
||||
@ -426,7 +426,7 @@ stf_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
|
||||
if (m && m->m_len < sizeof(struct ip))
|
||||
m = m_pullup(m, sizeof(struct ip));
|
||||
if (m == NULL) {
|
||||
ifp->if_oerrors++;
|
||||
if_statinc(ifp, if_oerrors);
|
||||
return ENOBUFS;
|
||||
}
|
||||
ip = mtod(m, struct ip *);
|
||||
@ -447,7 +447,7 @@ stf_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
|
||||
sockaddr_in_init(&u.dst4, &ip->ip_dst, 0);
|
||||
if ((rt = rtcache_lookup(&sc->sc_ro, &u.dst)) == NULL) {
|
||||
m_freem(m);
|
||||
ifp->if_oerrors++;
|
||||
if_statinc(ifp, if_oerrors);
|
||||
return ENETUNREACH;
|
||||
}
|
||||
|
||||
@ -456,13 +456,13 @@ stf_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
|
||||
rtcache_unref(rt, &sc->sc_ro);
|
||||
rtcache_free(&sc->sc_ro);
|
||||
m_freem(m);
|
||||
ifp->if_oerrors++;
|
||||
if_statinc(ifp, if_oerrors);
|
||||
return ENETUNREACH;
|
||||
}
|
||||
rtcache_unref(rt, &sc->sc_ro);
|
||||
|
||||
ifp->if_opackets++;
|
||||
ifp->if_obytes += m->m_pkthdr.len - sizeof(struct ip);
|
||||
if_statadd2(ifp, if_opackets, 1,
|
||||
if_obytes, m->m_pkthdr.len - sizeof(struct ip));
|
||||
return ip_output(m, NULL, &sc->sc_ro, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
@ -667,8 +667,7 @@ in_stf_input(struct mbuf *m, int off, int proto, void *eparg)
|
||||
|
||||
s = splnet();
|
||||
if (__predict_true(pktq_enqueue(ip6_pktq, m, 0))) {
|
||||
ifp->if_ipackets++;
|
||||
ifp->if_ibytes += pktlen;
|
||||
if_statadd2(ifp, if_ipackets, 1, if_ibytes, pktlen);
|
||||
} else {
|
||||
m_freem(m);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_tap.c,v 1.115 2020/01/06 20:31:35 christos Exp $ */
|
||||
/* $NetBSD: if_tap.c,v 1.116 2020/01/29 04:28:27 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, 2004, 2008, 2009 The NetBSD Foundation.
|
||||
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.115 2020/01/06 20:31:35 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.116 2020/01/29 04:28:27 thorpej Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
|
||||
@ -524,8 +524,7 @@ tap_start(struct ifnet *ifp)
|
||||
if (m0 == NULL)
|
||||
goto done;
|
||||
|
||||
ifp->if_opackets++;
|
||||
ifp->if_obytes += m0->m_len;
|
||||
if_statadd2(ifp, if_opackets, 1, if_obytes, m0->m_len);
|
||||
bpf_mtap(ifp, m0, BPF_D_OUT);
|
||||
|
||||
m_freem(m0);
|
||||
@ -893,8 +892,7 @@ tap_dev_close(struct tap_softc *sc)
|
||||
if (m == NULL)
|
||||
break;
|
||||
|
||||
ifp->if_opackets++;
|
||||
ifp->if_obytes += m->m_len;
|
||||
if_statadd2(ifp, if_opackets, 1, if_obytes, m->m_len);
|
||||
bpf_mtap(ifp, m, BPF_D_OUT);
|
||||
m_freem(m);
|
||||
}
|
||||
@ -980,8 +978,8 @@ tap_dev_read(int unit, struct uio *uio, int flags)
|
||||
goto out;
|
||||
}
|
||||
|
||||
ifp->if_opackets++;
|
||||
ifp->if_obytes += m->m_len; // XXX: only first in chain
|
||||
if_statadd2(ifp, if_opackets, 1,
|
||||
if_obytes, m->m_len); /* XXX only first in chain */
|
||||
bpf_mtap(ifp, m, BPF_D_OUT);
|
||||
if ((error = pfil_run_hooks(ifp->if_pfil, &m, ifp, PFIL_OUT)) != 0)
|
||||
goto out;
|
||||
@ -1069,7 +1067,7 @@ tap_dev_write(int unit, struct uio *uio, int flags)
|
||||
/* One write, one packet, that's the rule */
|
||||
MGETHDR(m, M_DONTWAIT, MT_DATA);
|
||||
if (m == NULL) {
|
||||
ifp->if_ierrors++;
|
||||
if_statinc(ifp, if_ierrors);
|
||||
return ENOBUFS;
|
||||
}
|
||||
m->m_pkthdr.len = uio->uio_resid;
|
||||
@ -1089,15 +1087,14 @@ tap_dev_write(int unit, struct uio *uio, int flags)
|
||||
mp = &(*mp)->m_next;
|
||||
}
|
||||
if (error) {
|
||||
ifp->if_ierrors++;
|
||||
if_statinc(ifp, if_ierrors);
|
||||
m_freem(m);
|
||||
return error;
|
||||
}
|
||||
|
||||
m_set_rcvif(m, ifp);
|
||||
|
||||
ifp->if_ipackets++;
|
||||
ifp->if_ibytes += len;
|
||||
if_statadd2(ifp, if_ipackets, 1, if_ibytes, len);
|
||||
bpf_mtap(ifp, m, BPF_D_IN);
|
||||
if ((error = pfil_run_hooks(ifp->if_pfil, &m, ifp, PFIL_IN)) != 0)
|
||||
return error;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_tun.c,v 1.157 2019/12/13 14:13:55 maxv Exp $ */
|
||||
/* $NetBSD: if_tun.c,v 1.158 2020/01/29 04:34:10 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk>
|
||||
@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.157 2019/12/13 14:13:55 maxv Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.158 2020/01/29 04:34:10 thorpej Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_inet.h"
|
||||
@ -259,13 +259,6 @@ tunattach0(struct tun_softc *tp)
|
||||
ifp->if_extflags = IFEF_NO_LINK_STATE_CHANGE;
|
||||
ifp->if_type = IFT_TUNNEL;
|
||||
ifp->if_snd.ifq_maxlen = ifqmaxlen;
|
||||
ifp->if_collisions = 0;
|
||||
ifp->if_ierrors = 0;
|
||||
ifp->if_oerrors = 0;
|
||||
ifp->if_ipackets = 0;
|
||||
ifp->if_opackets = 0;
|
||||
ifp->if_ibytes = 0;
|
||||
ifp->if_obytes = 0;
|
||||
ifp->if_dlt = DLT_NULL;
|
||||
IFQ_SET_READY(&ifp->if_snd);
|
||||
if_attach(ifp);
|
||||
@ -612,13 +605,12 @@ tun_output(struct ifnet *ifp, struct mbuf *m0, const struct sockaddr *dst,
|
||||
mlen = m0->m_pkthdr.len;
|
||||
IFQ_ENQUEUE(&ifp->if_snd, m0, error);
|
||||
if (error) {
|
||||
ifp->if_collisions++;
|
||||
if_statinc(ifp, if_collisions);
|
||||
error = EAFNOSUPPORT;
|
||||
m0 = NULL;
|
||||
goto out;
|
||||
}
|
||||
ifp->if_opackets++;
|
||||
ifp->if_obytes += mlen;
|
||||
if_statadd2(ifp, if_opackets, 1, if_obytes, mlen);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@ -828,7 +820,7 @@ tunread(dev_t dev, struct uio *uio, int ioflag)
|
||||
m_freem(m0);
|
||||
}
|
||||
if (error)
|
||||
ifp->if_ierrors++;
|
||||
if_statinc(ifp, if_ierrors);
|
||||
|
||||
return error;
|
||||
|
||||
@ -946,7 +938,7 @@ tunwrite(dev_t dev, struct uio *uio, int ioflag)
|
||||
if (error) {
|
||||
if (top != NULL)
|
||||
m_freem(top);
|
||||
ifp->if_ierrors++;
|
||||
if_statinc(ifp, if_ierrors);
|
||||
goto out0;
|
||||
}
|
||||
|
||||
@ -967,14 +959,13 @@ tunwrite(dev_t dev, struct uio *uio, int ioflag)
|
||||
goto out;
|
||||
}
|
||||
if (__predict_false(!pktq_enqueue(pktq, top, 0))) {
|
||||
ifp->if_collisions++;
|
||||
if_statinc(ifp, if_collisions);
|
||||
mutex_exit(&tp->tun_lock);
|
||||
error = ENOBUFS;
|
||||
m_freem(top);
|
||||
goto out0;
|
||||
}
|
||||
ifp->if_ipackets++;
|
||||
ifp->if_ibytes += tlen;
|
||||
if_statadd2(ifp, if_ipackets, 1, if_ibytes, tlen);
|
||||
out:
|
||||
mutex_exit(&tp->tun_lock);
|
||||
out0:
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_vlan.c,v 1.149 2019/12/12 02:15:43 pgoyette Exp $ */
|
||||
/* $NetBSD: if_vlan.c,v 1.150 2020/01/29 04:28:27 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
|
||||
@ -78,7 +78,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.149 2019/12/12 02:15:43 pgoyette Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.150 2020/01/29 04:28:27 thorpej Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_inet.h"
|
||||
@ -1391,7 +1391,7 @@ vlan_start(struct ifnet *ifp)
|
||||
if (m == NULL) {
|
||||
printf("%s: unable to prepend encap header",
|
||||
p->if_xname);
|
||||
ifp->if_oerrors++;
|
||||
if_statinc(ifp, if_oerrors);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1406,7 +1406,7 @@ vlan_start(struct ifnet *ifp)
|
||||
if (m == NULL) {
|
||||
printf("%s: unable to pullup encap "
|
||||
"header", p->if_xname);
|
||||
ifp->if_oerrors++;
|
||||
if_statinc(ifp, if_oerrors);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1455,10 +1455,10 @@ vlan_start(struct ifnet *ifp)
|
||||
error = if_transmit_lock(p, m);
|
||||
if (error) {
|
||||
/* mbuf is already freed */
|
||||
ifp->if_oerrors++;
|
||||
if_statinc(ifp, if_oerrors);
|
||||
continue;
|
||||
}
|
||||
ifp->if_opackets++;
|
||||
if_statinc(ifp, if_opackets);
|
||||
}
|
||||
|
||||
ifp->if_flags &= ~IFF_OACTIVE;
|
||||
@ -1509,7 +1509,7 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m)
|
||||
if (m == NULL) {
|
||||
printf("%s: unable to prepend encap header",
|
||||
p->if_xname);
|
||||
ifp->if_oerrors++;
|
||||
if_statinc(ifp, if_oerrors);
|
||||
error = ENOBUFS;
|
||||
goto out;
|
||||
}
|
||||
@ -1525,7 +1525,7 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m)
|
||||
if (m == NULL) {
|
||||
printf("%s: unable to pullup encap "
|
||||
"header", p->if_xname);
|
||||
ifp->if_oerrors++;
|
||||
if_statinc(ifp, if_oerrors);
|
||||
error = ENOBUFS;
|
||||
goto out;
|
||||
}
|
||||
@ -1574,16 +1574,17 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m)
|
||||
}
|
||||
|
||||
error = if_transmit_lock(p, m);
|
||||
net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
|
||||
if (error) {
|
||||
/* mbuf is already freed */
|
||||
ifp->if_oerrors++;
|
||||
if_statinc_ref(nsr, if_oerrors);
|
||||
} else {
|
||||
|
||||
ifp->if_opackets++;
|
||||
ifp->if_obytes += pktlen;
|
||||
if_statinc_ref(nsr, if_opackets);
|
||||
if_statadd_ref(nsr, if_obytes, pktlen);
|
||||
if (mcast)
|
||||
ifp->if_omcasts++;
|
||||
if_statinc_ref(nsr, if_omcasts);
|
||||
}
|
||||
IF_STAT_PUTREF(ifp);
|
||||
|
||||
out:
|
||||
/* Remove reference to mib before release */
|
||||
@ -1639,7 +1640,7 @@ vlan_input(struct ifnet *ifp, struct mbuf *m)
|
||||
mib = vlan_lookup_tag_psref(ifp, vid, &psref);
|
||||
if (mib == NULL) {
|
||||
m_freem(m);
|
||||
ifp->if_noproto++;
|
||||
if_statinc(ifp, if_noproto);
|
||||
return;
|
||||
}
|
||||
KASSERT(mib->ifvm_encaplen == ETHER_VLAN_ENCAP_LEN);
|
||||
@ -1648,7 +1649,7 @@ vlan_input(struct ifnet *ifp, struct mbuf *m)
|
||||
if ((ifv->ifv_if.if_flags & (IFF_UP | IFF_RUNNING)) !=
|
||||
(IFF_UP | IFF_RUNNING)) {
|
||||
m_freem(m);
|
||||
ifp->if_noproto++;
|
||||
if_statinc(ifp, if_noproto);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#ifdef _KERNEL
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: npf_ext_log.c,v 1.15 2018/09/29 14:41:36 rmind Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: npf_ext_log.c,v 1.16 2020/01/29 04:30:41 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/module.h>
|
||||
@ -140,8 +140,7 @@ npf_log(npf_cache_t *npc, void *meta, const npf_match_info_t *mi, int *decision)
|
||||
}
|
||||
|
||||
/* Pass through BPF. */
|
||||
ifp->if_opackets++;
|
||||
ifp->if_obytes += m->m_pkthdr.len;
|
||||
if_statadd2(ifp, if_opackets, 1, if_obytes, m->m_pkthdr.len);
|
||||
if (ifp->if_bpf) {
|
||||
bpf_mtap2(ifp->if_bpf, &hdr, NPFLOG_HDRLEN, m, BPF_D_OUT);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ppp_tty.c,v 1.66 2019/09/20 08:45:29 maxv Exp $ */
|
||||
/* $NetBSD: ppp_tty.c,v 1.67 2020/01/29 04:28:27 thorpej Exp $ */
|
||||
/* Id: ppp_tty.c,v 1.3 1996/07/01 01:04:11 paulus Exp */
|
||||
|
||||
/*
|
||||
@ -93,7 +93,7 @@
|
||||
/* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.66 2019/09/20 08:45:29 maxv Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.67 2020/01/29 04:28:27 thorpej Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "ppp.h"
|
||||
@ -1035,7 +1035,7 @@ pppinput(int c, struct tty *tp)
|
||||
if (sc->sc_flags & SC_DEBUG)
|
||||
printf("%s: bad fcs %x\n", sc->sc_if.if_xname,
|
||||
sc->sc_fcs);
|
||||
sc->sc_if.if_ierrors++;
|
||||
if_statinc(&sc->sc_if, if_ierrors);
|
||||
sc->sc_stats.ppp_ierrors++;
|
||||
} else
|
||||
sc->sc_flags &= ~(SC_FLUSH | SC_ESCAPED);
|
||||
@ -1048,7 +1048,7 @@ pppinput(int c, struct tty *tp)
|
||||
if (sc->sc_flags & SC_DEBUG)
|
||||
printf("%s: too short (%d)\n", sc->sc_if.if_xname, ilen);
|
||||
s = spltty();
|
||||
sc->sc_if.if_ierrors++;
|
||||
if_statinc(&sc->sc_if, if_ierrors);
|
||||
sc->sc_stats.ppp_ierrors++;
|
||||
sc->sc_flags |= SC_PKTLOST;
|
||||
splx(s);
|
||||
@ -1192,7 +1192,7 @@ pppinput(int c, struct tty *tp)
|
||||
flush:
|
||||
if (!(sc->sc_flags & SC_FLUSH)) {
|
||||
s = spltty();
|
||||
sc->sc_if.if_ierrors++;
|
||||
if_statinc(&sc->sc_if, if_ierrors);
|
||||
sc->sc_stats.ppp_ierrors++;
|
||||
sc->sc_flags |= SC_FLUSH;
|
||||
splx(s);
|
||||
|
Loading…
Reference in New Issue
Block a user