blob_for_each_attr(entry, a, rem) {
const char *type = NULL;
+ const char *name = "ubus rule";
blobmsg_for_each_attr(opt, entry, orem)
if (!strcmp(blobmsg_name(opt), "type"))
type = blobmsg_get_string(opt);
+ else if (!strcmp(blobmsg_name(opt), "name"))
+ name = blobmsg_get_string(opt);
if (!type || strcmp(type, "rule"))
continue;
if (!(rule = alloc_rule(state)))
continue;
- if (!fw3_parse_blob_options(rule, fw3_rule_opts, entry))
+ if (!fw3_parse_blob_options(rule, fw3_rule_opts, entry, name))
{
- fprintf(stderr, "ubus section skipped due to invalid options\n");
+ fprintf(stderr, "%s skipped due to invalid options\n", name);
fw3_free_rule(rule);
continue;
}
{
char chain[32];
- snprintf(chain, sizeof(chain), "delegate_output");
+ snprintf(chain, sizeof(chain), "OUTPUT");
if (rule->target == FW3_FLAG_NOTRACK)
{
snprintf(chain, sizeof(chain), "zone_%s_notrack", rule->src.name);
}
- else if (rule->target == FW3_FLAG_MARK)
+ else if (rule->target == FW3_FLAG_MARK && (rule->_src || rule->src.any))
{
- snprintf(chain, sizeof(chain), "fwmark");
+ snprintf(chain, sizeof(chain), "PREROUTING");
}
else
{
else
{
if (rule->dest.set)
- snprintf(chain, sizeof(chain), "delegate_forward");
+ snprintf(chain, sizeof(chain), "FORWARD");
else
- snprintf(chain, sizeof(chain), "delegate_input");
+ snprintf(chain, sizeof(chain), "INPUT");
}
}
if (rule->dest.set && !rule->src.set)
{
if (rule->dest.any)
- snprintf(chain, sizeof(chain), "delegate_output");
+ snprintf(chain, sizeof(chain), "OUTPUT");
else
snprintf(chain, sizeof(chain), "zone_%s_output",
rule->dest.name);