projects
/
project
/
firewall3.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
make fw3_ubus_address take a list_head * argument instead of allocating & returning one
[project/firewall3.git]
/
redirects.c
diff --git
a/redirects.c
b/redirects.c
index
f1fa1f4
..
080e2c1
100644
(file)
--- a/
redirects.c
+++ b/
redirects.c
@@
-171,8
+171,7
@@
check_local(struct uci_element *e, struct fw3_redirect *redir,
{
struct fw3_zone *zone;
struct fw3_device *net;
{
struct fw3_zone *zone;
struct fw3_device *net;
- struct fw3_address *addr;
- struct list_head *addrs;
+ struct fw3_address *addr, *tmp;
if (redir->target != FW3_FLAG_DNAT)
return false;
if (redir->target != FW3_FLAG_DNAT)
return false;
@@
-187,25
+186,23
@@
check_local(struct uci_element *e, struct fw3_redirect *redir,
{
list_for_each_entry(net, &zone->networks, list)
{
{
list_for_each_entry(net, &zone->networks, list)
{
- addrs = fw3_ubus_address(net->name);
-
- if (!addrs)
- continue;
+ LIST_HEAD(addrs);
- list_for_each_entry(addr, addrs, list)
+ fw3_ubus_address(&addrs, net->name);
+ list_for_each_entry_safe(addr, tmp, &addrs, list)
{
{
- if (!compare_addr(&redir->ip_redir, addr))
- continue;
+ if (compare_addr(&redir->ip_redir, addr)) {
+ warn_elem(e, "refers to a destination address on this router, "
+ "assuming port redirection");
- warn_elem(e, "refers to a destination address on this router, "
- "assuming port redirection");
+ redir->local = true;
+ continue;
+ }
-
redir->local = true
;
-
break
;
+
list_del(&addr->list)
;
+
free(addr)
;
}
}
- fw3_free_list(addrs);
-
if (redir->local)
return true;
}
if (redir->local)
return true;
}