diff options
author | Peter Stadler <peter.stadler@student.uibk.ac.at> | 2020-01-22 10:00:39 +0100 |
---|---|---|
committer | Peter Stadler <peter.stadler@student.uibk.ac.at> | 2020-01-22 10:00:39 +0100 |
commit | f76f1e082dae1c046e65cbdb1091fa8297db6a6b (patch) | |
tree | 93db0b30dfc32a2c951f3fede0f69251bcef4a54 /net | |
parent | 5cd9d62f52422d946acbc1b5520e998079d79e90 (diff) |
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 <peter.stadler@student.uibk.ac.at>
Diffstat (limited to 'net')
-rw-r--r-- | net/nginx-util/Makefile | 9 | ||||
-rw-r--r-- | net/nginx-util/src/nginx-util.cpp | 13 | ||||
-rw-r--r-- | 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<const char *>(blobmsg_data(ip)), ""); + } + + for (auto ip : loopback_status.filter("ipv6-address", "", "address")) { + add_listen("[", static_cast<const char *>(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<<std::endl; // // example for exploring: -// ubus::strings keys{"ipv4-address", "", "*"}; +// ubus::strings keys{"ipv4-address", "", ""}; // for (auto x : ubus::call("network.interface.lan", "status").filter(keys)) { // std::cout<<blobmsg_name(x)<<": "; // switch (blob_id(x)) { @@ -173,8 +173,7 @@ private: public: - - explicit iterator(const blob_attr * msg, const strings & filter) + explicit iterator(const blob_attr * msg, const strings & filter={""}) : keys{filter}, n{keys.size()-1}, pos{msg}, cur{this} { if (pos!=nullptr) { |