Skip to content

Commit

Permalink
Fix legacy iptables support (#50)
Browse files Browse the repository at this point in the history
* Fix legacy mode in klipper-lb

Signed-off-by: galal-hussein <[email protected]>

* Fix erroring out when nft doesnt exist

Signed-off-by: galal-hussein <[email protected]>

---------

Signed-off-by: galal-hussein <[email protected]>
  • Loading branch information
galal-hussein authored Apr 6, 2023
1 parent 2e96f69 commit 7a5c27d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions entry
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,25 @@ fatal()
}

check_iptables_mode() {
set +e
lsmod | grep "nf_tables" 2> /dev/null
if [ $? = 0 ]; then
mode=nft
else
mode=legacy
fi
set -e
}

set_nft() {
for i in iptables iptables-save iptables-restore ip6tables; do
ln -sf "xtables-nft-multi" "$BIN_DIR/$i";
ln -sf /sbin/xtables-nft-multi "$BIN_DIR/$i";
done
}

set_legacy() {
for i in iptables iptables-save iptables-restore ip6tables; do
ln -sf /sbin/xtables-nft-multi "$BIN_DIR/$i";
ln -sf /sbin/xtables-legacy-multi "$BIN_DIR/$i";
done
}

Expand Down

0 comments on commit 7a5c27d

Please sign in to comment.