From 7421816de98c230f487cd545680b1a5fcbd65667 Mon Sep 17 00:00:00 2001 From: Peter Kjellerstedt Date: Thu, 7 Nov 2024 10:01:00 +0100 Subject: [PATCH] ebtables: Remove the dependecy on bash Rewrite ebtables-legacy-save to avoid using bashisms. Signed-off-by: Peter Kjellerstedt Signed-off-by: Khem Raj --- .../ebtables-2.0.11/ebtables-legacy-save | 19 +++++++++---------- .../ebtables/ebtables_2.0.11.bb | 2 -- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/meta-networking/recipes-filter/ebtables/ebtables-2.0.11/ebtables-legacy-save b/meta-networking/recipes-filter/ebtables/ebtables-2.0.11/ebtables-legacy-save index 2133600f777..0b39c23debe 100644 --- a/meta-networking/recipes-filter/ebtables/ebtables-2.0.11/ebtables-legacy-save +++ b/meta-networking/recipes-filter/ebtables/ebtables-2.0.11/ebtables-legacy-save @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh EBTABLES="/usr/sbin/ebtables-legacy" @@ -11,7 +11,7 @@ cnt="" 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; } + [ $? -eq 0 ] || { echo "$table"; exit 1; } chain="" rules="" @@ -20,24 +20,23 @@ for table_name in $(grep -E '^ebtable_' /proc/modules | cut -f1 -d' ' | sed s/eb case "$line" in Bridge\ table:\ *) - echo "*${line:14}" + echo "*${line#Bridge table: }" ;; Bridge\ chain:\ *) - chain="${line:14}" + chain="${line#Bridge chain: }" 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" + [ "$cnt" != "--Lc" ] || + line=$(echo "$line" | sed -e 's/, pcnt =/-c/' -e 's/ -- bcnt =//') + rules="$rules-A $chain $line +" ;; esac done <