]> git.ipfire.org Git - thirdparty/util-linux.git/commit
agetty: Implement netlink based IP processing
authorStanislav Brabec <sbrabec@suse.cz>
Wed, 9 Jul 2025 12:35:28 +0000 (14:35 +0200)
committerStanislav Brabec <sbrabec@suse.cz>
Wed, 1 Oct 2025 19:59:12 +0000 (21:59 +0200)
commitb8b5030d792c0ffe51ee4a5925d43735b5d782d8
tree516565d1bcd9aa725ad1811f147622d81118fb5b
parentee8586cbdfb20bea6b1a7e3f10f136b6c8554f02
agetty: Implement netlink based IP processing

The current \4 and \6 issue file escapes implementation is inferior. It
uses get getifaddrs() to get a list of IP addresses. This function does not
provide enough information to discriminate between stable IP addresses and
ephemeral addresses. As a result, especially \6 often gives unreliable
results.

The code is actually unable to get list of all interfaces, so a proper out
of the box IP address reporting depends on external tools that generate
issue file with the interfaces list.

The netlink messages are already used, but only as a change notifier. The
contents is not used, even if it contains exact information about the
change. As a result, change processing is triggered even for unrelated
network changes like IPv6 router advertisement.

The new implementation uses the new netaddrq library. It reports more
reliable results especially for IPv6.

Additionally, two new escapes are implemented:

\a Report all interfaces and assigned addresses that are considered as
reliable.

\A Report all interfaces and all assigned addresses.

TODO:

To prevent overflooding of the console, the list is currently limited to 12
interfaces. It would be nice to make it configurable.

Two pass processing of issue files. First pass just collects IP protocols
and list of interfaces (in future interface patterns). Now it always
processes both IPv4 and IPv6 on all interfaces. Not so bad, as \a is smart
enough to display just the useful part.

Maybe implement more options and formatting support for \a and \A.

Maybe implement interface filter globs or regexps for \a and \A. Still not
so bad, as \a automatically skips interfaces without reliable addresses
(e. g. lo or TUN).

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
term-utils/agetty.8.adoc
term-utils/agetty.c