Source file src/internal/routebsd/sys_netbsd.go

     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.
     4  
     5  package routebsd
     6  
     7  import "syscall"
     8  
     9  // MTU returns the interface MTU.
    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  	// NetBSD 6 and above kernels require 64-bit aligned access to
    20  	// routing facilities.
    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