summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/header
diff options
context:
space:
mode:
authorBhasker Hariharan <bhaskerh@google.com>2021-10-21 13:50:08 -0700
committergVisor bot <gvisor-bot@google.com>2021-10-21 13:53:04 -0700
commit207221ffb27f2010c46468d827f1817432df3960 (patch)
treef1c22aa2c0fcc729ce56bdfb5eb592175cb4f621 /pkg/tcpip/header
parentcfcd3eba9f011b73be1f359f6da7af7f2584a089 (diff)
Add an integration test for istio like redirect.
Updates #6441,#6317 PiperOrigin-RevId: 404872327
Diffstat (limited to 'pkg/tcpip/header')
-rw-r--r--pkg/tcpip/header/ipv4.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/tcpip/header/ipv4.go b/pkg/tcpip/header/ipv4.go
index dcc549c7b..7baaf0d17 100644
--- a/pkg/tcpip/header/ipv4.go
+++ b/pkg/tcpip/header/ipv4.go
@@ -208,6 +208,15 @@ var IPv4EmptySubnet = func() tcpip.Subnet {
return subnet
}()
+// IPv4LoopbackSubnet is the loopback subnet for IPv4.
+var IPv4LoopbackSubnet = func() tcpip.Subnet {
+ subnet, err := tcpip.NewSubnet(tcpip.Address("\x7f\x00\x00\x00"), tcpip.AddressMask("\xff\x00\x00\x00"))
+ if err != nil {
+ panic(err)
+ }
+ return subnet
+}()
+
// IPVersion returns the version of IP used in the given packet. It returns -1
// if the packet is not large enough to contain the version field.
func IPVersion(b []byte) int {