blob: 5e51a605358b5a974ff3858ea5de068347b3b310 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/bin/bash
# support for ifname in named maps
tmpfile=$(mktemp)
if [ ! -w $tmpfile ] ; then
echo "Failed to create tmp file" >&2
exit 0
fi
trap "rm -rf $tmpfile" EXIT # cleanup if aborted
EXPECTED="table inet t {
map m1 {
type ifname : ipv4_addr
elements = { \"eth0\" : 1.1.1.1 }
}
chain c {
ip daddr set iifname map @m1
ip daddr set oifname map @m1
}
}"
set -e
echo "$EXPECTED" > $tmpfile
$NFT -f $tmpfile
|