Skip to content

[202511] Backport PR #22486: sonic dhcp relay agent for IPv4#25371

Merged
vmittal-msft merged 8 commits intosonic-net:202511from
ashutosh-agrawal:202511-pr22486-cherrypick
Mar 23, 2026
Merged

[202511] Backport PR #22486: sonic dhcp relay agent for IPv4#25371
vmittal-msft merged 8 commits intosonic-net:202511from
ashutosh-agrawal:202511-pr22486-cherrypick

Conversation

@ashutosh-agrawal
Copy link
Member

@ashutosh-agrawal ashutosh-agrawal commented Feb 5, 2026

Backport of #22486 to 202511

This PR backports the sonic DHCPv4 relay agent functionality from master to the 202511 branch.

Original PR

Changes

  • Cherry-picked all changes from the original PR
  • Resolved conflict in sonic-device_metadata.yang (added zebra_nexthop field specific to 202511)
  • Fixed indentation in dhcprelayd.py for consistency

What was added

  • New sonic DHCPv4 relay agent package (dhcp4relay)
  • Configuration flag has_sonic_dhcpv4_relay in DEVICE_METADATA
  • Supervisord templates for the sonic agent
  • Comprehensive test coverage for all scenarios
  • When enabled, the sonic agent replaces ISC DHCP relay for IPv4

Testing

  • Includes all test files and expected outputs from original PR
  • Tests verify correct behavior with sonic agent enabled/disabled
  • Tests verify correct behavior with/without DHCP relay configuration

How to verify

Configure sonic DHCPv4 agent as described in the feature HLD: sonic-net/SONiC#1938

Why I did it
Currently SONiC uses the 'isc-dhcp-relay' package to allow DHCP relay functionality on IPv4 networks.
With this PR we are adding sonic dhcp relay agent for IPv4 as described in this HLD(sonic-net/SONiC#1938)

Work item tracking
Microsoft ADO (number only):
How I did it
Edit supervisord template to start sonic DHCPv4 relay instance when configured to do so in Config DB.
Align cfg unit test to the new change.

How to verify it
Configure sonic DHCPv4 agent as described in the feature HLD(sonic-net/SONiC#1938)
Test it with real client/server with IPv4 or use the sonic-mgmt suite

Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
Co-authored-by: Shivashankar C R <shivashankar.c.r@gmail.com>
Co-authored-by: Ashutosh Agrawal <ashu@cisco.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: StormLiangMS <89824293+StormLiangMS@users.noreply.github.com>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@dayouliu1
Copy link
Contributor

dayouliu1 commented Feb 9, 2026

FYI from the checks it seems like there are build failures for all platforms.

Ex for broadcom:

dpkg-checkbuilddeps: error: Unmet build dependencies: libboost-thread-dev libboost-system-dev
dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied; aborting
dpkg-buildpackage: warning: (Use -d flag to override.)
[  FAIL LOG END  ] [ target/debs/bookworm/sonic-dhcp4relay_1.0.0-0_amd64.deb ]
make: *** [slave.mk:799: target/debs/bookworm/sonic-dhcp4relay_1.0.0-0_amd64.deb] Error 1
make: *** Waiting for unfinished jobs....
[ finished ] [ target/debs/bookworm/libteam5_1.31-1_amd64.deb-install ] 
[ finished ] [ target/debs/bookworm/python3-swsscommon_1.0.0_amd64.deb-install ] 
[ finished ] [ target/docker-config-engine-bookworm.gz ] 
make[1]: *** [Makefile.work:624: bookworm] Error 2
make[1]: Leaving directory '/data/vss/_work/1/s'
make: *** [Makefile:50: target/sonic-aboot-broadcom.swi] Error 2

@ashutosh-agrawal
Copy link
Member Author

@dayouliu1 @vmittal-msft @Blueve I think build failures are due to Boost library dependency. We probably need to backport PR#87 and PR#88 to fix it. Also, PR#84 needs to be backported for functional bug fixes.

@dayouliu1
Copy link
Contributor

dayouliu1 commented Feb 10, 2026

@sdszhang sdszhang closed this Feb 19, 2026
@sdszhang sdszhang reopened this Feb 19, 2026
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines failed to run 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@vmittal-msft
Copy link
Contributor

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@vmittal-msft
Copy link
Contributor

@ashutosh-agrawal can you please check failures ?

@ashutosh-agrawal
Copy link
Member Author

@vmittal-msft We need the following PR to be merged to fix the build issues.

sonic-net/sonic-dhcp-relay#95

@dayouliu1 had earlier opened two separate PRs for the changes but both set of changes are required together to pass the CI on sonic-dhcp-relay repo.

Once you merge the above PR, I'll update the refpoint to sonic-dhcp-relay in this PR.

Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@yxieca
Copy link
Contributor

yxieca commented Mar 18, 2026

/azpw ms_conflict

1 similar comment
@yxieca
Copy link
Contributor

yxieca commented Mar 20, 2026

/azpw ms_conflict

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@yijingyan2
Copy link
Contributor

/azpw ms_conflict

3 similar comments
@yijingyan2
Copy link
Contributor

/azpw ms_conflict

@yijingyan2
Copy link
Contributor

/azpw ms_conflict

@yijingyan2
Copy link
Contributor

/azpw ms_conflict

@yijingyan2
Copy link
Contributor

/azpw retry

@mssonicbld
Copy link
Collaborator

Retrying failed(or canceled) jobs...

@mssonicbld
Copy link
Collaborator

Retrying failed(or canceled) stages in build 1067549:
✅Stage Test:

  • Job impacted-area-kvmtest-t2 by Elastictest: retried.

@yijingyan2
Copy link
Contributor

/azpw ms_conflict

@vmittal-msft vmittal-msft merged commit b2e816b into sonic-net:202511 Mar 23, 2026
18 checks passed
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.

8 participants