Skip to content

[dhcp4relay] Apply configured maximum hop count - #123

Draft
Xichen96 wants to merge 1 commit into
sonic-net:masterfrom
Xichen96:dev/xichenlin/item10-max-hop-config
Draft

[dhcp4relay] Apply configured maximum hop count#123
Xichen96 wants to merge 1 commit into
sonic-net:masterfrom
Xichen96:dev/xichenlin/item10-max-hop-config

Conversation

@Xichen96

@Xichen96 Xichen96 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Description of PR

Summary:

Apply configured DHCPv4 maximum hop counts to active per-VLAN relay state and
use the YANG/RFC-recommended default of 4, while retaining 16 as the distinct
absolute supported maximum.

This is a low-priority placeholder for a non-current deployment scenario. This
draft must not merge yet.

Type of change

  • Bug fix

Approach

What is the motivation for this PR?

DHCPMgr parses max_hop_count, but the main relay event path does not copy it
into the active VLAN configuration. Runtime behavior therefore remains at the
native struct default, which was incorrectly conflated with the absolute limit
of 16 instead of the configured/YANG default of 4.

How did you do it?

  • Define 4 as the native default and retain 16 as the absolute supported limit.
  • Copy each add/update event's parsed max_hop_count into the active VLAN
    relay_config.
  • Add focused native unit coverage for the default, add propagation, and update
    propagation.

How did you verify/test it?

Focused native unit code is included but was NOT RUN, per explicit test
deferral. Test execution is deferred until the higher-priority DHCP relay PRs
listed below merge.

Any platform specific information?

None. This covers a lower-priority, non-current deployment scenario.

Dependencies and future validation TODOs

Validation sequencing depends on these higher-priority relay PRs merging first
(no code dependency; this branch is independently based on fresh origin/master):

Before marking ready or merging:

  • Execute the focused native unit coverage included in this PR.
  • Open the dependent sonic-mgmt PR with threshold-discriminating coverage:
    [dhcp_relay] Verify configured DHCP relay hop limits sonic-mgmt#26321 — configured 2 with
    incoming hops=2 must drop, and configured 4 with incoming hops=3
    must forward after increment.
  • Validate a live CONFIG_DB update changes the active threshold without a
    daemon restart.
  • Run applicable PR CI/hardware validation after the dependency PRs merge.
  • Keep this PR in draft; do not merge before these TODOs are complete.

Documentation

Behavior aligns the native default with the existing YANG contract and RFC 1542
recommended configurable threshold while preserving the absolute limit of 16.

Use the RFC-recommended default while preserving the absolute supported maximum, and propagate parsed configuration into active VLAN relay state.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2b881aa9-3a3a-4aaf-b2ca-b941705b2438
Signed-off-by: Xichen96 <lukelin0907@gmail.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants