*/
#include "options.h"
+#include "ubus.h"
static bool
return true;
}
+bool
+fw3_parse_network(void *ptr, const char *val)
+{
+ struct fw3_device dev;
+ struct fw3_address *tmp, *addr = ptr;
+ struct list_head *list;
+
+ if (!fw3_parse_address(addr, val))
+ {
+ memset(&dev, 0, sizeof(dev));
+
+ if (!fw3_parse_device(&dev, val))
+ return false;
+
+ list = fw3_ubus_address(dev.name);
+
+ if (list)
+ {
+ list_for_each_entry(tmp, list, list)
+ {
+ *addr = *tmp;
+ addr->invert = dev.invert;
+ break;
+ }
+
+ fw3_ubus_address_free(list);
+ }
+ }
+
+ return true;
+}
+
bool
fw3_parse_mac(void *ptr, const char *val)
{
bool fw3_parse_limit(void *ptr, const char *val);
bool fw3_parse_device(void *ptr, const char *val);
bool fw3_parse_address(void *ptr, const char *val);
+bool fw3_parse_network(void *ptr, const char *val);
bool fw3_parse_mac(void *ptr, const char *val);
bool fw3_parse_port(void *ptr, const char *val);
bool fw3_parse_family(void *ptr, const char *val);
FW3_OPT("output", target, zone, policy_output),
FW3_OPT("masq", bool, zone, masq),
- FW3_LIST("masq_src", address, zone, masq_src),
- FW3_LIST("masq_dest", address, zone, masq_dest),
+ FW3_LIST("masq_src", network, zone, masq_src),
+ FW3_LIST("masq_dest", network, zone, masq_dest),
FW3_OPT("extra", string, zone, extra_src),
FW3_OPT("extra_src", string, zone, extra_src),
fw3_foreach(msrc, &zone->masq_src)
fw3_foreach(mdest, &zone->masq_dest)
{
- fw3_pr("-A zone_%s_postrouting ", zone->name);
+ if (!fw3_is_family(msrc, family) ||
+ !fw3_is_family(mdest, family))
+ continue;
+
+ fw3_pr("-A zone_%s_postrouting", zone->name);
fw3_format_src_dest(msrc, mdest);
- fw3_pr("-j MASQUERADE\n");
+ fw3_pr(" -j MASQUERADE\n");
}
}
break;