Skip to content
  • Thomas Haller's avatar
    systemd/dhcp: fix assertion starting DHCP client without MAC address · 1031b2bb
    Thomas Haller authored
    An assertion in dhcp_network_bind_raw_socket() is triggered when
    starting an sd_dhcp_client without setting setting a MAC address
    first.
    
      - sd_dhcp_client_start()
        - client_start()
          - client_start_delayed()
            - dhcp_network_bind_raw_socket()
    
    In that case, the arp-type and MAC address is still unset. Note that
    dhcp_network_bind_raw_socket() already checks for a valid arp-type
    and MAC address below, so we should just gracefully return -EINVAL.
    
    Maybe sd_dhcp_client_start() should fail earlier when starting without
    MAC address. But the failure here will be correctly propagated and
    the start aborted.
    
    See-also: https://github.com/systemd/systemd/pull/10054
    (cherry picked from commit 34af574d)
    (cherry picked from commit 0a797bdc)
    (cherry picked from commit f37ed84c)
    1031b2bb