What | Removed | Added |
---|---|---|
Status | CONFIRMED | IN_PROGRESS |
CC | jbohac@suse.com, mkubecek@suse.com | |
Flags | needinfo?(mkubecek@suse.com), needinfo?(jbohac@suse.com) |
I spent two days in learning of the network code. As far as I understand, the current agetty code (see comment 4) is not capable to discriminate between global, link and ephemeral IPv6 address as well as it is not capable to discriminate between primary and secondary IPv4 address. If I read the documentation correctly, there are at least three completely different implementations of IP addresses interface: - POSIX getifaddrs() used by agetty. - sockios ioctl() and its SIOC* commands, used by the old net-tools, e. g. ifconfig. - NETLINK_ROUTE netlink messages, used by iproute2, e. g. ip. Only the first one is portable. And probably only the last one is capable to provide ifaddrmsg, the structure that reports type of the IP address as well as lifetime for ephemeral addresses. (For the first one I am pretty sure that it is not possible, as the documented part does not contain it, and ifa_data is unused by kernel and set to zero in glibc. I am not sure for the second interface.) The third interface is used by ip, and so it seems to be possible to get the requested information in that way. Could you confirm that I have to rewrite the agetty to NETLINK_ROUTE to fix this bug? Are you aware of any sample code that is more readable than iproute2? In case of rewrite to NETLINK_ROUTE, it could make sense to parse network change messages, but it would require even larger rewrite of agetty. Note that it is a bit confusing that linux/if_addr.h refer to ifa_flags, which are part of struct ifaddrs from getifaddrs(). It is probably recycled in more interfaces. So, I definitely see that ifa_flags contains items starting with IFF_. And that starting with IFA_F_ is surely not part of ifa_flags from getifaddrs(), but probably returned in netlink messages.