Skip to content
  • Thomas Haller's avatar
    platform: fix link_type_from_udev() to use ifname from libnl · b9d85bb7
    Thomas Haller authored
    
    
    When an interface gets renamed, we first receive a libnl update with
    the changed interface name.
    
    This results in the following chain of calls:
      - event_notification()
      - announce_object()
      - link_init()
      - link_extract_type()
      - link_type_from_udev()
    Then link_type_from_udev() looks up the name in the udev data (getting
    the previous name, because we did not yet recieve the udev notification)
    and passes the name to wifi_utils_is_wifi(), which eventually calls
    nm_platform_link_get_ifindex() -- doing a lookup by the old name.
    
    Fix this, by passing the ifname from libnl to link_type_from_udev().
    
    Also, change hack_empty_master_iff_lower_up() because it is called
    from event_notification(), at a moment when the link cache possibly
    does not yet know the ifindex -- so that the call chain to
    link_extract_type(), link_type_from_udev(), wifi_utils_is_wifi()
    again might lead to lookup for something that does not yet exist.
    Note, that in this case the name would not yet exist, because we
    did not yet put the libnl object into the link cache.
    
    Signed-off-by: default avatarThomas Haller <thaller@redhat.com>
    b9d85bb7