1 // Copyright 2016 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
7 func (typ RIBType) parseable() bool { return true }
9 // RouteMetrics represents route metrics.
10 type RouteMetrics struct {
11 PathMTU int // path maximum transmission unit
14 // SysType implements the SysType method of Sys interface.
15 func (rmx *RouteMetrics) SysType() SysType { return SysMetrics }
17 // Sys implements the Sys method of Message interface.
18 func (m *RouteMessage) Sys() []Sys {
21 PathMTU: int(nativeEndian.Uint64(m.raw[m.extOff+8 : m.extOff+16])),
26 // RouteMetrics represents route metrics.
27 type InterfaceMetrics struct {
28 Type int // interface type
29 MTU int // maximum transmission unit
32 // SysType implements the SysType method of Sys interface.
33 func (imx *InterfaceMetrics) SysType() SysType { return SysMetrics }
35 // Sys implements the Sys method of Message interface.
36 func (m *InterfaceMessage) Sys() []Sys {
39 Type: int(m.raw[m.extOff]),
40 MTU: int(nativeEndian.Uint32(m.raw[m.extOff+8 : m.extOff+12])),
45 func probeRoutingStack() (int, map[int]*wireFormat) {
46 rtm := &wireFormat{extOff: 40, bodyOff: sizeofRtMsghdrNetBSD7}
47 rtm.parse = rtm.parseRouteMessage
48 ifm := &wireFormat{extOff: 16, bodyOff: sizeofIfMsghdrNetBSD7}
49 ifm.parse = ifm.parseInterfaceMessage
50 ifam := &wireFormat{extOff: sizeofIfaMsghdrNetBSD7, bodyOff: sizeofIfaMsghdrNetBSD7}
51 ifam.parse = ifam.parseInterfaceAddrMessage
52 ifanm := &wireFormat{extOff: sizeofIfAnnouncemsghdrNetBSD7, bodyOff: sizeofIfAnnouncemsghdrNetBSD7}
53 ifanm.parse = ifanm.parseInterfaceAnnounceMessage
54 // NetBSD 6 and above kernels require 64-bit aligned access to
55 // routing facilities.
56 return 8, map[int]*wireFormat{
68 sysRTM_IFANNOUNCE: ifanm,