summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-04-01 02:55:29 +0000
committergVisor bot <gvisor-bot@google.com>2020-04-01 02:55:29 +0000
commitbbba7a4527f117b6e4a3fe64e816b3e9ef4a6300 (patch)
treed2313744450dd547f44fc1677601bd6bb9b2eaa4 /pkg
parent3fa968f7a5d62f5d667925e5fe579634b38520a4 (diff)
parentd25036ad17a3ada7fa6ce9900f20e246e07acd2f (diff)
Merge release-20200323.0-44-gd25036a (automated)
Diffstat (limited to 'pkg')
-rw-r--r--pkg/tcpip/header/udp.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/tcpip/header/udp.go b/pkg/tcpip/header/udp.go
index 74412c894..9339d637f 100644
--- a/pkg/tcpip/header/udp.go
+++ b/pkg/tcpip/header/udp.go
@@ -99,6 +99,11 @@ func (b UDP) SetChecksum(checksum uint16) {
binary.BigEndian.PutUint16(b[udpChecksum:], checksum)
}
+// SetLength sets the "length" field of the udp header.
+func (b UDP) SetLength(length uint16) {
+ binary.BigEndian.PutUint16(b[udpLength:], length)
+}
+
// CalculateChecksum calculates the checksum of the udp packet, given the
// checksum of the network-layer pseudo-header and the checksum of the payload.
func (b UDP) CalculateChecksum(partialChecksum uint16) uint16 {