[dhcp_server] Revert container-side docker0 syslog iptables add/del (#26637); caclmgrd to own the rule#28328
Conversation
…n bridge-mode container (sonic-net#26637)" This reverts commit 933d908. Move ownership of the dhcp_server docker0 syslog (UDP 514) INPUT exception out of the container start/stop script. Going forward caclmgrd owns this rule and re-installs it on every control-plane ACL flush-and-rebuild, keyed on FEATURE|dhcp_server, so the rebuild never drops it (sonic-net#27584). This revert is step 1 of that plan. The caclmgrd change (sonic-host-services) and the container-side bounded waits that replace this add/del land in follow-up PRs. Signed-off-by: Xichen96 <lukelin0907@gmail.com>
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR reverts the dhcp_server container-side management of the host iptables INPUT exception for bridge-mode syslog (UDP/514 on docker0), as part of moving ownership of that rule to caclmgrd so it persists across CACL flush/rebuild operations.
Changes:
- Removed the
dhcp_server-specificiptables -I ... --dport 514 ...insertion frompreStartAction(). - Removed the matching
iptables -D ... --dport 514 ...deletion fromstop().
Comments suppressed due to low confidence (1)
files/build_templates/docker_image_ctl.j2:138
- This revert removes the only place in this repo that ensured UDP/514 syslog from the bridge-mode
dhcp_servercontainer is accepted on the host (INPUTondocker0). Unless the image already includes the follow-up change wherecaclmgrdreinstalls the equivalent rule on every CACL rebuild, this will reintroduce the original failure mode (syslog silently dropped when the catch-all DROP is present). Consider updating the relevant dependency (e.g., sonic-host-services/caclmgrd) in the same PR or otherwise gating/ordering the merge so the image is never built without any component owning this exception.
{%- else %}
: # nothing
{%- endif %}
updateSyslogConf
}
|
Gentle ping for review 🙏 — this is the resolved approach for the caclmgrd / dhcp_server syslog-rule ownership: it reverts the container-side docker0 iptables add/del from #26637 and lets caclmgrd own the rule, replacing the abandoned sonic-host-services#396. CI green. @yxieca @StormLiangMS could you take a look? Thanks! |
|
@Xichen96 Can you provide ETA to raise PR to make caclmgrd owning the iptable rules? |
|
The label |
|
@vaibhavhd Hi Vaibhvd, pls help review, I want this in the 202605 branch |
Step 3 of 3 of moving the dhcp_server docker0 syslog INPUT exception ownership to caclmgrd (fixes #27584). PR1 (#28328) removed the container-side add/del; PR2 (sonic-net/sonic-host-services#412) made caclmgrd own the rule. This replaces the removed add/del with feature-gated bounded waits that synchronize with caclmgrd: - preStartAction: when FEATURE|dhcp_server is enabled, wait up to 10s for the docker0 tcp/2514 ACCEPT rule to be present before the container starts, so the RELP client's first connection is not dropped by the control-plane catch-all DROP. - stop(): when FEATURE|dhcp_server is disabled, wait up to 10s for the rule to be removed. Plain restarts / shutdown / CONFIG_DB-down skip the wait (positive-state gate). The iptables -C existence check matches the canonical stored form of the rule caclmgrd installs (identical to `iptables -S INPUT` output), so the wait observes the rule reliably across iptables variants. Signed-off-by: Xichen96 <lukelin0907@gmail.com>
Step 3 of 3 of moving the dhcp_server docker0 syslog INPUT exception ownership to caclmgrd (fixes #27584). PR1 (#28328) removed the container-side add/del; PR2 (sonic-net/sonic-host-services#412) made caclmgrd own the rule. This replaces the removed add/del with feature-gated bounded waits that synchronize with caclmgrd: - preStartAction: when FEATURE|dhcp_server is enabled, wait up to 10s for the docker0 tcp/2514 ACCEPT rule to be present before the container starts, so the RELP client's first connection is not dropped by the control-plane catch-all DROP. - stop(): when FEATURE|dhcp_server is disabled, wait up to 10s for the rule to be removed. Plain restarts / shutdown / CONFIG_DB-down skip the wait (positive-state gate). The iptables -C existence check matches the canonical stored form of the rule caclmgrd installs (identical to `iptables -S INPUT` output), so the wait observes the rule reliably across iptables variants. Signed-off-by: Xichen96 <lukelin0907@gmail.com>
The dhcp_server docker0 syslog INPUT exception changed from UDP 514 to RELP over tcp/2514, and its ownership moved from the container start/stop script to caclmgrd, which re-installs it on every control-plane ACL flush-and-rebuild while FEATURE|dhcp_server is enabled (sonic-net/sonic-buildimage#28328, sonic-net/sonic-host-services#412, sonic-net/sonic-buildimage#28580; fixes sonic-net/sonic-buildimage#27584). Update generate_expected_rules() to assert the tcp/2514 exception instead of the old udp/514 rule, and gate the expectation on the FEATURE|dhcp_server state that caclmgrd keys on (read via sonic-db-cli), rather than on mere container presence. Signed-off-by: Xichen Lin <lukelin0907@gmail.com>
The dhcp_server docker0 syslog INPUT exception changed from UDP 514 to RELP over tcp/2514, and its ownership moved from the container start/stop script to caclmgrd, which re-installs it on every control-plane ACL flush-and-rebuild while FEATURE|dhcp_server is enabled (sonic-net/sonic-buildimage#28328, sonic-net/sonic-host-services#412, sonic-net/sonic-buildimage#28580; fixes sonic-net/sonic-buildimage#27584). Update generate_expected_rules() to assert the tcp/2514 exception instead of the old udp/514 rule, and gate the expectation on the FEATURE|dhcp_server state that caclmgrd keys on (read via sonic-db-cli), rather than on mere container presence. Signed-off-by: Xichen Lin <lukelin0907@gmail.com>
Add test_caclmgrd_dhcp_server_syslog verifying the docker0 RELP tcp/2514 INPUT exception that caclmgrd now owns (sonic-net/sonic-buildimage#28328, sonic-net/sonic-host-services#412, sonic-net/sonic-buildimage#28580; fixes sonic-net/sonic-buildimage#27584): * present above the control-plane catch-all DROP while FEATURE|dhcp_server is enabled, * survives a control-plane ACL flush-and-rebuild (forced via the dummy_acl_rules fixture / acl-loader), and * removed on feature-disable and restored on feature-enable. The test skips when dhcp_server is not enabled on the DUT. Signed-off-by: Xichen Lin <lukelin0907@gmail.com>
Step 3 of 3 of moving the dhcp_server docker0 syslog INPUT exception ownership to caclmgrd (fixes #27584). PR1 (#28328) removed the container-side add/del; PR2 (sonic-net/sonic-host-services#412) made caclmgrd own the rule. This replaces the removed add/del with feature-gated bounded waits that synchronize with caclmgrd: - preStartAction: when FEATURE|dhcp_server is enabled, wait up to 10s for the docker0 tcp/2514 ACCEPT rule to be present before the container starts, so the RELP client's first connection is not dropped by the control-plane catch-all DROP. - stop(): when FEATURE|dhcp_server is disabled, wait up to 10s for the rule to be removed. Plain restarts / shutdown / CONFIG_DB-down skip the wait (positive-state gate). The iptables -C existence check matches the canonical stored form of the rule caclmgrd installs (identical to `iptables -S INPUT` output), so the wait observes the rule reliably across iptables variants. Signed-off-by: Xichen96 <lukelin0907@gmail.com>
Add test_caclmgrd_dhcp_server_syslog verifying the docker0 RELP tcp/2514 INPUT exception that caclmgrd now owns (sonic-net/sonic-buildimage#28328, sonic-net/sonic-host-services#412, sonic-net/sonic-buildimage#28580; fixes sonic-net/sonic-buildimage#27584): * present above the control-plane catch-all DROP while FEATURE|dhcp_server is enabled, * survives a control-plane ACL flush-and-rebuild (forced via the dummy_acl_rules fixture / acl-loader), and * removed on feature-disable and restored on feature-enable. The test skips when dhcp_server is not enabled on the DUT. Signed-off-by: Xichen Lin <lukelin0907@gmail.com>
Step 3 of 3 of moving the dhcp_server docker0 syslog INPUT exception ownership to caclmgrd (fixes #27584). PR1 (#28328) removed the container-side add/del; PR2 (sonic-net/sonic-host-services#412) made caclmgrd own the rule. This replaces the removed add/del with feature-gated bounded waits that synchronize with caclmgrd: - preStartAction: when FEATURE|dhcp_server is enabled, wait up to 10s for the docker0 tcp/2514 ACCEPT rule to be present before the container starts, so the RELP client's first connection is not dropped by the control-plane catch-all DROP. - stop(): when FEATURE|dhcp_server is disabled, wait up to 10s for the rule to be removed. Plain restarts / shutdown / CONFIG_DB-down skip the wait (positive-state gate). The iptables -C existence check matches the canonical stored form of the rule caclmgrd installs (identical to `iptables -S INPUT` output), so the wait observes the rule reliably across iptables variants. Signed-off-by: Xichen96 <lukelin0907@gmail.com>
Add test_caclmgrd_dhcp_server_syslog verifying the docker0 RELP tcp/2514 INPUT exception that caclmgrd now owns (sonic-net/sonic-buildimage#28328, sonic-net/sonic-host-services#412, sonic-net/sonic-buildimage#28580; fixes sonic-net/sonic-buildimage#27584): * present above the control-plane catch-all DROP while FEATURE|dhcp_server is enabled, * survives a control-plane ACL flush-and-rebuild (forced via the dummy_acl_rules fixture / acl-loader), and * removed on feature-disable and restored on feature-enable. The test skips when dhcp_server is not enabled on the DUT. Signed-off-by: Xichen Lin <lukelin0907@gmail.com>
Why I did it
Reverts #26637.
This is step 1 of 3 of moving the
dhcp_serverdocker0syslog (UDP 514)INPUTexception out of the container start/stop script so thatcaclmgrdowns it.caclmgrdwill re-install the rule on every control-plane ACL flush-and-rebuild, keyed onFEATURE|dhcp_server, so the rebuild never drops it — the root cause of #27584.Plan (parent ADO 38699922):
iptables -I/-Dadd/del.caclmgrdinstalls/removes the rule based onFEATURE|dhcp_server(sonic-host-services#412 — must reach the image before this repo relies on it).caclmgrd([dhcp_server] Wait for caclmgrd-owned docker0 syslog rule on start/stop #28580).Work item tracking
How I did it
git revertof 933d908 (#26637). Removes the twodhcp_server-specific blocks infiles/build_templates/docker_image_ctl.j2(theiptables -IinpreStartActionand theiptables -Dinstop). No other change.How to verify it
grep dhcp_server_syslog files/build_templates/docker_image_ctl.j2returns nothing.dhcp_servercontainer ctl script no longer adds/removes thedocker0UDP 514iptablesrule on start/stop.Hardware validation
Validated as part of the 3-PR set (revert here + caclmgrd ownership + container waits) by hand-patching the changes onto a running DUT (no image rebuild).
bjw-can-720dt-2(720dt,mx),dhcp_serverenabled.rsyslogdlistens on240.127.1.1:2514, thedocker0IP).dhcp_servercontainer ctl script no longer adds/removes thedocker0syslogiptablesrule on start/stop — the rule is instead owned and re-installed bycaclmgrd.Results:
docker exec dhcp_server logger ...reached host/var/log/syslog; thedocker0ACCEPT rule showed packet hits (2 pkts / 214 B).config feature state dhcp_server disabledremoves the rule;enabledre-adds it (caclmgrd logs both transitions).INPUT), thedocker0/2514 ACCEPT rule is still present at position 3, above the catch-all DROP. With the container-side add/del removed by this PR, this only holds becausecaclmgrdnow owns the rule.Which release branch to backport (provide reason below if selected)
Backporting the revert in isolation would leave the branch with neither the container nor caclmgrd owning the rule; the 202605 backport is handled together with the caclmgrd change (sonic-host-services#412) and the container-waits change (#28580) as a coordinated set.
Tracking issue/work item for backport/cherry-pick request (GitHub issue or Microsoft ADO): Microsoft ADO 38745010
Failure type: day-one issue (the container-owned docker0 syslog rule never survived a caclmgrd control-plane ACL rebuild)
Tested branch
Test result
bjw-can-720dt-2(720dt,mx) as part of the 3-PR set; see "Hardware validation" above (caclmgrd owns the docker0 tcp/2514 rule above the catch-all DROP, end-to-end RELP syslog delivered, feature toggle add/remove, survives an unrelated control-plane ACL re-walk — bug Bug: CACL updates remove dhcp_server syslog iptables rule #27584 fix).dhcp_serverctl script andcaclmgrdcode path are identical to 202605; a master-image run is the only remaining validation step.Description for the changelog
Revert the dhcp_server container-side docker0 syslog iptables add/del; ownership of that INPUT exception moves to caclmgrd.