Skip to content
  • Thomas Haller's avatar
    device: refactor nm_device_set_ip_ifindex() and set_ip_iface() · ab457830
    Thomas Haller authored
    - don't even bother to look into the platform cache, but use
      if_indextoname() / if_nametoindex(). In most cases, we obtained
      the ifindex/ifname not from the platform cache in the first
      place. Hence, there is a race, where the interface might not
      exist.
      However, try to process events of the platform cache, hoping
      that the cache contains an interface for the given ifindex/ifname.
    
    - let set_ip_ifindex() and set_ip_iface() both return a boolean
      value to indicate whether a ip-interface is set or not. That is,
      whether we have a positive ip_ifindex. That seems more interesting
      information, then to return whether anything changed.
    
    - as before, set_ip_ifindex() can only clear an ifindex/ifname,
      or error out without doing anything. That is different from
      set_ip_iface(), which will also set an ifname if no ifindex
      can be resolved. That is curreently ugly, because then ip-ifindex
      and ip-iface don't agree. That shall be improved in the future
      by:
      - trying to set an interface that cannot be resolved shall
        lead to a disconnect in any case.
      - we shall make less use of the ip-iface and rely more on the
        ifindex.
    ab457830