You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dnsdist: add opt-in fatal bind failures for console and webserver
Introduce opt-in fatal behavior when binding the webserver socket or
the control socket fails, to make startup failures visible to service
managers like systemd.
Expose the feature in both configuration styles:
- Lua: setConsoleBindFatal(bool), setWebserverBindFatal(bool)
- YAML: console.bind_fatal, webserver.bind_fatal
When enabled, dnsdist now exits with failure on bind exceptions for:
- control socket listeners
- webserver listeners
Wire the new settings through runtime configuration loading, Lua
configuration items, and YAML parsing, and add console completion
entries for both setters.
Update documentation with new config functions and behavior notes.
Add regression tests in test_BindFatal.py for Lua and YAML, validating:
- default/not set: bind failures are non-fatal
- explicit false: bind failures are non-fatal
- explicit true: bind failures are fatal at startup
Signed-off-by: b.courtois <b.courtois@criteo.com>
{"setCacheCleaningPercentage", true, "num", "Set the percentage of the cache that the cache cleaning algorithm will try to free by removing expired entries. By default (100), all expired entries are remove"},
240
240
{"setConsistentHashingBalancingFactor", true, "factor", "Set the balancing factor for bounded-load consistent hashing"},
241
241
{"setConsoleACL", true, "{netmask, netmask}", "replace the console ACL set with these netmasks"},
242
+
{"setConsoleBindFatal", true, "enable", "whether a failure to bind the console control socket is fatal"},
242
243
{"setConsoleConnectionsLogging", true, "enabled", "whether to log the opening and closing of console connections"},
243
244
{"setConsoleMaximumConcurrentConnections", true, "max", "Set the maximum number of concurrent console connections"},
244
245
{"setConsoleOutputMaxMsgSize", true, "messageSize", "set console message maximum size in bytes, default is 10 MB"},
{"setVerbose", true, "bool", "set whether log messages at the verbose level will be logged"},
310
311
{"setVerboseHealthChecks", true, "bool", "set whether health check errors will be logged"},
311
312
{"setVerboseLogDestination", true, "destination file", "Set a destination file to write the 'verbose' log messages to, instead of sending them to syslog and/or the standard output"},
313
+
{"setWebserverBindFatal", true, "enable", "whether a failure to bind a web server socket is fatal"},
{"setWeightedBalancingFactor", true, "factor", "Set the balancing factor for bounded-load weighted policies (whashed, wrandom)"},
314
316
{"setWHashedPerturbation", true, "value", "Set the hash perturbation value to be used in the whashed policy instead of a random one, allowing to have consistent whashed results on different instance"},
g_outputBuffer = "Unable to bind to webserver socket on " + local.toStringWithPort() + ": " + e.what();
1124
1124
SLOG(errlog("Unable to bind to webserver socket on %s: %s", local.toStringWithPort(), e.what()),
1125
1125
getLogger("webserver")->error(Logr::Error, e.what(), "Error while trying to bind the web server socket", "network.local.address", Logging::Loggable(local)));
1126
+
if (dnsdist::configuration::getCurrentRuntimeConfiguration().d_webserverBindFatal) {
g_outputBuffer = "Unable to bind to control socket on " + local.toStringWithPort() + ": " + exp.what();
1244
1247
SLOG(errlog("Unable to bind to control socket on %s: %s", local.toStringWithPort(), exp.what()),
1245
1248
getLogger("controlSocket")->error(Logr::Error, exp.what(), "Unable to bind to console's control socket", "network.local.address", Logging::Loggable(local)));
1249
+
if (dnsdist::configuration::getCurrentRuntimeConfiguration().d_consoleBindFatal) {
Copy file name to clipboardExpand all lines: pdns/dnsdistdist/dnsdist-settings-definitions.yml
+14Lines changed: 14 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -466,6 +466,13 @@ webserver:
466
466
type: "bool"
467
467
default: "false"
468
468
description: "Allow modifications via the API. Optionally saving these changes to disk. Modifications done via the API will not be written to the configuration by default and will not persist after a reload"
469
+
- name: "bind_fatal"
470
+
type: "bool"
471
+
default: "false"
472
+
lua-name: "setWebserverBindFatal"
473
+
internal-field-name: "d_webserverBindFatal"
474
+
runtime-configurable: true
475
+
description: "Whether a failure to bind a web server socket should be fatal"
description: "Set the maximum number of concurrent console connection"
513
+
- name: "bind_fatal"
514
+
type: "bool"
515
+
default: "false"
516
+
lua-name: "setConsoleBindFatal"
517
+
internal-field-name: "d_consoleBindFatal"
518
+
runtime-configurable: true
519
+
description: "Whether a failure to bind the console control socket should be fatal"
506
520
507
521
ebpf_map:
508
522
description: "An ``eBPF`` map that is used to share data with kernel-land ``AF_XDP``/``XSK``, ``socket filter`` or ``XDP`` programs. Maps can be pinned to a filesystem path, which makes their content persistent across restarts and allows external programs to read their content and to add new entries. :program:`dnsdist` will try to load maps that are pinned to a filesystem path on startups, inheriting any existing entries, and fall back to creating them if they do not exist yet. Note that the user :program`dnsdist` is running under must have the right privileges to read and write to the given file, and to go through all the directories in the path leading to that file. The pinned path must be on a filesystem of type ``BPF``, usually below ``/sys/fs/bpf/``"
SLOG(errlog("Unable to bind to control socket on %s: %s", local.toStringWithPort(), exp.what()),
3555
3555
dnsdist::logging::getTopLogger("setup")->error(Logr::Error, exp.what(), "Unable to bind to console control socket", "network.local.address", Logging::Loggable(local)));
SLOG(errlog("Unable to bind to web server socket on %s: %s", local.toStringWithPort(), exp.what()),
3568
3571
dnsdist::logging::getTopLogger("setup")->error(Logr::Error, exp.what(), "Unable to bind to web server socket", "network.local.address", Logging::Loggable(local)));
0 commit comments