shill: Extract local address for point-to-point interfaces in RTNL messages.
This CL modifies DeviceInfo::AddressMsgHandler to extract the local IP
address, instead of the peer IP address, for a point-to-point interface
from a RTNL address message, such that the IP address can be properly
removed from a point-to-point interface after disconnect.
BUG=chrome-os-partner:10613
TEST=Verify that the IP address of a point-to-point interface and a
non point-to-point interface is properly removed after disconnect.
Change-Id: I4cb723897ef2cd1280f0f2afce33835dbfecae11
Reviewed-on: https://gerrit.chromium.org/gerrit/25559
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Ready: Ben Chan <benchan@chromium.org>
diff --git a/device_info.cc b/device_info.cc
index 4c0a746..9ee30fb 100644
--- a/device_info.cc
+++ b/device_info.cc
@@ -618,9 +618,13 @@
}
const RTNLMessage::AddressStatus &status = msg.address_status();
IPAddress address(msg.family(),
- msg.GetAttribute(IFA_ADDRESS),
+ msg.HasAttribute(IFA_LOCAL) ?
+ msg.GetAttribute(IFA_LOCAL) : msg.GetAttribute(IFA_ADDRESS),
status.prefix_len);
+ SLOG_IF(Device, 2, msg.HasAttribute(IFA_LOCAL))
+ << "Found local address attribute for interface " << interface_index;
+
vector<AddressData> &address_list = infos_[interface_index].ip_addresses;
vector<AddressData>::iterator iter;
for (iter = address_list.begin(); iter != address_list.end(); ++iter) {