diff options
author | Arthur Sfez <asfez@google.com> | 2021-01-19 15:05:17 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-01-19 15:07:39 -0800 |
commit | be17b94446b2f96c2a3d531fe20271537c77c8aa (patch) | |
tree | 1274841ecbb71f37195676354908deea9bf0d24c /pkg/tcpip/network/arp | |
parent | 833ba3590b422d453012e5b2ec2e780211d9caf9 (diff) |
Per NIC NetworkEndpoint statistics
To facilitate the debugging of multi-homed setup, track Network
protocols statistics for each endpoint. Note that the original
stack-wide stats still exist.
A new type of statistic counter is introduced, which track two
versions of a stat at the same time. This lets a network endpoint
increment both the local stat and the stack-wide stat at the same
time.
Fixes #4605
PiperOrigin-RevId: 352663276
Diffstat (limited to 'pkg/tcpip/network/arp')
-rw-r--r-- | pkg/tcpip/network/arp/arp.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pkg/tcpip/network/arp/arp.go b/pkg/tcpip/network/arp/arp.go index d54e7fe86..1d4d2966e 100644 --- a/pkg/tcpip/network/arp/arp.go +++ b/pkg/tcpip/network/arp/arp.go @@ -210,6 +210,20 @@ func (e *endpoint) HandlePacket(pkt *stack.PacketBuffer) { } } +// Stats implements stack.NetworkEndpoint. +func (e *endpoint) Stats() stack.NetworkEndpointStats { + // TODO(gvisor.dev/issues/4963): Record statistics for ARP. + return &Stats{} +} + +var _ stack.NetworkEndpointStats = (*Stats)(nil) + +// Stats holds ARP statistics. +type Stats struct{} + +// IsNetworkEndpointStats implements stack.NetworkEndpointStats. +func (*Stats) IsNetworkEndpointStats() {} + // protocol implements stack.NetworkProtocol and stack.LinkAddressResolver. type protocol struct { stack *stack.Stack |