Skip to content

dhcp: T7052: Fix remaining time evaluation and formatting errors #4320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

indrajitr
Copy link
Contributor

@indrajitr indrajitr commented Jan 26, 2025

Change summary

The remaining time for a lease was not being correctly evaluated and formatted. As a result, expired leases show up with show dhcp server leases.

Also, the empty hostname should be replaced by '-'.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

https://vyos.dev/T7052

Related PR(s)

How to test / Smoketest result

Before:

10.10.2.1 has lease expired but still shows up, 10.10.2.2 doesn't have hostname set to -

vyos@test-0125:~$ show dhcp server leases sort ip
IP Address    MAC address        State    Lease start                Lease expiration           Remaining    Pool    Hostname                     Origin
------------  -----------------  -------  -------------------------  -------------------------  -----------  ------  ---------------------------  --------
10.10.1.9     80:aa:bb:cc:dd:ee  active   2025-01-26 08:25:54+00:00  2025-01-27 08:25:54+00:00  13:40:25     LAN1    ngap                         local
10.10.2.1     7e:aa:bb:cc:dd:ee  expired  2025-01-25 17:46:19+00:00  2025-01-26 17:46:19+00:00  -            LAN2    watch                        local
10.10.2.2     a6:aa:bb:cc:dd:ee  active   2025-01-25 23:23:18+00:00  2025-01-26 23:23:18+00:00  4:37:49      LAN2                                 local

After:

10.10.2.1 doesn't show up, 10.10.2.2 has hostname set to - correctly

vyos@test-0125:~$ show dhcp server leases sort ip
IP Address    MAC address        State    Lease start                Lease expiration           Remaining    Pool    Hostname                     Origin
------------  -----------------  -------  -------------------------  -------------------------  -----------  ------  ---------------------------  --------
10.10.1.9     80:aa:bb:cc:dd:ee  active   2025-01-26 08:25:54+00:00  2025-01-27 08:25:54+00:00  13:15:04     LAN1    ngap                         local
10.10.2.2     a6:aa:bb:cc:dd:ee  active   2025-01-25 23:23:18+00:00  2025-01-26 23:23:18+00:00  4:12:28      LAN2    -                            local

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

The remaining time for a lease was not being correctly
evaluated and formatted. As a result, expired leases
show up with `show dhcp server leases`.

Also, the empty hostname should be replaced by '-'.
Copy link

github-actions bot commented Jan 26, 2025

👍
No issues in PR Title / Commit Title

Copy link

CI integration 👍 passed!

Details

CI logs

  • CLI Smoketests (no interfaces) 👍 passed
  • CLI Smoketests (interfaces only) 👍 passed
  • Config tests 👍 passed
  • RAID1 tests 👍 passed
  • TPM tests 👍 passed

@dmbaturin dmbaturin merged commit d50cdfe into vyos:current Jan 27, 2025
15 checks passed
@indrajitr indrajitr deleted the vyos-t7052-2 branch January 27, 2025 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants