summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/transport/ping
diff options
context:
space:
mode:
authorIan Gudger <igudger@google.com>2018-12-06 11:40:39 -0800
committerShentubot <shentubot@google.com>2018-12-06 11:41:33 -0800
commit000fa84a3bb1aebeda235c56545c942d7c29003d (patch)
tree9026936e4d865c118b6903f3cd1c32dc4ea701e8 /pkg/tcpip/transport/ping
parent685eaf119ffa6c44c4dcaec0e083bbdc0271231a (diff)
Fix tcpip.Endpoint.Write contract regarding short writes
* Clarify tcpip.Endpoint.Write contract regarding short writes. * Enforce tcpip.Endpoint.Write contract regarding short writes. * Update relevant users of tcpip.Endpoint.Write. PiperOrigin-RevId: 224377586 Change-Id: I24299ecce902eb11317ee13dae3b8d8a7c5b097d
Diffstat (limited to 'pkg/tcpip/transport/ping')
-rw-r--r--pkg/tcpip/transport/ping/endpoint.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/tcpip/transport/ping/endpoint.go b/pkg/tcpip/transport/ping/endpoint.go
index b3f54cfe0..10d4d138e 100644
--- a/pkg/tcpip/transport/ping/endpoint.go
+++ b/pkg/tcpip/transport/ping/endpoint.go
@@ -299,7 +299,11 @@ func (e *endpoint) Write(p tcpip.Payload, opts tcpip.WriteOptions) (uintptr, <-c
err = sendPing6(route, e.id.LocalPort, v)
}
- return uintptr(len(v)), nil, err
+ if err != nil {
+ return 0, nil, err
+ }
+
+ return uintptr(len(v)), nil, nil
}
// Peek only returns data from a single datagram, so do nothing here.