mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Make network test contexts consistent with ipv4
Return by value rather than by pointer. Updates #6910. PiperOrigin-RevId: 429408498
This commit is contained in:
committed by
gVisor bot
parent
8dda736af8
commit
a9b5dcd31b
@@ -226,13 +226,13 @@ type testContext struct {
|
||||
s *stack.Stack
|
||||
}
|
||||
|
||||
func newTestContext() *testContext {
|
||||
func newTestContext() testContext {
|
||||
s := stack.New(stack.Options{
|
||||
NetworkProtocols: []stack.NetworkProtocolFactory{ipv4.NewProtocol, ipv6.NewProtocol},
|
||||
TransportProtocols: []stack.TransportProtocolFactory{udp.NewProtocol, tcp.NewProtocol},
|
||||
RawFactory: raw.EndpointFactory{},
|
||||
})
|
||||
return &testContext{s: s}
|
||||
return testContext{s: s}
|
||||
}
|
||||
|
||||
func (ctx *testContext) cleanup() {
|
||||
@@ -240,7 +240,7 @@ func (ctx *testContext) cleanup() {
|
||||
ctx.s.Wait()
|
||||
}
|
||||
|
||||
func buildIPv4Route(ctx *testContext, local, remote tcpip.Address) (*stack.Route, tcpip.Error) {
|
||||
func buildIPv4Route(ctx testContext, local, remote tcpip.Address) (*stack.Route, tcpip.Error) {
|
||||
s := ctx.s
|
||||
s.CreateNIC(nicID, loopback.New())
|
||||
protocolAddr := tcpip.ProtocolAddress{
|
||||
@@ -259,7 +259,7 @@ func buildIPv4Route(ctx *testContext, local, remote tcpip.Address) (*stack.Route
|
||||
return s.FindRoute(nicID, local, remote, ipv4.ProtocolNumber, false /* multicastLoop */)
|
||||
}
|
||||
|
||||
func buildIPv6Route(ctx *testContext, local, remote tcpip.Address) (*stack.Route, tcpip.Error) {
|
||||
func buildIPv6Route(ctx testContext, local, remote tcpip.Address) (*stack.Route, tcpip.Error) {
|
||||
s := ctx.s
|
||||
s.CreateNIC(nicID, loopback.New())
|
||||
protocolAddr := tcpip.ProtocolAddress{
|
||||
|
||||
@@ -124,12 +124,12 @@ type multicastTestContext struct {
|
||||
clock *faketime.ManualClock
|
||||
}
|
||||
|
||||
func newMulticastTestContext(t *testing.T, v4, mgpEnabled bool) *multicastTestContext {
|
||||
func newMulticastTestContext(t *testing.T, v4, mgpEnabled bool) multicastTestContext {
|
||||
t.Helper()
|
||||
|
||||
e := channel.New(maxUnsolicitedReports, header.IPv6MinimumMTU, linkAddr)
|
||||
s, clock := createStackWithLinkEndpoint(t, v4, mgpEnabled, e)
|
||||
return &multicastTestContext{
|
||||
return multicastTestContext{
|
||||
s: s,
|
||||
e: e,
|
||||
clock: clock,
|
||||
|
||||
Reference in New Issue
Block a user