summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/network
diff options
context:
space:
mode:
authorNick Brown <nickbrow@google.com>2021-10-27 10:03:11 -0700
committergVisor bot <gvisor-bot@google.com>2021-10-27 10:06:55 -0700
commit22a6a37079c69129d10abfbdd6fdfdf7a9d4a68d (patch)
tree6c19c8844d062db058f9fe02840ed4c69387314d /pkg/tcpip/network
parent7b8f19dc76a9fecbf4d2e5f43a47c6d47d53e100 (diff)
Record counts of packets with unknown L3/L4 numbers
Previously, we recorded a single aggregated count. These per-protocol counts can help us debug field issues when frames are dropped for this reason. PiperOrigin-RevId: 405913911
Diffstat (limited to 'pkg/tcpip/network')
-rw-r--r--pkg/tcpip/network/arp/stats_test.go5
-rw-r--r--pkg/tcpip/network/ipv4/stats_test.go15
-rw-r--r--pkg/tcpip/network/ipv6/ipv6_test.go10
3 files changed, 24 insertions, 6 deletions
diff --git a/pkg/tcpip/network/arp/stats_test.go b/pkg/tcpip/network/arp/stats_test.go
index 0df39ae81..c7d97afec 100644
--- a/pkg/tcpip/network/arp/stats_test.go
+++ b/pkg/tcpip/network/arp/stats_test.go
@@ -45,7 +45,10 @@ func TestMultiCounterStatsInitialization(t *testing.T) {
// expected to be bound by a MultiCounterStat.
refStack := s.Stats()
refEP := ep.stats.localStats
- if err := testutil.ValidateMultiCounterStats(reflect.ValueOf(&ep.stats.arp).Elem(), []reflect.Value{reflect.ValueOf(&refEP.ARP).Elem(), reflect.ValueOf(&refStack.ARP).Elem()}); err != nil {
+ if err := testutil.ValidateMultiCounterStats(reflect.ValueOf(&ep.stats.arp).Elem(), []reflect.Value{reflect.ValueOf(&refEP.ARP).Elem(), reflect.ValueOf(&refStack.ARP).Elem()}, testutil.ValidateMultiCounterStatsOptions{
+ ExpectMultiCounterStat: true,
+ ExpectMultiIntegralStatCounterMap: false,
+ }); err != nil {
t.Error(err)
}
}
diff --git a/pkg/tcpip/network/ipv4/stats_test.go b/pkg/tcpip/network/ipv4/stats_test.go
index d1f9e3cf5..15a056d4b 100644
--- a/pkg/tcpip/network/ipv4/stats_test.go
+++ b/pkg/tcpip/network/ipv4/stats_test.go
@@ -87,13 +87,22 @@ func TestMultiCounterStatsInitialization(t *testing.T) {
// expected to be bound by a MultiCounterStat.
refStack := s.Stats()
refEP := ep.stats.localStats
- if err := testutil.ValidateMultiCounterStats(reflect.ValueOf(&ep.stats.ip).Elem(), []reflect.Value{reflect.ValueOf(&refEP.IP).Elem(), reflect.ValueOf(&refStack.IP).Elem()}); err != nil {
+ if err := testutil.ValidateMultiCounterStats(reflect.ValueOf(&ep.stats.ip).Elem(), []reflect.Value{reflect.ValueOf(&refEP.IP).Elem(), reflect.ValueOf(&refStack.IP).Elem()}, testutil.ValidateMultiCounterStatsOptions{
+ ExpectMultiCounterStat: true,
+ ExpectMultiIntegralStatCounterMap: false,
+ }); err != nil {
t.Error(err)
}
- if err := testutil.ValidateMultiCounterStats(reflect.ValueOf(&ep.stats.icmp).Elem(), []reflect.Value{reflect.ValueOf(&refEP.ICMP).Elem(), reflect.ValueOf(&refStack.ICMP.V4).Elem()}); err != nil {
+ if err := testutil.ValidateMultiCounterStats(reflect.ValueOf(&ep.stats.icmp).Elem(), []reflect.Value{reflect.ValueOf(&refEP.ICMP).Elem(), reflect.ValueOf(&refStack.ICMP.V4).Elem()}, testutil.ValidateMultiCounterStatsOptions{
+ ExpectMultiCounterStat: true,
+ ExpectMultiIntegralStatCounterMap: false,
+ }); err != nil {
t.Error(err)
}
- if err := testutil.ValidateMultiCounterStats(reflect.ValueOf(&ep.stats.igmp).Elem(), []reflect.Value{reflect.ValueOf(&refEP.IGMP).Elem(), reflect.ValueOf(&refStack.IGMP).Elem()}); err != nil {
+ if err := testutil.ValidateMultiCounterStats(reflect.ValueOf(&ep.stats.igmp).Elem(), []reflect.Value{reflect.ValueOf(&refEP.IGMP).Elem(), reflect.ValueOf(&refStack.IGMP).Elem()}, testutil.ValidateMultiCounterStatsOptions{
+ ExpectMultiCounterStat: true,
+ ExpectMultiIntegralStatCounterMap: false,
+ }); err != nil {
t.Error(err)
}
}
diff --git a/pkg/tcpip/network/ipv6/ipv6_test.go b/pkg/tcpip/network/ipv6/ipv6_test.go
index e5286081e..9e08b5318 100644
--- a/pkg/tcpip/network/ipv6/ipv6_test.go
+++ b/pkg/tcpip/network/ipv6/ipv6_test.go
@@ -3515,10 +3515,16 @@ func TestMultiCounterStatsInitialization(t *testing.T) {
// supposed to be bound.
refStack := s.Stats()
refEP := ep.stats.localStats
- if err := testutil.ValidateMultiCounterStats(reflect.ValueOf(&ep.stats.ip).Elem(), []reflect.Value{reflect.ValueOf(&refStack.IP).Elem(), reflect.ValueOf(&refEP.IP).Elem()}); err != nil {
+ if err := testutil.ValidateMultiCounterStats(reflect.ValueOf(&ep.stats.ip).Elem(), []reflect.Value{reflect.ValueOf(&refStack.IP).Elem(), reflect.ValueOf(&refEP.IP).Elem()}, testutil.ValidateMultiCounterStatsOptions{
+ ExpectMultiCounterStat: true,
+ ExpectMultiIntegralStatCounterMap: false,
+ }); err != nil {
t.Error(err)
}
- if err := testutil.ValidateMultiCounterStats(reflect.ValueOf(&ep.stats.icmp).Elem(), []reflect.Value{reflect.ValueOf(&refStack.ICMP.V6).Elem(), reflect.ValueOf(&refEP.ICMP).Elem()}); err != nil {
+ if err := testutil.ValidateMultiCounterStats(reflect.ValueOf(&ep.stats.icmp).Elem(), []reflect.Value{reflect.ValueOf(&refStack.ICMP.V6).Elem(), reflect.ValueOf(&refEP.ICMP).Elem()}, testutil.ValidateMultiCounterStatsOptions{
+ ExpectMultiCounterStat: true,
+ ExpectMultiIntegralStatCounterMap: false,
+ }); err != nil {
t.Error(err)
}
}