blob: 8ebb450969625fc21bd4a7c7007c3f67e09ca390 (
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
|
#!/bin/bash
tmpfile=$(mktemp)
if [ ! -w $tmpfile ] ; then
echo "Failed to create tmp file" >&2
exit 0
fi
trap "rm -rf $tmpfile" EXIT # cleanup if aborted
echo "
table ip t {
map sourcemap {
type ipv4_addr : verdict;
}
chain postrouting {
ip saddr vmap @sourcemap accept
}
}
add chain t c
add element t sourcemap { 100.123.10.2 : jump c }
" > $tmpfile
set -e
$NFT -f $tmpfile
|