summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2015-05-26 14:50:21 +0200
committerJo-Philipp Wich <jow@openwrt.org>2015-05-26 14:53:24 +0200
commit18a503d0125aebc3a8d62dad1c02e6bb1da92eb6 (patch)
tree471e125ca4eed128e614bb33e68e4982e5f18548
parent980b7859bbd1db1e5e46422fccccbce38f9809ab (diff)
downloadfirewall3-18a503d0125aebc3a8d62dad1c02e6bb1da92eb6.tar.gz
redirects: only emit REDIRECT rules if dest_ip is unset
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
-rw-r--r--redirects.c34
1 files changed, 1 insertions, 33 deletions
diff --git a/redirects.c b/redirects.c
index 50ed44d..5b8d7a9 100644
--- a/redirects.c
+++ b/redirects.c
@@ -166,45 +166,13 @@ static bool
check_local(struct uci_element *e, struct fw3_redirect *redir,
struct fw3_state *state)
{
- struct fw3_zone *zone;
- struct fw3_device *net;
- struct fw3_address *addr, *tmp;
-
if (redir->target != FW3_FLAG_DNAT)
return false;
if (!redir->ip_redir.set)
redir->local = true;
- if (redir->local)
- return true;
-
- list_for_each_entry(zone, &state->zones, list)
- {
- list_for_each_entry(net, &zone->networks, list)
- {
- LIST_HEAD(addrs);
-
- fw3_ubus_address(&addrs, net->name);
- list_for_each_entry_safe(addr, tmp, &addrs, list)
- {
- if (!redir->local && compare_addr(&redir->ip_redir, addr)) {
- warn_elem(e, "refers to a destination address on this router, "
- "assuming port redirection");
-
- redir->local = true;
- }
-
- list_del(&addr->list);
- free(addr);
- }
-
- if (redir->local)
- return true;
- }
- }
-
- return false;
+ return redir->local;
}
void