summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2014-09-19 20:09:19 +0200
committerJo-Philipp Wich <jow@openwrt.org>2014-09-19 20:09:40 +0200
commit50e97c52e75bdfd325cf20d43b32d294ff84d92f (patch)
tree435f8948a53c78b0bafe9d810651f0123adb81fc
parent8ea29822ce53c36c91c7b67c6a99b2c50f2c373f (diff)
downloadfirewall3-50e97c52e75bdfd325cf20d43b32d294ff84d92f.tar.gz
options: allow '*' as value for protocols and families
No functional change, just a little bit of consistency with src / dest specifiers where '*' means 'any' or 'all'. To follow the principle of least surprise, allow the some for family and protocol options. option proto '*' is equivalent to option proto 'all' option family '*' is equivalent to option family 'any' Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
-rw-r--r--options.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/options.c b/options.c
index 0a796a4..f41153c 100644
--- a/options.c
+++ b/options.c
@@ -442,7 +442,7 @@ fw3_parse_port(void *ptr, const char *val, bool is_list)
bool
fw3_parse_family(void *ptr, const char *val, bool is_list)
{
- if (!strcmp(val, "any"))
+ if (!strcmp(val, "any") || !strcmp(val, "*"))
*((enum fw3_family *)ptr) = FW3_FAMILY_ANY;
else if (!strcmp(val, "inet") || strrchr(val, '4'))
*((enum fw3_family *)ptr) = FW3_FAMILY_V4;
@@ -543,7 +543,7 @@ fw3_parse_protocol(void *ptr, const char *val, bool is_list)
while (isspace(*++val));
}
- if (!strcmp(val, "all"))
+ if (!strcmp(val, "all") || !strcmp(val, "any") || !strcmp(val, "*"))
{
proto.any = true;
put_value(ptr, &proto, sizeof(proto), is_list);