Properly handle reject target in rules with specific destination
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 13 Jun 2013 12:46:17 +0000 (14:46 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 13 Jun 2013 12:46:17 +0000 (14:46 +0200)
rules.c

diff --git a/rules.c b/rules.c
index 4750af7ef2d9dee6050d567c7c15c633a030ae54..1a4473b18730f1a030df4df7d293971210396323 100644 (file)
--- a/rules.c
+++ b/rules.c
@@ -295,7 +295,7 @@ static void set_target(struct fw3_ipt_rule *r, struct fw3_rule *rule)
                break;
 
        default:
-               name = "reject";
+               name = fw3_flag_names[FW3_FLAG_REJECT];
                break;
        }
 
@@ -303,8 +303,10 @@ static void set_target(struct fw3_ipt_rule *r, struct fw3_rule *rule)
                fw3_ipt_rule_target(r, "zone_%s_dest_%s", rule->dest.name, name);
        else if (need_src_action_chain(rule))
                fw3_ipt_rule_target(r, "zone_%s_src_%s", rule->src.name, name);
-       else
+       else if (strcmp(name, "REJECT"))
                fw3_ipt_rule_target(r, name);
+       else
+               fw3_ipt_rule_target(r, "reject");
 }
 
 static void