From eadbf9539c7a23b3f181c78e7a02f0f6378d59db Mon Sep 17 00:00:00 2001 From: Tomas Krizek Date: Wed, 11 Dec 2019 18:07:01 +0100 Subject: [PATCH] bindings/net: throw lua error ofr net.listen() failures To avoid configuration errors, throw a lua error and crash if it's not possible to bind as specified in net.listen(). For special use-cases, freebind=true should be used instead. --- daemon/bindings/net.c | 5 +++-- doc/upgrading.rst | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/daemon/bindings/net.c b/daemon/bindings/net.c index 3a80f0120..b7d934192 100644 --- a/daemon/bindings/net.c +++ b/daemon/bindings/net.c @@ -224,8 +224,9 @@ static int net_listen(lua_State *L) /* Now focus on the first argument. */ lua_settop(L, 1); - const bool res = net_listen_addrs(L, port, tls, kind, freebind); - lua_pushboolean(L, res); + if (!net_listen_addrs(L, port, tls, kind, freebind)) + lua_error_p(L, "net.listen() failed to bind"); + lua_pushboolean(L, true); return 1; } diff --git a/doc/upgrading.rst b/doc/upgrading.rst index ab5601606..c6f589d9b 100644 --- a/doc/upgrading.rst +++ b/doc/upgrading.rst @@ -5,6 +5,15 @@ Upgrading This section summarizes steps required for upgrade to newer Knot Resolver versions. We advise users to also read :ref:`release_notes` for respective versions. +4.x to 5.x +========== + +Configuration file +------------------ + +* ``net.listen()`` throws an error if it fails to bind. Use ``freebind=true`` option + to bind to nonlocal addresses. + 4.2.2 to 4.3+ ============= -- 2.47.2