From: Tomas Krizek Date: Wed, 11 Dec 2019 17:07:01 +0000 (+0100) Subject: bindings/net: throw lua error ofr net.listen() failures X-Git-Tag: v5.0.0~16^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eadbf9539c7a23b3f181c78e7a02f0f6378d59db;p=thirdparty%2Fknot-resolver.git 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. --- 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+ =============