From 50e97c52e75bdfd325cf20d43b32d294ff84d92f Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 19 Sep 2014 20:09:19 +0200 Subject: [PATCH] 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 --- options.c | 4 ++-- 1 file 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); -- 2.30.2