github.com/hbdrawn/golang@v0.0.0-20141214014649-6b835209aba2/src/syscall/route_freebsd_32bit.go (about) 1 // Copyright 2014 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. 4 5 // +build freebsd,386 freebsd,arm 6 7 package syscall 8 9 import "unsafe" 10 11 func (any *anyMessage) parseInterfaceMessage(b []byte) *InterfaceMessage { 12 p := (*InterfaceMessage)(unsafe.Pointer(any)) 13 // FreeBSD 10 and beyond have a restructured mbuf 14 // packet header view. 15 // See http://svnweb.freebsd.org/base?view=revision&revision=254804. 16 if freebsdVersion >= 1000000 { 17 m := (*ifMsghdr)(unsafe.Pointer(any)) 18 p.Header.Data.Hwassist = uint32(m.Data.Hwassist) 19 p.Header.Data.Epoch = m.Data.Epoch 20 p.Header.Data.Lastchange = m.Data.Lastchange 21 return &InterfaceMessage{Header: p.Header, Data: b[sizeofIfMsghdr:any.Msglen]} 22 } 23 return &InterfaceMessage{Header: p.Header, Data: b[SizeofIfMsghdr:any.Msglen]} 24 }