Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ebtables] Replace binary config file with text config file #5252

Merged
merged 1 commit into from
Sep 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ fi
sudo cp -f files/image_config/ebtables/ebtables.default $FILESYSTEM_ROOT/etc/default/ebtables
sudo cp -f files/image_config/ebtables/ebtables.init $FILESYSTEM_ROOT/etc/init.d/ebtables
sudo cp -f files/image_config/ebtables/ebtables.service $FILESYSTEM_ROOT/lib/systemd/system/ebtables.service
sudo cp files/image_config/ebtables/ebtables.filter ${FILESYSTEM_ROOT}/etc
sudo cp files/image_config/ebtables/ebtables.filter.cfg ${FILESYSTEM_ROOT}/etc
sudo LANG=C chroot $FILESYSTEM_ROOT update-alternatives --set ebtables /usr/sbin/ebtables-legacy
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable ebtables.service

Expand Down
Binary file removed files/image_config/ebtables/ebtables.filter
Binary file not shown.
11 changes: 11 additions & 0 deletions files/image_config/ebtables/ebtables.filter.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SONiC ebtables filter table configuration
# Generated using ebtables-save

*filter
:INPUT ACCEPT
:FORWARD ACCEPT
:OUTPUT ACCEPT
-A FORWARD -d BGA -j DROP
-A FORWARD -p ARP -j DROP
-A FORWARD -p 802_1Q --vlan-encap ARP -j DROP

10 changes: 10 additions & 0 deletions files/image_config/platform/rc.local
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ program_console_speed()
systemctl daemon-reload
}

ebtables_config()
{
# Generate atomic config file and save it persistent
/usr/sbin/ebtables-restore < /etc/ebtables.filter.cfg
/usr/sbin/ebtables -t filter --atomic-file /etc/ebtables.filter --atomic-save
}

#### Begin Main Body ####

logger "SONiC version ${SONIC_VERSION} starting up..."
Expand Down Expand Up @@ -341,6 +348,9 @@ if [ -f $FIRST_BOOT_FILE ]; then
# Create dir where following scripts put their output files
mkdir -p /var/platform

# Firsttime ebtables configuration
ebtables_config

firsttime_exit
fi

Expand Down