Commit 12376c93 authored by Mikio Hara's avatar Mikio Hara Committed by Russ Cox

syscall: add routing messages support for BSD variants

R=rsc
CC=golang-dev
https://golang.org/cl/4539084
parent 86327cdc
...@@ -18,11 +18,13 @@ GOFILES=\ ...@@ -18,11 +18,13 @@ GOFILES=\
GOFILES_freebsd=\ GOFILES_freebsd=\
exec_unix.go\ exec_unix.go\
route_bsd.go\
syscall_bsd.go\ syscall_bsd.go\
syscall_unix.go\ syscall_unix.go\
GOFILES_darwin=\ GOFILES_darwin=\
exec_unix.go\ exec_unix.go\
route_bsd.go\
syscall_bsd.go\ syscall_bsd.go\
syscall_unix.go\ syscall_unix.go\
......
...@@ -54,6 +54,7 @@ includes_Darwin=' ...@@ -54,6 +54,7 @@ includes_Darwin='
#include <sys/wait.h> #include <sys/wait.h>
#include <net/bpf.h> #include <net/bpf.h>
#include <net/if.h> #include <net/if.h>
#include <net/if_types.h>
#include <net/route.h> #include <net/route.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/ip.h> #include <netinet/ip.h>
...@@ -69,6 +70,7 @@ includes_FreeBSD=' ...@@ -69,6 +70,7 @@ includes_FreeBSD='
#include <sys/wait.h> #include <sys/wait.h>
#include <net/bpf.h> #include <net/bpf.h>
#include <net/if.h> #include <net/if.h>
#include <net/if_types.h>
#include <net/route.h> #include <net/route.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/ip.h> #include <netinet/ip.h>
...@@ -140,7 +142,7 @@ done ...@@ -140,7 +142,7 @@ done
$2 !~ "NLA_TYPE_MASK" && $2 !~ "NLA_TYPE_MASK" &&
$2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|RTM|RTN|RTPROT|RTA|RTAX|RTNH|ARPHRD)_/ || $2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|RTM|RTN|RTPROT|RTA|RTAX|RTNH|ARPHRD)_/ ||
$2 ~ /^SIOC/ || $2 ~ /^SIOC/ ||
$2 ~ /^(IFF|NET_RT|RTM|RTF|RTV|RTA|RTAX)_/ || $2 ~ /^(IFF|IFT|NET_RT|RTM|RTF|RTV|RTA|RTAX)_/ ||
$2 ~ /^BIOC/ || $2 ~ /^BIOC/ ||
$2 !~ /^(BPF_TIMEVAL)$/ && $2 !~ /^(BPF_TIMEVAL)$/ &&
$2 ~ /^(BPF|DLT)_/ || $2 ~ /^(BPF|DLT)_/ ||
......
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Routing sockets and messages
package syscall
import (
"unsafe"
)
const darwinAMD64 = OS == "darwin" && ARCH == "amd64"
// Round the length of a raw sockaddr up to align it propery.
func rsaAlignOf(salen int) int {
salign := sizeofPtr
// NOTE: It seems like 64-bit Darwin kernel still requires 32-bit
// aligned access to BSD subsystem.
if darwinAMD64 {
salign = 4
}
if salen == 0 {
return salign
}
return (salen + salign - 1) & ^(salign - 1)
}
// RouteRIB returns routing information base, as known as RIB,
// which consists of network facility information, states and
// parameters.
func RouteRIB(facility, param int) ([]byte, int) {
var (
tab []byte
e int
)
mib := []_C_int{CTL_NET, AF_ROUTE, 0, 0, _C_int(facility), _C_int(param)}
// Find size.
n := uintptr(0)
if e = sysctl(mib, nil, &n, nil, 0); e != 0 {
return nil, e
}
if n == 0 {
return nil, 0
}
tab = make([]byte, n)
if e = sysctl(mib, &tab[0], &n, nil, 0); e != 0 {
return nil, e
}
return tab[:n], 0
}
// RoutingMessage represents a routing message.
type RoutingMessage interface {
sockaddr() []Sockaddr
}
const anyMessageLen = unsafe.Sizeof(anyMessage{})
type anyMessage struct {
Msglen uint16
Version uint8
Type uint8
}
func (any *anyMessage) toRoutingMessage(buf []byte) RoutingMessage {
switch any.Type {
case RTM_ADD, RTM_DELETE, RTM_CHANGE, RTM_GET, RTM_LOSING, RTM_REDIRECT, RTM_MISS, RTM_LOCK, RTM_RESOLVE:
p := (*RouteMessage)(unsafe.Pointer(any))
rtm := &RouteMessage{}
rtm.Header = p.Header
rtm.Data = buf[SizeofRtMsghdr:any.Msglen]
return rtm
case RTM_IFINFO:
p := (*InterfaceMessage)(unsafe.Pointer(any))
ifm := &InterfaceMessage{}
ifm.Header = p.Header
ifm.Data = buf[SizeofIfMsghdr:any.Msglen]
return ifm
case RTM_NEWADDR, RTM_DELADDR:
p := (*InterfaceAddrMessage)(unsafe.Pointer(any))
ifam := &InterfaceAddrMessage{}
ifam.Header = p.Header
ifam.Data = buf[SizeofIfaMsghdr:any.Msglen]
return ifam
case RTM_NEWMADDR, RTM_DELMADDR:
// TODO: implement this in the near future
}
return nil
}
// RouteMessage represents a routing message containing routing
// entries.
type RouteMessage struct {
Header RtMsghdr
Data []byte
}
func (m *RouteMessage) sockaddr() (sas []Sockaddr) {
// TODO: implement this in the near future
return nil
}
// InterfaceMessage represents a routing message containing
// network interface entries.
type InterfaceMessage struct {
Header IfMsghdr
Data []byte
}
func (m *InterfaceMessage) sockaddr() (sas []Sockaddr) {
if m.Header.Addrs&RTA_IFP == 0 {
return nil
}
sa, e := anyToSockaddr((*RawSockaddrAny)(unsafe.Pointer(&m.Data[0])))
if e != 0 {
return nil
}
return append(sas, sa)
}
// InterfaceAddrMessage represents a routing message containing
// network interface address entries.
type InterfaceAddrMessage struct {
Header IfaMsghdr
Data []byte
}
const rtaMask = RTA_IFA | RTA_NETMASK | RTA_BRD
func (m *InterfaceAddrMessage) sockaddr() (sas []Sockaddr) {
if m.Header.Addrs&rtaMask == 0 {
return nil
}
buf := m.Data[:]
for i := uint(0); i < RTAX_MAX; i++ {
if m.Header.Addrs&rtaMask&(1<<i) == 0 {
continue
}
rsa := (*RawSockaddr)(unsafe.Pointer(&buf[0]))
switch i {
case RTAX_IFA:
sa, e := anyToSockaddr((*RawSockaddrAny)(unsafe.Pointer(rsa)))
if e != 0 {
return nil
}
sas = append(sas, sa)
case RTAX_NETMASK, RTAX_BRD:
// nothing to do
}
buf = buf[rsaAlignOf(int(rsa.Len)):]
}
return sas
}
// ParseRoutingMessage parses buf as routing messages and returns
// the slice containing the RoutingMessage interfaces.
func ParseRoutingMessage(buf []byte) (msgs []RoutingMessage, errno int) {
for len(buf) >= anyMessageLen {
any := (*anyMessage)(unsafe.Pointer(&buf[0]))
if any.Version != RTM_VERSION {
return nil, EINVAL
}
msgs = append(msgs, any.toRoutingMessage(buf))
buf = buf[any.Msglen:]
}
return msgs, 0
}
// ParseRoutingMessage parses msg's payload as raw sockaddrs and
// returns the slice containing the Sockaddr interfaces.
func ParseRoutingSockaddr(msg RoutingMessage) (sas []Sockaddr, errno int) {
return append(sas, msg.sockaddr()...), 0
}
...@@ -519,27 +519,6 @@ func SysctlUint32(name string) (value uint32, errno int) { ...@@ -519,27 +519,6 @@ func SysctlUint32(name string) (value uint32, errno int) {
return *(*uint32)(unsafe.Pointer(&buf[0])), 0 return *(*uint32)(unsafe.Pointer(&buf[0])), 0
} }
func SysctlNetRoute(fourth, fifth, sixth int) (value []byte, errno int) {
mib := []_C_int{CTL_NET, AF_ROUTE, 0, _C_int(fourth), _C_int(fifth), _C_int(sixth)}
// Find size.
n := uintptr(0)
if errno = sysctl(mib, nil, &n, nil, 0); errno != 0 {
return nil, errno
}
if n == 0 {
return nil, 0
}
// Read into buffer of that size.
b := make([]byte, n)
if errno = sysctl(mib, &b[0], &n, nil, 0); errno != 0 {
return nil, errno
}
return b[0:n], 0
}
//sys utimes(path string, timeval *[2]Timeval) (errno int) //sys utimes(path string, timeval *[2]Timeval) (errno int)
func Utimes(path string, tv []Timeval) (errno int) { func Utimes(path string, tv []Timeval) (errno int) {
if len(tv) != 2 { if len(tv) != 2 {
......
...@@ -339,6 +339,72 @@ const ( ...@@ -339,6 +339,72 @@ const (
IFF_SIMPLEX = 0x800 IFF_SIMPLEX = 0x800
IFF_UP = 0x1 IFF_UP = 0x1
IFNAMSIZ = 0x10 IFNAMSIZ = 0x10
IFT_1822 = 0x2
IFT_AAL5 = 0x31
IFT_ARCNET = 0x23
IFT_ARCNETPLUS = 0x24
IFT_ATM = 0x25
IFT_BRIDGE = 0xd1
IFT_CARP = 0xf8
IFT_CEPT = 0x13
IFT_DS3 = 0x1e
IFT_ENC = 0xf4
IFT_EON = 0x19
IFT_ETHER = 0x6
IFT_FAITH = 0x38
IFT_FDDI = 0xf
IFT_FRELAY = 0x20
IFT_FRELAYDCE = 0x2c
IFT_GIF = 0x37
IFT_HDH1822 = 0x3
IFT_HIPPI = 0x2f
IFT_HSSI = 0x2e
IFT_HY = 0xe
IFT_IEEE1394 = 0x90
IFT_IEEE8023ADLAG = 0x88
IFT_ISDNBASIC = 0x14
IFT_ISDNPRIMARY = 0x15
IFT_ISO88022LLC = 0x29
IFT_ISO88023 = 0x7
IFT_ISO88024 = 0x8
IFT_ISO88025 = 0x9
IFT_ISO88026 = 0xa
IFT_L2VLAN = 0x87
IFT_LAPB = 0x10
IFT_LOCALTALK = 0x2a
IFT_LOOP = 0x18
IFT_MIOX25 = 0x26
IFT_MODEM = 0x30
IFT_NSIP = 0x1b
IFT_OTHER = 0x1
IFT_P10 = 0xc
IFT_P80 = 0xd
IFT_PARA = 0x22
IFT_PDP = 0xff
IFT_PFLOG = 0xf5
IFT_PFSYNC = 0xf6
IFT_PPP = 0x17
IFT_PROPMUX = 0x36
IFT_PROPVIRTUAL = 0x35
IFT_PTPSERIAL = 0x16
IFT_RS232 = 0x21
IFT_SDLC = 0x11
IFT_SIP = 0x1f
IFT_SLIP = 0x1c
IFT_SMDSDXI = 0x2b
IFT_SMDSICIP = 0x34
IFT_SONET = 0x27
IFT_SONETPATH = 0x32
IFT_SONETVT = 0x33
IFT_STARLAN = 0xb
IFT_STF = 0x39
IFT_T1 = 0x12
IFT_ULTRA = 0x1d
IFT_V35 = 0x2d
IFT_X25 = 0x5
IFT_X25DDN = 0x4
IFT_X25PLE = 0x28
IFT_XETHER = 0x1a
IN_CLASSA_HOST = 0xffffff IN_CLASSA_HOST = 0xffffff
IN_CLASSA_MAX = 0x80 IN_CLASSA_MAX = 0x80
IN_CLASSA_NET = 0xff000000 IN_CLASSA_NET = 0xff000000
......
...@@ -339,6 +339,72 @@ const ( ...@@ -339,6 +339,72 @@ const (
IFF_SIMPLEX = 0x800 IFF_SIMPLEX = 0x800
IFF_UP = 0x1 IFF_UP = 0x1
IFNAMSIZ = 0x10 IFNAMSIZ = 0x10
IFT_1822 = 0x2
IFT_AAL5 = 0x31
IFT_ARCNET = 0x23
IFT_ARCNETPLUS = 0x24
IFT_ATM = 0x25
IFT_BRIDGE = 0xd1
IFT_CARP = 0xf8
IFT_CEPT = 0x13
IFT_DS3 = 0x1e
IFT_ENC = 0xf4
IFT_EON = 0x19
IFT_ETHER = 0x6
IFT_FAITH = 0x38
IFT_FDDI = 0xf
IFT_FRELAY = 0x20
IFT_FRELAYDCE = 0x2c
IFT_GIF = 0x37
IFT_HDH1822 = 0x3
IFT_HIPPI = 0x2f
IFT_HSSI = 0x2e
IFT_HY = 0xe
IFT_IEEE1394 = 0x90
IFT_IEEE8023ADLAG = 0x88
IFT_ISDNBASIC = 0x14
IFT_ISDNPRIMARY = 0x15
IFT_ISO88022LLC = 0x29
IFT_ISO88023 = 0x7
IFT_ISO88024 = 0x8
IFT_ISO88025 = 0x9
IFT_ISO88026 = 0xa
IFT_L2VLAN = 0x87
IFT_LAPB = 0x10
IFT_LOCALTALK = 0x2a
IFT_LOOP = 0x18
IFT_MIOX25 = 0x26
IFT_MODEM = 0x30
IFT_NSIP = 0x1b
IFT_OTHER = 0x1
IFT_P10 = 0xc
IFT_P80 = 0xd
IFT_PARA = 0x22
IFT_PDP = 0xff
IFT_PFLOG = 0xf5
IFT_PFSYNC = 0xf6
IFT_PPP = 0x17
IFT_PROPMUX = 0x36
IFT_PROPVIRTUAL = 0x35
IFT_PTPSERIAL = 0x16
IFT_RS232 = 0x21
IFT_SDLC = 0x11
IFT_SIP = 0x1f
IFT_SLIP = 0x1c
IFT_SMDSDXI = 0x2b
IFT_SMDSICIP = 0x34
IFT_SONET = 0x27
IFT_SONETPATH = 0x32
IFT_SONETVT = 0x33
IFT_STARLAN = 0xb
IFT_STF = 0x39
IFT_T1 = 0x12
IFT_ULTRA = 0x1d
IFT_V35 = 0x2d
IFT_X25 = 0x5
IFT_X25DDN = 0x4
IFT_X25PLE = 0x28
IFT_XETHER = 0x1a
IN_CLASSA_HOST = 0xffffff IN_CLASSA_HOST = 0xffffff
IN_CLASSA_MAX = 0x80 IN_CLASSA_MAX = 0x80
IN_CLASSA_NET = 0xff000000 IN_CLASSA_NET = 0xff000000
......
...@@ -304,6 +304,15 @@ const ( ...@@ -304,6 +304,15 @@ const (
DLT_USER9 = 0x9c DLT_USER9 = 0x9c
DLT_X2E_SERIAL = 0xd5 DLT_X2E_SERIAL = 0xd5
DLT_X2E_XORAYA = 0xd6 DLT_X2E_XORAYA = 0xd6
DT_BLK = 0x6
DT_CHR = 0x2
DT_DIR = 0x4
DT_FIFO = 0x1
DT_LNK = 0xa
DT_REG = 0x8
DT_SOCK = 0xc
DT_UNKNOWN = 0
DT_WHT = 0xe
E2BIG = 0x7 E2BIG = 0x7
EACCES = 0xd EACCES = 0xd
EADDRINUSE = 0x30 EADDRINUSE = 0x30
...@@ -473,6 +482,212 @@ const ( ...@@ -473,6 +482,212 @@ const (
IFF_STATICARP = 0x80000 IFF_STATICARP = 0x80000
IFF_UP = 0x1 IFF_UP = 0x1
IFNAMSIZ = 0x10 IFNAMSIZ = 0x10
IFT_1822 = 0x2
IFT_A12MPPSWITCH = 0x82
IFT_AAL2 = 0xbb
IFT_AAL5 = 0x31
IFT_ADSL = 0x5e
IFT_AFLANE8023 = 0x3b
IFT_AFLANE8025 = 0x3c
IFT_ARAP = 0x58
IFT_ARCNET = 0x23
IFT_ARCNETPLUS = 0x24
IFT_ASYNC = 0x54
IFT_ATM = 0x25
IFT_ATMDXI = 0x69
IFT_ATMFUNI = 0x6a
IFT_ATMIMA = 0x6b
IFT_ATMLOGICAL = 0x50
IFT_ATMRADIO = 0xbd
IFT_ATMSUBINTERFACE = 0x86
IFT_ATMVCIENDPT = 0xc2
IFT_ATMVIRTUAL = 0x95
IFT_BGPPOLICYACCOUNTING = 0xa2
IFT_BRIDGE = 0xd1
IFT_BSC = 0x53
IFT_CARP = 0xf8
IFT_CCTEMUL = 0x3d
IFT_CEPT = 0x13
IFT_CES = 0x85
IFT_CHANNEL = 0x46
IFT_CNR = 0x55
IFT_COFFEE = 0x84
IFT_COMPOSITELINK = 0x9b
IFT_DCN = 0x8d
IFT_DIGITALPOWERLINE = 0x8a
IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
IFT_DLSW = 0x4a
IFT_DOCSCABLEDOWNSTREAM = 0x80
IFT_DOCSCABLEMACLAYER = 0x7f
IFT_DOCSCABLEUPSTREAM = 0x81
IFT_DS0 = 0x51
IFT_DS0BUNDLE = 0x52
IFT_DS1FDL = 0xaa
IFT_DS3 = 0x1e
IFT_DTM = 0x8c
IFT_DVBASILN = 0xac
IFT_DVBASIOUT = 0xad
IFT_DVBRCCDOWNSTREAM = 0x93
IFT_DVBRCCMACLAYER = 0x92
IFT_DVBRCCUPSTREAM = 0x94
IFT_ENC = 0xf4
IFT_EON = 0x19
IFT_EPLRS = 0x57
IFT_ESCON = 0x49
IFT_ETHER = 0x6
IFT_FAITH = 0xf2
IFT_FAST = 0x7d
IFT_FASTETHER = 0x3e
IFT_FASTETHERFX = 0x45
IFT_FDDI = 0xf
IFT_FIBRECHANNEL = 0x38
IFT_FRAMERELAYINTERCONNECT = 0x3a
IFT_FRAMERELAYMPI = 0x5c
IFT_FRDLCIENDPT = 0xc1
IFT_FRELAY = 0x20
IFT_FRELAYDCE = 0x2c
IFT_FRF16MFRBUNDLE = 0xa3
IFT_FRFORWARD = 0x9e
IFT_G703AT2MB = 0x43
IFT_G703AT64K = 0x42
IFT_GIF = 0xf0
IFT_GIGABITETHERNET = 0x75
IFT_GR303IDT = 0xb2
IFT_GR303RDT = 0xb1
IFT_H323GATEKEEPER = 0xa4
IFT_H323PROXY = 0xa5
IFT_HDH1822 = 0x3
IFT_HDLC = 0x76
IFT_HDSL2 = 0xa8
IFT_HIPERLAN2 = 0xb7
IFT_HIPPI = 0x2f
IFT_HIPPIINTERFACE = 0x39
IFT_HOSTPAD = 0x5a
IFT_HSSI = 0x2e
IFT_HY = 0xe
IFT_IBM370PARCHAN = 0x48
IFT_IDSL = 0x9a
IFT_IEEE1394 = 0x90
IFT_IEEE80211 = 0x47
IFT_IEEE80212 = 0x37
IFT_IEEE8023ADLAG = 0xa1
IFT_IFGSN = 0x91
IFT_IMT = 0xbe
IFT_INTERLEAVE = 0x7c
IFT_IP = 0x7e
IFT_IPFORWARD = 0x8e
IFT_IPOVERATM = 0x72
IFT_IPOVERCDLC = 0x6d
IFT_IPOVERCLAW = 0x6e
IFT_IPSWITCH = 0x4e
IFT_IPXIP = 0xf9
IFT_ISDN = 0x3f
IFT_ISDNBASIC = 0x14
IFT_ISDNPRIMARY = 0x15
IFT_ISDNS = 0x4b
IFT_ISDNU = 0x4c
IFT_ISO88022LLC = 0x29
IFT_ISO88023 = 0x7
IFT_ISO88024 = 0x8
IFT_ISO88025 = 0x9
IFT_ISO88025CRFPINT = 0x62
IFT_ISO88025DTR = 0x56
IFT_ISO88025FIBER = 0x73
IFT_ISO88026 = 0xa
IFT_ISUP = 0xb3
IFT_L2VLAN = 0x87
IFT_L3IPVLAN = 0x88
IFT_L3IPXVLAN = 0x89
IFT_LAPB = 0x10
IFT_LAPD = 0x4d
IFT_LAPF = 0x77
IFT_LOCALTALK = 0x2a
IFT_LOOP = 0x18
IFT_MEDIAMAILOVERIP = 0x8b
IFT_MFSIGLINK = 0xa7
IFT_MIOX25 = 0x26
IFT_MODEM = 0x30
IFT_MPC = 0x71
IFT_MPLS = 0xa6
IFT_MPLSTUNNEL = 0x96
IFT_MSDSL = 0x8f
IFT_MVL = 0xbf
IFT_MYRINET = 0x63
IFT_NFAS = 0xaf
IFT_NSIP = 0x1b
IFT_OPTICALCHANNEL = 0xc3
IFT_OPTICALTRANSPORT = 0xc4
IFT_OTHER = 0x1
IFT_P10 = 0xc
IFT_P80 = 0xd
IFT_PARA = 0x22
IFT_PFLOG = 0xf6
IFT_PFSYNC = 0xf7
IFT_PLC = 0xae
IFT_POS = 0xab
IFT_PPP = 0x17
IFT_PPPMULTILINKBUNDLE = 0x6c
IFT_PROPBWAP2MP = 0xb8
IFT_PROPCNLS = 0x59
IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5
IFT_PROPDOCSWIRELESSMACLAYER = 0xb4
IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6
IFT_PROPMUX = 0x36
IFT_PROPVIRTUAL = 0x35
IFT_PROPWIRELESSP2P = 0x9d
IFT_PTPSERIAL = 0x16
IFT_PVC = 0xf1
IFT_QLLC = 0x44
IFT_RADIOMAC = 0xbc
IFT_RADSL = 0x5f
IFT_REACHDSL = 0xc0
IFT_RFC1483 = 0x9f
IFT_RS232 = 0x21
IFT_RSRB = 0x4f
IFT_SDLC = 0x11
IFT_SDSL = 0x60
IFT_SHDSL = 0xa9
IFT_SIP = 0x1f
IFT_SLIP = 0x1c
IFT_SMDSDXI = 0x2b
IFT_SMDSICIP = 0x34
IFT_SONET = 0x27
IFT_SONETOVERHEADCHANNEL = 0xb9
IFT_SONETPATH = 0x32
IFT_SONETVT = 0x33
IFT_SRP = 0x97
IFT_SS7SIGLINK = 0x9c
IFT_STACKTOSTACK = 0x6f
IFT_STARLAN = 0xb
IFT_STF = 0xd7
IFT_T1 = 0x12
IFT_TDLC = 0x74
IFT_TERMPAD = 0x5b
IFT_TR008 = 0xb0
IFT_TRANSPHDLC = 0x7b
IFT_TUNNEL = 0x83
IFT_ULTRA = 0x1d
IFT_USB = 0xa0
IFT_V11 = 0x40
IFT_V35 = 0x2d
IFT_V36 = 0x41
IFT_V37 = 0x78
IFT_VDSL = 0x61
IFT_VIRTUALIPADDRESS = 0x70
IFT_VOICEEM = 0x64
IFT_VOICEENCAP = 0x67
IFT_VOICEFXO = 0x65
IFT_VOICEFXS = 0x66
IFT_VOICEOVERATM = 0x98
IFT_VOICEOVERFRAMERELAY = 0x99
IFT_VOICEOVERIP = 0x68
IFT_X213 = 0x5d
IFT_X25 = 0x5
IFT_X25DDN = 0x4
IFT_X25HUNTGROUP = 0x7a
IFT_X25MLP = 0x79
IFT_X25PLE = 0x28
IFT_XETHER = 0x1a
IN_CLASSA_HOST = 0xffffff IN_CLASSA_HOST = 0xffffff
IN_CLASSA_MAX = 0x80 IN_CLASSA_MAX = 0x80
IN_CLASSA_NET = 0xff000000 IN_CLASSA_NET = 0xff000000
......
...@@ -304,6 +304,15 @@ const ( ...@@ -304,6 +304,15 @@ const (
DLT_USER9 = 0x9c DLT_USER9 = 0x9c
DLT_X2E_SERIAL = 0xd5 DLT_X2E_SERIAL = 0xd5
DLT_X2E_XORAYA = 0xd6 DLT_X2E_XORAYA = 0xd6
DT_BLK = 0x6
DT_CHR = 0x2
DT_DIR = 0x4
DT_FIFO = 0x1
DT_LNK = 0xa
DT_REG = 0x8
DT_SOCK = 0xc
DT_UNKNOWN = 0
DT_WHT = 0xe
E2BIG = 0x7 E2BIG = 0x7
EACCES = 0xd EACCES = 0xd
EADDRINUSE = 0x30 EADDRINUSE = 0x30
...@@ -473,6 +482,212 @@ const ( ...@@ -473,6 +482,212 @@ const (
IFF_STATICARP = 0x80000 IFF_STATICARP = 0x80000
IFF_UP = 0x1 IFF_UP = 0x1
IFNAMSIZ = 0x10 IFNAMSIZ = 0x10
IFT_1822 = 0x2
IFT_A12MPPSWITCH = 0x82
IFT_AAL2 = 0xbb
IFT_AAL5 = 0x31
IFT_ADSL = 0x5e
IFT_AFLANE8023 = 0x3b
IFT_AFLANE8025 = 0x3c
IFT_ARAP = 0x58
IFT_ARCNET = 0x23
IFT_ARCNETPLUS = 0x24
IFT_ASYNC = 0x54
IFT_ATM = 0x25
IFT_ATMDXI = 0x69
IFT_ATMFUNI = 0x6a
IFT_ATMIMA = 0x6b
IFT_ATMLOGICAL = 0x50
IFT_ATMRADIO = 0xbd
IFT_ATMSUBINTERFACE = 0x86
IFT_ATMVCIENDPT = 0xc2
IFT_ATMVIRTUAL = 0x95
IFT_BGPPOLICYACCOUNTING = 0xa2
IFT_BRIDGE = 0xd1
IFT_BSC = 0x53
IFT_CARP = 0xf8
IFT_CCTEMUL = 0x3d
IFT_CEPT = 0x13
IFT_CES = 0x85
IFT_CHANNEL = 0x46
IFT_CNR = 0x55
IFT_COFFEE = 0x84
IFT_COMPOSITELINK = 0x9b
IFT_DCN = 0x8d
IFT_DIGITALPOWERLINE = 0x8a
IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
IFT_DLSW = 0x4a
IFT_DOCSCABLEDOWNSTREAM = 0x80
IFT_DOCSCABLEMACLAYER = 0x7f
IFT_DOCSCABLEUPSTREAM = 0x81
IFT_DS0 = 0x51
IFT_DS0BUNDLE = 0x52
IFT_DS1FDL = 0xaa
IFT_DS3 = 0x1e
IFT_DTM = 0x8c
IFT_DVBASILN = 0xac
IFT_DVBASIOUT = 0xad
IFT_DVBRCCDOWNSTREAM = 0x93
IFT_DVBRCCMACLAYER = 0x92
IFT_DVBRCCUPSTREAM = 0x94
IFT_ENC = 0xf4
IFT_EON = 0x19
IFT_EPLRS = 0x57
IFT_ESCON = 0x49
IFT_ETHER = 0x6
IFT_FAITH = 0xf2
IFT_FAST = 0x7d
IFT_FASTETHER = 0x3e
IFT_FASTETHERFX = 0x45
IFT_FDDI = 0xf
IFT_FIBRECHANNEL = 0x38
IFT_FRAMERELAYINTERCONNECT = 0x3a
IFT_FRAMERELAYMPI = 0x5c
IFT_FRDLCIENDPT = 0xc1
IFT_FRELAY = 0x20
IFT_FRELAYDCE = 0x2c
IFT_FRF16MFRBUNDLE = 0xa3
IFT_FRFORWARD = 0x9e
IFT_G703AT2MB = 0x43
IFT_G703AT64K = 0x42
IFT_GIF = 0xf0
IFT_GIGABITETHERNET = 0x75
IFT_GR303IDT = 0xb2
IFT_GR303RDT = 0xb1
IFT_H323GATEKEEPER = 0xa4
IFT_H323PROXY = 0xa5
IFT_HDH1822 = 0x3
IFT_HDLC = 0x76
IFT_HDSL2 = 0xa8
IFT_HIPERLAN2 = 0xb7
IFT_HIPPI = 0x2f
IFT_HIPPIINTERFACE = 0x39
IFT_HOSTPAD = 0x5a
IFT_HSSI = 0x2e
IFT_HY = 0xe
IFT_IBM370PARCHAN = 0x48
IFT_IDSL = 0x9a
IFT_IEEE1394 = 0x90
IFT_IEEE80211 = 0x47
IFT_IEEE80212 = 0x37
IFT_IEEE8023ADLAG = 0xa1
IFT_IFGSN = 0x91
IFT_IMT = 0xbe
IFT_INTERLEAVE = 0x7c
IFT_IP = 0x7e
IFT_IPFORWARD = 0x8e
IFT_IPOVERATM = 0x72
IFT_IPOVERCDLC = 0x6d
IFT_IPOVERCLAW = 0x6e
IFT_IPSWITCH = 0x4e
IFT_IPXIP = 0xf9
IFT_ISDN = 0x3f
IFT_ISDNBASIC = 0x14
IFT_ISDNPRIMARY = 0x15
IFT_ISDNS = 0x4b
IFT_ISDNU = 0x4c
IFT_ISO88022LLC = 0x29
IFT_ISO88023 = 0x7
IFT_ISO88024 = 0x8
IFT_ISO88025 = 0x9
IFT_ISO88025CRFPINT = 0x62
IFT_ISO88025DTR = 0x56
IFT_ISO88025FIBER = 0x73
IFT_ISO88026 = 0xa
IFT_ISUP = 0xb3
IFT_L2VLAN = 0x87
IFT_L3IPVLAN = 0x88
IFT_L3IPXVLAN = 0x89
IFT_LAPB = 0x10
IFT_LAPD = 0x4d
IFT_LAPF = 0x77
IFT_LOCALTALK = 0x2a
IFT_LOOP = 0x18
IFT_MEDIAMAILOVERIP = 0x8b
IFT_MFSIGLINK = 0xa7
IFT_MIOX25 = 0x26
IFT_MODEM = 0x30
IFT_MPC = 0x71
IFT_MPLS = 0xa6
IFT_MPLSTUNNEL = 0x96
IFT_MSDSL = 0x8f
IFT_MVL = 0xbf
IFT_MYRINET = 0x63
IFT_NFAS = 0xaf
IFT_NSIP = 0x1b
IFT_OPTICALCHANNEL = 0xc3
IFT_OPTICALTRANSPORT = 0xc4
IFT_OTHER = 0x1
IFT_P10 = 0xc
IFT_P80 = 0xd
IFT_PARA = 0x22
IFT_PFLOG = 0xf6
IFT_PFSYNC = 0xf7
IFT_PLC = 0xae
IFT_POS = 0xab
IFT_PPP = 0x17
IFT_PPPMULTILINKBUNDLE = 0x6c
IFT_PROPBWAP2MP = 0xb8
IFT_PROPCNLS = 0x59
IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5
IFT_PROPDOCSWIRELESSMACLAYER = 0xb4
IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6
IFT_PROPMUX = 0x36
IFT_PROPVIRTUAL = 0x35
IFT_PROPWIRELESSP2P = 0x9d
IFT_PTPSERIAL = 0x16
IFT_PVC = 0xf1
IFT_QLLC = 0x44
IFT_RADIOMAC = 0xbc
IFT_RADSL = 0x5f
IFT_REACHDSL = 0xc0
IFT_RFC1483 = 0x9f
IFT_RS232 = 0x21
IFT_RSRB = 0x4f
IFT_SDLC = 0x11
IFT_SDSL = 0x60
IFT_SHDSL = 0xa9
IFT_SIP = 0x1f
IFT_SLIP = 0x1c
IFT_SMDSDXI = 0x2b
IFT_SMDSICIP = 0x34
IFT_SONET = 0x27
IFT_SONETOVERHEADCHANNEL = 0xb9
IFT_SONETPATH = 0x32
IFT_SONETVT = 0x33
IFT_SRP = 0x97
IFT_SS7SIGLINK = 0x9c
IFT_STACKTOSTACK = 0x6f
IFT_STARLAN = 0xb
IFT_STF = 0xd7
IFT_T1 = 0x12
IFT_TDLC = 0x74
IFT_TERMPAD = 0x5b
IFT_TR008 = 0xb0
IFT_TRANSPHDLC = 0x7b
IFT_TUNNEL = 0x83
IFT_ULTRA = 0x1d
IFT_USB = 0xa0
IFT_V11 = 0x40
IFT_V35 = 0x2d
IFT_V36 = 0x41
IFT_V37 = 0x78
IFT_VDSL = 0x61
IFT_VIRTUALIPADDRESS = 0x70
IFT_VOICEEM = 0x64
IFT_VOICEENCAP = 0x67
IFT_VOICEFXO = 0x65
IFT_VOICEFXS = 0x66
IFT_VOICEOVERATM = 0x98
IFT_VOICEOVERFRAMERELAY = 0x99
IFT_VOICEOVERIP = 0x68
IFT_X213 = 0x5d
IFT_X25 = 0x5
IFT_X25DDN = 0x4
IFT_X25HUNTGROUP = 0x7a
IFT_X25MLP = 0x79
IFT_X25PLE = 0x28
IFT_XETHER = 0x1a
IN_CLASSA_HOST = 0xffffff IN_CLASSA_HOST = 0xffffff
IN_CLASSA_MAX = 0x80 IN_CLASSA_MAX = 0x80
IN_CLASSA_NET = 0xff000000 IN_CLASSA_NET = 0xff000000
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment