Refactor HandleControlPacket/SockError

...to remove the need for the transport layer to deduce the type of
error it received.

Rename HandleControlPacket to HandleError as HandleControlPacket only
handles errors.

tcpip.SockError now holds a tcpip.SockErrorCause interface that
different errors can implement.

PiperOrigin-RevId: 354994306
This commit is contained in:
Ghanan Gowripalan
2021-02-01 12:04:03 -08:00
committed by gVisor bot
parent cbcebfea80
commit ebd3912c0f
19 changed files with 614 additions and 199 deletions
+2 -2
View File
@@ -2666,9 +2666,9 @@ func (s *socketOpsCommon) dequeueErr() *tcpip.SockError {
}
// Update socket error to reflect ICMP errors in queue.
if nextErr := so.PeekErr(); nextErr != nil && nextErr.ErrOrigin.IsICMPErr() {
if nextErr := so.PeekErr(); nextErr != nil && nextErr.Cause.Origin().IsICMPErr() {
so.SetLastError(nextErr.Err)
} else if err.ErrOrigin.IsICMPErr() {
} else if err.Cause.Origin().IsICMPErr() {
so.SetLastError(nil)
}
return err