{
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;
{
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;
}