projects
/
project
/
firewall3.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove src_flags and running_src_flags from fw3_zone struct, rename dst_flags and...
[project/firewall3.git]
/
options.c
diff --git
a/options.c
b/options.c
index
ff9a964
..
344d33d
100644
(file)
--- a/
options.c
+++ b/
options.c
@@
-55,6
+55,10
@@
const char *fw3_flag_names[FW3_DEFAULT_DROP_INVALID + 1] = {
"NOTRACK",
"DNAT",
"SNAT",
"NOTRACK",
"DNAT",
"SNAT",
+
+ "ACCEPT",
+ "REJECT",
+ "DROP",
};
static const char *limit_units[] = {
};
static const char *limit_units[] = {
@@
-636,7
+640,7
@@
fw3_parse_monthdays(void *ptr, const char *val)
if (!(s = strdup(val)))
return false;
if (!(s = strdup(val)))
return false;
- for (p = strtok(
(char *)val
, " \t"); p; p = strtok(NULL, " \t"))
+ for (p = strtok(
s
, " \t"); p; p = strtok(NULL, " \t"))
{
d = strtoul(p, &p, 10);
{
d = strtoul(p, &p, 10);
@@
-665,7
+669,7
@@
void
fw3_parse_options(void *s, const struct fw3_option *opts,
struct uci_section *section)
{
fw3_parse_options(void *s, const struct fw3_option *opts,
struct uci_section *section)
{
- char *p;
+ char *p
, *v
;
bool known;
struct uci_element *e, *l;
struct uci_option *o;
bool known;
struct uci_element *e, *l;
struct uci_option *o;
@@
-720,9
+724,15
@@
fw3_parse_options(void *s, const struct fw3_option *opts,
}
else
{
}
else
{
- if (!o->v.string)
+ v = o->v.string;
+
+ if (!v)
continue;
continue;
+ /* protocol "tcpudp" compatibility hack */
+ if (opt->parse == fw3_parse_protocol && !strcmp(v, "tcpudp"))
+ v = strdup("tcp udp");
+
if (!opt->elem_size)
{
if (!opt->parse((char *)s + opt->offset, o->v.string))
if (!opt->elem_size)
{
if (!opt->parse((char *)s + opt->offset, o->v.string))
@@
-730,9
+740,7
@@
fw3_parse_options(void *s, const struct fw3_option *opts,
}
else
{
}
else
{
- for (p = strtok(o->v.string, " \t");
- p != NULL;
- p = strtok(NULL, " \t"))
+ for (p = strtok(v, " \t"); p != NULL; p = strtok(NULL, " \t"))
{
item = malloc(opt->elem_size);
{
item = malloc(opt->elem_size);
@@
-752,6
+760,9
@@
fw3_parse_options(void *s, const struct fw3_option *opts,
list_add_tail(item, dest);
}
}
list_add_tail(item, dest);
}
}
+
+ if (v != o->v.string)
+ free(v);
}
known = true;
}
known = true;