From: Jo-Philipp Wich Date: Fri, 19 Sep 2014 18:09:19 +0000 (+0200) Subject: options: allow '*' as value for protocols and families X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=50e97c52e75bdfd325cf20d43b32d294ff84d92f;p=oweals%2Ffirewall3.git 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 --- 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);