Skip to content

R5 netlink: rules, nexthops, generic netlink and ethtool for networkd, resolved and udevd #538

Open

Description

@tamnd

Part of #14.

Netlink has only the family NETLINK_ROUTE. Other protocols give EPROTONOSUPPORT (net/rk-net/src/netlink/mod.rs). rtnetlink has the links (new, get, set and delete, with the kinds veth and dummy), the IPv4 and IPv6 addresses and routes, the neighbours, the netconf get, the namespace IDs, and the multicast groups for links, addresses, routes, neighbours and namespace IDs. SIOCETHTOOL exists as an ioctl. There are no rules, no nexthop objects, no generic netlink and no ethtool netlink family. LTP net now: 117 pass of 356 (tools/ltp/net.md).

Scope

  • Routing rules: RTM_NEWRULE, RTM_DELRULE and RTM_GETRULE for IPv4 and IPv6, the three default rules, and a rule lookup before the route lookup. Test: a new part of the netcfg boot test with ip rule add and ip route get for a policy route. Exit: the ip rule output is the same as on the reference, and the policy route works. net: routing rules for IPv4 and IPv6, and the extended ack #550: the rules, the rule lookup and the extended ack; netcfg passes.
  • Nexthop objects: RTM_NEWNEXTHOP, RTM_DELNEXTHOP and RTM_GETNEXTHOP, and routes that use a nexthop ID. networkd probes for them at start. Test: netcfg with ip nexthop add and a route with nhid. Exit: the output is the same as on the reference. net: nexthop objects and routes with nhid #554: nexthop objects and RTA_NH_ID routes; a group route uses its first member; netcfg passes.
  • Generic netlink: the protocol NETLINK_GENERIC and the nlctrl family, with CTRL_CMD_GETFAMILY for one family and for a dump, and the multicast groups of each family. Test: netcfg with genl ctrl list. Exit: the message layout is the same as on the reference for the families that rukernel has. net: generic netlink and nlctrl #559: NETLINK_GENERIC and nlctrl with GETFAMILY by name, by ID and as a dump; no GETPOLICY yet.
  • The ethtool netlink family: ETHTOOL_MSG_LINKINFO_GET, LINKMODES_GET and SET, FEATURES_GET and SET, CHANNELS_GET, RINGS_GET and WOL_GET. Also the SIOCETHTOOL commands that udevd uses for .link files: ETHTOOL_GDRVINFO, ETHTOOL_GLINKSETTINGS and ETHTOOL_GPERMADDR. Test: netcfg with ethtool eth0, ethtool -i eth0 and ethtool -k eth0. Exit: the output is the same as on the reference for virtio-net. net: ethtool netlink family and SIOCETHTOOL #564: ethtool netlink family and SIOCETHTOOL; 29 inet checks pass on both architectures.
  • Link properties: RTM_NEWLINKPROP and RTM_DELLINKPROP for alternative names, a rename of a link with IFLA_IFNAME, and the RTM_NEWLINK notices for a rename. udevd uses these to name devices. Test: netcfg with ip link property add dev eth0 altname and ip link set eth0 name. Exit: the notices on ip monitor link are the same as on the reference. net: alternative names of links and live renames #570: altnames with RTM_NEWLINKPROP and RTM_DELLINKPROP, renames while up, with notices; 27 inet checks pass on both architectures.
  • A networkd boot test: the Debian 13 image of the systemd boot test (see R5 systemd as PID 1: cgroup v2 controllers, namespaces and pidfds #536) with systemd-networkd and systemd-resolved. It gets an IPv4 address with DHCP from the QEMU user network, sets a static IPv6 address, and resolves a name with resolvectl query. Exit: networkctl status eth0 gives routable, and the query gives an address. Then run systemd test/test-network/systemd-networkd-tests.py and the TEST-75-RESOLVED integration test, and write a report. Exit: they reach the pass set of the reference, apart from the listed exceptions. Add the networkd boot test, with the socket options of systemd-networkd and systemd-resolved #668 (first part): the networkd boot test passes on x86_64 and arm64; systemd-networkd-tests.py and TEST-75 remain. tmpfs: a size in percent of the memory, as Linux #724: tmpfs size=N%, so daemon-reload works and the tests run. net: set the hardware address with IFLA_ADDRESS and SIOCSIFHWADDR #733: IFLA_ADDRESS and SIOCSIFHWADDR set the hardware address, so the MACAddress= tests pass. sysfs: queues/rx-0/rps_cpus of a network interface, as Linux (#538) #738: sysfs rps_cpus, so test_rps_cpu passes. unix: a message before the accept gets the credentials of the sender #743: unix credentials before the accept, so udevadm control --reload works.
  • udevd names the network devices. With the uevents of R5 uevents, the keyring, fanotify and inotify #539 and the PCI tree in /sys of R5 the remaining /sys and /proc files that the images read #543, udevd renames eth0 to its predictable name, as on the reference (for example enp0s2 on x86_64). Test: the udevd boot test. Exit: the name is the same as on the reference on both architectures. Add name_assign_type of a network interface, check its udev name #654: name_assign_type in sysfs; udevd gives enp0s3 on x86_64, and enp0s1 (PCI) and eth0 (MMIO) on arm64, as on Linux.
  • Multipath routes: RTA_MULTIPATH in RTM_NEWROUTE, RTM_DELROUTE and the route dump for IPv4 and IPv6, with a weight for each path, IPv6 ECMP siblings, and a check of the device and gateway of each path. networkd sends MultiPathRoute= with RTA_MULTIPATH, also for one IPv6 path with a weight. Test: NetworkdNetworkTests.test_route_static of the networkd test suite, and ip route add ... nexthop via ... weight ... in the netcfg boot test. net: multipath routes, RTA_MULTIPATH for IPv4 and IPv6 (#538) #826: test_route_static passes on x86_64 and arm64, and ip route show gives the paths, weights and order of Linux 6.8. BusyBox ip of netcfg cannot send RTA_MULTIPATH, so the unit tests and the networkd tests are the tests.

Done when

networkd configures the network and udevd names the devices. This is the exit of the third item of #14.

Test each task on x86_64 and on arm64. Give the result of both in the PR body.

Linux reference: net/core/rtnetlink.c, net/core/fib_rules.c, net/ipv4/nexthop.c, net/netlink/genetlink.c, net/ethtool/netlink.c, net/ethtool/ioctl.c.

Activity

  1. added
    kind/feature
    area/net
    on Nov 2, 2026
  2. tamnd commented on Nov 2, 2026

    @tamnd
    OwnerAuthor

    #550 is merged. It adds the routing rules of IPv4 and IPv6 with RTM_NEWRULE, RTM_DELRULE and RTM_GETRULE, the default rules of Linux, the rule lookup before the route lookup, and the extended ack. x86_64: net and netcfg pass (load average 10 to 17). arm64: init and inet pass (load average 6 to 11). x86_64 init and inet time out at a load average near 20, and inet on main also times out at that load. Limits: no suppress_ifgroup, l3mdev or tun_id matches.

  3. tamnd commented on Nov 3, 2026

    @tamnd
    OwnerAuthor

    Nexthop objects are done in #554. RTM_NEWNEXTHOP, RTM_DELNEXTHOP and RTM_GETNEXTHOP work for single nexthops and groups, and IPv4 and IPv6 routes can use RTA_NH_ID. A route that uses a group sends on the first member of the group. The netcfg boot test passes on x86_64, and the init and inet boot tests pass on arm64.

  4. tamnd commented on Nov 3, 2026

    @tamnd
    OwnerAuthor

    Item 3 (generic netlink) is done in #559. A NETLINK_GENERIC socket works, and nlctrl answers CTRL_CMD_GETFAMILY by name, by ID and as a dump, with the same checks and errors as Linux. The 12 new checks of the inet boot test pass on arm64. On x86_64 the inet test did not reach the network part because of the load on server2 (load average 22 to 25). CTRL_CMD_GETPOLICY and the NEWFAMILY and DELFAMILY events are not there yet.

  5. tamnd commented on Nov 3, 2026

    @tamnd
    OwnerAuthor

    Item 4 (ethtool netlink) is done in #564. The family ethtool has STRSET_GET, LINKINFO_GET and SET, LINKMODES_GET and SET, LINKSTATE_GET, DEBUG_GET and SET, WOL_GET and SET, FEATURES_GET and SET, RINGS_GET and CHANNELS_GET, with the compact and verbose bitsets, the dumps, the extended ack and the notices of the group monitor. SIOCETHTOOL has ETHTOOL_GDRVINFO, ETHTOOL_GLINK, ETHTOOL_GPERMADDR and ETHTOOL_GLINKSETTINGS. The 29 new checks of the inet boot test pass on arm64 (MMIO, virtio-pci, and virtio-pci behind a bridge) and on x86_64 (with a longer local timeout, load average 26 to 35). The images have no ethtool tool, so the checks are C code in tests/user/init.c. RINGS_SET, CHANNELS_SET, statistics and the other commands of the family are not there yet.

  6. tamnd commented on Nov 4, 2026

    @tamnd
    OwnerAuthor

    Item 5 (link properties) is done in #570. RTM_NEWLINKPROP and RTM_DELLINKPROP add and remove the alternative names of a link, with the checks and the extended ack of net/core/rtnetlink.c. A lookup by name also finds an alternative name, and RTM_GETLINK gives them in IFLA_PROP_LIST. A link that is up can now change its name, a name with %d takes the first free unit, and the rename sends RTM_NEWLINK to RTMGRP_LINK and the uevent move of #562. The 27 new checks of the inet boot test pass on x86_64 and arm64. The images have no ip tool, so the checks are C code in tests/user/init.c. Items 6 (networkd) and 7 (udevd) remain. They need the networkd and udevd boot tests.

  7. tamnd commented on Nov 7, 2026

    @tamnd
    OwnerAuthor

    #654 merged. It adds name_assign_type of a network interface in sysfs, as on Linux: 2 for lo, 1 for eth%d, 3 for a name from the user, and 4 after a rename. The udevd boot test now checks that each interface with a name from net_id has that name and name_assign_type 4.

    Results, with the same QEMU command for rukernel and for Linux:

    • x86_64 (q35, virtio-net-pci at 00:03.0): enp0s3: name_assign_type 4, net_id name enp0s3 on both, and the test passes.
    • arm64 (virt, virtio-net-device and virtio-net-pci): enp0s1: name_assign_type 4, net_id name enp0s1 and eth0: name_assign_type 1, net_id name none on both, and the check passes. The virtio-mmio interface has no name from net_id, so it keeps eth0, also on Linux.

    The item is done. What remains in this issue is the networkd item. systemd-resolved still stops with ENOPROTOOPT (socket options on TCP and IP_UNICAST_IF), so these runs masked it. The next change fixes this.

  8. tamnd commented on Nov 8, 2026

    @tamnd
    OwnerAuthor

    #668 merged. It adds the networkd boot test. systemd-networkd gets 10.0.2.15 with DHCP from the user network of QEMU and sets the static address fec0::10. systemd-resolved runs, networkctl gives routable, and resolvectl query debian.org gives 151.101.2.132.

    The fixes in rukernel:

    • The socket options of systemd-resolved: IP_UNICAST_IF, the receive options of IPv4 and IPv6 on TCP sockets, IP_FREEBIND, IP_MTU_DISCOVER and TCP_FASTOPEN.
    • For the DHCP client: IP_FREEBIND with a bind to an address that is not local, and PACKET_AUXDATA on packet sockets.
    • The NETLINK_PKTINFO control message. Without it, sd-netlink dropped each notification of the kernel, and systemd-networkd stayed in configuring.

    Results:

    • x86_64 on server1: rukernel enp0s3: routable and pass. Linux with the same image and QEMU command: the same.
    • arm64 (virt, virtio-net-device and virtio-net-pci) on server2: rukernel eth0: routable and pass.
    • The udevd boot test passes on x86_64 without a mask for systemd-resolved.

    The item stays open. What remains: test/test-network/systemd-networkd-tests.py and the TEST-75-RESOLVED integration test did not run, and there is no report yet. systemd-networkd cannot write the net sysctls accept_ra and promote_secondaries (EPERM). It ignores the error, but this is a difference from Linux, in the /proc area of #543.

  9. tamnd commented on Nov 13, 2026

    @tamnd
    OwnerAuthor

    #724 fixes the tmpfs option size=N%: the limit is now N percent of the memory, as Linux. Before, a size in percent had no limit, statfs gave 0 free blocks on /run, and systemd refused daemon-reload, which systemd-networkd-tests.py calls for each test. With the fix the tests run on x86_64 and arm64. The item stays open: the runs found more kernel causes (the hardware address of a new link, rps_cpus in sysfs), and the report is not done.

  10. tamnd commented on Nov 14, 2026

    @tamnd
    OwnerAuthor

    #733 merged: RTM_NEWLINK and RTM_SETLINK with IFLA_ADDRESS, and SIOCSIFHWADDR, set the hardware address of a device, as dev_set_mac_address of Linux. networkd needs this for MACAddress= in .netdev and .link files. Next: the other fixes for systemd-networkd-tests.py, one PR each.

  11. 41 remaining items

  12. tamnd commented on Nov 17, 2026

    @tamnd
    OwnerAuthor

    #796 merged: a UDP, raw or ping socket of IPv6 sends through the interface of IPV6_MULTICAST_IF or IPV6_UNICAST_IF, as udpv6_sendmsg of Linux. Before, the router advertisements of dnsmasq on veth-peer went out on veth99 when veth99 went up last, veth-peer learned a wrong link address for veth99, and the DHCPv6 replies did not get to veth99 (#538).

  13. tamnd commented on Nov 20, 2026

    @tamnd
    OwnerAuthor

    #806 merged: getsockopt of IP_PKTOPTIONS and IPV6_2292PKTOPTIONS on a TCP socket gives the interface and the TTL of the SYN, as Linux. Before, systemd-resolved closed each TCP connection to its stub resolver at 127.0.0.53, so dig +tcp and dig AXFR got "connection reset" and TEST-75-RESOLVED stopped at testcase_08_resolved (#538).

  14. tamnd commented on Nov 20, 2026

    @tamnd
    OwnerAuthor

    TEST-75-RESOLVED testcase_11_nft fails on rukernel (x86_64, main with #806). Two runs on server1 gave the same result: pk1, and the rerun pk2 at load average 2.

    What the test does, and what it gets:

    + nft add table inet sd_test
    + nft add set inet sd_test c '{ type cgroupsv2; }'
    + nft add set inet sd_test u '{ typeof meta skuid; }'
    + nft add set inet sd_test g '{ typeof meta skgid; }'
    + systemd-run --unit test-nft.service --service-type=exec -p DynamicUser=yes -p 'NFTSet=cgroup:inet:sd_test:c user:inet:sd_test:u group:inet:sd_test:g' sleep 10000
    Running as unit: test-nft.service; invocation ID: 68e174ed03e748b2857f57be9e38351d
    + nft list set inet sd_test c
    table inet sd_test {
    	set c {
    		type cgroupsv2
    	}
    }
    + grep -qF test-nft.service /tmp/tmp.w3VMPYAM3H
    exit 1
    

    The set c stays empty, so the test stops at this first check. It does not get to the sets u and g. Testcases 01 to 10 pass.

    Facts from the code (not yet confirmed with a log of PID 1, because the run keeps only the journal of networkd, udevd and resolved):

    • systemd PID 1 adds the element for NFTSet=cgroup:. The element is the 64-bit cgroup ID of the unit. systemd gets the ID with name_to_handle_at on the cgroup directory in cgroupfs (cg_path_get_cgroupid).
    • In rukernel, cgroupfs (fs/rk-fs-cgroup) has no file_handle. So name_to_handle_at on cgroupfs gives EOPNOTSUPP (core/rk-syscall/src/fhandle.rs). Linux gives a FILEID_KERNFS handle with the kernfs ID.
    • Thus PID 1 probably has no cgroup ID for the unit and adds no element. This cause can be in cgroupfs and not in nf_tables.
    • nft list set shows a cgroupsv2 element as a path. To find the path from the ID, nft also uses name_to_handle_at on cgroupfs. So the check needs these handles too.
    • In the same runs, networkd adds elements to the addr4, network4, addr6, network6 and ifindex sets of sd_test ("Added NFT set entry"). So the add of a set element in nf_tables works.

    Next step: run the test again with the journal of PID 1, or run name_to_handle_at on /sys/fs/cgroup/system.slice in the VM.

  15. tamnd commented on Nov 20, 2026

    @tamnd
    OwnerAuthor

    #808 merged: RTM_SETLINK takes IFLA_INET6_ADDR_GEN_MODE in IFLA_AF_SPEC, each link has its AF_INET6 attributes in IFLA_AF_SPEC, and a device with IN6_ADDR_GEN_MODE_NONE gets no link local address, as Linux. Before, systemd-networkd could not stop or start the link local address of a link (#538).

    Run agm1 on server1 (x86_64, load average 0.8 at the start, kernel of main f68a676 with #808 and the IPv6 gateway change of the next PR): NetworkdNetworkTests.test_link_local_addressing_ipv6ll passes. test_link_local_addressing now stops at /proc/sys/net/ipv6/conf/test1/stable_secret, which rukernel does not have. NetworkdNetworkTests has 3 failures and 8 errors (before: 4 and 8). NetworkctlTests and NetworkdMTUTests pass.

  16. tamnd commented on Nov 20, 2026

    @tamnd
    OwnerAuthor

    #809 merged: the IPv6 gateway of a new nexthop or route is on the link while each address of the interface is tentative, as ip6_route_check_nh of Linux. Before, systemd-networkd got "No route to host" for the nexthop id 2 via 2001:1234:5:8f63::2 dev veth99 in test_nexthop and failed the link (#538).

    Run agm1 on server1 (x86_64, load average 0.8 at the start, kernel of main f68a676 with #808 and #809): the log has no "No route to host" and no "Failed to set static nexthop" (before: 2 of each). test_nexthop still gives an error at the next step: the route 10.10.10.11/32 through nexthop 2 gives "IPv4 routes through IPv6 gateways are not supported" (RTA_VIA), as in test_route_via_ipv6. RTA_VIA is not done yet.

  17. tamnd commented on Nov 20, 2026

    @tamnd
    OwnerAuthor

    #810: tools/systemd/networkd.md and nettest.py tell how to run systemd-networkd-tests.py and TEST-75-RESOLVED on rukernel and on Linux under QEMU, and give the results of each test class on x86_64, the kernel fixes, and the causes of the tests that do not pass yet (#538).

  18. tamnd commented on Nov 21, 2026

    @tamnd
    OwnerAuthor

    A check of #817 (file handles of cgroup2) on main 4d97cdc, x86_64 release kernel:

    • TEST-75-RESOLVED with nettest.py --t75 on server1, alone under the VM lock: testok and exit 0, in 520 s of wall time (load 2.1 at the start, 5.2 at the end). The run with the kernel of the cgroup: file handles of cgroup2, as kernfs, with the path in the mount of mount_fd #817 branch took 492 s. As in that run, the runner gives exit 1 after the test, when the VM stops.
    • RK_RELEASE=1 cargo xtask boot-test systemd on server2: boot test systemd: pass, in about 8.5 min of wall time (load 6 to 8).

    So #817 works on main, and no change is necessary.

  19. tamnd commented on Nov 23, 2026

    @tamnd
    OwnerAuthor

    #826 merged: multipath routes (RTA_MULTIPATH) for IPv4 and IPv6, as Linux. Each path has a weight, IPv6 multipath routes are siblings, and the kernel checks the device and the gateway of each path. Before, networkd failed dummy98 in test_route_static with "Could not set static route: No such device".

    • Run rk-x86-mp2 on server1 (x86_64, load average 0.2 at the start, about 1.1 during the run): NetworkdNetworkTests gives 32 of 42 (31 before, run via1). test_route_static passes. No other test of the class changed. ip route show gives the same paths, weights and order as Linux 6.8.
    • Run rk-a64-mp3 on server2 (arm64, load average 2.8 at the start, 8.2 at the end): test_route_static, test_route_via_ipv6, test_nexthop and test_route_static_issue_35047 pass. test_ip_route_ipv6_src_route gives an error because bond199 does not come up (bond devices), the same as on x86_64.
    • Linux reference (run lx-x86-c3, Linux 6.8 in the same QEMU VM on server1, load average 3.0 at the start, about 1.4 during the run): 84 of 85 tests in 13 classes pass, and TEST-75-RESOLVED passes. NetworkdDHCPPDTests.test_dhcp4_6rd gave an error once on Linux.

    BusyBox ip cannot send RTA_MULTIPATH, so the netcfg boot test has no multipath route. The networkd boot test item stays open: the rest of systemd-networkd-tests.py and TEST-75 remain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/netkind/feature

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions