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