diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2014-09-19 20:09:19 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2014-09-19 20:09:40 +0200 |
commit | 50e97c52e75bdfd325cf20d43b32d294ff84d92f (patch) | |
tree | 435f8948a53c78b0bafe9d810651f0123adb81fc | |
parent | 8ea29822ce53c36c91c7b67c6a99b2c50f2c373f (diff) | |
download | firewall3-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.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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); |