Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • NetworkManager NetworkManager
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 192
    • Issues 192
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 23
    • Merge requests 23
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • NetworkManagerNetworkManager
  • NetworkManagerNetworkManager
  • Merge requests
  • !1308

[th/dhclient-fix-accept] dhcp: fix EXTENDED DHCP event to accept lease for dhclient plugin

  • Review changes

  • Download
  • Patches
  • Plain diff
Closed Thomas Haller requested to merge th/dhclient-fix-accept into main Jul 20, 2022
  • Overview 4
  • Commits 1
  • Pipelines 2
  • Changes 2

n-dhcp4 only supports calling ACCEPT during the GRANTED state. Not during a EXTENDED event. So usually, we would not want to call accept in that case.

And we didn't. During EXTENDED event, we would usually skip ACD (because it's either not enabled or we already have an ACD state for the current address). In that case, in _nm_dhcp_client_notify() we hit the line

     if (client_event_type == NM_DHCP_CLIENT_EVENT_TYPE_BOUND && priv->l3cd_curr
         && nm_l3_config_data_get_num_addresses(priv->l3cd_curr, priv->config.addr_family) > 0)
         priv->l3cfg_notify.wait_dhcp_commit = TRUE;
     else
         priv->l3cfg_notify.wait_dhcp_commit = FALSE;

and would not set wait_dhpc_commit. That means, we never called _dhcp_client_accept(). For nettools, that doesn't really matter because calling ACCEPT during EXTENDED is invalid anyway. However, for dhclient that is fatal because we wouldn't reply the D-Bus request from nm-dhcp-helper. The helper times out after 60 seconds and dhclient disconnects.

We need to fix that by also calling _dhcp_client_accept() in the case, when we don't need to wait (the EXTENDED case).

However, previously _dhcp_client_accept() was rather peculiar and didn't like to be called in unexpected state. Relax that. Now, when calling accept in an unexpected state, just do nothing and signal success. That frees the caller from the complexity to understand when they must/must not call accept.

https://bugzilla.redhat.com/show_bug.cgi?id=2109285

Fixes: 156d8421 ('dhcp/dhclient: implement accept/decline (ACD) for dhclient plugin')

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: th/dhclient-fix-accept