Skip to content

Commit e9d3d96

Browse files
antony-rheneusabdosi
authored andcommitted
[ebtbles] Replace binary config file to text config file for ebtables (#5252)
Issue: Binary ebtables config file is CPU arch dependent Fix: Load the text config during firsttime boot and Generate the binary persistent atomic file Signed-off-by: Antony Rheneus <[email protected]>
1 parent cc998f3 commit e9d3d96

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

build_debian.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,12 @@ if [ "${enable_organization_extensions}" = "y" ]; then
466466
fi
467467

468468
## Setup ebtable rules (rule file is in binary format)
469-
sudo sed -i 's/EBTABLES_LOAD_ON_START="no"/EBTABLES_LOAD_ON_START="yes"/g' ${FILESYSTEM_ROOT}/etc/default/ebtables
470-
sudo cp files/image_config/ebtables/ebtables.filter ${FILESYSTEM_ROOT}/etc
469+
sudo cp -f files/image_config/ebtables/ebtables.default $FILESYSTEM_ROOT/etc/default/ebtables
470+
sudo cp -f files/image_config/ebtables/ebtables.init $FILESYSTEM_ROOT/etc/init.d/ebtables
471+
sudo cp -f files/image_config/ebtables/ebtables.service $FILESYSTEM_ROOT/lib/systemd/system/ebtables.service
472+
sudo cp files/image_config/ebtables/ebtables.filter.cfg ${FILESYSTEM_ROOT}/etc
473+
sudo LANG=C chroot $FILESYSTEM_ROOT update-alternatives --set ebtables /usr/sbin/ebtables-legacy
474+
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable ebtables.service
471475

472476
## Debug Image specific changes
473477
## Update motd for debug image
-840 Bytes
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# SONiC ebtables filter table configuration
2+
# Generated using ebtables-save
3+
4+
*filter
5+
:INPUT ACCEPT
6+
:FORWARD ACCEPT
7+
:OUTPUT ACCEPT
8+
-A FORWARD -d BGA -j DROP
9+
-A FORWARD -p ARP -j DROP
10+
-A FORWARD -p 802_1Q --vlan-encap ARP -j DROP
11+

files/image_config/platform/rc.local

+10
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ program_console_speed()
186186
systemctl daemon-reload
187187
}
188188

189+
ebtables_config()
190+
{
191+
# Generate atomic config file and save it persistent
192+
/usr/sbin/ebtables-restore < /etc/ebtables.filter.cfg
193+
/usr/sbin/ebtables -t filter --atomic-file /etc/ebtables.filter --atomic-save
194+
}
195+
189196
#### Begin Main Body ####
190197

191198
logger "SONiC version ${SONIC_VERSION} starting up..."
@@ -355,6 +362,9 @@ if [ -f $FIRST_BOOT_FILE ]; then
355362
# Create dir where following scripts put their output files
356363
mkdir -p /var/platform
357364

365+
# Firsttime ebtables configuration
366+
ebtables_config
367+
358368
firsttime_exit
359369
fi
360370

0 commit comments

Comments
 (0)