Add ENABLE_FRR_SNMP_AGENT build option to disable BGP4-MIB#27877
Merged
Conversation
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
9494398 to
1746cdc
Compare
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
lguohan
previously approved these changes
Jun 13, 2026
1746cdc to
ecb4005
Compare
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
ecb4005 to
b95dbc2
Compare
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
b95dbc2 to
8c78f63
Compare
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
lguohan
previously approved these changes
Jun 14, 2026
Collaborator
|
/azpw ms_conflict |
6b2b997 to
ece0486
Compare
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
lguohan
previously approved these changes
Jun 14, 2026
3cdb5ca to
8e96556
Compare
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
0fd3a67 to
e3439c5
Compare
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
lguohan
previously approved these changes
Jun 14, 2026
Add a new build-time option ENABLE_FRR_SNMP_AGENT (default 'y') that
controls whether FRR loads the SNMP AgentX module. When set to 'n':
- frr-snmp package is excluded from docker-fpm-frr
- bgpd/zebra/ospfd run without -M snmp module
- agentx directive is omitted from bgpd/zebra configs
- snmp.conf is not copied into the container
This avoids snmpd memory issues caused by BGP4-MIB polling on switches
that don't require SNMP monitoring of BGP state.
Implementation:
- New ENABLE_FRR_SNMP_AGENT variable in rules/config (default y)
- constants.yml.j2 template renders frr.enable_snmp_agent for runtime use
- Jinja2 expression syntax in supervisord.conf.j2 for -M snmp flag
(uses {{ }} expressions instead of {% if %} blocks to avoid
trim_blocks newline eating in sonic-cfggen's Jinja2 environment)
- Jinja2 conditionals in bgpd.conf.j2, zebra.conf.j2 for agentx
- Docker build conditionals for frr-snmp package and snmp.conf
- Unit test constants.yml added to src/sonic-config-engine/tests/data/
- Static constants.yml kept at files/image_config/constants/ for bgpcfgd
Signed-off-by: securely1g <securely1g@users.noreply.github.com>
e3439c5 to
5c842ca
Compare
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
|
/azpw ms_conflict |
lguohan
approved these changes
Jun 15, 2026
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.
Description
Add a build-time option
ENABLE_FRR_SNMP_AGENT(default:y) that controls whether FRR's SNMP AgentX support (rfc1657 BGP4-MIB) is included in the image.Why I did it
The SNMP rfc1657 BGP4-MIB triggers memory management issues and causes snmpd to crash. This option allows deployments that do not need BGP4-MIB to disable it at build time.
How I did it
Added
ENABLE_FRR_SNMP_AGENTtorules/configwith conditional logic across build-time and runtime paths:Build-time (Makefile/Dockerfile):
rules/config— defineENABLE_FRR_SNMP_AGENT ?= yrules/frr.mk— conditionally defineFRR_SNMP/FRR_SNMP_DBGpackagesrules/docker-fpm-frr.mk— conditionally depend onFRR_SNMPslave.mk— export variable for Dockerfile.j2 rendering and image builddockers/docker-fpm-frr/Dockerfile.j2— conditionally COPYsnmp.confRuntime (sonic-cfggen template rendering):
files/build_templates/sonic_debian_extension.j2— injectsconstants.frr.enable_snmp_agentinto/etc/sonic/constants.ymlat image build timedockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2— conditionally adds-M snmpto zebra, bgpd, ospfd based onconstants.frr.enable_snmp_agentdockers/docker-fpm-frr/frr/bgpd/bgpd.conf.j2— conditionally emitsagentxdockers/docker-fpm-frr/frr/frr.conf.j2— conditionally emitsagentxNote:
dockers/docker-snmp/snmpd.conf.j2keepsagentxsocketunconditionally — the listening socket is harmless when no AgentX client connects, and docker-snmp does not loadconstants.yml.When
ENABLE_FRR_SNMP_AGENT=n:frr-snmppackage is not installed into docker-fpm-frr-M snmpmoduleagentxdirective is omitted from FRR config at runtimesnmp.confis not copied into the FRR containerHow to verify it
Build with
ENABLE_FRR_SNMP_AGENT=ninrules/configand confirm:Default build (
ENABLE_FRR_SNMP_AGENT=y) keeps existing behavior unchanged.Signed-off-by: securely1g securely1g@users.noreply.github.com