mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-06-10 16:40:03 +00:00
ebtables: replace ebtables-save perl script with bash rewrite
Fedora provides a bash replacement for the default ebtables-save perl script. Using it allows the ebtables run-time dependency on perl to be replaced with a runtime dependency on bash - which is lower overhead and more likely to be present on typical embedded systems already. https://bugzilla.redhat.com/show_bug.cgi?id=746040 http://pkgs.fedoraproject.org/cgit/rpms/ebtables.git/tree/ebtables-save Since ebtables-save no longer contains a references to /usr, the previous QA issue workaround of moving it from ${base_sbindir} to ${sbindir} is no longer required. http://git.openembedded.org/meta-openembedded/commit/?id=a7c6fcebee7d9f86c356ea92de445d89e714ff62 Signed-off-by: Andre McCurdy <armccurdy@gmail.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
This commit is contained in:
committed by
Joe MacDonald
parent
18b8535e1a
commit
7f72300736
@@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
EBTABLES="/sbin/ebtables"
|
||||||
|
|
||||||
|
[ -x "$EBTABLES" ] || exit 1
|
||||||
|
|
||||||
|
echo "# Generated by ebtables-save v1.0 on $(date)"
|
||||||
|
|
||||||
|
cnt=""
|
||||||
|
[ "x$EBTABLES_SAVE_COUNTER" = "xyes" ] && cnt="--Lc"
|
||||||
|
|
||||||
|
for table_name in $(grep -E '^ebtable_' /proc/modules | cut -f1 -d' ' | sed s/ebtable_//); do
|
||||||
|
table=$($EBTABLES -t $table_name -L $cnt)
|
||||||
|
[ $? -eq 0 ] || { echo "$table"; exit -1; }
|
||||||
|
|
||||||
|
chain=""
|
||||||
|
rules=""
|
||||||
|
while read line; do
|
||||||
|
[ -z "$line" ] && continue
|
||||||
|
|
||||||
|
case "$line" in
|
||||||
|
Bridge\ table:\ *)
|
||||||
|
echo "*${line:14}"
|
||||||
|
;;
|
||||||
|
Bridge\ chain:\ *)
|
||||||
|
chain="${line:14}"
|
||||||
|
chain="${chain%%,*}"
|
||||||
|
policy="${line##*policy: }"
|
||||||
|
echo ":$chain $policy"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [ "$cnt" = "--Lc" ]; then
|
||||||
|
line=${line/, pcnt \=/ -c}
|
||||||
|
line=${line/-- bcnt \=/}
|
||||||
|
fi
|
||||||
|
rules="$rules-A $chain $line\n"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done <<EOF
|
||||||
|
$table
|
||||||
|
EOF
|
||||||
|
echo -e $rules
|
||||||
|
done
|
||||||
@@ -4,14 +4,15 @@ DESCRIPTION = "Utility for basic Ethernet frame filtering on a Linux bridge, \
|
|||||||
LICENSE = "GPLv2"
|
LICENSE = "GPLv2"
|
||||||
LIC_FILES_CHKSUM = "file://COPYING;md5=53b4a999993871a28ab1488fdbd2e73e"
|
LIC_FILES_CHKSUM = "file://COPYING;md5=53b4a999993871a28ab1488fdbd2e73e"
|
||||||
SECTION = "net"
|
SECTION = "net"
|
||||||
PR = "r3"
|
PR = "r4"
|
||||||
|
|
||||||
RDEPENDS_${PN} += "perl"
|
RDEPENDS_${PN} += "bash"
|
||||||
|
|
||||||
RRECOMMENDS_${PN} += "kernel-module-ebtables \
|
RRECOMMENDS_${PN} += "kernel-module-ebtables \
|
||||||
"
|
"
|
||||||
|
|
||||||
SRC_URI = "${SOURCEFORGE_MIRROR}/ebtables/ebtables-v${PV}.tar.gz \
|
SRC_URI = "${SOURCEFORGE_MIRROR}/ebtables/ebtables-v${PV}.tar.gz \
|
||||||
|
file://ebtables-save \
|
||||||
file://installnonroot.patch \
|
file://installnonroot.patch \
|
||||||
file://01debian_defaultconfig.patch \
|
file://01debian_defaultconfig.patch \
|
||||||
file://ebtables.init \
|
file://ebtables.init \
|
||||||
@@ -78,12 +79,10 @@ do_install () {
|
|||||||
mv ${D}${sysconfdir}/default/ebtables-config ${D}${sysconfdir}/default/ebtables
|
mv ${D}${sysconfdir}/default/ebtables-config ${D}${sysconfdir}/default/ebtables
|
||||||
sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/ebtables
|
sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/ebtables
|
||||||
|
|
||||||
# The script ebtables-save refernces perl in exec_prefix, so
|
# Replace upstream ebtables-save perl script with Fedora bash based rewrite
|
||||||
# move it to sbindir to avoid QA issue
|
# http://pkgs.fedoraproject.org/cgit/rpms/ebtables.git/tree/ebtables-save
|
||||||
if ${base_sbindir} != ${sbindir} ; then
|
install -m 0755 ${WORKDIR}/ebtables-save ${D}${base_sbindir}/ebtables-save
|
||||||
install -d ${D}/${sbindir}
|
sed -i 's!/sbin/!${base_sbindir}/!g' ${D}${base_sbindir}/ebtables-save
|
||||||
mv ${D}/${base_sbindir}/ebtables-save ${D}/${sbindir}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install systemd service files
|
# Install systemd service files
|
||||||
install -d ${D}${systemd_unitdir}/system
|
install -d ${D}${systemd_unitdir}/system
|
||||||
|
|||||||
Reference in New Issue
Block a user