1
2
3
4
5 package routebsd
6
7 import (
8 "syscall"
9 "unsafe"
10 )
11
12
13 func (m *InterfaceMessage) MTU() int {
14 return int(nativeEndian.Uint32(m.raw[28:32]))
15 }
16
17 func probeRoutingStack() (int, map[int]*wireFormat) {
18 var p uintptr
19 ifm := &wireFormat{extOff: -1, bodyOff: -1}
20 ifm.parse = ifm.parseInterfaceMessage
21 ifam := &wireFormat{extOff: -1, bodyOff: -1}
22 ifam.parse = ifam.parseInterfaceAddrMessage
23 return int(unsafe.Sizeof(p)), map[int]*wireFormat{
24 syscall.RTM_NEWADDR: ifam,
25 syscall.RTM_DELADDR: ifam,
26 syscall.RTM_IFINFO: ifm,
27 }
28 }
29
View as plain text