Skip to content

caclmgrd: Deny BGP to VLAN SVI on Fairwater BT0 devices - #428

Open
yyynini wants to merge 1 commit into
sonic-net:masterfrom
yyynini:bt0-bgp-svi-deny
Open

caclmgrd: Deny BGP to VLAN SVI on Fairwater BT0 devices#428
yyynini wants to merge 1 commit into
sonic-net:masterfrom
yyynini:bt0-bgp-svi-deny

Conversation

@yyynini

@yyynini yyynini commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

What

On Fairwater (FW) BT0 devices, deny inbound BGP (tcp/179) destined to the VLAN SVI (default gateway), while preserving all other BGP traffic (e.g. uplink peering) via the existing blanket ACCEPT. Non-FW devices are completely unaffected.

Why

caclmgrd currently has a hardcoded blanket ACCEPT for all inbound BGP (except the mgmt port), with a long-standing TODO in the source acknowledging this gap. On FW BT0, this allows BGP session attempts from the server/VLAN side to reach the switch's own control plane, which should be blocked.

How

  • FairwaterBt0 flag detected once at daemon init from DEVICE_METADATA: mgmt_type == "FairWater" and type == "BackEndToRRouter". Verified against a real FW BT0 device and a real non-FW DualToR device.
  • New generate_block_bgp_to_fw_vlan_svi_commands() reads VLAN_INTERFACE live (same convention as the existing generate_block_ip2me_traffic_iptables_commands) and emits DROP rules for tcp/179 to the SVI address, IPv4 and IPv6.
  • DROP rules are appended before the existing ACCEPT rule for BGP, so SVI-destined BGP is denied first; everything else falls through to ACCEPT unchanged; mgmt-port (eth0) exclusion is preserved as-is.

Testing

  • Added tests/caclmgrd/test_bgp_fw_vlan_svi_vectors.py + caclmgrd_bgp_fw_vlan_svi_test.py (4 vectors), all passing via pytest against the real module.
  • Full existing caclmgrd test suite (69 tests) re-run with no regressions.

On Fairwater (FW) BT0 devices, deny inbound BGP (tcp/179) destined to
the VLAN SVI (default gateway), while preserving all other BGP
traffic (e.g. uplink peering) via the existing blanket ACCEPT.
Non-FW devices are completely unaffected.

- FairwaterBt0 flag detected once at daemon init from DEVICE_METADATA:
  mgmt_type == 'FairWater' and type == 'BackEndToRRouter'. Verified
  against a real FW BT0 device (ATL21-0101-0022-12BT0) and a real
  non-FW DualToR device (str2-8101c1-01).
- New generate_block_bgp_to_fw_vlan_svi_commands() reads VLAN_INTERFACE
  live (same convention as generate_block_ip2me_traffic_iptables_commands)
  and emits DROP rules for tcp/179 to the SVI address, IPv4 and IPv6.
- DROP rules are appended before the existing ACCEPT rule for BGP, so
  SVI-destined BGP is denied first; everything else falls through to
  ACCEPT unchanged; mgmt-port (eth0) exclusion is preserved as-is.

Tested: added tests/caclmgrd/test_bgp_fw_vlan_svi_vectors.py +
caclmgrd_bgp_fw_vlan_svi_test.py (4 vectors), all passing via pytest
against the real module. Full existing caclmgrd test suite (69 tests)
re-run with no regressions.
@azure-pipelines

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

@yyynini yyynini closed this Aug 28, 2026
@yyynini yyynini reopened this Aug 28, 2026
@azure-pipelines

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

@mssonicbld

Copy link
Copy Markdown

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

2 participants