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.
  • 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.

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/featureNew behavior or a new part.
    area/netNetworking: sockets, TCP, netlink and netfilter.
    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.

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/netNetworking: sockets, TCP, netlink and netfilter.kind/featureNew behavior or a new part.

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions