summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/transport/udp
diff options
context:
space:
mode:
authorBruno Dal Bo <brunodalbo@google.com>2020-12-12 09:05:43 -0800
committergVisor bot <gvisor-bot@google.com>2020-12-12 09:07:44 -0800
commit4aef908c92c8530222fe547c154e2ee45a130b1b (patch)
tree299aba0f291b7d46e659b2030f9386e2cf4a139e /pkg/tcpip/transport/udp
parent4b697aae55eacac75f5e9c76aacd40981720c3fd (diff)
Introduce IPv6 extension header serialization facilities
Adds IPv6 extension header serializer and Hop by Hop options serializer. Add RouterAlert option serializer and use it in MLD. Fixed #4996 Startblock: has LGTM from marinaciocea and then add reviewer ghanan PiperOrigin-RevId: 347174537
Diffstat (limited to 'pkg/tcpip/transport/udp')
-rw-r--r--pkg/tcpip/transport/udp/udp_test.go34
1 files changed, 17 insertions, 17 deletions
diff --git a/pkg/tcpip/transport/udp/udp_test.go b/pkg/tcpip/transport/udp/udp_test.go
index cca865b34..08980c298 100644
--- a/pkg/tcpip/transport/udp/udp_test.go
+++ b/pkg/tcpip/transport/udp/udp_test.go
@@ -453,12 +453,12 @@ func (c *testContext) buildV6Packet(payload []byte, h *header4Tuple) buffer.View
// Initialize the IP header.
ip := header.IPv6(buf)
ip.Encode(&header.IPv6Fields{
- TrafficClass: testTOS,
- PayloadLength: uint16(header.UDPMinimumSize + len(payload)),
- NextHeader: uint8(udp.ProtocolNumber),
- HopLimit: 65,
- SrcAddr: h.srcAddr.Addr,
- DstAddr: h.dstAddr.Addr,
+ TrafficClass: testTOS,
+ PayloadLength: uint16(header.UDPMinimumSize + len(payload)),
+ TransportProtocol: udp.ProtocolNumber,
+ HopLimit: 65,
+ SrcAddr: h.srcAddr.Addr,
+ DstAddr: h.dstAddr.Addr,
})
// Initialize the UDP header.
@@ -1494,7 +1494,7 @@ func TestReadRecvOriginalDstAddr(t *testing.T) {
bindAddr := tcpip.FullAddress{Port: stackPort}
if err := c.ep.Bind(bindAddr); err != nil {
- t.Fatalf("Bind(%+v): %s", bindAddr, err)
+ t.Fatalf("Bind(%#v): %s", bindAddr, err)
}
if test.flow.isMulticast() {
@@ -2029,8 +2029,8 @@ func TestV6UnknownDestination(t *testing.T) {
}
// Correct UDP length to access payload.
origDgram.SetLength(uint16(wantPayloadLen + header.UDPMinimumSize))
- if got, want := origDgram.Payload(), payload[:wantPayloadLen]; !bytes.Equal(got, want) {
- t.Fatalf("got origDgram.Payload() = %x, want = %x", got, want)
+ if diff := cmp.Diff(payload[:wantPayloadLen], origDgram.Payload()); diff != "" {
+ t.Fatalf("origDgram.Payload() mismatch (-want +got):\n%s", diff)
}
})
}
@@ -2089,12 +2089,12 @@ func TestShortHeader(t *testing.T) {
// Initialize the IP header.
ip := header.IPv6(buf)
ip.Encode(&header.IPv6Fields{
- TrafficClass: testTOS,
- PayloadLength: uint16(udpSize),
- NextHeader: uint8(udp.ProtocolNumber),
- HopLimit: 65,
- SrcAddr: h.srcAddr.Addr,
- DstAddr: h.dstAddr.Addr,
+ TrafficClass: testTOS,
+ PayloadLength: uint16(udpSize),
+ TransportProtocol: udp.ProtocolNumber,
+ HopLimit: 65,
+ SrcAddr: h.srcAddr.Addr,
+ DstAddr: h.dstAddr.Addr,
})
// Initialize the UDP header.
@@ -2597,12 +2597,12 @@ func TestReceiveShortLength(t *testing.T) {
// Try to receive the data.
v, _, err := c.ep.Read(nil)
if err != nil {
- t.Fatalf("c.ep.Read(..): %s", err)
+ t.Fatalf("c.ep.Read(nil): %s", err)
}
// Check the payload is read back without extra bytes.
if diff := cmp.Diff(buffer.View(payload), v); diff != "" {
- t.Errorf("c.ep.Read(..) mismatch (-want +got):\n%s", diff)
+ t.Errorf("c.ep.Read(nil) mismatch (-want +got):\n%s", diff)
}
})
}