You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.7 KiB

  1. From c7c1e55f09839727ba7defd37347fc500dabb202 Mon Sep 17 00:00:00 2001
  2. From: Willy Tarreau <w@1wt.eu>
  3. Date: Tue, 11 Aug 2015 11:36:45 +0200
  4. Subject: [PATCH 10/13] MEDIUM: config: emit a warning on a frontend without
  5. listener
  6. Commit c6678e2 ("MEDIUM: config: authorize frontend and listen without bind")
  7. completely removed the test for bind lines in frontends in order to make it
  8. easier for automated tools to generate configs (eg: replacing a bind with
  9. another one passing via a temporary config without any bind line). The
  10. problem is that some common mistakes are totally hidden now. For example,
  11. this apparently valid entry is silently ignored :
  12. listen 1.2.3.4:8000
  13. server s1 127.0.0.1:8000
  14. Hint: 1.2.3.4:8000 is mistakenly the proxy name here.
  15. Thus instead we now emit a warning to indicate that a frontend was found
  16. with no listener. This should be backported to 1.5 to help spot abnormal
  17. configurations.
  18. (cherry picked from commit f82d1ca2d7ec83804d6b54e61a35747ad2f85188)
  19. ---
  20. src/cfgparse.c | 6 ++++++
  21. 1 file changed, 6 insertions(+)
  22. diff --git a/src/cfgparse.c b/src/cfgparse.c
  23. index 2a5f178..d67edc5 100644
  24. --- a/src/cfgparse.c
  25. +++ b/src/cfgparse.c
  26. @@ -6193,6 +6193,12 @@ int check_config_validity()
  27. break;
  28. }
  29. + if ((curproxy->cap & PR_CAP_FE) && LIST_ISEMPTY(&curproxy->conf.listeners)) {
  30. + Warning("config : %s '%s' has no 'bind' directive. Please declare it as a backend if this was intended.\n",
  31. + proxy_type_str(curproxy), curproxy->id);
  32. + err_code |= ERR_WARN;
  33. + }
  34. +
  35. if ((curproxy->cap & PR_CAP_BE) && (curproxy->mode != PR_MODE_HEALTH)) {
  36. if (curproxy->lbprm.algo & BE_LB_KIND) {
  37. if (curproxy->options & PR_O_TRANSP) {
  38. --
  39. 2.4.6