[caclmgrd]: Preserve dhcp_server_syslog rule during CACL rebuild#390
Open
Bojun-Feng wants to merge 1 commit into
Open
[caclmgrd]: Preserve dhcp_server_syslog rule during CACL rebuild#390Bojun-Feng wants to merge 1 commit into
Bojun-Feng wants to merge 1 commit into
Conversation
* Regenerate dhcp_server syslog iptables rule in flush-and-rebuild cycle when dhcp_server feature is present * Add unit tests for feature-present and feature-absent cases Signed-off-by: Bojun-Feng <bojundf@gmail.com>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@Bojun-Feng I am not comfortable with dhcp_servrer modify kernel iptables rules directly instead of through CONFIG_DB involvement. I understand this fix tries to address the issue by modifying kernel iptables rules again in caclmgrd but I want to understand if we can address this in dhcp_server. I tagged the origin author PR in the github issue. |
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.
Why I did it
Fix sonic-net/sonic-buildimage#27584
The dhcp_server container uses Docker bridge networking and sends syslog traffic to the host through docker0. Its iptables rule (
-A INPUT -i docker0 -p udp --dport 514 -m comment --comment dhcp_server_syslog -j ACCEPT) is created by docker_image_ctl.j2 during container startup but has no representation in CONFIG_DB.When caclmgrd processes a CACL update, it flushes all INPUT chain rules and rebuilds from CONFIG_DB state. Since the dhcp_server_syslog rule exists only in the kernel, it is permanently lost until the dhcp_server container is restarted. This silently breaks syslog delivery from dhcp_server after any CACL configuration change.
How I did it
How to verify it
iptables -S | grep dhcp_server_syslogsonic-db-cli CONFIG_DB HSET "ACL_TABLE|TEST" "policy_desc" "test" "type" "CTRLPLANE" "stage" "ingress" "services@" "SSH"iptables -S | grep dhcp_server_syslogDescription for the changelog
Fix caclmgrd to preserve dhcp_server_syslog iptables rule during CACL flush-and-rebuild cycle