summaryrefslogtreecommitdiffstats
path: root/sys/net/if_arp.h
diff options
context:
space:
mode:
authorgnn <gnn@FreeBSD.org>2009-09-03 21:10:57 +0000
committergnn <gnn@FreeBSD.org>2009-09-03 21:10:57 +0000
commit60eb51e7a3e3a1dfacd9d9284b7e21e1fe4de011 (patch)
treeadac442cdf92025f0d2ded02f1a96f79bc1b1cfc /sys/net/if_arp.h
parent5d151fa1f9e0bab1181b49200884097a9b1874ac (diff)
downloadFreeBSD-src-60eb51e7a3e3a1dfacd9d9284b7e21e1fe4de011.zip
FreeBSD-src-60eb51e7a3e3a1dfacd9d9284b7e21e1fe4de011.tar.gz
Add ARP statistics to the kernel and netstat.
New counters now exist for: requests sent replies sent requests received replies received packets received total packets dropped due to no ARP entry entrys timed out Duplicate IPs seen The new statistics are seen in the netstat command when it is given the -s command line switch. MFC after: 2 weeks In collaboration with: bz
Diffstat (limited to 'sys/net/if_arp.h')
-rw-r--r--sys/net/if_arp.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/sys/net/if_arp.h b/sys/net/if_arp.h
index 1e18804..2bb6358 100644
--- a/sys/net/if_arp.h
+++ b/sys/net/if_arp.h
@@ -108,6 +108,31 @@ struct arpcom {
#define IFP2AC(ifp) ((struct arpcom *)(ifp->if_l2com))
#define AC2IFP(ac) ((ac)->ac_ifp)
-#endif
+#endif /* _KERNEL */
+
+struct arpstat {
+ /* Normal things that happen: */
+ u_long txrequests; /* # of ARP requests sent by this host. */
+ u_long txreplies; /* # of ARP replies sent by this host. */
+ u_long rxrequests; /* # of ARP requests received by this host. */
+ u_long rxreplies; /* # of ARP replies received by this host. */
+ u_long received; /* # of ARP packets received by this host. */
+
+ u_long arp_spares[4]; /* For either the upper or lower half. */
+ /* Abnormal event and error counting: */
+ u_long dropped; /* # of packets dropped waiting for a reply. */
+ u_long timeouts; /* # of times with entries removed */
+ /* due to timeout. */
+ u_long dupips; /* # of duplicate IPs detected. */
+};
+
+/*
+ * In-kernel consumers can use these accessor macros directly to update
+ * stats.
+ */
+#define ARPSTAT_ADD(name, val) V_arpstat.name += (val)
+#define ARPSTAT_SUB(name, val) V_arpstat.name -= (val)
+#define ARPSTAT_INC(name) ARPSTAT_ADD(name, 1)
+#define ARPSTAT_DEC(name) ARPSTAT_SUB(name, 1)
#endif /* !_NET_IF_ARP_H_ */
OpenPOWER on IntegriCloud