mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
[syserror] Change syserror to linuxerr for E2BIG, EADDRINUSE, and EINVAL
Remove three syserror entries duplicated in linuxerr. Because of the linuxerr.Equals method, this is a mere change of return values from syserror to linuxerr definitions. Done with only these three errnos as CLs removing all grow to a significantly large size. PiperOrigin-RevId: 382173835
This commit is contained in:
committed by
gVisor bot
parent
d205926f23
commit
54b71221c0
@@ -18,6 +18,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/abi/linux"
|
||||
"gvisor.dev/gvisor/pkg/errors/linuxerr"
|
||||
"gvisor.dev/gvisor/pkg/log"
|
||||
"gvisor.dev/gvisor/pkg/sentry/inet"
|
||||
"gvisor.dev/gvisor/pkg/syserr"
|
||||
@@ -110,19 +111,19 @@ func convertAddr(addr inet.InterfaceAddr) (tcpip.ProtocolAddress, error) {
|
||||
switch addr.Family {
|
||||
case linux.AF_INET:
|
||||
if len(addr.Addr) != header.IPv4AddressSize {
|
||||
return protocolAddress, syserror.EINVAL
|
||||
return protocolAddress, linuxerr.EINVAL
|
||||
}
|
||||
if addr.PrefixLen > header.IPv4AddressSize*8 {
|
||||
return protocolAddress, syserror.EINVAL
|
||||
return protocolAddress, linuxerr.EINVAL
|
||||
}
|
||||
protocol = ipv4.ProtocolNumber
|
||||
address = tcpip.Address(addr.Addr)
|
||||
case linux.AF_INET6:
|
||||
if len(addr.Addr) != header.IPv6AddressSize {
|
||||
return protocolAddress, syserror.EINVAL
|
||||
return protocolAddress, linuxerr.EINVAL
|
||||
}
|
||||
if addr.PrefixLen > header.IPv6AddressSize*8 {
|
||||
return protocolAddress, syserror.EINVAL
|
||||
return protocolAddress, linuxerr.EINVAL
|
||||
}
|
||||
protocol = ipv6.ProtocolNumber
|
||||
address = tcpip.Address(addr.Addr)
|
||||
|
||||
@@ -16,7 +16,7 @@ package netstack
|
||||
|
||||
import (
|
||||
"gvisor.dev/gvisor/pkg/abi/linux"
|
||||
"gvisor.dev/gvisor/pkg/syserror"
|
||||
"gvisor.dev/gvisor/pkg/errors/linuxerr"
|
||||
"gvisor.dev/gvisor/pkg/tcpip/link/tun"
|
||||
)
|
||||
|
||||
@@ -41,7 +41,7 @@ func LinuxToTUNFlags(flags uint16) (tun.Flags, error) {
|
||||
// when there is no sk_filter. See __tun_chr_ioctl() in
|
||||
// net/drivers/tun.c.
|
||||
if flags&^uint16(linux.IFF_TUN|linux.IFF_TAP|linux.IFF_NO_PI|linux.IFF_ONE_QUEUE) != 0 {
|
||||
return tun.Flags{}, syserror.EINVAL
|
||||
return tun.Flags{}, linuxerr.EINVAL
|
||||
}
|
||||
return tun.Flags{
|
||||
TUN: flags&linux.IFF_TUN != 0,
|
||||
|
||||
Reference in New Issue
Block a user