tony;
I am aware that I can call ip a and parse the result. [...] Is there any other way to obtain this data, maybe from /sys?
just call libc.getifaddrs() directly.