Skip to content

Commit 2619d6e

Browse files
committed
Fix redirect rule deletion
1 parent 42fd64e commit 2619d6e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/aleph/vm/network/firewall.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,8 @@ def remove_port_redirect_rule(interface: TapInterface, host_port: int, vm_port:
508508
The exit code from executing the nftables commands
509509
"""
510510
nft_ruleset = get_existing_nftables_ruleset()
511+
chain = add_or_get_prerouting_chain()
512+
511513
commands = []
512514

513515
for entry in nft_ruleset:
@@ -516,7 +518,7 @@ def remove_port_redirect_rule(interface: TapInterface, host_port: int, vm_port:
516518
and "rule" in entry
517519
and entry["rule"].get("family") == "ip"
518520
and entry["rule"].get("table") == "nat"
519-
and entry["rule"].get("chain") == "prerouting"
521+
and entry["rule"].get("chain") == chain["name"]
520522
and "expr" in entry["rule"]
521523
):
522524
expr = entry["rule"]["expr"]

0 commit comments

Comments
 (0)