From a8eeaf768e2f1e79985827dd5d4d409e93767123 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Fri, 21 May 2021 13:47:14 +0200 Subject: [PATCH] ucentral: development update * update schema * update openNDS * mac80211 fix Signed-off-by: John Crispin --- feeds/ucentral/opennds/Makefile | 16 +-- .../opennds/patches/100-config-reload.patch | 16 --- .../opennds/patches/100-reload-config.patch | 17 +++ .../files/etc/ucentral/captive.json | 122 ++++++++++++++++++ .../files/etc/ucentral/default.json | 22 +--- .../etc/uci-defaults/99-ucentral-network | 1 + .../etc/uci-defaults/99-ucentral-opennds | 2 +- feeds/ucentral/ucentral-schema/Makefile | 2 +- .../files/lib/netifd/wireless/mac80211.sh | 94 +------------- 9 files changed, 154 insertions(+), 138 deletions(-) delete mode 100644 feeds/ucentral/opennds/patches/100-config-reload.patch create mode 100644 feeds/ucentral/opennds/patches/100-reload-config.patch create mode 100644 feeds/ucentral/ucentral-defaults/files/etc/ucentral/captive.json diff --git a/feeds/ucentral/opennds/Makefile b/feeds/ucentral/opennds/Makefile index d9ee170fb..c07b9888d 100644 --- a/feeds/ucentral/opennds/Makefile +++ b/feeds/ucentral/opennds/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=opennds PKG_FIXUP:=autoreconf -PKG_VERSION:=8.1.1 +PKG_VERSION:=9.0.0 PKG_RELEASE:=1 PKG_SOURCE_URL:=https://codeload.github.com/opennds/opennds/tar.gz/v$(PKG_VERSION)? PKG_SOURCE:=opennds-$(PKG_VERSION).tar.gz -PKG_HASH:=9e0ede334755dc95a4133a94304f4294b956d4849c48c5521f12b4ed295e356f +PKG_HASH:=466dbd78a9464d56f6bf8c8374071e4c21854700a8176a47e72e23930e4271b2 PKG_BUILD_DIR:=$(BUILD_DIR)/openNDS-$(PKG_VERSION) PKG_MAINTAINER:=Rob White @@ -21,7 +21,6 @@ PKG_LICENSE:=GPL-2.0+ include $(INCLUDE_DIR)/package.mk - define Package/opennds SUBMENU:=Captive Portals SECTION:=net @@ -42,26 +41,27 @@ define Package/opennds/description endef define Package/opennds/install - $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_BIN) $(PKG_BUILD_DIR)/opennds $(1)/usr/bin/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/ndsctl $(1)/usr/bin/ - $(INSTALL_DIR) $(1)/etc/opennds/htdocs/images $(INSTALL_DIR) $(1)/etc/config $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_DIR) $(1)/etc/uci-defaults $(INSTALL_DIR) $(1)/usr/lib/opennds - $(CP) $(PKG_BUILD_DIR)/resources/splash.html $(1)/etc/opennds/htdocs/ $(CP) $(PKG_BUILD_DIR)/resources/splash.css $(1)/etc/opennds/htdocs/ - $(CP) $(PKG_BUILD_DIR)/resources/status.html $(1)/etc/opennds/htdocs/ $(CP) $(PKG_BUILD_DIR)/resources/splash.jpg $(1)/etc/opennds/htdocs/images/ $(CP) $(PKG_BUILD_DIR)/linux_openwrt/opennds/files/etc/config/opennds $(1)/etc/config/ + $(CP) $(PKG_BUILD_DIR)/linux_openwrt/opennds/files/etc/config/opennds $(1)/etc/opennds/config.uci $(CP) $(PKG_BUILD_DIR)/linux_openwrt/opennds/files/etc/init.d/opennds $(1)/etc/init.d/ $(CP) $(PKG_BUILD_DIR)/linux_openwrt/opennds/files/etc/uci-defaults/40_opennds $(1)/etc/uci-defaults/ $(CP) $(PKG_BUILD_DIR)/linux_openwrt/opennds/files/usr/lib/opennds/restart.sh $(1)/usr/lib/opennds/ $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/binauth/binauth_log.sh $(1)/usr/lib/opennds/ - $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/PreAuth/login.sh $(1)/usr/lib/opennds/ + $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/libopennds.sh $(1)/usr/lib/opennds/ + $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/PreAuth/theme_click-to-continue-basic.sh $(1)/usr/lib/opennds/ + $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/PreAuth/theme_click-to-continue-custom-placeholders.sh $(1)/usr/lib/opennds/ + $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/PreAuth/theme_user-email-login-basic.sh $(1)/usr/lib/opennds/ + $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/PreAuth/theme_user-email-login-custom-placeholders.sh $(1)/usr/lib/opennds/ $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/get_client_interface.sh $(1)/usr/lib/opennds/ $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/get_client_token.sh $(1)/usr/lib/opennds/ $(CP) $(PKG_BUILD_DIR)/forward_authentication_service/libs/client_params.sh $(1)/usr/lib/opennds/ diff --git a/feeds/ucentral/opennds/patches/100-config-reload.patch b/feeds/ucentral/opennds/patches/100-config-reload.patch deleted file mode 100644 index ba099e985..000000000 --- a/feeds/ucentral/opennds/patches/100-config-reload.patch +++ /dev/null @@ -1,16 +0,0 @@ -Index: openNDS-8.1.1/linux_openwrt/opennds/files/etc/init.d/opennds -=================================================================== ---- openNDS-8.1.1.orig/linux_openwrt/opennds/files/etc/init.d/opennds -+++ openNDS-8.1.1/linux_openwrt/opennds/files/etc/init.d/opennds -@@ -183,6 +183,11 @@ start_service() { - config_foreach create_instance opennds - } - -+service_triggers() -+{ -+ procd_add_reload_trigger "opennds" -+} -+ - stop_service() { - # When procd terminates opennds, it does not exit fast enough. - # Otherwise procd will restart opennds twice. First time starting diff --git a/feeds/ucentral/opennds/patches/100-reload-config.patch b/feeds/ucentral/opennds/patches/100-reload-config.patch new file mode 100644 index 000000000..e7056574e --- /dev/null +++ b/feeds/ucentral/opennds/patches/100-reload-config.patch @@ -0,0 +1,17 @@ +Index: openNDS-9.0.0/linux_openwrt/opennds/files/etc/init.d/opennds +=================================================================== +--- openNDS-9.0.0.orig/linux_openwrt/opennds/files/etc/init.d/opennds ++++ openNDS-9.0.0/linux_openwrt/opennds/files/etc/init.d/opennds +@@ -182,3 +182,12 @@ stop_service() { + # opennds fails, second time it succeeds. + sleep 1 + } ++ ++reload_service() { ++ restart ++} ++ ++service_triggers() ++{ ++ procd_add_reload_trigger "opennds" ++} diff --git a/feeds/ucentral/ucentral-defaults/files/etc/ucentral/captive.json b/feeds/ucentral/ucentral-defaults/files/etc/ucentral/captive.json new file mode 100644 index 000000000..b5af5ee0e --- /dev/null +++ b/feeds/ucentral/ucentral-defaults/files/etc/ucentral/captive.json @@ -0,0 +1,122 @@ +{ + "uuid": 1, + "radios": [ + { + "band": "6G", + "country": "CA", + "channel-mode": "HE", + "channel-width": 80 + }, + { + "band": "5G", + "country": "CA", + "channel-mode": "HE", + "channel-width": 80 + }, + { + "band": "2G", + "country": "CA", + "channel-mode": "HE", + "channel-width": 80 + } + ], + + "interfaces": [ + { + "name": "WAN", + "role": "upstream", + "ethernet": [ + { + "select-ports": [ + "WAN*" + ] + } + ], + "ipv4": { + "addressing": "dynamic" + }, + "ssids": [ + { + "name": "OpenWifi", + "wifi-bands": [ + "5G", + "2G" + ], + "bss-mode": "ap", + "encryption": { + "proto": "psk2", + "key": "OpenWifi", + "ieee80211w": "optional" + }, + "roaming": { + "message-exchange": "ds", + "generate-psk": true + } + } + ] + }, + { + "name": "LAN", + "role": "downstream", + "ethernet": [ + { + "select-ports": [ + "LAN*" + ] + } + ], + "ipv4": { + "addressing": "static", + "subnet": "192.168.1.1/24", + "dhcp": { + "lease-first": 10, + "lease-count": 100, + "lease-time": "6h" + } + } + }, + { + "name": "captive", + "role": "downstream", + "captive": { + "max-clients": 32 + }, + "ipv4": { + "addressing": "static", + "subnet": "192.168.2.1/24", + "dhcp": { + "lease-first": 10, + "lease-count": 100, + "lease-time": "6h" + } + }, + "ssids": [ + { + "name": "Maverick", + "wifi-bands": [ + "5G", + "2G" + ], + "bss-mode": "ap", + "encryption": { + "proto": "none", + "ieee80211w": "optional" + }, + "roaming": { + "message-exchange": "ds", + "generate-psk": true + } + } + ] + } + ], + "metrics": { + "statistics": { + "interval": 120, + "types": [ "ssids", "lldp", "clients" ] + }, + "health": { + "interval": 120 + } + } +} diff --git a/feeds/ucentral/ucentral-defaults/files/etc/ucentral/default.json b/feeds/ucentral/ucentral-defaults/files/etc/ucentral/default.json index 46b35ad23..8b414e823 100644 --- a/feeds/ucentral/ucentral-defaults/files/etc/ucentral/default.json +++ b/feeds/ucentral/ucentral-defaults/files/etc/ucentral/default.json @@ -1,23 +1,12 @@ { "uuid": 1, "radios": [ - { - "band": "6G", - "country": "CA", - "channel-mode": "HE", - "channel-width": 80 - }, { "band": "5G", "country": "CA", "channel-mode": "HE", - "channel-width": 80 - }, - { - "band": "2G", - "country": "CA", - "channel-mode": "HE", - "channel-width": 80 + "channel-width": 80, + "channel": 32 } ], @@ -39,18 +28,13 @@ { "name": "OpenWifi", "wifi-bands": [ - "5G", - "2G" + "5G" ], "bss-mode": "ap", "encryption": { "proto": "psk2", "key": "OpenWifi", "ieee80211w": "optional" - }, - "roaming": { - "message-exchange": "ds", - "generate-psk": true } } ] diff --git a/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-network b/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-network index bfc7259b7..9509e061e 100755 --- a/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-network +++ b/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-network @@ -15,6 +15,7 @@ config_load dhcp config_foreach section_del dhcp dhcp config_load firewall +config_foreach section_del rule firewall config_foreach section_del zone firewall config_foreach section_del forwarding firewall diff --git a/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-opennds b/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-opennds index 282e8fdd3..f41b3b889 100755 --- a/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-opennds +++ b/feeds/ucentral/ucentral-defaults/files/etc/uci-defaults/99-ucentral-opennds @@ -1,3 +1,3 @@ #!/bin/sh -uci set opennds.@opennds[-1].enabled=0 +uci delete opennds.@opennds[-1] diff --git a/feeds/ucentral/ucentral-schema/Makefile b/feeds/ucentral/ucentral-schema/Makefile index 016b4b899..b9c455f41 100644 --- a/feeds/ucentral/ucentral-schema/Makefile +++ b/feeds/ucentral/ucentral-schema/Makefile @@ -6,7 +6,7 @@ PKG_RELEASE:=1 PKG_SOURCE_URL=https://github.com/blogic/ucentral-schema.git PKG_SOURCE_PROTO:=git PKG_SOURCE_DATE:=2021-02-15 -PKG_SOURCE_VERSION:=72978e949b093fbef1d38e01738afd764a227887 +PKG_SOURCE_VERSION:=fd626c67dba508d6f2d6735ac2d0e8fc1ae8bbe8 PKG_MAINTAINER:=John Crispin PKG_LICENSE:=BSD-3-Clause diff --git a/feeds/wifi-ax/mac80211/files/lib/netifd/wireless/mac80211.sh b/feeds/wifi-ax/mac80211/files/lib/netifd/wireless/mac80211.sh index 52122a8ca..edd36b273 100644 --- a/feeds/wifi-ax/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/feeds/wifi-ax/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -118,63 +118,6 @@ mac80211_add_he_capabilities() { IFS="$oifs" } -mac80211_get_seg0() { - local ht_mode="$1" - local seg0=0 - - case "$ht_mode" in - 40) - if [ $freq -gt 5950 ] && [ $freq -le 7115 ]; then - case "$(( ($channel / 4) % 2 ))" in - 1) seg0=$(($channel - 2));; - 0) seg0=$(($channel + 2));; - esac - elif [ $freq != 5935 ]; then - case "$(( ($channel / 4) % 2 ))" in - 1) seg0=$(($channel + 2));; - 0) seg0=$(($channel - 2));; - esac - fi - ;; - 80) - if [ $freq -gt 5950 ] && [ $freq -le 7115 ]; then - case "$(( ($channel / 4) % 4 ))" in - 0) seg0=$(($channel + 6));; - 1) seg0=$(($channel + 2));; - 2) seg0=$(($channel - 2));; - 3) seg0=$(($channel - 6));; - esac - elif [ $freq != 5935 ]; then - case "$(( ($channel / 4) % 4 ))" in - 1) seg0=$(($channel + 6));; - 2) seg0=$(($channel + 2));; - 3) seg0=$(($channel - 2));; - 0) seg0=$(($channel - 6));; - esac - fi - ;; - 160) - if [ $freq -gt 5950 ] && [ $freq -le 7115 ]; then - case "$channel" in - 1|5|9|13|17|21|25|29) seg0=15;; - 33|37|41|45|49|53|57|61) seg0=47;; - 65|69|73|77|81|85|89|93) seg0=79;; - 97|101|105|109|113|117|121|125) seg0=111;; - 129|133|137|141|145|149|153|157) seg0=143;; - 161|165|169|173|177|181|185|189) seg0=175;; - 193|197|201|205|209|213|217|221) seg0=207;; - esac - elif [ $freq != 5935 ]; then - case "$channel" in - 36|40|44|48|52|56|60|64) seg0=50;; - 100|104|108|112|116|120|124|128) seg0=114;; - esac - fi - ;; - esac - printf "$seg0" -} - mac80211_hostapd_setup_base() { local phy="$1" @@ -422,43 +365,8 @@ mac80211_hostapd_setup_base() { # 802.11ax enable_ax=0 case "$htmode" in - HE20) enable_ax=1 - if [ $freq -gt 5950 ] && [ $freq -le 7115 ]; then - append base_cfg "op_class=131" "$N" - fi - ;; - HE40) + HE20|HE40|HE80| HE160) enable_ax=1 - idx="$(mac80211_get_seg0 "40")" - if [ $freq -ge 5180 ] && [ $freq != 5935 ]; then - if [ $freq -gt 5950 ] && [ $freq -le 7115 ]; then - append base_cfg "op_class=132" "$N" - fi - append base_cfg "he_oper_chwidth=0" "$N" - append base_cfg "he_oper_centr_freq_seg0_idx=$idx" "$N" - fi - ;; - HE80) - enable_ax=1 - idx="$(mac80211_get_seg0 "80")" - if [ $freq != 5935 ]; then - if [ $freq -gt 5950 ] && [ $freq -le 7115 ]; then - append base_cfg "op_class=133" "$N" - fi - append base_cfg "he_oper_chwidth=1" "$N" - append base_cfg "he_oper_centr_freq_seg0_idx=$idx" "$N" - fi - ;; - HE160) - enable_ax=1 - idx="$(mac80211_get_seg0 "160")" - if [ $freq != 5935 ]; then - if [ $freq -gt 5950 ] && [ $freq -le 7115 ]; then - append base_cfg "op_class=134" "$N" - fi - append base_cfg "he_oper_chwidth=2" "$N" - append base_cfg "he_oper_centr_freq_seg0_idx=$idx" "$N" - fi ;; esac