| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
# NFT_TEST_REQUIRES(NFT_TEST_HAVE_comment) |
| 4 |
|
| 5 |
set -e |
| 6 |
|
| 7 |
COMMENT128="12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678" |
| 8 |
|
| 9 |
# test for pass with comment that is 128 bytes long. |
| 10 |
rc=0 |
| 11 |
$NFT add table ip filter \{ quota foo1 \{ comment "\"${COMMENT128}\"" \}\; \}\; || rc="$?" |
| 12 |
test "$rc" = 0 |
| 13 |
|
| 14 |
# test for failure with comment that is 128+1 bytes long. |
| 15 |
rc=0 |
| 16 |
$NFT add table ip filter \{ quota foo2 \{ comment "\"${COMMENT128}x\"" \}\; \}\; || rc="$?" |
| 17 |
test "$rc" = 1 |
| 18 |
|
| 19 |
RULESET='table ip filter { |
| 20 |
quota q { |
| 21 |
over 1200 bytes |
| 22 |
comment "'"$COMMENT128"'" |
| 23 |
} |
| 24 |
|
| 25 |
counter c { |
| 26 |
packets 0 bytes 0 |
| 27 |
comment "test2" |
| 28 |
} |
| 29 |
|
| 30 |
ct helper h { |
| 31 |
type "sip" protocol tcp |
| 32 |
l3proto ip |
| 33 |
comment "test3" |
| 34 |
} |
| 35 |
|
| 36 |
ct expectation e { |
| 37 |
protocol tcp |
| 38 |
dport 666 |
| 39 |
timeout 100ms |
| 40 |
size 96 |
| 41 |
l3proto ip |
| 42 |
comment "test4" |
| 43 |
} |
| 44 |
|
| 45 |
limit l { |
| 46 |
rate 400/hour |
| 47 |
comment "test5" |
| 48 |
} |
| 49 |
|
| 50 |
synproxy s { |
| 51 |
mss 1460 |
| 52 |
wscale 2 |
| 53 |
comment "test6" |
| 54 |
} |
| 55 |
} |
| 56 |
' |
| 57 |
|
| 58 |
$NFT -f - <<< "$RULESET" |