summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/network/internal
diff options
context:
space:
mode:
authorArthur Sfez <asfez@google.com>2021-02-18 12:27:53 -0800
committergVisor bot <gvisor-bot@google.com>2021-02-18 12:29:54 -0800
commit2a2cb29e1cc5c94299b79a3e561d7a6915158ae6 (patch)
treec87faf21bc50374099a54d82249aefe449998986 /pkg/tcpip/network/internal
parent26eada5dea1cce3e0911b1419d1257657378f494 (diff)
Validate IGMP packets
This change also adds support for Router Alert option processing on incoming packets, a new stat for Router Alert option, and exports all the IP-option related stats. Fixes #5491 PiperOrigin-RevId: 358238123
Diffstat (limited to 'pkg/tcpip/network/internal')
-rw-r--r--pkg/tcpip/network/internal/ip/stats.go21
1 files changed, 14 insertions, 7 deletions
diff --git a/pkg/tcpip/network/internal/ip/stats.go b/pkg/tcpip/network/internal/ip/stats.go
index 898f8b356..5f7e60c5c 100644
--- a/pkg/tcpip/network/internal/ip/stats.go
+++ b/pkg/tcpip/network/internal/ip/stats.go
@@ -68,11 +68,17 @@ type MultiCounterIPStats struct {
// Output chain.
IPTablesOutputDropped tcpip.MultiCounterStat
- // OptionTSReceived is the number of Timestamp options seen.
- OptionTSReceived tcpip.MultiCounterStat
+ // TODO(https://gvisor.dev/issues/5529): Move the IPv4-only option stats out
- // OptionRRReceived is the number of Record Route options seen.
- OptionRRReceived tcpip.MultiCounterStat
+ // of IPStats.
+ // OptionTimestampReceived is the number of Timestamp options seen.
+ OptionTimestampReceived tcpip.MultiCounterStat
+
+ // OptionRecordRouteReceived is the number of Record Route options seen.
+ OptionRecordRouteReceived tcpip.MultiCounterStat
+
+ // OptionRouterAlertReceived is the number of Router Alert options seen.
+ OptionRouterAlertReceived tcpip.MultiCounterStat
// OptionUnknownReceived is the number of unknown IP options seen.
OptionUnknownReceived tcpip.MultiCounterStat
@@ -92,9 +98,10 @@ func (m *MultiCounterIPStats) Init(a, b *tcpip.IPStats) {
m.IPTablesPreroutingDropped.Init(a.IPTablesPreroutingDropped, b.IPTablesPreroutingDropped)
m.IPTablesInputDropped.Init(a.IPTablesInputDropped, b.IPTablesInputDropped)
m.IPTablesOutputDropped.Init(a.IPTablesOutputDropped, b.IPTablesOutputDropped)
- m.OptionTSReceived.Init(a.OptionTSReceived, b.OptionTSReceived)
- m.OptionRRReceived.Init(a.OptionRRReceived, b.OptionRRReceived)
+ m.OptionTimestampReceived.Init(a.OptionTimestampReceived, b.OptionTimestampReceived)
+ m.OptionRecordRouteReceived.Init(a.OptionRecordRouteReceived, b.OptionRecordRouteReceived)
+ m.OptionRouterAlertReceived.Init(a.OptionRouterAlertReceived, b.OptionRouterAlertReceived)
m.OptionUnknownReceived.Init(a.OptionUnknownReceived, b.OptionUnknownReceived)
}
-// LINT.ThenChange(:MultiCounterIPStats, ../../tcpip.go:IPStats)
+// LINT.ThenChange(:MultiCounterIPStats, ../../../tcpip.go:IPStats)