From 62846b2674eb02e5790ddf52db6b856a2db39703 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Cyril=20Bont=C3=A9?= Date: Mon, 1 Nov 2010 19:26:00 +0100 Subject: [PATCH] [MINOR] config: detect options not supported due to compilation options Some options depends on the target architecture or compilation options. When such an option is used on a compiled version that doesn't support it, it's probably better to identify it as an unsupported option due to compilation options instead of an unknown option. Edit: better check on the empty capability than on the option bits. -Willy --- src/cfgparse.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/cfgparse.c b/src/cfgparse.c index 034fe62209..7c27d8366f 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -129,6 +129,8 @@ static const struct cfg_opt cfg_opts[] = { "srvtcpka", PR_O_TCP_SRV_KA, PR_CAP_BE, 0, 0 }, #ifdef TPROXY { "transparent", PR_O_TRANSP, PR_CAP_BE, 0, 0 }, +#else + { "transparent", 0, 0, 0, 0 }, #endif { NULL, 0, 0, 0, 0 } @@ -141,6 +143,10 @@ static const struct cfg_opt cfg_opts2[] = { "splice-request", PR_O2_SPLIC_REQ, PR_CAP_FE|PR_CAP_BE, 0, 0 }, { "splice-response", PR_O2_SPLIC_RTR, PR_CAP_FE|PR_CAP_BE, 0, 0 }, { "splice-auto", PR_O2_SPLIC_AUT, PR_CAP_FE|PR_CAP_BE, 0, 0 }, +#else + { "splice-request", 0, 0, 0, 0 }, + { "splice-response", 0, 0, 0, 0 }, + { "splice-auto", 0, 0, 0, 0 }, #endif { "accept-invalid-http-request", PR_O2_REQBUG_OK, PR_CAP_FE, 0, PR_MODE_HTTP }, { "accept-invalid-http-response", PR_O2_RSPBUG_OK, PR_CAP_BE, 0, PR_MODE_HTTP }, @@ -2999,6 +3005,12 @@ stats_error_parsing: for (optnum = 0; cfg_opts[optnum].name; optnum++) { if (!strcmp(args[1], cfg_opts[optnum].name)) { + if (cfg_opts[optnum].cap == PR_CAP_NONE) { + Alert("parsing [%s:%d]: option '%s' is not supported due to build options.\n", + file, linenum, cfg_opts[optnum].name); + err_code |= ERR_ALERT | ERR_FATAL; + goto out; + } if (warnifnotcap(curproxy, cfg_opts[optnum].cap, file, linenum, args[1], NULL)) { err_code |= ERR_WARN; goto out; @@ -3024,6 +3036,12 @@ stats_error_parsing: for (optnum = 0; cfg_opts2[optnum].name; optnum++) { if (!strcmp(args[1], cfg_opts2[optnum].name)) { + if (cfg_opts2[optnum].cap == PR_CAP_NONE) { + Alert("parsing [%s:%d]: option '%s' is not supported due to build options.\n", + file, linenum, cfg_opts2[optnum].name); + err_code |= ERR_ALERT | ERR_FATAL; + goto out; + } if (warnifnotcap(curproxy, cfg_opts2[optnum].cap, file, linenum, args[1], NULL)) { err_code |= ERR_WARN; goto out; -- 2.47.3