From 6e6a38ea87aebeaefe70869c226cadad0312f144 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 5 Jun 2013 12:49:17 +0200 Subject: [PATCH] Use zone_name_src_ACTION chain for input rules with non-wildcard source --- rules.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/rules.c b/rules.c index a251f7c..3f2ca68 100644 --- a/rules.c +++ b/rules.c @@ -200,6 +200,11 @@ fw3_load_rules(struct fw3_state *state, struct uci_package *p) setbit(rule->_dest->flags[0], rule->target); setbit(rule->_dest->flags[1], rule->target); } + else if (rule->_src) + { + setbit(rule->_src->flags[0], fw3_to_src_target(rule->target)); + setbit(rule->_src->flags[1], fw3_to_src_target(rule->target)); + } list_add_tail(&rule->list, &state->rules); continue; @@ -274,21 +279,24 @@ static void set_target(struct fw3_ipt_rule *r, struct fw3_rule *rule) fw3_ipt_rule_addarg(r, false, name, buf); return; + case FW3_FLAG_NOTRACK: + fw3_ipt_rule_target(r, fw3_flag_names[rule->target]); + return; + case FW3_FLAG_ACCEPT: case FW3_FLAG_DROP: - case FW3_FLAG_NOTRACK: name = fw3_flag_names[rule->target]; break; default: - name = fw3_flag_names[FW3_FLAG_REJECT]; + name = "reject"; break; } if (rule->dest.set && !rule->dest.any) fw3_ipt_rule_target(r, "zone_%s_dest_%s", rule->dest.name, name); - else if (rule->target == FW3_FLAG_REJECT) - fw3_ipt_rule_target(r, "reject"); + else if (rule->src.set && !rule->src.any) + fw3_ipt_rule_target(r, "zone_%s_src_%s", rule->src.name, name); else fw3_ipt_rule_target(r, name); } -- 2.25.1