From 8e1e79cfa24c155c8d504822fbbd3c20f890fb70 Mon Sep 17 00:00:00 2001 From: Viacheslav Hletenko Date: Sat, 23 Dec 2023 13:21:43 +0000 Subject: T160: NAT64 add match firewall mark feature Match mark allows to use firewall marks of packet to use a specific pool Example of instance config /run/jool/instance-100.json ``` ... "pool4": [ { "protocol": "TCP", "prefix": "192.0.2.10", "port range": "1-65535", "mark": 23 }, ... ``` --- src/conf_mode/nat64.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/conf_mode/nat64.py') diff --git a/src/conf_mode/nat64.py b/src/conf_mode/nat64.py index a8b90fb11..6026c61d0 100755 --- a/src/conf_mode/nat64.py +++ b/src/conf_mode/nat64.py @@ -148,6 +148,11 @@ def generate(nat64) -> None: if dict_search("translation.pool", instance): pool4 = [] + # mark + mark = '' + if dict_search("match.mark", instance): + mark = instance["match"]["mark"] + for pool in instance["translation"]["pool"].values(): if "disable" in pool: continue @@ -159,6 +164,8 @@ def generate(nat64) -> None: "prefix": pool["address"], "port range": pool["port"], } + if mark: + obj["mark"] = int(mark) if "description" in pool: obj["comment"] = pool["description"] -- cgit v1.2.3