diff options
author | Sam Balana <sbalana@google.com> | 2021-05-27 16:16:29 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-05-27 16:19:00 -0700 |
commit | 121af37738525a629ecc11863b7454b67c0f4117 (patch) | |
tree | 16ab7bc5c0d2528482264f15f3daf524a38af866 /test/packetimpact/testbench/layers.go | |
parent | 17df2df75ca092342a29694739d6fbe3bf95b770 (diff) |
Support SO_BINDTODEVICE in ICMP sockets
Adds support for the SO_BINDTODEVICE socket option in ICMP sockets with an
accompanying packetimpact test to exercise use of this socket option.
Adds a unit test to exercise the NIC selection logic introduced by this change.
The remaining unit tests for ICMP sockets need to be added in a subsequent CL.
See https://gvisor.dev/issues/5623 for the list of remaining unit tests.
Adds a "timeout" field to PacketimpactTestInfo, necessary due to the long
runtime of the newly added packetimpact test.
Fixes #5678
Fixes #4896
Updates #5623
Updates #5681
Updates #5763
Updates #5956
Updates #5966
Updates #5967
PiperOrigin-RevId: 376271581
Diffstat (limited to 'test/packetimpact/testbench/layers.go')
-rw-r--r-- | test/packetimpact/testbench/layers.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/packetimpact/testbench/layers.go b/test/packetimpact/testbench/layers.go index ef8b63db4..078f500e4 100644 --- a/test/packetimpact/testbench/layers.go +++ b/test/packetimpact/testbench/layers.go @@ -824,6 +824,7 @@ type ICMPv6 struct { Type *header.ICMPv6Type Code *header.ICMPv6Code Checksum *uint16 + Ident *uint16 // Only in Echo Request/Reply. Pointer *uint32 // Only in Parameter Problem. Payload []byte } @@ -849,6 +850,10 @@ func (l *ICMPv6) ToBytes() ([]byte, error) { } typ := h.Type() switch typ { + case header.ICMPv6EchoRequest, header.ICMPv6EchoReply: + if l.Ident != nil { + h.SetIdent(*l.Ident) + } case header.ICMPv6ParamProblem: if l.Pointer != nil { h.SetTypeSpecific(*l.Pointer) @@ -899,6 +904,8 @@ func parseICMPv6(b []byte) (Layer, layerParser) { Payload: h.Payload(), } switch msgType { + case header.ICMPv6EchoRequest, header.ICMPv6EchoReply: + icmpv6.Ident = Uint16(h.Ident()) case header.ICMPv6ParamProblem: icmpv6.Pointer = Uint32(h.TypeSpecific()) } |