aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre McCurdy <armccurdy@gmail.com>2017-07-11 10:09:11 -0700
committerMartin Jansa <Martin.Jansa@gmail.com>2017-08-31 14:55:40 +0200
commit3426784762e6080893d0cdcc262be9d4cd28d7a7 (patch)
treec9536d884bfb445b6055d4bdcbb62d304d1a07ed
parent2194ffc9707d43a61227df41a57888f919751b18 (diff)
downloadmeta-openembedded-contrib-3426784762e6080893d0cdcc262be9d4cd28d7a7.tar.gz
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>
-rwxr-xr-xmeta-networking/recipes-filter/ebtables/ebtables-2.0.10-4/ebtables-save43
-rw-r--r--meta-networking/recipes-filter/ebtables/ebtables_2.0.10-4.bb15
2 files changed, 50 insertions, 8 deletions
diff --git a/meta-networking/recipes-filter/ebtables/ebtables-2.0.10-4/ebtables-save b/meta-networking/recipes-filter/ebtables/ebtables-2.0.10-4/ebtables-save
new file mode 100755
index 0000000000..2d7fc4ed7c
--- /dev/null
+++ b/meta-networking/recipes-filter/ebtables/ebtables-2.0.10-4/ebtables-save
@@ -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
diff --git a/meta-networking/recipes-filter/ebtables/ebtables_2.0.10-4.bb b/meta-networking/recipes-filter/ebtables/ebtables_2.0.10-4.bb
index 375423d5d7..e724731d03 100644
--- a/meta-networking/recipes-filter/ebtables/ebtables_2.0.10-4.bb
+++ b/meta-networking/recipes-filter/ebtables/ebtables_2.0.10-4.bb
@@ -4,14 +4,15 @@ DESCRIPTION = "Utility for basic Ethernet frame filtering on a Linux bridge, \
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=53b4a999993871a28ab1488fdbd2e73e"
SECTION = "net"
-PR = "r3"
+PR = "r4"
-RDEPENDS_${PN} += "perl"
+RDEPENDS_${PN} += "bash"
RRECOMMENDS_${PN} += "kernel-module-ebtables \
"
SRC_URI = "${SOURCEFORGE_MIRROR}/ebtables/ebtables-v${PV}.tar.gz \
+ file://ebtables-save \
file://installnonroot.patch \
file://01debian_defaultconfig.patch \
file://ebtables.init \
@@ -78,12 +79,10 @@ do_install () {
mv ${D}${sysconfdir}/default/ebtables-config ${D}${sysconfdir}/default/ebtables
sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/ebtables
- # The script ebtables-save refernces perl in exec_prefix, so
- # move it to sbindir to avoid QA issue
- if ${base_sbindir} != ${sbindir} ; then
- install -d ${D}/${sbindir}
- mv ${D}/${base_sbindir}/ebtables-save ${D}/${sbindir}
- fi
+ # Replace upstream ebtables-save perl script with Fedora bash based rewrite
+ # http://pkgs.fedoraproject.org/cgit/rpms/ebtables.git/tree/ebtables-save
+ install -m 0755 ${WORKDIR}/ebtables-save ${D}${base_sbindir}/ebtables-save
+ sed -i 's!/sbin/!${base_sbindir}/!g' ${D}${base_sbindir}/ebtables-save
# Install systemd service files
install -d ${D}${systemd_unitdir}/system