I attach the patch which in case of linux systems reads the IP address from the kernel table instead of the ioctl(SIOCGIFADDR) mechanism. This is needed for usage with dhcpcd, since the latter associates several IPs to the interface, and the desired IP is usually not the first one. The patch uses the last IP for the interface; private IPs (like 192.168.*.*) are ignored.
Created attachment 230735 [details, diff] Use kernel address table under linux
Created attachment 230895 [details, diff] Use local ip instead of point-to-point destination Since I had now an opportunity to test the patch also with pppd, I found that ifconfig reports the local ip instead of the point-to-point destination ip. So in order not to break previous functionality, the patch now also uses IFA_LOCAL insead of IFA_ADDR.
Created attachment 232193 [details, diff] Reopen socket for every query After doing some long-time tests, I found that the linux kernel gets confused if one keeps the netlink socket open permanently. So (under linux) the socket is now opened/closed for every netlink query. This is slightly slower but needs less permanent resources and appears to work reliable.
new revision with your patch in CVS. Many thanks!