Refactor DHCP implementation to comply with RFC 2131#57
Merged
grossmj merged 1 commit intoGNS3:masterfrom Nov 23, 2025
Merged
Conversation
This commit refactors the DHCP functionality in VPCS to better align with RFC 2131 specifications: 1. Renamed the boolean 'renew' parameter to enum 'stage' in dhcp4_request() to properly distinguish between DHCP phases: - stage = 0: Initial DHCP request (INIT) - stage = 1: Renewing request (RENEWING) - stage = 2: Rebinding request (REBINDING) 2. Corrected IP address handling for each phase: - INIT phase (stage = 0): Source IP set to 0.0.0.0 - RENEWING phase (stage = 1): Source IP set to client's current IP - REBINDING phase (stage = 2): Source IP set to client's current IP 3. Updated all dhcp4_request() calls to pass appropriate stage values: - run_dhcp_new() selects stage based on user input - dhcp_renew() passes stage = 1 - dhcp_rebind() passes stage = 2 4. Maintained backward compatibility by keeping the 'renew' parameter in dhcp4_discover() 5. Improved code documentation and removed redundant comments These changes ensure proper DHCP behavior according to RFC 2131 while maintaining compatibility with existing code.
Contributor
Author
|
Before this commit, systemd-resolved did not accept DHCP requests from VPCS, like this: After this commit, DHCP can proceed normally: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit refactors the DHCP functionality in VPCS to better align with RFC 2131 specifications:
Renamed the boolean 'renew' parameter to enum 'stage' in dhcp4_request() to properly distinguish between DHCP phases:
Corrected IP address handling for each phase:
Updated all dhcp4_request() calls to pass appropriate stage values:
Maintained backward compatibility by keeping the 'renew' parameter in dhcp4_discover()
Improved code documentation and removed redundant comments
These changes ensure proper DHCP behavior according to RFC 2131 while maintaining compatibility with existing code.