1
0
mirror of https://github.com/golang/go synced 2024-11-17 16:14:42 -07:00

net: use IFF_* consts from package syscall on solaris

All necessary IFF_* consts are available in the syscall package. Use
them in linkFlags instead of duplicating them.

Change-Id: Ibd2b0f6f39f98bfad2a0c8c55d1eb64167aeee03
Reviewed-on: https://go-review.googlesource.com/c/go/+/255497
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Tobias Klauser 2020-09-17 16:05:52 +02:00 committed by Tobias Klauser
parent 22053790fa
commit e6426dfd6d

View File

@ -32,39 +32,21 @@ func interfaceTable(ifindex int) ([]Interface, error) {
return ift, nil
}
const (
sysIFF_UP = 0x1
sysIFF_BROADCAST = 0x2
sysIFF_DEBUG = 0x4
sysIFF_LOOPBACK = 0x8
sysIFF_POINTOPOINT = 0x10
sysIFF_NOTRAILERS = 0x20
sysIFF_RUNNING = 0x40
sysIFF_NOARP = 0x80
sysIFF_PROMISC = 0x100
sysIFF_ALLMULTI = 0x200
sysIFF_INTELLIGENT = 0x400
sysIFF_MULTICAST = 0x800
sysIFF_MULTI_BCAST = 0x1000
sysIFF_UNNUMBERED = 0x2000
sysIFF_PRIVATE = 0x8000
)
func linkFlags(rawFlags int) Flags {
var f Flags
if rawFlags&sysIFF_UP != 0 {
if rawFlags&syscall.IFF_UP != 0 {
f |= FlagUp
}
if rawFlags&sysIFF_BROADCAST != 0 {
if rawFlags&syscall.IFF_BROADCAST != 0 {
f |= FlagBroadcast
}
if rawFlags&sysIFF_LOOPBACK != 0 {
if rawFlags&syscall.IFF_LOOPBACK != 0 {
f |= FlagLoopback
}
if rawFlags&sysIFF_POINTOPOINT != 0 {
if rawFlags&syscall.IFF_POINTOPOINT != 0 {
f |= FlagPointToPoint
}
if rawFlags&sysIFF_MULTICAST != 0 {
if rawFlags&syscall.IFF_MULTICAST != 0 {
f |= FlagMulticast
}
return f