Iface name is not always part of a Netlink message, as opposed to the
OS index of the interface, and looking up the name following reception of
an interface removal notification just does not work.
All supported and prospective platforms seem to have a concept of
interface OS index, so this should cause no problem and be more efficient.
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
v4: IfaceIpList,
v6: IfaceIpList,
}
-type IpList = HashMap<String, IfaceIpStruct>;
+type IpList = HashMap<u32, IfaceIpStruct>;
// pseudo version for xe-daemon compatibility, real agent version in
// BuildVersion below
impl Schema {
fn munged_address(&mut self, addr: &IpAddr, iface: &NetInterface) -> io::Result<String> {
let ip_entry = self.ip_addresses
- .entry(iface.name.clone()) // wtf, need cloning string for a lookup!?
+ .entry(iface.index)
.or_insert(IfaceIpStruct{v4: [None; NUM_IFACE_IPS], v6: [None; NUM_IFACE_IPS]});
let ip_list = match addr { IpAddr::V4(_) => &mut ip_entry.v4,
IpAddr::V6(_) => &mut ip_entry.v6 };