firmware/src/packages/fff/fff-layer3-ipv4snat/files/etc/layer3.d/33-snat.conf

32 lines
633 B
Plaintext

configure() {
# first we delete the snat config
uci del network.client.nat
if [ "$(uci -q get gateway.@client[0].nat)" = '1' ]; then
# first check the config is plausible
if ! peer_ip=$(uci get gateway.meta.peer_ip); then
echo "ERROR: No peer_ip set! For SNAT use you must set a peer_ip"
return 1
fi
if ! ipaddr=$(uci get gateway.@client[0].ipaddr); then
echo "ERROR: No ipaddr set! For SNAT use you must set ipaddr"
return 1
fi
# We set the snat config
uci set network.client.nat=1
fi
}
reload() {
/etc/init.d/fff-firewall start
}
apply() {
uci commit network
}
revert() {
uci revert network
}