diff options
-rwxr-xr-x | meta-networking/recipes-filter/ebtables/ebtables-2.0.10-4/ebtables-save | 43 | ||||
-rw-r--r-- | meta-networking/recipes-filter/ebtables/ebtables_2.0.10-4.bb | 15 |
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 |