Debian Codegraph @

/

debian golang-github-jsimonetti-rtnetlink 2.2.0-2debian golang-github-jsimonetti-rtnetlink-dev gomod github.com/jsimonetti/rtnetlink/v2 debiangogoinimakefilemarkdownnixshellyaml 85 files · 1511 symbols
View dependency graph

Depends on

README (full)

rtnetlink Linux Integration GoDoc Go Report Card

Package rtnetlink allows the kernel's routing tables to be read and altered. Network routes, IP addresses, Link parameters, Neighbor setups, Queueing disciplines, Traffic classes and Packet classifiers may all be controlled. It is based on netlink messages.

A convenient, high-level API wrapper is available using package rtnl.

The base rtnetlink library explicitly only exposes a limited low-level API to rtnetlink. It is not the intention (nor wish) to create an iproute2 replacement.

Debugging and netlink errors

Unfortunately the errors generated by the kernels netlink interface are not very great.

When in doubt about your message structure it can always be useful to look at the message send by iproute2 using strace -f -esendmsg /bin/ip or similar.

Another (and possibly even more flexible) way would be using nlmon and wireshark. nlmon is a special kernel module which allows you to capture all netlink (not just rtnetlink) traffic inside the kernel. Be aware that this might be overwhelming on a system with a lot of netlink traffic.

# modprobe nlmon
# ip link add type nlmon
# ip link set nlmon0 up

At this point use wireshark or tcpdump on the nlmon0 interface to view all netlink traffic.

Have a look at the examples for common uses of rtnetlink.

If you have any questions or you'd like some guidance, please join us on Gophers Slack in the #networking channel!

dir .github/
dir debian/
dir driver/
dir internal/
dir rtnl/
dir testdata/
file .gitignore
file .golangci.yml
file LICENSE.md
file README.md
file address.go
file address_test.go
file conn.go
file conn_test.go
file doc.go
file endian.go
file example_address_add_test.go
file example_address_del_test.go
file example_address_list_test.go
file example_link_list_test.go
file example_link_setdown_test.go
file example_link_sethwaddr_test.go
file example_link_setup_test.go
file example_neigh_list_test.go
file example_route_add_test.go
file example_rule_list_test.go
file fuzz-shell.nix
file fuzz_test.go
file go.mod
file go.sum
file link.go
file link_live_test.go
file link_test.go
file neigh.go
file neigh_test.go
file netns.go
file route.go
file route_live_test.go
file route_test.go
file rule.go
file rule_test.go