summaryrefslogtreecommitdiff
path: root/src/shared/firewall-util.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2020-06-19 12:41:49 +0200
committerLennart Poettering <lennart@poettering.net>2020-12-03 11:05:14 +0100
commit7509c7fdf94df385661ab9818df0dc5f0a3b7247 (patch)
tree69f6a9f4128c4d849548104116f80c12a65e4f7e /src/shared/firewall-util.c
parent67b3732a533a55968727ff52bbce789e9f88501c (diff)
downloadsystemd-7509c7fdf94df385661ab9818df0dc5f0a3b7247.tar.gz
fw_add_masquerade: remove unused function arguments
Similar to the previous commit. All callers pass NULL. This will ease initial nftables backend implementation (less features to cover). Add the function parameters as local variables and let compiler remove branches. Followup patch can remove the if (NULL) conditionals.
Diffstat (limited to 'src/shared/firewall-util.c')
-rw-r--r--src/shared/firewall-util.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/shared/firewall-util.c b/src/shared/firewall-util.c
index bcef7602ce..974803903d 100644
--- a/src/shared/firewall-util.c
+++ b/src/shared/firewall-util.c
@@ -81,12 +81,8 @@ static int entry_fill_basics(
int fw_add_masquerade(
bool add,
int af,
- int protocol,
const union in_addr_union *source,
- unsigned source_prefixlen,
- const char *out_interface,
- const union in_addr_union *destination,
- unsigned destination_prefixlen) {
+ unsigned source_prefixlen) {
static const xt_chainlabel chain = "POSTROUTING";
_cleanup_(iptc_freep) struct xtc_handle *h = NULL;
@@ -94,14 +90,14 @@ int fw_add_masquerade(
struct ipt_entry_target *t;
size_t sz;
struct nf_nat_ipv4_multi_range_compat *mr;
- int r;
+ int r, protocol = 0;
+ const char *out_interface = NULL;
+ const union in_addr_union *destination = NULL;
+ unsigned destination_prefixlen = 0;
if (af != AF_INET)
return -EOPNOTSUPP;
- if (!IN_SET(protocol, 0, IPPROTO_TCP, IPPROTO_UDP))
- return -EOPNOTSUPP;
-
h = iptc_init("nat");
if (!h)
return -errno;