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.

52 lines
1.7 KiB

  1. From e77015cdc18ab74aba61cdf57de56d06be5c2a4d Mon Sep 17 00:00:00 2001
  2. From: Willy Tarreau <w@1wt.eu>
  3. Date: Wed, 14 Jan 2015 11:48:58 +0100
  4. Subject: [PATCH 05/10] MINOR: config: extend the default max hostname length
  5. to 64 and beyond
  6. Some users reported that the default max hostname length of 32 is too
  7. short in some environments. This patch does two things :
  8. - it relies on the system's max hostname length as found in MAXHOSTNAMELEN
  9. if it is set. This is the most logical thing to do as the system libs
  10. generally present the appropriate value supported by the system. This
  11. value is 64 on Linux and 256 on Solaris, to give a few examples.
  12. - otherwise it defaults to 64
  13. It is still possible to override this value by defining MAX_HOSTNAME_LEN at
  14. build time. After some observation time, this patch may be backported to
  15. 1.5 if it does not cause any build issue, as it is harmless and may help
  16. some users.
  17. (cherry picked from commit 75abcb3106e2c27ef983df885558cf94e01f717a)
  18. Cc: Lukas Tribus <luky-37@hotmail.com>
  19. Cc: jose.castro.leon@cern.ch
  20. [wt: no issue reported so far and Jose rightfully asked for it in 1.5]
  21. ---
  22. include/common/defaults.h | 8 ++++++--
  23. 1 file changed, 6 insertions(+), 2 deletions(-)
  24. diff --git a/include/common/defaults.h b/include/common/defaults.h
  25. index 0075509..a191b8a 100644
  26. --- a/include/common/defaults.h
  27. +++ b/include/common/defaults.h
  28. @@ -190,8 +190,12 @@
  29. /* Maximum host name length */
  30. #ifndef MAX_HOSTNAME_LEN
  31. -#define MAX_HOSTNAME_LEN 32
  32. -#endif
  33. +#if MAXHOSTNAMELEN
  34. +#define MAX_HOSTNAME_LEN MAXHOSTNAMELEN
  35. +#else
  36. +#define MAX_HOSTNAME_LEN 64
  37. +#endif // MAXHOSTNAMELEN
  38. +#endif // MAX_HOSTNAME_LEN
  39. /* Maximum health check description length */
  40. #ifndef HCHK_DESC_LEN
  41. --
  42. 2.4.10