firewall/utils: replace ipv4 iptables macro with ipxtables macro

This commit is contained in:
Jan Vaclav
2025-03-27 11:21:45 +01:00
parent 18d5b7d641
commit 2106251e46

View File

@@ -213,9 +213,6 @@ _iptables_call_v(const char *const *argv)
return TRUE;
}
#define _share_iptables_call(...) \
_iptables_call_v(NM_MAKE_STRV("" IPTABLES_PATH "", "--wait", "2", __VA_ARGS__))
#define _ipxtables_call(family, ...) \
_iptables_call_v( \
NM_MAKE_STRV((family == AF_INET ? "" IPTABLES_PATH "" : "" IP6TABLES_PATH ""), \
@@ -226,7 +223,7 @@ _iptables_call_v(const char *const *argv)
static gboolean
_share_iptables_chain_op(const char *table, const char *chain, const char *op)
{
return _share_iptables_call("--table", table, op, chain);
return _ipxtables_call(AF_INET, "--table", table, op, chain);
}
static gboolean
@@ -255,7 +252,8 @@ _share_iptables_set_masquerade_sync(gboolean up, const char *ip_iface, in_addr_t
comment_name = _iptables_get_name(FALSE, "nm-shared", ip_iface);
_share_iptables_subnet_to_str(str_subnet, addr, plen);
_share_iptables_call("--table",
_ipxtables_call(AF_INET,
"--table",
"nat",
up ? "--insert" : "--delete",
"POSTROUTING",
@@ -305,7 +303,8 @@ _share_iptables_set_shared_chains_add(const char *chain_input,
_share_iptables_chain_add("filter", chain_input);
for (i = 0; i < (int) G_N_ELEMENTS(input_params); i++) {
_share_iptables_call("--table",
_ipxtables_call(AF_INET,
"--table",
"filter",
"--append",
chain_input,
@@ -319,7 +318,8 @@ _share_iptables_set_shared_chains_add(const char *chain_input,
_share_iptables_chain_add("filter", chain_forward);
_share_iptables_call("--table",
_ipxtables_call(AF_INET,
"--table",
"filter",
"--append",
chain_forward,
@@ -333,7 +333,8 @@ _share_iptables_set_shared_chains_add(const char *chain_input,
"ESTABLISHED,RELATED",
"--jump",
"ACCEPT");
_share_iptables_call("--table",
_ipxtables_call(AF_INET,
"--table",
"filter",
"--append",
chain_forward,
@@ -343,7 +344,8 @@ _share_iptables_set_shared_chains_add(const char *chain_input,
ip_iface,
"--jump",
"ACCEPT");
_share_iptables_call("--table",
_ipxtables_call(AF_INET,
"--table",
"filter",
"--append",
chain_forward,
@@ -353,7 +355,8 @@ _share_iptables_set_shared_chains_add(const char *chain_input,
ip_iface,
"--jump",
"ACCEPT");
_share_iptables_call("--table",
_ipxtables_call(AF_INET,
"--table",
"filter",
"--append",
chain_forward,
@@ -361,7 +364,8 @@ _share_iptables_set_shared_chains_add(const char *chain_input,
ip_iface,
"--jump",
"REJECT");
_share_iptables_call("--table",
_ipxtables_call(AF_INET,
"--table",
"filter",
"--append",
chain_forward,
@@ -392,7 +396,8 @@ _share_iptables_set_shared_sync(gboolean up, const char *ip_iface, in_addr_t add
if (up)
_share_iptables_set_shared_chains_add(chain_input, chain_forward, ip_iface, addr, plen);
_share_iptables_call("--table",
_ipxtables_call(AF_INET,
"--table",
"filter",
up ? "--insert" : "--delete",
"INPUT",
@@ -405,7 +410,8 @@ _share_iptables_set_shared_sync(gboolean up, const char *ip_iface, in_addr_t add
"--comment",
comment_name);
_share_iptables_call("--table",
_ipxtables_call(AF_INET,
"--table",
"filter",
up ? "--insert" : "--delete",
"FORWARD",