Browse Source

Merge pull request #11092 from peter-stadler/nginx-util

nginx-util: fix PROVIDES variable and failure with ipv6 disabled
lilik-openwrt-22.03
Rosen Penev 5 years ago
committed by GitHub
parent
commit
fd30aa5f02
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 10 deletions
  1. +5
    -4
      net/nginx-util/Makefile
  2. +10
    -3
      net/nginx-util/src/nginx-util.cpp
  3. +2
    -3
      net/nginx-util/src/ubus-cxx.hpp

+ 5
- 4
net/nginx-util/Makefile View File

@ -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


+ 10
- 3
net/nginx-util/src/nginx-util.cpp View File

@ -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")) {


+ 2
- 3
net/nginx-util/src/ubus-cxx.hpp View File

@ -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) {


Loading…
Cancel
Save