Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 318905

Summary: [PATCH] Make ez-ipupdate work with iproute2/dhcpcd under linux
Product: Gentoo Linux Reporter: Martin Väth <martin>
Component: Current packagesAssignee: Stefan Briesenick (RETIRED) <sbriesen>
Status: RESOLVED FIXED    
Severity: normal    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Use kernel address table under linux
Use local ip instead of point-to-point destination
Reopen socket for every query

Description Martin Väth 2010-05-07 19:55:19 UTC
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.
Comment 1 Martin Väth 2010-05-07 19:56:06 UTC
Created attachment 230735 [details, diff]
Use kernel address table under linux
Comment 2 Martin Väth 2010-05-09 20:02:45 UTC
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.
Comment 3 Martin Väth 2010-05-20 06:30:51 UTC
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.
Comment 4 Stefan Briesenick (RETIRED) gentoo-dev 2010-07-20 20:31:45 UTC
new revision with your patch in CVS. Many thanks!