summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/tests/utils
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/tcpip/tests/utils')
-rw-r--r--pkg/tcpip/tests/utils/utils.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/pkg/tcpip/tests/utils/utils.go b/pkg/tcpip/tests/utils/utils.go
index 654309584..bf6c69e3b 100644
--- a/pkg/tcpip/tests/utils/utils.go
+++ b/pkg/tcpip/tests/utils/utils.go
@@ -370,9 +370,11 @@ func rxICMPv4Echo(e *channel.Endpoint, src, dst tcpip.Address, ttl uint8, ty hea
})
ip.SetChecksum(^ip.CalculateChecksum())
- e.InjectInbound(header.IPv4ProtocolNumber, stack.NewPacketBuffer(stack.PacketBufferOptions{
+ newPkt := stack.NewPacketBuffer(stack.PacketBufferOptions{
Data: hdr.View().ToVectorisedView(),
- }))
+ })
+ defer newPkt.DecRef()
+ e.InjectInbound(header.IPv4ProtocolNumber, newPkt)
}
// RxICMPv4EchoRequest constructs and injects an ICMPv4 echo request packet on
@@ -408,9 +410,11 @@ func rxICMPv6Echo(e *channel.Endpoint, src, dst tcpip.Address, ttl uint8, ty hea
DstAddr: dst,
})
- e.InjectInbound(header.IPv6ProtocolNumber, stack.NewPacketBuffer(stack.PacketBufferOptions{
+ newPkt := stack.NewPacketBuffer(stack.PacketBufferOptions{
Data: hdr.View().ToVectorisedView(),
- }))
+ })
+ defer newPkt.DecRef()
+ e.InjectInbound(header.IPv6ProtocolNumber, newPkt)
}
// RxICMPv6EchoRequest constructs and injects an ICMPv6 echo request packet on