miniupnpd 1.9 (20160113)
[tomato.git] / release / src / router / miniupnpd / netfilter_nft / scripts / nft_init.sh
blob45b42ea00f6bc817ac4bc5c3b7cd2cede7d255f3
1 #! /bin/sh
3 nft list table nat > /dev/null
4 nft_nat_exists=$?
5 nft list table filter > /dev/null
6 nft_filter_exists=$?
7 nft list table mangle > /dev/null
8 nft_mangle_exists=$?
10 if [ $nft_nat_exists -eq "1" ]; then
11 echo "create nat"
12 nft "add table nat"
14 if [ $nft_filter_exists -eq "1" ]; then
15 echo "create filter"
16 nft "add table filter"
18 if [ $nft_mangle_exists -eq "1" ]; then
19 echo "create mangle"
20 nft "add table mangle"
23 nft list chain nat miniupnpd > /dev/null
24 nft_nat_miniupnpd_exists=$?
25 nft list chain nat miniupnpd-pcp-peer > /dev/null
26 nft_nat_miniupnpd_pcp_peer_exists=$?
27 nft list chain filter miniupnpd > /dev/null
28 nft_filter_miniupnpd_exists=$?
29 nft list chain mangle miniupnpd > /dev/null
30 nft_mangle_miniupnpd_exists=$?
32 if [ $nft_nat_miniupnpd_exists -eq "1" ]; then
33 echo "create chain in nat"
34 nft "add chain nat miniupnpd"
36 if [ $nft_nat_miniupnpd_pcp_peer_exists -eq "1" ]; then
37 echo "create pcp peer chain in nat"
38 nft "add chain nat miniupnpd-pcp-peer"
40 if [ $nft_filter_miniupnpd_exists -eq "1" ]; then
41 echo "create chain in filter "
42 nft "add chain filter miniupnpd"
44 if [ $nft_mangle_miniupnpd_exists -eq "1" ]; then
45 echo "create chain in mangle"
46 nft "add chain mangle miniupnpd"