Skip to content

[dhcp4relay] Implement RFC 6607 VSS-Control#122

Draft
Xichen96 wants to merge 2 commits into
sonic-net:masterfrom
Xichen96:dev/xichenlin/fix-vss-control
Draft

[dhcp4relay] Implement RFC 6607 VSS-Control#122
Xichen96 wants to merge 2 commits into
sonic-net:masterfrom
Xichen96:dev/xichenlin/fix-vss-control

Conversation

@Xichen96

Copy link
Copy Markdown
Contributor

Description of PR

Summary:

Implement RFC 6607 VSS-Control handling for relay-assigned DHCPv4 VSS.

The relay currently emits VSS Suboption 151 without the mandatory
VSS-Control Suboption 152. It therefore cannot distinguish a VSS-aware server
from a server such as Kea that merely echoes Option 82 without processing VSS.

Type of change

  • Bug fix

Approach

What is the motivation for this PR?

RFC 6607 requires a relay to include zero-length Suboption 152 whenever it
includes Suboption 151. A server that processes VSS removes 152 from its reply;
a server that does not process VSS returns both. Accepting an unprocessed reply
can deliver an address selected from the wrong VPN.

How did you do it?

  • Append zero-length VSS-Control Suboption 152 immediately after VSS
    Suboption 151.
  • For configurations requiring VSS, accept replies only when they contain the
    matching Type-0 client VRF in Suboption 151 and do not contain Suboption 152.
  • Drop and diagnose replies that retain 152 or omit/change 151.
  • Correct the TLV length boundary check used by the new reply validation.
  • Add focused unit coverage for zero-length TLVs, request encoding, successful
    VSS acknowledgement, retained 152, and missing/mismatched 151.

How did you verify/test it?

Focused unit coverage is included in dhcp4relay/test/mock_relay.cpp.
Compilation and unit execution are delegated to PR CI; no local SONiC build
was used.

Any platform specific information?

None.

Documentation

The behavior follows RFC 6607 Sections 3.3 and 5.

Emit zero-length VSS-Control whenever relay-assigned VSS is present. Validate server replies and drop retained VSS-Control or missing/mismatched VSS data.

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).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements RFC 6607 VSS-Control handling for DHCPv4 relay VSS (Option 82 suboptions), so the relay can distinguish VSS-aware servers from servers that merely echo Option 82 and can safely reject unprocessed replies.

Changes:

  • Appends zero-length VSS-Control Suboption 152 whenever VSS Suboption 151 is included in relay agent options.
  • Adds server-reply validation for VSS-required configurations (require matching Type-0 Suboption 151 and absence of Suboption 152; otherwise drop and log).
  • Fixes TLV encoding/decoding robustness and adds focused unit tests around zero-length TLVs and VSS validation.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
dhcp4relay/src/dhcp4relay.cpp Adds VSS-Control encoding, reply validation logic, and fixes TLV boundary handling.
dhcp4relay/src/dhcp4relay.h Introduces constant for VSS-Control suboption (152).
dhcp4relay/test/mock_relay.cpp Extends unit tests for zero-length TLVs, VSS-Control presence, and reply validation paths.

Comment thread dhcp4relay/src/dhcp4relay.cpp
Comment thread dhcp4relay/test/mock_relay.cpp
Comment thread dhcp4relay/test/mock_relay.cpp
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Validate the complete Option 82 suboption buffer before checking VSS acknowledgement so a truncated VSS-Control TLV cannot be treated as absent. Keep the unit-only helper declaration in the production header to avoid a duplicated test prototype.

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

Copilot-Session: 2b881aa9-3a3a-4aaf-b2ca-b941705b2438
Signed-off-by: Xichen96 <lukelin0907@gmail.com>
@Xichen96
Xichen96 force-pushed the dev/xichenlin/fix-vss-control branch from 13ba166 to 9be6f60 Compare July 18, 2026 15:41
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp 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.

3 participants