Skip to content
  • Thomas Haller's avatar
    dhcp: cleanup initializing IPv4 client-id for internal DHCP · c3e7e617
    Thomas Haller authored
    - if we leave the client-id of sd_dhcp_client unset, it will
      anyway generate a node-specific client-id (and may fail if
      "/etc/machine-id" is invalid).
      Anticipate that, and don't let the client-id unset. In case
      we have no client-id from configuration or lease, just generate
      the id ourself (using the same algorithm). The advantage is,
      that we know it upfront and can store the client-id in the
      NMDhcpClient instance. We no longer need to peel it out from
      the lease later.
    
    - to generate the IPv4 client-id, we need a valid MAC address. Also,
      sd_dhcp_client needs a MAC address for dhcp_network_bind_raw_socket()
      as well. Just require that a MAC address is always needed. Likewise,
      we need a valid ifindex and ifname set.
    
    - likewise for IPv6 and IPv4, cleanup detecting the arptype and
      checking MAC address length. sd_dhcp_client_set_mac() is overly
      strict at asserting input arguments, so we must validate them anyway.
    
    - also, now that we always initialize the client-id when starting
      the DHCP client, there is no need to retroactively extract it
      again when we receive the first lease.
    c3e7e617