xtcpnl

package
v0.0.0-...-2036b99 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildNetlinkSockDiagRequest

func BuildNetlinkSockDiagRequest(addressFamily *uint8, make_size int, nlmsg_len uint32, nlmsg_seq uint32, nlmsg_pid uint32, idiag_ext uint8, idiag_stats uint8) (packetBytes []byte)

BuildNetlinkSockDiagRequest function builds up the binary bytes for the Netlink request We're using unsafe pointers for the uint8, because there is no PutUint8 addressFamily should be 2=IPv4, and 10=IPv6 per the kernel TODO - switch to binary package, because we're using unsafe. This is the only unsafe code in this program. Lots of comments here to show what we're doing, and includes links to the kernel source

func OpenNetlinkSocketWithTimeout

func OpenNetlinkSocketWithTimeout(timeout int64) (socketFileDescriptor int, socketAddress *unix.SockaddrNetlink)

OpenNetlinkSocketWithTimeout function opens a Netlink socket in the C style way Using the newer https://godoc.org/golang.org/x/sys/unix library Commented out is some timeout code, which was used during testing, but leaving it here in case we want it back at some point

func SendNetlinkDumpRequest

func SendNetlinkDumpRequest(socketFileDescriptor int, socketAddress *unix.SockaddrNetlink, packetBytes []byte)

SendNetlinkDumpRequest function sends the netlink request Please note the mutex is for being able to update the netlink revc function with the time we sent the request This is described in more detail in the xtcp.go TODO - look to refactor the arguments here using a type/struct which would probably be easier to read

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL