diff options
author | Michael Stapelberg <stapelberg@debian.org> | 2014-06-19 09:22:53 +0200 |
---|---|---|
committer | Michael Stapelberg <stapelberg@debian.org> | 2014-06-19 09:22:53 +0200 |
commit | 8a39ee361feb9bf46d728ff1ba4f07ca1d9610b1 (patch) | |
tree | 4449f2036cccf162e8417cc5841a35815b3e7ac5 /src/pkg/syscall/route_freebsd.go | |
parent | c8bf49ef8a92e2337b69c14b9b88396efe498600 (diff) | |
download | golang-8a39ee361feb9bf46d728ff1ba4f07ca1d9610b1.tar.gz |
Imported Upstream version 1.3upstream/1.3
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 } |