MCPcopy Create free account
hub / github.com/encodeous/nylon / createNetlinkRouteSocket

Function createNetlinkRouteSocket

polyamide/device/sticky_linux.go:209–224  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

207}
208
209func createNetlinkRouteSocket() (int, error) {
210 sock, err := unix.Socket(unix.AF_NETLINK, unix.SOCK_RAW|unix.SOCK_CLOEXEC, unix.NETLINK_ROUTE)
211 if err != nil {
212 return -1, err
213 }
214 saddr := &unix.SockaddrNetlink{
215 Family: unix.AF_NETLINK,
216 Groups: unix.RTMGRP_IPV4_ROUTE,
217 }
218 err = unix.Bind(sock, saddr)
219 if err != nil {
220 unix.Close(sock)
221 return -1, err
222 }
223 return sock, nil
224}

Callers 1

startRouteListenerMethod · 0.85

Calls 2

BindMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected