diff options
Diffstat (limited to 'meta-networking/recipes-filter/ebtables/ebtables-2.0.10-4/ebtables-save')
-rwxr-xr-x | meta-networking/recipes-filter/ebtables/ebtables-2.0.10-4/ebtables-save | 43 |
1 files changed, 43 insertions, 0 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 000000000..2d7fc4ed7 --- /dev/null +++ b/meta-networking/recipes-filter/ebtables/ebtables-2.0.10-4/ebtables-save | |||
@@ -0,0 +1,43 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | EBTABLES="/sbin/ebtables" | ||
4 | |||
5 | [ -x "$EBTABLES" ] || exit 1 | ||
6 | |||
7 | echo "# Generated by ebtables-save v1.0 on $(date)" | ||
8 | |||
9 | cnt="" | ||
10 | [ "x$EBTABLES_SAVE_COUNTER" = "xyes" ] && cnt="--Lc" | ||
11 | |||
12 | for table_name in $(grep -E '^ebtable_' /proc/modules | cut -f1 -d' ' | sed s/ebtable_//); do | ||
13 | table=$($EBTABLES -t $table_name -L $cnt) | ||
14 | [ $? -eq 0 ] || { echo "$table"; exit -1; } | ||
15 | |||
16 | chain="" | ||
17 | rules="" | ||
18 | while read line; do | ||
19 | [ -z "$line" ] && continue | ||
20 | |||
21 | case "$line" in | ||
22 | Bridge\ table:\ *) | ||
23 | echo "*${line:14}" | ||
24 | ;; | ||
25 | Bridge\ chain:\ *) | ||
26 | chain="${line:14}" | ||
27 | chain="${chain%%,*}" | ||
28 | policy="${line##*policy: }" | ||
29 | echo ":$chain $policy" | ||
30 | ;; | ||
31 | *) | ||
32 | if [ "$cnt" = "--Lc" ]; then | ||
33 | line=${line/, pcnt \=/ -c} | ||
34 | line=${line/-- bcnt \=/} | ||
35 | fi | ||
36 | rules="$rules-A $chain $line\n" | ||
37 | ;; | ||
38 | esac | ||
39 | done <<EOF | ||
40 | $table | ||
41 | EOF | ||
42 | echo -e $rules | ||
43 | done | ||