summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormvs <mvs@openbsd.org>2020-08-30 19:45:20 +0000
committermvs <mvs@openbsd.org>2020-08-30 19:45:20 +0000
commit583e9cb043c50a0262c159f34780253fee0c24ff (patch)
treef0b19a514c6d2000dd8fdfd6a9610dc5cb6f7435
parentCompactify SDEV_/ADEV_ flags & quirks to eliminate the gaps in bit use and thus (diff)
downloadwireguard-openbsd-583e9cb043c50a0262c159f34780253fee0c24ff.tar.xz
wireguard-openbsd-583e9cb043c50a0262c159f34780253fee0c24ff.zip
pppac(4) uses per cpu counters for collect `ifnet' statistics, but in
pipex(4) layer this `ifnet' still uses `if_data'. Also pppx(4) doesn't use per cpu counters but `if_data'. Add per cpu counters to pppx(4) and pipex(4). This finishes interface statistics collecting mess. ok yasuoka@
-rw-r--r--sys/net/if_pppx.c5
-rw-r--r--sys/net/pipex.c8
2 files changed, 6 insertions, 7 deletions
diff --git a/sys/net/if_pppx.c b/sys/net/if_pppx.c
index 8906fc73491..e71d181a801 100644
--- a/sys/net/if_pppx.c
+++ b/sys/net/if_pppx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pppx.c,v 1.102 2020/08/27 10:47:52 yasuoka Exp $ */
+/* $OpenBSD: if_pppx.c,v 1.103 2020/08/30 19:45:20 mvs Exp $ */
/*
* Copyright (c) 2010 Claudio Jeker <claudio@openbsd.org>
@@ -658,6 +658,7 @@ pppx_add_session(struct pppx_dev *pxd, struct pipex_session_req *req)
ifp->if_type = IFT_PPP;
ifp->if_softc = pxi;
/* ifp->if_rdomain = req->pr_rdomain; */
+ if_counters_alloc(ifp);
/* XXXSMP breaks atomicity */
NET_UNLOCK();
@@ -878,7 +879,7 @@ pppx_if_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
out:
if (error)
- ifp->if_oerrors++;
+ counters_inc(ifp->if_counters, ifc_oerrors);
return (error);
}
diff --git a/sys/net/pipex.c b/sys/net/pipex.c
index 7ce310e0adc..76d2feb49c6 100644
--- a/sys/net/pipex.c
+++ b/sys/net/pipex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pipex.c,v 1.125 2020/08/27 10:47:52 yasuoka Exp $ */
+/* $OpenBSD: pipex.c,v 1.126 2020/08/30 19:45:20 mvs Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -912,8 +912,7 @@ pipex_ip_input(struct mbuf *m0, struct pipex_session *session)
bpf_mtap_af(ifp->if_bpf, AF_INET, m0, BPF_DIRECTION_IN);
#endif
- ifp->if_ipackets++;
- ifp->if_ibytes += len;
+ counters_pkt(ifp->if_counters, ifc_ipackets, ifc_ibytes, len);
session->stat.ipackets++;
session->stat.ibytes += len;
ipv4_input(ifp, m0);
@@ -962,8 +961,7 @@ pipex_ip6_input(struct mbuf *m0, struct pipex_session *session)
bpf_mtap_af(ifp->if_bpf, AF_INET6, m0, BPF_DIRECTION_IN);
#endif
- ifp->if_ipackets++;
- ifp->if_ibytes += len;
+ counters_pkt(ifp->if_counters, ifc_ipackets, ifc_ibytes, len);
session->stat.ipackets++;
session->stat.ibytes += len;
ipv6_input(ifp, m0);