if (r < 0)
return r;
- r = fw_add_masquerade(add, AF_INET, 0, &masked, address->prefixlen, NULL, NULL, 0);
+ r = fw_add_masquerade(add, AF_INET, &masked, address->prefixlen);
if (r < 0)
return r;
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;
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;
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);
int fw_add_local_dnat(
bool add,
static inline 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) {
return -EOPNOTSUPP;
}
int r;
test_setup_logging(LOG_DEBUG);
- r = fw_add_masquerade(true, AF_INET, 0, NULL, 0, "foobar", NULL, 0);
+ r = fw_add_masquerade(true, AF_INET, NULL, 0);
if (r < 0)
log_error_errno(r, "Failed to modify firewall: %m");
- r = fw_add_masquerade(true, AF_INET, 0, NULL, 0, "foobar", NULL, 0);
+ r = fw_add_masquerade(true, AF_INET, NULL, 0);
if (r < 0)
log_error_errno(r, "Failed to modify firewall: %m");
- r = fw_add_masquerade(false, AF_INET, 0, NULL, 0, "foobar", NULL, 0);
+ r = fw_add_masquerade(false, AF_INET, NULL, 0);
if (r < 0)
log_error_errno(r, "Failed to modify firewall: %m");