summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/tests
diff options
context:
space:
mode:
authorAdin Scannell <ascannell@google.com>2021-01-12 12:36:17 -0800
committergVisor bot <gvisor-bot@google.com>2021-01-12 12:38:22 -0800
commit4e03e87547853523d4ff941935a6ef1712518c61 (patch)
treee930ce0e5f15f7041e7b74daca05acc7afbd2558 /pkg/tcpip/tests
parenta20da708291e2e5bdece5176dce61c1b4b10b7d9 (diff)
Fix simple mistakes identified by goreportcard.
These are primarily simplification and lint mistakes. However, minor fixes are also included and tests added where appropriate. PiperOrigin-RevId: 351425971
Diffstat (limited to 'pkg/tcpip/tests')
-rw-r--r--pkg/tcpip/tests/integration/forward_test.go24
-rw-r--r--pkg/tcpip/tests/integration/link_resolution_test.go8
-rw-r--r--pkg/tcpip/tests/integration/loopback_test.go10
-rw-r--r--pkg/tcpip/tests/integration/multicast_broadcast_test.go10
4 files changed, 26 insertions, 26 deletions
diff --git a/pkg/tcpip/tests/integration/forward_test.go b/pkg/tcpip/tests/integration/forward_test.go
index 60054d6ef..4c2084d19 100644
--- a/pkg/tcpip/tests/integration/forward_test.go
+++ b/pkg/tcpip/tests/integration/forward_test.go
@@ -285,58 +285,58 @@ func TestForwarding(t *testing.T) {
}
host1Stack.SetRouteTable([]tcpip.Route{
- tcpip.Route{
+ {
Destination: host1IPv4Addr.AddressWithPrefix.Subnet(),
NIC: host1NICID,
},
- tcpip.Route{
+ {
Destination: host1IPv6Addr.AddressWithPrefix.Subnet(),
NIC: host1NICID,
},
- tcpip.Route{
+ {
Destination: host2IPv4Addr.AddressWithPrefix.Subnet(),
Gateway: routerNIC1IPv4Addr.AddressWithPrefix.Address,
NIC: host1NICID,
},
- tcpip.Route{
+ {
Destination: host2IPv6Addr.AddressWithPrefix.Subnet(),
Gateway: routerNIC1IPv6Addr.AddressWithPrefix.Address,
NIC: host1NICID,
},
})
routerStack.SetRouteTable([]tcpip.Route{
- tcpip.Route{
+ {
Destination: routerNIC1IPv4Addr.AddressWithPrefix.Subnet(),
NIC: routerNICID1,
},
- tcpip.Route{
+ {
Destination: routerNIC1IPv6Addr.AddressWithPrefix.Subnet(),
NIC: routerNICID1,
},
- tcpip.Route{
+ {
Destination: routerNIC2IPv4Addr.AddressWithPrefix.Subnet(),
NIC: routerNICID2,
},
- tcpip.Route{
+ {
Destination: routerNIC2IPv6Addr.AddressWithPrefix.Subnet(),
NIC: routerNICID2,
},
})
host2Stack.SetRouteTable([]tcpip.Route{
- tcpip.Route{
+ {
Destination: host2IPv4Addr.AddressWithPrefix.Subnet(),
NIC: host2NICID,
},
- tcpip.Route{
+ {
Destination: host2IPv6Addr.AddressWithPrefix.Subnet(),
NIC: host2NICID,
},
- tcpip.Route{
+ {
Destination: host1IPv4Addr.AddressWithPrefix.Subnet(),
Gateway: routerNIC2IPv4Addr.AddressWithPrefix.Address,
NIC: host2NICID,
},
- tcpip.Route{
+ {
Destination: host1IPv6Addr.AddressWithPrefix.Subnet(),
Gateway: routerNIC2IPv6Addr.AddressWithPrefix.Address,
NIC: host2NICID,
diff --git a/pkg/tcpip/tests/integration/link_resolution_test.go b/pkg/tcpip/tests/integration/link_resolution_test.go
index 209da3903..b4bffaec1 100644
--- a/pkg/tcpip/tests/integration/link_resolution_test.go
+++ b/pkg/tcpip/tests/integration/link_resolution_test.go
@@ -154,21 +154,21 @@ func TestPing(t *testing.T) {
}
host1Stack.SetRouteTable([]tcpip.Route{
- tcpip.Route{
+ {
Destination: ipv4Addr1.AddressWithPrefix.Subnet(),
NIC: host1NICID,
},
- tcpip.Route{
+ {
Destination: ipv6Addr1.AddressWithPrefix.Subnet(),
NIC: host1NICID,
},
})
host2Stack.SetRouteTable([]tcpip.Route{
- tcpip.Route{
+ {
Destination: ipv4Addr2.AddressWithPrefix.Subnet(),
NIC: host2NICID,
},
- tcpip.Route{
+ {
Destination: ipv6Addr2.AddressWithPrefix.Subnet(),
NIC: host2NICID,
},
diff --git a/pkg/tcpip/tests/integration/loopback_test.go b/pkg/tcpip/tests/integration/loopback_test.go
index cf9e86c3c..cb6169cfc 100644
--- a/pkg/tcpip/tests/integration/loopback_test.go
+++ b/pkg/tcpip/tests/integration/loopback_test.go
@@ -198,11 +198,11 @@ func TestLoopbackAcceptAllInSubnetUDP(t *testing.T) {
t.Fatalf("AddProtocolAddress(%d, %+v): %s", nicID, test.addAddress, err)
}
s.SetRouteTable([]tcpip.Route{
- tcpip.Route{
+ {
Destination: header.IPv4EmptySubnet,
NIC: nicID,
},
- tcpip.Route{
+ {
Destination: header.IPv6EmptySubnet,
NIC: nicID,
},
@@ -291,7 +291,7 @@ func TestLoopbackSubnetLifetimeBoundToAddr(t *testing.T) {
t.Fatalf("s.AddProtocolAddress(%d, %#v): %s", nicID, protoAddr, err)
}
s.SetRouteTable([]tcpip.Route{
- tcpip.Route{
+ {
Destination: header.IPv4EmptySubnet,
NIC: nicID,
},
@@ -429,11 +429,11 @@ func TestLoopbackAcceptAllInSubnetTCP(t *testing.T) {
t.Fatalf("AddProtocolAddress(%d, %#v): %s", nicID, test.addAddress, err)
}
s.SetRouteTable([]tcpip.Route{
- tcpip.Route{
+ {
Destination: header.IPv4EmptySubnet,
NIC: nicID,
},
- tcpip.Route{
+ {
Destination: header.IPv6EmptySubnet,
NIC: nicID,
},
diff --git a/pkg/tcpip/tests/integration/multicast_broadcast_test.go b/pkg/tcpip/tests/integration/multicast_broadcast_test.go
index fae6c256a..b42375695 100644
--- a/pkg/tcpip/tests/integration/multicast_broadcast_test.go
+++ b/pkg/tcpip/tests/integration/multicast_broadcast_test.go
@@ -166,11 +166,11 @@ func TestPingMulticastBroadcast(t *testing.T) {
// Default routes for IPv4 and IPv6 so ICMP can find a route to the remote
// node when attempting to send the ICMP Echo Reply.
s.SetRouteTable([]tcpip.Route{
- tcpip.Route{
+ {
Destination: header.IPv6EmptySubnet,
NIC: nicID,
},
- tcpip.Route{
+ {
Destination: header.IPv4EmptySubnet,
NIC: nicID,
},
@@ -530,7 +530,7 @@ func TestReuseAddrAndBroadcast(t *testing.T) {
}
s.SetRouteTable([]tcpip.Route{
- tcpip.Route{
+ {
// We use the empty subnet instead of just the loopback subnet so we
// also have a route to the IPv4 Broadcast address.
Destination: header.IPv4EmptySubnet,
@@ -699,11 +699,11 @@ func TestUDPAddRemoveMembershipSocketOption(t *testing.T) {
// routable to the multicast address when the NIC isn't specified.
if !subTest.specifyNICID && !subTest.specifyNICAddr {
s.SetRouteTable([]tcpip.Route{
- tcpip.Route{
+ {
Destination: header.IPv6EmptySubnet,
NIC: nicID,
},
- tcpip.Route{
+ {
Destination: header.IPv4EmptySubnet,
NIC: nicID,
},