From b878cb7d83855f4420791561b63aa4b96d73663a Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Fri, 8 Jun 2018 14:41:08 +0200 Subject: tests: shell: add quotes when using <<<-style here document bash 4.3.30 removes newlines in RULESET when "" are omitted, which then causes nft -f to complain about invalid syntax. As a result, all test cases that use this here-doc style fail. Signed-off-by: Florian Westphal --- tests/shell/testcases/transactions/0001table_0 | 2 +- tests/shell/testcases/transactions/0002table_0 | 2 +- tests/shell/testcases/transactions/0003table_0 | 2 +- tests/shell/testcases/transactions/0010chain_0 | 2 +- tests/shell/testcases/transactions/0011chain_0 | 2 +- tests/shell/testcases/transactions/0012chain_0 | 2 +- tests/shell/testcases/transactions/0013chain_0 | 2 +- tests/shell/testcases/transactions/0014chain_1 | 2 +- tests/shell/testcases/transactions/0015chain_0 | 4 ++-- tests/shell/testcases/transactions/0020rule_0 | 2 +- tests/shell/testcases/transactions/0021rule_0 | 2 +- tests/shell/testcases/transactions/0022rule_1 | 2 +- tests/shell/testcases/transactions/0023rule_1 | 2 +- tests/shell/testcases/transactions/0030set_0 | 2 +- tests/shell/testcases/transactions/0031set_0 | 2 +- tests/shell/testcases/transactions/0032set_0 | 2 +- tests/shell/testcases/transactions/0033set_0 | 2 +- tests/shell/testcases/transactions/0034set_0 | 2 +- tests/shell/testcases/transactions/0035set_0 | 2 +- tests/shell/testcases/transactions/0036set_1 | 2 +- tests/shell/testcases/transactions/0037set_0 | 2 +- tests/shell/testcases/transactions/0038set_0 | 2 +- tests/shell/testcases/transactions/0039set_0 | 2 +- tests/shell/testcases/transactions/0040set_0 | 4 ++-- tests/shell/testcases/transactions/0041nat_restore_0 | 4 ++-- 25 files changed, 28 insertions(+), 28 deletions(-) (limited to 'tests/shell/testcases/transactions') diff --git a/tests/shell/testcases/transactions/0001table_0 b/tests/shell/testcases/transactions/0001table_0 index 1a8ecb86..99298244 100755 --- a/tests/shell/testcases/transactions/0001table_0 +++ b/tests/shell/testcases/transactions/0001table_0 @@ -7,7 +7,7 @@ delete table x add table x add table y" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 diff --git a/tests/shell/testcases/transactions/0002table_0 b/tests/shell/testcases/transactions/0002table_0 index 290ea436..246b1092 100755 --- a/tests/shell/testcases/transactions/0002table_0 +++ b/tests/shell/testcases/transactions/0002table_0 @@ -7,7 +7,7 @@ delete table x add table x add table x { flags dormant; }" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 diff --git a/tests/shell/testcases/transactions/0003table_0 b/tests/shell/testcases/transactions/0003table_0 index c5a87d3f..6e508fc2 100755 --- a/tests/shell/testcases/transactions/0003table_0 +++ b/tests/shell/testcases/transactions/0003table_0 @@ -6,7 +6,7 @@ RULESET="add table x add table y flush ruleset" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 diff --git a/tests/shell/testcases/transactions/0010chain_0 b/tests/shell/testcases/transactions/0010chain_0 index 39a5fe9e..ce66bd64 100755 --- a/tests/shell/testcases/transactions/0010chain_0 +++ b/tests/shell/testcases/transactions/0010chain_0 @@ -8,7 +8,7 @@ flush ruleset add table w add chain w y" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 diff --git a/tests/shell/testcases/transactions/0011chain_0 b/tests/shell/testcases/transactions/0011chain_0 index 7dca1287..3bed16dd 100755 --- a/tests/shell/testcases/transactions/0011chain_0 +++ b/tests/shell/testcases/transactions/0011chain_0 @@ -8,7 +8,7 @@ delete chain x y add chain x y { type filter hook input priority 0; } add chain x y { policy drop; }" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 diff --git a/tests/shell/testcases/transactions/0012chain_0 b/tests/shell/testcases/transactions/0012chain_0 index 7ebfad42..0d80ef4e 100755 --- a/tests/shell/testcases/transactions/0012chain_0 +++ b/tests/shell/testcases/transactions/0012chain_0 @@ -12,7 +12,7 @@ flush ruleset add table w add chain w y { type filter hook output priority 0; }" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 diff --git a/tests/shell/testcases/transactions/0013chain_0 b/tests/shell/testcases/transactions/0013chain_0 index 383e8347..2756dd60 100755 --- a/tests/shell/testcases/transactions/0013chain_0 +++ b/tests/shell/testcases/transactions/0013chain_0 @@ -13,7 +13,7 @@ flush ruleset add table w add chain w y { type filter hook output priority 0; }" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 diff --git a/tests/shell/testcases/transactions/0014chain_1 b/tests/shell/testcases/transactions/0014chain_1 index 40cea8b2..802a7e63 100755 --- a/tests/shell/testcases/transactions/0014chain_1 +++ b/tests/shell/testcases/transactions/0014chain_1 @@ -7,5 +7,5 @@ add chain x y delete chain x y delete chain x y" -$NFT -f - <<< $RULESET 2>/dev/null +$NFT -f - <<< "$RULESET" 2>/dev/null echo "E: allowing double-removal of chain" >&2 diff --git a/tests/shell/testcases/transactions/0015chain_0 b/tests/shell/testcases/transactions/0015chain_0 index 90f87182..42950b37 100755 --- a/tests/shell/testcases/transactions/0015chain_0 +++ b/tests/shell/testcases/transactions/0015chain_0 @@ -7,7 +7,7 @@ add chain x y add chain x z add rule x z jump y" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 @@ -18,7 +18,7 @@ delete chain x z delete chain x y delete table x" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 diff --git a/tests/shell/testcases/transactions/0020rule_0 b/tests/shell/testcases/transactions/0020rule_0 index b8e4cff5..f8d2d377 100755 --- a/tests/shell/testcases/transactions/0020rule_0 +++ b/tests/shell/testcases/transactions/0020rule_0 @@ -7,7 +7,7 @@ add chain x y add rule x y ip saddr 1.1.1.1 counter flush ruleset" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 diff --git a/tests/shell/testcases/transactions/0021rule_0 b/tests/shell/testcases/transactions/0021rule_0 index f5f6eb8b..ee265abd 100755 --- a/tests/shell/testcases/transactions/0021rule_0 +++ b/tests/shell/testcases/transactions/0021rule_0 @@ -10,7 +10,7 @@ add table x add chain x y add rule x y ip saddr 2.2.2.2 counter" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 diff --git a/tests/shell/testcases/transactions/0022rule_1 b/tests/shell/testcases/transactions/0022rule_1 index 83c72af1..0e7c9a6f 100755 --- a/tests/shell/testcases/transactions/0022rule_1 +++ b/tests/shell/testcases/transactions/0022rule_1 @@ -8,5 +8,5 @@ delete chain x y add rule x y jump y" # kernel must return ENOENT -$NFT -f - <<< $RULESET 2>/dev/null +$NFT -f - <<< "$RULESET" 2>/dev/null echo "E: allowing jump loop to unexisting chain" diff --git a/tests/shell/testcases/transactions/0023rule_1 b/tests/shell/testcases/transactions/0023rule_1 index b43a0cce..edc4e8d2 100755 --- a/tests/shell/testcases/transactions/0023rule_1 +++ b/tests/shell/testcases/transactions/0023rule_1 @@ -7,5 +7,5 @@ add chain x y add rule x y jump y" # kernel must return ELOOP -$NFT -f - <<< $RULESET 2>/dev/null +$NFT -f - <<< "$RULESET" 2>/dev/null echo "E: allowing jump to chain loop" diff --git a/tests/shell/testcases/transactions/0030set_0 b/tests/shell/testcases/transactions/0030set_0 index 464bc2b3..e17b42f3 100755 --- a/tests/shell/testcases/transactions/0030set_0 +++ b/tests/shell/testcases/transactions/0030set_0 @@ -7,7 +7,7 @@ add set x y { type ipv4_addr; } flush ruleset add table x" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 diff --git a/tests/shell/testcases/transactions/0031set_0 b/tests/shell/testcases/transactions/0031set_0 index 0bab4993..b2133cfe 100755 --- a/tests/shell/testcases/transactions/0031set_0 +++ b/tests/shell/testcases/transactions/0031set_0 @@ -7,7 +7,7 @@ add set x y { type ipv4_addr; } delete set x y add set x y { type ipv4_addr; }" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 diff --git a/tests/shell/testcases/transactions/0032set_0 b/tests/shell/testcases/transactions/0032set_0 index 126f37e5..5882518b 100755 --- a/tests/shell/testcases/transactions/0032set_0 +++ b/tests/shell/testcases/transactions/0032set_0 @@ -8,7 +8,7 @@ flush ruleset add table w add set w y { type ipv4_addr; }" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 diff --git a/tests/shell/testcases/transactions/0033set_0 b/tests/shell/testcases/transactions/0033set_0 index f7a31e8c..6bd5893a 100755 --- a/tests/shell/testcases/transactions/0033set_0 +++ b/tests/shell/testcases/transactions/0033set_0 @@ -6,7 +6,7 @@ RULESET="add table x add set x y { type ipv4_addr; } delete set x y" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 diff --git a/tests/shell/testcases/transactions/0034set_0 b/tests/shell/testcases/transactions/0034set_0 index 88261032..1580c321 100755 --- a/tests/shell/testcases/transactions/0034set_0 +++ b/tests/shell/testcases/transactions/0034set_0 @@ -7,7 +7,7 @@ add set x y { type ipv4_addr; } add element x y { 1.1.1.1 } delete element x y { 1.1.1.1 }" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 diff --git a/tests/shell/testcases/transactions/0035set_0 b/tests/shell/testcases/transactions/0035set_0 index d442b68e..0967fd42 100755 --- a/tests/shell/testcases/transactions/0035set_0 +++ b/tests/shell/testcases/transactions/0035set_0 @@ -9,7 +9,7 @@ delete element x y { 1.1.1.1 } delete element x y { 2.2.2.2 } add element x y { 3.3.3.3 }" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 diff --git a/tests/shell/testcases/transactions/0036set_1 b/tests/shell/testcases/transactions/0036set_1 index a0deb7a0..e691fa7f 100755 --- a/tests/shell/testcases/transactions/0036set_1 +++ b/tests/shell/testcases/transactions/0036set_1 @@ -8,6 +8,6 @@ add element x y { 1.1.1.1, 2.2.2.2 } delete element x y { 1.1.1.1 } delete element x y { 1.1.1.1 }" -$NFT -f - <<< $RULESET 2> /dev/null +$NFT -f - <<< "$RULESET" 2> /dev/null # Kernel must return ENOENT echo "E: allowing double-removal of element" diff --git a/tests/shell/testcases/transactions/0037set_0 b/tests/shell/testcases/transactions/0037set_0 index 4aef63f1..2882863d 100755 --- a/tests/shell/testcases/transactions/0037set_0 +++ b/tests/shell/testcases/transactions/0037set_0 @@ -7,7 +7,7 @@ add set x y { type ipv4_addr; flags interval;} add element x y { 1.1.1.0/24 } delete element x y { 1.1.1.0/24 }" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 diff --git a/tests/shell/testcases/transactions/0038set_0 b/tests/shell/testcases/transactions/0038set_0 index fc9f1ca4..d7c2ba3d 100755 --- a/tests/shell/testcases/transactions/0038set_0 +++ b/tests/shell/testcases/transactions/0038set_0 @@ -9,7 +9,7 @@ delete element x y { 192.168.0.0/24 } delete element x y { 192.168.2.0/24 } add element x y { 192.168.4.0/24 }" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 diff --git a/tests/shell/testcases/transactions/0039set_0 b/tests/shell/testcases/transactions/0039set_0 index fc9f1ca4..d7c2ba3d 100755 --- a/tests/shell/testcases/transactions/0039set_0 +++ b/tests/shell/testcases/transactions/0039set_0 @@ -9,7 +9,7 @@ delete element x y { 192.168.0.0/24 } delete element x y { 192.168.2.0/24 } add element x y { 192.168.4.0/24 }" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 diff --git a/tests/shell/testcases/transactions/0040set_0 b/tests/shell/testcases/transactions/0040set_0 index 7386ecfb..c991b84e 100755 --- a/tests/shell/testcases/transactions/0040set_0 +++ b/tests/shell/testcases/transactions/0040set_0 @@ -20,7 +20,7 @@ RULESET="table ip filter { chain CIn_1 { } }" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 @@ -36,7 +36,7 @@ fi RULESET="delete element ip filter client_to_any { 1.2.3.4 : goto CIn_1 } delete chain ip filter CIn_1" -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" if [ $? -ne 0 ] ; then echo "E: unable to load good ruleset" >&2 exit 1 diff --git a/tests/shell/testcases/transactions/0041nat_restore_0 b/tests/shell/testcases/transactions/0041nat_restore_0 index 62971852..9e1d6c96 100755 --- a/tests/shell/testcases/transactions/0041nat_restore_0 +++ b/tests/shell/testcases/transactions/0041nat_restore_0 @@ -7,11 +7,11 @@ add table ip t add chain ip t c { type nat hook postrouting priority 0; } " -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" RULESET=" flush ruleset $RULESET " -$NFT -f - <<< $RULESET +$NFT -f - <<< "$RULESET" -- cgit v1.2.3