helpers: implement explicit CT helper assignment support
[project/firewall3.git] / options.c
index 6d2a283..d990cad 100644 (file)
--- a/options.c
+++ b/options.c
@@ -75,6 +75,7 @@ const char *fw3_flag_names[__FW3_FLAG_MAX] = {
        "REJECT",
        "DROP",
        "NOTRACK",
+       "HELPER",
        "MARK",
        "DNAT",
        "SNAT",
@@ -897,6 +898,28 @@ fw3_parse_direction(void *ptr, const char *val, bool is_list)
        return valid;
 }
 
+bool
+fw3_parse_cthelper(void *ptr, const char *val, bool is_list)
+{
+       struct fw3_cthelpermatch m = { };
+
+       if (*val == '!')
+       {
+               m.invert = true;
+               while (isspace(*++val));
+       }
+
+       if (*val)
+       {
+               m.set = true;
+               strncpy(m.name, val, sizeof(m.name) - 1);
+               put_value(ptr, &m, sizeof(m), is_list);
+               return true;
+       }
+
+       return false;
+}
+
 
 bool
 fw3_parse_options(void *s, const struct fw3_option *opts,