--- /dev/null
+#
+# Copyright (C) 2014-2017 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libuhttpd
+PKG_VERSION:=2.0.0
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_VERSION:=v$(PKG_VERSION)
+PKG_SOURCE_URL=https://github.com/zhaojh329/libuhttpd.git
+PKG_MIRROR_HASH:=6101b348ba743eebcfd9e6561df94809e72298c8639ed296c3fb4e6837ed20ba
+CMAKE_INSTALL:=1
+
+PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_SUBDIR)
+
+PKG_LICENSE:=LGPL-2.1
+PKG_LICENSE_FILES:=LICENSE
+
+PKG_MAINTAINER:=Jianhui Zhao <jianhuizhao329@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+define Package/libuhttpd/default
+ SECTION:=libs
+ CATEGORY:=Libraries
+ SUBMENU:=Networking
+ TITLE:=libuhttpd
+ DEPENDS:=+libubox +liblua
+endef
+
+define Package/libuhttpd-nossl
+ $(Package/libuhttpd/default)
+ TITLE += (NO SSL)
+ VARIANT:=nossl
+endef
+
+define Package/libuhttpd-openssl
+ $(Package/libuhttpd/default)
+ TITLE += (openssl)
+ DEPENDS += +libustream-openssl
+ VARIANT:=openssl
+endef
+
+define Package/libuhttpd-wolfssl
+ $(Package/libuhttpd/default)
+ TITLE += (wolfssl)
+ DEPENDS += +libustream-wolfssl
+ VARIANT:=wolfssl
+endef
+
+define Package/libuhttpd-mbedtls
+ $(Package/libuhttpd/default)
+ TITLE += (mbedtls)
+ DEPENDS += +libustream-mbedtls
+ VARIANT:=mbedtls
+endef
+
+ifeq ($(BUILD_VARIANT),nossl)
+ CMAKE_OPTIONS += -DUHTTPD_SSL_SUPPORT=off
+endif
+
+define Package/libuhttpd/default/install
+ $(INSTALL_DIR) $(1)/usr/lib/
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libuhttpd.so* $(1)/usr/lib/
+endef
+
+Package/libuhttpd-nossl/install = $(Package/libuhttpd/default/install)
+Package/libuhttpd-openssl/install = $(Package/libuhttpd/default/install)
+Package/libuhttpd-wolfssl/install = $(Package/libuhttpd/default/install)
+Package/libuhttpd-mbedtls/install = $(Package/libuhttpd/default/install)
+
+$(eval $(call BuildPackage,libuhttpd-nossl))
+$(eval $(call BuildPackage,libuhttpd-mbedtls))
+$(eval $(call BuildPackage,libuhttpd-wolfssl))
+$(eval $(call BuildPackage,libuhttpd-openssl))
--- /dev/null
+#
+# Copyright (C) 2014-2017 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=wifidog-ng
+PKG_VERSION:=1.0.1
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_VERSION:=v$(PKG_VERSION)
+PKG_SOURCE_URL=https://github.com/zhaojh329/wifidog-ng.git
+PKG_MIRROR_HASH:=f6ff1e91f37a101df157655e0aa5628966b3e27c49294125a7dab6755fb4bf97
+
+PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_SUBDIR)
+
+PKG_LICENSE:=LGPL-2.1
+PKG_LICENSE_FILES:=LICENSE
+
+PKG_MAINTAINER:=Jianhui Zhao <jianhuizhao329@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+define Package/wifidog-ng/default
+ SUBMENU:=Captive Portals
+ SECTION:=net
+ CATEGORY:=Network
+ TITLE:=Next generation WifiDog
+ DEPENDS:=+kmod-wifidog-ng +libuci +libuclient +libblobmsg-json +libubus +libcares
+endef
+
+define Package/wifidog-ng-nossl
+ $(Package/wifidog-ng/default)
+ TITLE += (NO SSL)
+ DEPENDS += +libuhttpd-nossl
+ VARIANT:=nossl
+ CONFLICTS:=wifidog-ng-openssl wifidog-ng-wolfssl wifidog-ng-mbedtls
+endef
+
+define Package/wifidog-ng-openssl
+ $(Package/wifidog-ng/default)
+ TITLE += (openssl)
+ DEPENDS += +libuhttpd-openssl
+ VARIANT:=openssl
+ CONFLICTS:=wifidog-ng-wolfssl wifidog-ng-mbedtls
+endef
+
+define Package/wifidog-ng-wolfssl
+ $(Package/wifidog-ng/default)
+ TITLE += (wolfssl)
+ DEPENDS += +libuhttpd-wolfssl
+ VARIANT:=wolfssl
+ CONFLICTS:=wifidog-ng-mbedtls
+endef
+
+define Package/wifidog-ng-mbedtls
+ $(Package/wifidog-ng/default)
+ TITLE += (mbedtls)
+ DEPENDS += +libuhttpd-mbedtls
+ VARIANT:=mbedtls
+endef
+
+define Package/wifidog-ng/default/install
+ $(INSTALL_DIR) $(1)/usr/bin $(1)/etc/init.d $(1)/etc/config $(1)/etc/wifidog-ng
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/wifidog-ng $(1)/usr/bin
+ $(INSTALL_BIN) ./files/wifidog-ng.init $(1)/etc/init.d/wifidog-ng
+ $(INSTALL_CONF) ./files/wifidog-ng.config $(1)/etc/config/wifidog-ng
+ $(INSTALL_CONF) ./files/wifidog-ng.key $(1)/etc/wifidog-ng
+ $(INSTALL_CONF) ./files/wifidog-ng.crt $(1)/etc/wifidog-ng
+endef
+
+Package/wifidog-ng-nossl/install = $(Package/wifidog-ng/default/install)
+Package/wifidog-ng-openssl/install = $(Package/wifidog-ng/default/install)
+Package/wifidog-ng-wolfssl/install = $(Package/wifidog-ng/default/install)
+Package/wifidog-ng-mbedtls/install = $(Package/wifidog-ng/default/install)
+
+include $(INCLUDE_DIR)/kernel.mk
+
+define KernelPackage/wifidog-ng
+ SUBMENU:=Other modules
+ TITLE:=Kernel module for wifidog-ng
+ DEPENDS:=+kmod-nf-nat
+ FILES:=$(PKG_BUILD_DIR)/kmod/wifidog-ng.ko
+endef
+
+include $(INCLUDE_DIR)/kernel-defaults.mk
+
+define Build/Compile
+ $(call Build/Compile/Default)
+ $(MAKE) $(KERNEL_MAKEOPTS) SUBDIRS="$(PKG_BUILD_DIR)"/kmod modules
+endef
+
+$(eval $(call BuildPackage,wifidog-ng-nossl))
+$(eval $(call BuildPackage,wifidog-ng-mbedtls))
+$(eval $(call BuildPackage,wifidog-ng-wolfssl))
+$(eval $(call BuildPackage,wifidog-ng-openssl))
+
+$(eval $(call KernelPackage,wifidog-ng))
--- /dev/null
+config gateway
+ option enabled 1
+ option ifname 'br-lan'
+ option port 2060
+ option ssl_port 8443
+ option checkinterval 30
+ option temppass_time 30
+
+config authserver
+ option host 'authserver.com'
+ option port 80
+ option path '/wifidog/'
+ option login_path 'login'
+ option portal_path 'portal'
+ option msg_path 'gw_message.php'
+ option ping_path 'ping'
+ option auth_path 'auth'
+
+config popularserver
+ list server www.baidu.com
+ list server www.qq.com
--- /dev/null
+-----BEGIN CERTIFICATE-----
+MIID8TCCAtmgAwIBAgICCCUwDQYJKoZIhvcNAQELBQAwczELMAkGA1UEBhMCQ04x
+EDAOBgNVBAgMB1RpYW5qaW4xEDAOBgNVBAcMB1RpYW5qaW4xFTATBgNVBAoMDENI
+SU5BU1NMIEluYzEpMCcGA1UEAwwgQ0hJTkFTU0wgQ2VydGlmaWNhdGlvbiBBdXRo
+b3JpdHkwHhcNMTgwMzAzMTQyODQ2WhcNMTkwMzAzMTQyODQ2WjCBgzELMAkGA1UE
+BhMCQ04xEDAOBgNVBAgMB3NpY2h1YW4xEjAQBgNVBAoMCXpoYW9qaDMyOTETMBEG
+A1UECwwKd2lmaWRvZy1uZzEQMA4GA1UEAwwHd2lmaWRvZzEnMCUGCSqGSIb3DQEJ
+ARYYamlhbmh1aXpoYW8zMjlAZ21haWwuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOC
+AQ8AMIIBCgKCAQEAyD8gd3XIJvkYeySP2q0toYsfvhlA+lceUPiMi16U1nR3TD5U
+uTNGsvYBDMiR7vG0NKClFT73u/d8HBcYcTBgbhHfBkz4v9S5aMdUYQsUMQEITBdE
+hPEeXVqqj796Lu6iEkNUFrtam2h3t+kYODjbszk2woBtohaRWfNyOB/AJH6Stv4l
+jkPYwt9NHcKQSm9kjcGsAqQwkgVd4UfHX2G20gaTijimeHlJL2wv61uLBUvYux0E
++98KIcEIYu3BVAfoO2Omg/o73cwH+sFTswEXPuXirwrOzmJ850WBLScLkSKSATrY
+1YdU6CRaJuP/POFfSqAhn/mPRNQFU5fAaDcfEwIDAQABo34wfDAJBgNVHRMEAjAA
+MC8GCWCGSAGG+EIBDQQiFiBDSElOQVNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
+eTAdBgNVHQ4EFgQU9XS4dW6j1r1lEOIHWkoJx3zSqqgwHwYDVR0jBBgwFoAUXB8j
++sjhITHC2Df2iPzSb8JUQzMwDQYJKoZIhvcNAQELBQADggEBAFsaq5qehwp0zMqY
+cb0IX5/f4ZnscX587SM/NhORODa0p/bT3EwG3grtljHhRW+s/4c4gPgilrzV0Fxn
+Y5FodLfFdbNVjhgeSrDCRmwIvKSe81LYOe+rbfTBF0g3YYWDwcwc8tFvcwWBxqWn
+4F+u9aIKgHU7HXQokqCxEOTFjrAHVJf1OqtRMTXlBBb6ypVdHn0glfSxOIC/Vp2T
+5UR7oVdD4E8ASqe7Q7MmTeY377CRagfd0WD9XK7o+cbKkLLW1QWc8ht1rHjGp+/2
+gmkxEmpX2Xhpv1FX/b6sj1dTmOc2bXBzpvV6yonRMu5dYsOrdDwbH/T05X+hCFW9
+G86ZLFY=
+-----END CERTIFICATE-----
--- /dev/null
+#!/bin/sh /etc/rc.common
+
+USE_PROCD=1
+START=95
+
+BIN=/usr/bin/wifidog-ng
+
+start_service() {
+ modprobe wifidog-ng
+
+ procd_open_instance
+ procd_set_param command $BIN
+ procd_set_param respawn
+ procd_close_instance
+}
+
+stop_service() {
+ rmmod wifidog-ng
+}
--- /d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