diff options
Diffstat (limited to 'src/pkg/syscall/route_freebsd.go')
-rw-r--r-- | src/pkg/syscall/route_freebsd.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/pkg/syscall/route_freebsd.go b/src/pkg/syscall/route_freebsd.go index d8f80316b..15897b1ac 100644 --- a/src/pkg/syscall/route_freebsd.go +++ b/src/pkg/syscall/route_freebsd.go @@ -8,14 +8,20 @@ package syscall import "unsafe" +// See http://www.freebsd.org/doc/en/books/porters-handbook/freebsd-versions.html. +var freebsdVersion uint32 + +func init() { + freebsdVersion, _ = SysctlUint32("kern.osreldate") +} + func (any *anyMessage) toRoutingMessage(b []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)) return &RouteMessage{Header: p.Header, Data: b[SizeofRtMsghdr:any.Msglen]} case RTM_IFINFO: - p := (*InterfaceMessage)(unsafe.Pointer(any)) - return &InterfaceMessage{Header: p.Header, Data: b[SizeofIfMsghdr:any.Msglen]} + return any.parseInterfaceMessage(b) case RTM_IFANNOUNCE: p := (*InterfaceAnnounceMessage)(unsafe.Pointer(any)) return &InterfaceAnnounceMessage{Header: p.Header} @@ -30,7 +36,7 @@ func (any *anyMessage) toRoutingMessage(b []byte) RoutingMessage { } // InterfaceAnnounceMessage represents a routing message containing -// network interface arrival and depature information. +// network interface arrival and departure information. type InterfaceAnnounceMessage struct { Header IfAnnounceMsghdr } |