Skip to content
  • Beniamino Galvani's avatar
    dhcp: fix handling of failure events · bd63d392
    Beniamino Galvani authored
    DHCPv4 can fail for two reasons:
    
     (a) the client failed to contact server and to get an initial lease
    
     (b) the client failed to renew the lease after it was successfully
         acquired
    
    For (a) the client generates a TIMEOUT event, for (b) an EXPIRED
    event.  Currently we fail the IP method immediately after (a), but
    this doesn't work well when the carrier flickers and we restart the
    client because if the server goes temporarily down, the IP method
    fails and DHCP is never restarted.
    
    Let's change this, and determine whether to fail IP configuration only
    by looking at the current IP state: when it's IP_CONF then we are
    getting the initial lease and a failure means that IP configuration
    must fail; otherwise any other state means that the lease expired or
    could not be renewed and thus we keep the client running for the grace
    period.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1573780
    bd63d392