if (ipset_types[i].method == ipset->method &&
ipset_types[i].types == typelist)
{
- if (!ipset->external || !*ipset->external)
+ if (!ipset->external)
{
if ((ipset_types[i].required & OPT_IPRANGE) &&
!ipset->iprange.set)
fw3_parse_options(ipset, fw3_ipset_opts, s);
+ if (ipset->external)
+ {
+ if (!*ipset->external)
+ ipset->external = NULL;
+ else if (!ipset->name)
+ ipset->name = ipset->external;
+ }
+
if (!ipset->name || !*ipset->name)
{
warn_elem(e, "must have a name assigned");
struct fw3_ipset_datatype *type;
- if (ipset->external && *ipset->external)
+ if (ipset->external)
return;
info(" * Creating ipset %s", ipset->name);
req_name.op = IP_SET_OP_GET_BYNAME;
req_name.version = req_ver.version;
snprintf(req_name.set.name, IPSET_MAXNAMELEN - 1, "%s",
- (set->external && *set->external) ? set->external : set->name);
+ set->external ? set->external : set->name);
if (getsockopt(s, SOL_IP, SO_IP_SET, &req_name, &sz))
goto out;
if (!ipset)
return;
- if (ipset->external && *ipset->external)
- name = ipset->external;
- else
- name = ipset->name;
+ name = ipset->external ? ipset->external : ipset->name;
fw3_pr(" -m set %s--match-set %s", invert ? "! " : "", name);
if (!fw3_check_ipset(redir->_ipset))
{
info(" ! Skipping due to missing ipset '%s'",
- (redir->_ipset->external && *redir->_ipset->external) ?
+ redir->_ipset->external ?
redir->_ipset->external : redir->_ipset->name);
return;
}
if (!fw3_check_ipset(rule->_ipset))
{
info(" ! Skipping due to missing ipset '%s'",
- (rule->_ipset->external && *rule->_ipset->external) ?
- rule->_ipset->external : rule->_ipset->name);
+ rule->_ipset->external
+ ? rule->_ipset->external : rule->_ipset->name);
return;
}
struct uci_ptr ptr = { .p = dest };
- if (!s->enabled || (s->external && *s->external))
+ if (!s->enabled || s->external)
return;
uci_add_section(ctx, dest, "ipset", &ptr.s);