From f76f1e082dae1c046e65cbdb1091fa8297db6a6b Mon Sep 17 00:00:00 2001 From: Peter Stadler Date: Wed, 22 Jan 2020 10:00:39 +0100 Subject: [PATCH] nginx-util: fix PROVIDES and issue #6905 nginx-ssl-util and nginx-ssl-util-nopcre are replacements for each other, but cannot replace nginx-util (instead conflict with it). The hard coded [::1] could lead to a nginx error if build without IPv6. So, get the loopback addresses dynamically. Signed-off-by: Peter Stadler --- net/nginx-util/Makefile | 9 +++++---- net/nginx-util/src/nginx-util.cpp | 13 ++++++++++--- net/nginx-util/src/ubus-cxx.hpp | 5 ++--- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/net/nginx-util/Makefile b/net/nginx-util/Makefile index b07206c9b..289649fdf 100644 --- a/net/nginx-util/Makefile +++ b/net/nginx-util/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nginx-util PKG_VERSION:=1.1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -13,13 +13,14 @@ define Package/nginx-util SUBMENU:=Web Servers/Proxies TITLE:=Builder of LAN listen directives for Nginx DEPENDS:=+libstdcpp +libubus +libubox +libpthread - PROVIDES:=nginx-util endef define Package/nginx-ssl-util/default $(Package/nginx-util) TITLE+= and manager of its SSL certificates - DEPENDS+=+libopenssl + DEPENDS+= +libopenssl + CONFLICTS:=nginx-util + PROVIDES:=nginx-ssl-util endef define Package/nginx-ssl-util-nopcre @@ -30,7 +31,7 @@ endef define Package/nginx-ssl-util $(Package/nginx-ssl-util/default) TITLE+= (using PCRE) - DEPENDS+=+libpcre + DEPENDS+= +libpcre endef define Package/nginx-util/description diff --git a/net/nginx-util/src/nginx-util.cpp b/net/nginx-util/src/nginx-util.cpp index 935a005f2..acce1e723 100644 --- a/net/nginx-util/src/nginx-util.cpp +++ b/net/nginx-util/src/nginx-util.cpp @@ -13,6 +13,7 @@ void create_lan_listen() std::string ssl_listen = listen; std::string ssl_listen_default = listen; +#ifndef NO_UBUS auto add_listen = [&listen, &listen_default #ifdef NGINX_OPENSSL ,&ssl_listen, &ssl_listen_default @@ -31,10 +32,16 @@ void create_lan_listen() #endif }; - add_listen("", "127.0.0.1", ""); - add_listen("[", "::1", "]"); + auto loopback_status = ubus::call("network.interface.loopback", "status"); + + for (auto ip : loopback_status.filter("ipv4-address", "", "address")) { + add_listen("", static_cast(blobmsg_data(ip)), ""); + } + + for (auto ip : loopback_status.filter("ipv6-address", "", "address")) { + add_listen("[", static_cast(blobmsg_data(ip)), "]"); + } -#ifndef NO_UBUS auto lan_status = ubus::call("network.interface.lan", "status"); for (auto ip : lan_status.filter("ipv4-address", "", "address")) { diff --git a/net/nginx-util/src/ubus-cxx.hpp b/net/nginx-util/src/ubus-cxx.hpp index 22edae77e..83a1ee1df 100644 --- a/net/nginx-util/src/ubus-cxx.hpp +++ b/net/nginx-util/src/ubus-cxx.hpp @@ -31,7 +31,7 @@ extern "C" { //TODO(pst): remove when in upstream // std::cout<