diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2018-04-01 18:51:39 +0200 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2018-04-01 19:03:36 +0200 |
commit | 2221432434ddd269048e71a34cda6ebafbddcc9c (patch) | |
tree | 772b5c0aaacde5ab3be853f9659be6516dde483c /main/nftables/nftables.initd | |
parent | 09d5ae0cd26007718bd77c5a5a866a094fae61a9 (diff) | |
download | aports-2221432434ddd269048e71a34cda6ebafbddcc9c.tar.bz2 aports-2221432434ddd269048e71a34cda6ebafbddcc9c.tar.xz |
main/nftables: add support for enabling forwarding to runscript
Diffstat (limited to 'main/nftables/nftables.initd')
-rw-r--r-- | main/nftables/nftables.initd | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/main/nftables/nftables.initd b/main/nftables/nftables.initd index 6035d1a7bc..56d31c3bba 100644 --- a/main/nftables/nftables.initd +++ b/main/nftables/nftables.initd @@ -16,9 +16,11 @@ description_reload="Clear current rulesets and load rulesets from the saved rule : ${rules_file:=${NFTABLES_SAVE:="/var/lib/nftables/rules-save"}} : ${save_options:=${SAVE_OPTIONS:="-n"}} : ${save_on_stop:=${SAVE_ON_STOP:="yes"}} +: ${enable_forwarding:="no"} depend() { need localmount + after sysctl before net provide firewall } @@ -74,7 +76,13 @@ start() { ebegin "Loading nftables state and starting firewall" nft -f "$rules_file" - eend $? + eend $? || return 1 + + if yesno "$ip_forward"; then + ebegin "Enabling forwarding" + forwarding 1 + eend $? || return 1 + fi } stop() { @@ -82,6 +90,12 @@ stop() { save || return 1 fi + if yesno "$enable_forwarding"; then + ebegin "Disabling forwarding" + forwarding 0 + eend $? + fi + ebegin "Stopping firewall" nft flush ruleset eend $? @@ -104,3 +118,10 @@ checkkernel() { fi return 0 } + +forwarding() { + /sbin/sysctl -qw \ + net.ipv4.ip_forward=$1 \ + net.ipv6.conf.default.forwarding=$1 \ + net.ipv6.conf.all.forwarding=$1 +} |