From 028c1de03a88dec15855132a8bb581a3a4399944 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 26 Jun 2021 20:38:44 +0200 Subject: [PATCH 01/86] docs: add .readthedocs.yml to set Python version and requirements.txt --- .readthedocs.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .readthedocs.yml diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 00000000..81f82c55 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,16 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + +# Optionally set the version of Python and requirements required to build your docs +python: + version: 3.8 + install: + - requirements: docs/requirements.txt From 32ae071954b0f1b595f931b6b8ba1953f2b17dc2 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 26 Jun 2021 20:39:31 +0200 Subject: [PATCH 02/86] docs: pin theme version rtd.io uses a severely outdated theme version with several known bugs by default. Pin to a never version to get the bugfixes. --- docs/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 6c5d5d44..f85be1ff 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1 +1 @@ -sphinx-rtd-theme +sphinx-rtd-theme==0.5.2 From 65c9d05d54a945f4a199a94d0d54d57f038c80f3 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 26 Jun 2021 20:40:43 +0200 Subject: [PATCH 03/86] docs: drop obselete theme fixes --- docs/_static/css/custom.css | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/docs/_static/css/custom.css b/docs/_static/css/custom.css index 38458950..b4fd2586 100644 --- a/docs/_static/css/custom.css +++ b/docs/_static/css/custom.css @@ -8,38 +8,3 @@ .rst-content div[class^='highlight'] pre { overflow: visible; } - - -/* - This fixes the bottom margin of paragraphs inside lists, where margins inside - a single list item would incorrectly be displayed larger than margins between - the list items. - - Upstream fix (not fixed on readthedocs.io yet): - https://github.com/readthedocs/sphinx_rtd_theme/commit/ac20ce75d426efeb40fe2af1f89ea9bad285a45b -*/ -.rst-content .section ol li > p, -.rst-content .section ol li > p:last-child, -.rst-content .section ul li > p, -.rst-content .section ul li > p:last-child { - margin-bottom: 12px; -} -.rst-content .section ol li > p:only-child, -.rst-content .section ol li > p:only-child:last-child, -.rst-content .section ul li > p:only-child, -.rst-content .section ul li > p:only-child:last-child { - margin-bottom: 0rem; -} - -/* - This fixes the bottom margin of nested lists - - Based on upstream fix (not on readthedocs.io yet): - https://github.com/readthedocs/sphinx_rtd_theme/commit/6f0de13baff93f25204aa2cdf0308aae47d71312 -*/ -.rst-content .section ul li > ul, -.rst-content .section ul li > ol, -.rst-content .section ol li > ul, -.rst-content .section ol li > ol { - margin-bottom: 12px; -} From 3386221ef113241d3ecfd57b50253c89e61bd12f Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 11 Jul 2021 22:38:20 +0200 Subject: [PATCH 04/86] gluon.mk: fix indentation A leading tab character usually marks recipe lines in Makefiles; non-recipe lines must be indented using spaces. The incorrect tab character doesn't seen to have caused any issues in this case, but it should be fixed nonetheless, if only for consistency. --- package/gluon.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon.mk b/package/gluon.mk index 0139544e..5a794476 100644 --- a/package/gluon.mk +++ b/package/gluon.mk @@ -4,7 +4,7 @@ PKG_FILE_DEPENDS += $(GLUON_MK) PKG_BUILD_DEPENDS += luasrcdiet/host ifneq ($(wildcard ./luasrc/.),) - PKG_CONFIG_DEPENDS += CONFIG_GLUON_MINIFY + PKG_CONFIG_DEPENDS += CONFIG_GLUON_MINIFY endif ifneq ($(wildcard ./src/respondd.c),) From eb3fad4bae30ff0c7912d94ffd3c7704cb0bdfe6 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 13 Jun 2021 00:05:56 +0200 Subject: [PATCH 05/86] build: move check_site.lua main script into gluon-core package Installing the script into the image allows site checks to run for manual package installations via opkg. --- .../gluon-core/luasrc/lib/gluon/check-site.lua | 0 package/gluon.mk | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename scripts/check_site.lua => package/gluon-core/luasrc/lib/gluon/check-site.lua (100%) diff --git a/scripts/check_site.lua b/package/gluon-core/luasrc/lib/gluon/check-site.lua similarity index 100% rename from scripts/check_site.lua rename to package/gluon-core/luasrc/lib/gluon/check-site.lua diff --git a/package/gluon.mk b/package/gluon.mk index 5a794476..199ef863 100644 --- a/package/gluon.mk +++ b/package/gluon.mk @@ -21,7 +21,7 @@ shell-verbatim = $(call shell-unescape,$(call shell-escape,$(1))) define GluonCheckSite -[ -z "$$IPKG_INSTROOT" ] || "${TOPDIR}/staging_dir/hostpkg/bin/lua" "${TOPDIR}/../scripts/check_site.lua" <<'END__GLUON__CHECK__SITE' +[ -z "$$IPKG_INSTROOT" ] || "${TOPDIR}/staging_dir/hostpkg/bin/lua" "$$IPKG_INSTROOT/lib/gluon/check-site.lua" <<'END__GLUON__CHECK__SITE' $(call shell-verbatim,cat '$(1)') END__GLUON__CHECK__SITE endef From 298723c22b0f898ce348d7b2617186f09b0d2534 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 13 Jun 2021 00:55:40 +0200 Subject: [PATCH 06/86] gluon-core: gluon-check-site: do not fail when IPKG_INSTROOT is unset --- package/gluon-core/luasrc/lib/gluon/check-site.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/gluon-core/luasrc/lib/gluon/check-site.lua b/package/gluon-core/luasrc/lib/gluon/check-site.lua index 43765f80..6861d8cb 100644 --- a/package/gluon-core/luasrc/lib/gluon/check-site.lua +++ b/package/gluon-core/luasrc/lib/gluon/check-site.lua @@ -360,7 +360,7 @@ end function M.need_domain_name(path) M.need_string(path) M.need(path, function(domain_name) - local f = io.open(os.getenv('IPKG_INSTROOT') .. '/lib/gluon/domains/' .. domain_name .. '.json') + local f = io.open((os.getenv('IPKG_INSTROOT') or '') .. '/lib/gluon/domains/' .. domain_name .. '.json') if not f then return false end f:close() return true @@ -383,7 +383,7 @@ end local check = setfenv(assert(loadfile()), M) -site = assert(json.load(os.getenv('IPKG_INSTROOT') .. '/lib/gluon/site.json')) +site = assert(json.load((os.getenv('IPKG_INSTROOT') or '') .. '/lib/gluon/site.json')) local ok, err = pcall(function() if has_domains then From 3a2d176df8973e6647bcea805612f13a801108eb Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 13 Jun 2021 00:43:02 +0200 Subject: [PATCH 07/86] build: run site checks for manual package installations --- package/gluon.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/gluon.mk b/package/gluon.mk index 199ef863..a2aab619 100644 --- a/package/gluon.mk +++ b/package/gluon.mk @@ -21,7 +21,8 @@ shell-verbatim = $(call shell-unescape,$(call shell-escape,$(1))) define GluonCheckSite -[ -z "$$IPKG_INSTROOT" ] || "${TOPDIR}/staging_dir/hostpkg/bin/lua" "$$IPKG_INSTROOT/lib/gluon/check-site.lua" <<'END__GLUON__CHECK__SITE' +[ -z "$$STAGING_DIR_HOSTPKG" ] || PATH="$$STAGING_DIR_HOSTPKG/bin:$$PATH" +lua "$$IPKG_INSTROOT/lib/gluon/check-site.lua" <<'END__GLUON__CHECK__SITE' $(call shell-verbatim,cat '$(1)') END__GLUON__CHECK__SITE endef From 76185e3a2a28936afb97afe0e3090fa655340565 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Mon, 12 Jul 2021 19:23:29 +0200 Subject: [PATCH 08/86] gluon-status-page: relax nodeinfo query timeout (#2262) It was found that a one second timeout for nodeinfo data may be too low, so that when a node is otherwise occupied that timeout may be reached too often. The nodeinfo query response is also vital to the status-page base template, so that when it times out, the site will be turned in a broken state, that it cannot recover from. Fixes: #2256 --- .../luasrc/lib/gluon/status-page/controller/status-page.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-status-page/luasrc/lib/gluon/status-page/controller/status-page.lua b/package/gluon-status-page/luasrc/lib/gluon/status-page/controller/status-page.lua index ceb5d855..80c5e50a 100644 --- a/package/gluon-status-page/luasrc/lib/gluon/status-page/controller/status-page.lua +++ b/package/gluon-status-page/luasrc/lib/gluon/status-page/controller/status-page.lua @@ -61,7 +61,7 @@ local function match(a, b, n) end entry({}, call(function(http, renderer) - local nodeinfo = json.parse(util.exec('exec gluon-neighbour-info -d ::1 -p 1001 -t 1 -c 1 -r nodeinfo')) + local nodeinfo = json.parse(util.exec('exec gluon-neighbour-info -d ::1 -p 1001 -t 3 -c 1 -r nodeinfo')) local node_ip = parse_ip(http:getenv('SERVER_ADDR')) if node_ip and ( From 6ff19a495f73ddb892ff683990a3dd354215999c Mon Sep 17 00:00:00 2001 From: David Bauer Date: Tue, 13 Jul 2021 01:00:16 +0200 Subject: [PATCH 09/86] modules: update OpenWrt 38cdc57be6 mediatek: add missing config symbols 6073d2c02a generic: add missing config symbols 8921e36ed8 iwinfo: move device info into -data package d3278c4343 build: ensure that dash isn't prepended twice to abi version suffix 47f617ef8d build: prepend ABI suffixes with a dash if package name ends with digit febf6db0d0 ath79: add missing MTD_NAND_RB91X symbol 983fcc42a4 ath79: add missing GPIO_LATCH symbol 0ad49d368b ath79: mikrotik: fix beeper phantom noise on RB912 ffa943f0b9 ath79: ar934x: fix mounting issues if subpage is not supported 88e1c9b0b5 ath79: add support for MikroTik RouterBOARD 912UAG-2HPnD bd2e070557 ath79: add NAND driver for MikroTik RB91xG series 43723e6db9 ath79: add gpio-latch driver for MikroTik RouterBOARDs 3eb34bc251 hostapd: make wnm_sleep_mode_no_keys configurable 89d21b7f62 hostapd: make country3 option configurable 72f0733123 ltq-deu: Mark lantiq DEU broken b0424190ef iwinfo: build with nl80211 backend only and make shared d723002d84 treewide: unmark selected packages nonshared 86f6171788 ath10k-ct: fix typo in Makefile 24cfa5005e ath10k-ct: update to latest version 69c10497c7 kernel/modules: move act_gact into kmod-sched-core fc4b5411b3 package/comgt: Handle bind/unbind events Signed-off-by: David Bauer --- modules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules b/modules index 07814d3f..80d14960 100644 --- a/modules +++ b/modules @@ -2,7 +2,7 @@ GLUON_FEEDS='packages routing gluon' OPENWRT_REPO=https://github.com/openwrt/openwrt.git OPENWRT_BRANCH=openwrt-21.02 -OPENWRT_COMMIT=d666ebcaa327a1e03992a484d9601ea5f2e6b19a +OPENWRT_COMMIT=38cdc57be6350f4890510c9cece535d340c6a3a6 PACKAGES_PACKAGES_REPO=https://github.com/openwrt/packages.git PACKAGES_PACKAGES_BRANCH=openwrt-21.02 From 09c9b78e30edf9c83a870ea38dbe6168c27e7670 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 11 Jul 2021 22:23:50 +0200 Subject: [PATCH 10/86] ramips-rt305x: drop target VoCores aren't exactly useful mesh nodes except for experimentation. They certainly aren't worth maintaining a whole target, in particular one that has a WLAN driver not used by any other target. --- .github/workflows/build-gluon.yml | 2 +- docs/user/supported_devices.rst | 11 ----------- .../luasrc/usr/lib/lua/gluon/platform.lua | 5 ----- targets/ramips-rt305x | 18 ------------------ targets/targets.mk | 1 - 5 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 targets/ramips-rt305x diff --git a/.github/workflows/build-gluon.yml b/.github/workflows/build-gluon.yml index 904612b6..944870aa 100644 --- a/.github/workflows/build-gluon.yml +++ b/.github/workflows/build-gluon.yml @@ -32,7 +32,7 @@ jobs: strategy: fail-fast: false matrix: - target: [ath79-generic, ath79-nand, bcm27xx-bcm2708, bcm27xx-bcm2709, ipq40xx-generic, ipq806x-generic, lantiq-xrx200, lantiq-xway, mediatek-mt7622, mpc85xx-p1010, mpc85xx-p1020, ramips-mt7620, ramips-mt7621, ramips-mt76x8, ramips-rt305x, rockchip-armv8, sunxi-cortexa7, x86-generic, x86-geode, x86-legacy, x86-64, bcm27xx-bcm2710, mvebu-cortexa9] + target: [ath79-generic, ath79-nand, bcm27xx-bcm2708, bcm27xx-bcm2709, ipq40xx-generic, ipq806x-generic, lantiq-xrx200, lantiq-xway, mediatek-mt7622, mpc85xx-p1010, mpc85xx-p1020, ramips-mt7620, ramips-mt7621, ramips-mt76x8, rockchip-armv8, sunxi-cortexa7, x86-generic, x86-geode, x86-legacy, x86-64, bcm27xx-bcm2710, mvebu-cortexa9] runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 diff --git a/docs/user/supported_devices.rst b/docs/user/supported_devices.rst index b26fc4e3..0020c532 100644 --- a/docs/user/supported_devices.rst +++ b/docs/user/supported_devices.rst @@ -250,13 +250,6 @@ ramips-mt76x8 - Xiaomi Mi Router 4A (100M Edition) - Xiaomi Mi Router 4C -ramips-rt305x [#deprecated]_ [#device-class-tiny]_ ---------------------------------------------------- - -* VoCore - - - VoCore (8M, 16M) - rockchip-armv8 -------------- @@ -299,10 +292,6 @@ See also: :doc:`x86` Footnotes --------- -.. [#deprecated] - The device or target is reaching its end of life soon. This means that support - in the next major release of Gluon is doubtful. - .. [#device-class-tiny] These devices only support a subset of Gluons capabilities due to flash or memory size constraints. Devices are classified as tiny in they provide less than 7M of usable diff --git a/package/gluon-core/luasrc/usr/lib/lua/gluon/platform.lua b/package/gluon-core/luasrc/usr/lib/lua/gluon/platform.lua index 5bfe534e..24bb9cd6 100644 --- a/package/gluon-core/luasrc/usr/lib/lua/gluon/platform.lua +++ b/package/gluon-core/luasrc/usr/lib/lua/gluon/platform.lua @@ -44,11 +44,6 @@ function M.is_outdoor_device() end function M.device_supports_wpa3() - -- rt2x00 crashes when enabling WPA3 personal / OWE VAP - if M.match('ramips', 'rt305x') then - return false - end - return unistd.access('/lib/gluon/features/wpa3') end diff --git a/targets/ramips-rt305x b/targets/ramips-rt305x deleted file mode 100644 index f8be18c7..00000000 --- a/targets/ramips-rt305x +++ /dev/null @@ -1,18 +0,0 @@ -config('KERNEL_KALLSYMS', false) -config('GLUON_SPECIALIZE_KERNEL', true) - -no_opkg() - -defaults { - class = 'tiny', -- 32M RAM -} - --- VoCore - -device('vocore-8M', 'vocore_vocore-8m', { - factory = false, -}) - -device('vocore-16M', 'vocore_vocore-16m', { - factory = false, -}) diff --git a/targets/targets.mk b/targets/targets.mk index 67e87fa2..92b58ab8 100644 --- a/targets/targets.mk +++ b/targets/targets.mk @@ -12,7 +12,6 @@ $(eval $(call GluonTarget,mpc85xx,p1020)) $(eval $(call GluonTarget,ramips,mt7620)) $(eval $(call GluonTarget,ramips,mt7621)) $(eval $(call GluonTarget,ramips,mt76x8)) -$(eval $(call GluonTarget,ramips,rt305x)) $(eval $(call GluonTarget,rockchip,armv8)) $(eval $(call GluonTarget,sunxi,cortexa7)) $(eval $(call GluonTarget,x86,generic)) From c23bc293ef999649d5e8a3bf75f1fbd290d8c55a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 11 Jul 2021 22:45:47 +0200 Subject: [PATCH 11/86] treewide: remove GLUON_SPECIALIZE_KERNEL With the removal of ramips-rt305x, the last user of GLUON_SPECIALIZE_KERNEL is gone. --- package/gluon-client-bridge/Makefile | 2 +- package/gluon-core/Config.in | 360 ------------------- package/gluon-core/Makefile | 4 +- package/gluon-ebtables-limit-arp/Makefile | 5 +- package/gluon-ebtables/Makefile | 11 +- package/gluon-mesh-batman-adv/Makefile | 5 +- package/gluon-mesh-vpn-core/Makefile | 10 +- package/gluon-mesh-vpn-fastd/Makefile | 2 +- package/gluon-mesh-vpn-tunneldigger/Makefile | 2 +- 9 files changed, 10 insertions(+), 391 deletions(-) delete mode 100644 package/gluon-core/Config.in diff --git a/package/gluon-client-bridge/Makefile b/package/gluon-client-bridge/Makefile index a2daf34b..e65e4eef 100644 --- a/package/gluon-client-bridge/Makefile +++ b/package/gluon-client-bridge/Makefile @@ -7,7 +7,7 @@ include ../gluon.mk define Package/gluon-client-bridge TITLE:=Provides a bridge and a wireless interface for clients to connect to - DEPENDS:=+gluon-core +kmod-veth +@GLUON_SPECIALIZE_KERNEL:KERNEL_VETH + DEPENDS:=+gluon-core +kmod-veth endef $(eval $(call BuildPackageGluon,gluon-client-bridge)) diff --git a/package/gluon-core/Config.in b/package/gluon-core/Config.in deleted file mode 100644 index 6550ec7e..00000000 --- a/package/gluon-core/Config.in +++ /dev/null @@ -1,360 +0,0 @@ -config KERNEL_NET_IP_TUNNEL - bool - -config KERNEL_NET_UDP_TUNNEL - bool - -config KERNEL_VXLAN - bool - select KERNEL_NET_IP_TUNNEL - select KERNEL_NET_UDP_TUNNEL - -config KERNEL_VETH - bool - - -# for fastd - -config KERNEL_TUN - bool - - -# for tunneldigger - -config KERNEL_L2TP_V3 - bool - -config KERNEL_L2TP_ETH - bool - -config KERNEL_L2TP - bool - select KERNEL_L2TP_V3 - select KERNEL_L2TP_ETH - - -# for simple-tc - -config KERNEL_NET_SCHED - bool - -config KERNEL_NET_CLS - bool - select KERNEL_NET_SCHED - -config KERNEL_NET_CLS_ACT - bool - select KERNEL_NET_CLS - -config KERNEL_NET_ACT_POLICE - bool - select KERNEL_NET_CLS_ACT - -config KERNEL_NET_CLS_BASIC - bool - select KERNEL_NET_CLS - -config KERNEL_NET_SCH_TBF - bool - select KERNEL_NET_SCHED - -config KERNEL_NET_SCH_INGRESS - bool - select KERNEL_NET_CLS_ACT - - -# for batman-adv - -config KERNEL_DUMMY - bool - -config KERNEL_CRC16 - bool - -config KERNEL_LIBCRC32C - bool - - -# Netfilter modules used by ebtables and fw3 - -config KERNEL_NETFILTER - bool - -config KERNEL_NETFILTER_ADVANCED - bool - select KERNEL_NETFILTER - -config KERNEL_NETFILTER_XTABLES - bool - select KERNEL_NETFILTER_ADVANCED - -config KERNEL_BRIDGE_NF_EBTABLES - bool - select KERNEL_NETFILTER_XTABLES - -config KERNEL_BRIDGE_EBT_T_FILTER - bool - select KERNEL_BRIDGE_NF_EBTABLES - -config KERNEL_BRIDGE_EBT_T_NAT - bool - select KERNEL_BRIDGE_NF_EBTABLES - -config KERNEL_BRIDGE_EBT_ARP - bool - select KERNEL_BRIDGE_NF_EBTABLES - -config KERNEL_BRIDGE_EBT_DNAT - bool - select KERNEL_BRIDGE_NF_EBTABLES - -config KERNEL_BRIDGE_EBT_IP - bool - select KERNEL_BRIDGE_NF_EBTABLES - -config KERNEL_BRIDGE_EBT_IP6 - bool - select KERNEL_BRIDGE_NF_EBTABLES - -config KERNEL_BRIDGE_EBT_LIMIT - bool - select KERNEL_BRIDGE_NF_EBTABLES - -config KERNEL_BRIDGE_EBT_MARK - bool - select KERNEL_BRIDGE_NF_EBTABLES - -config KERNEL_BRIDGE_EBT_MARK_T - bool - select KERNEL_BRIDGE_NF_EBTABLES - -config KERNEL_BRIDGE_EBT_REDIRECT - bool - select KERNEL_BRIDGE_NF_EBTABLES - -# Not all of the following modules are really required for Gluon, but fw3 pulls -# them in, so we add them to the kernel config to reduce the number of loaded -# modules - -# kmod-nf-conntrack - -config KERNEL_NF_CONNTRACK - bool - select KERNEL_NETFILTER_ADVANCED - -config KERNEL_NF_CONNTRACK_RTCACHE - bool - select KERNEL_NF_CONNTRACK - -config KERNEL_NF_CONNTRACK_IPV4 - bool - select KERNEL_NF_CONNTRACK - - -# kmod-nf-conntrack6 - -config KERNEL_NF_CONNTRACK_IPV6 - bool - select KERNEL_NF_CONNTRACK - - -# kmod-nf-ipt - -config KERNEL_NF_REJECT_IPV4 - bool - select KERNEL_NETFILTER_ADVANCED - -config KERNEL_IP_NF_IPTABLES - bool - select KERNEL_NETFILTER_XTABLES - select KERNEL_NF_REJECT_IPV4 - - -# kmod-nf-ipt6 - -config KERNEL_NF_REJECT_IPV6 - bool - select KERNEL_NETFILTER_ADVANCED - -config KERNEL_IP6_NF_IPTABLES - bool - select KERNEL_NETFILTER_XTABLES - select KERNEL_NF_REJECT_IPV6 - - -# kmod-nf-nat - -config KERNEL_NF_NAT - bool - select KERNEL_NF_CONNTRACK - -config KERNEL_NF_NAT_REDIRECT - bool - select KERNEL_NF_NAT - -config KERNEL_NF_NAT_IPV4 - bool - select KERNEL_NETFILTER_ADVANCED - select KERNEL_NF_NAT - -config KERNEL_NF_NAT_MASQUERADE_IPV4 - bool - select KERNEL_NF_NAT_IPV4 - - -# kmod-ipt-core - -config KERNEL_IP_NF_FILTER - bool - select KERNEL_IP_NF_IPTABLES - -config KERNEL_IP_NF_MANGLE - bool - select KERNEL_IP_NF_IPTABLES - -config KERNEL_IP_NF_TARGET_REJECT - bool - select KERNEL_IP_NF_FILTER - -config KERNEL_NETFILTER_XT_MATCH_LIMIT - bool - select KERNEL_NETFILTER_XTABLES - -config KERNEL_NETFILTER_XT_MATCH_MAC - bool - select KERNEL_NETFILTER_XTABLES - -config KERNEL_NETFILTER_XT_MATCH_MULTIPORT - bool - select KERNEL_NETFILTER_XTABLES - -config KERNEL_NETFILTER_XT_MATCH_COMMENT - bool - select KERNEL_NETFILTER_XTABLES - -config KERNEL_NETFILTER_XT_MATCH_TIME - bool - select KERNEL_NETFILTER_XTABLES - -config KERNEL_NETFILTER_XT_MARK - bool - select KERNEL_NETFILTER_XTABLES - -config KERNEL_NETFILTER_XT_TARGET_LOG - bool - select KERNEL_NETFILTER_XTABLES - -config KERNEL_NETFILTER_XT_TARGET_TCPMSS - bool - select KERNEL_NETFILTER_XTABLES - -# kmod-ip6tables - -config KERNEL_IP6_NF_FILTER - bool - select KERNEL_IP6_NF_IPTABLES - -config KERNEL_IP6_NF_MANGLE - bool - select KERNEL_IP6_NF_IPTABLES - -config KERNEL_IP6_NF_TARGET_REJECT - bool - select KERNEL_IP6_NF_IPTABLES - - -# kmod-ipt-conntrack - -config KERNEL_NETFILTER_XT_MATCH_STATE - bool - select KERNEL_NETFILTER_XTABLES - select KERNEL_NF_CONNTRACK - -config KERNEL_NETFILTER_XT_MATCH_CONNTRACK - bool - select KERNEL_NETFILTER_XTABLES - select KERNEL_NF_CONNTRACK - -config KERNEL_IP_NF_RAW - bool - select KERNEL_IP_NF_IPTABLES - -config KERNEL_NETFILTER_XT_TARGET_CT - bool - select KERNEL_NETFILTER_XTABLES - select KERNEL_NF_CONNTRACK - select KERNEL_IP_NF_RAW - - -# kmod-ipt-nat - -config KERNEL_IP_NF_NAT - bool - select KERNEL_NF_NAT - select KERNEL_IP_NF_IPTABLES - -config KERNEL_IP_NF_TARGET_MASQUERADE - bool - select KERNEL_NF_NAT_MASQUERADE_IPV4 - select KERNEL_IP_NF_NAT - -config KERNEL_IP_NF_TARGET_REDIRECT - bool - select KERNEL_NF_NAT - select KERNEL_IP_NF_NAT - - -# kmod-ipt-extra - -config KERNEL_NETFILTER_XT_MATCH_ADDRTYPE - bool - select KERNEL_NETFILTER_XTABLES - -config KERNEL_NETFILTER_XT_MATCH_OWNER - bool - select KERNEL_NETFILTER_XTABLES - -config KERNEL_NETFILTER_XT_MATCH_PKTTYPE - bool - select KERNEL_NETFILTER_XTABLES - -config KERNEL_NETFILTER_XT_MATCH_QUOTA - bool - select KERNEL_NETFILTER_XTABLES - - -config GLUON_SPECIALIZE_KERNEL - bool "Specialize kernel for Gluon" - select KERNEL_VXLAN - select KERNEL_NF_CONNTRACK_RTCACHE - select KERNEL_NF_CONNTRACK_IPV4 - select KERNEL_NF_CONNTRACK_IPV6 - select KERNEL_IP_NF_IPTABLES - select KERNEL_IP6_NF_IPTABLES - select KERNEL_NF_NAT_REDIRECT - select KERNEL_NF_NAT_IPV4 - select KERNEL_NF_NAT_MASQUERADE_IPV4 - select KERNEL_IP_NF_FILTER - select KERNEL_IP_NF_MANGLE - select KERNEL_IP_NF_TARGET_REJECT - select KERNEL_IP6_NF_FILTER - select KERNEL_IP6_NF_MANGLE - select KERNEL_IP6_NF_TARGET_REJECT - select KERNEL_NETFILTER_XT_MATCH_LIMIT - select KERNEL_NETFILTER_XT_MATCH_MAC - select KERNEL_NETFILTER_XT_MATCH_MULTIPORT - select KERNEL_NETFILTER_XT_MATCH_COMMENT - select KERNEL_NETFILTER_XT_MATCH_TIME - select KERNEL_NETFILTER_XT_MARK - select KERNEL_NETFILTER_XT_TARGET_LOG - select KERNEL_NETFILTER_XT_TARGET_TCPMSS - select KERNEL_NETFILTER_XT_MATCH_STATE - select KERNEL_NETFILTER_XT_MATCH_CONNTRACK - select KERNEL_NETFILTER_XT_TARGET_CT - select KERNEL_IP_NF_NAT - select KERNEL_IP_NF_TARGET_MASQUERADE - select KERNEL_IP_NF_TARGET_REDIRECT - -config GLUON_MINIFY - bool "Minify Gluon scripts" - default y diff --git a/package/gluon-core/Makefile b/package/gluon-core/Makefile index 37aaa3f2..e8f69535 100644 --- a/package/gluon-core/Makefile +++ b/package/gluon-core/Makefile @@ -22,7 +22,9 @@ define Package/gluon-core/description endef define Package/gluon-core/config - source "$(SOURCE)/Config.in" +config GLUON_MINIFY + bool "Minify Gluon scripts" + default y endef define Package/gluon-core/install diff --git a/package/gluon-ebtables-limit-arp/Makefile b/package/gluon-ebtables-limit-arp/Makefile index f7bdc48d..852900ef 100644 --- a/package/gluon-ebtables-limit-arp/Makefile +++ b/package/gluon-ebtables-limit-arp/Makefile @@ -8,10 +8,7 @@ include ../gluon.mk define Package/gluon-ebtables-limit-arp TITLE:=Ebtables limiter for ARP packets - DEPENDS:=+gluon-core +gluon-ebtables gluon-mesh-batman-adv \ - +@GLUON_SPECIALIZE_KERNEL:KERNEL_BRIDGE_EBT_LIMIT \ - +@GLUON_SPECIALIZE_KERNEL:KERNEL_BRIDGE_EBT_MARK \ - +@GLUON_SPECIALIZE_KERNEL:KERNEL_BRIDGE_EBT_MARK_T + DEPENDS:=+gluon-core +gluon-ebtables gluon-mesh-batman-adv endef define Package/gluon-ebtables-limit-arp/description diff --git a/package/gluon-ebtables/Makefile b/package/gluon-ebtables/Makefile index ca83fcf4..e15cfe59 100644 --- a/package/gluon-ebtables/Makefile +++ b/package/gluon-ebtables/Makefile @@ -4,21 +4,12 @@ PKG_NAME:=gluon-ebtables PKG_VERSION:=1 PKG_RELEASE:=1 -PKG_CONFIG_DEPENDS := CONFIG_GLUON_SPECIALIZE_KERNEL - include ../gluon.mk define Package/gluon-ebtables TITLE:=Ebtables support DEPENDS:=+gluon-core +ebtables-tiny \ - +@GLUON_SPECIALIZE_KERNEL:KERNEL_BRIDGE_EBT_T_FILTER \ - +@GLUON_SPECIALIZE_KERNEL:KERNEL_BRIDGE_EBT_T_NAT \ - +@GLUON_SPECIALIZE_KERNEL:KERNEL_BRIDGE_EBT_ARP \ - +@GLUON_SPECIALIZE_KERNEL:KERNEL_BRIDGE_EBT_IP \ - +@GLUON_SPECIALIZE_KERNEL:KERNEL_BRIDGE_EBT_IP6 \ - +!GLUON_SPECIALIZE_KERNEL:kmod-ebtables \ - +!GLUON_SPECIALIZE_KERNEL:kmod-ebtables-ipv4 \ - +!GLUON_SPECIALIZE_KERNEL:kmod-ebtables-ipv6 + +kmod-ebtables +kmod-ebtables-ipv4 +kmod-ebtables-ipv6 endef define Package/gluon-ebtables/description diff --git a/package/gluon-mesh-batman-adv/Makefile b/package/gluon-mesh-batman-adv/Makefile index eac84ac5..1d124584 100644 --- a/package/gluon-mesh-batman-adv/Makefile +++ b/package/gluon-mesh-batman-adv/Makefile @@ -19,10 +19,7 @@ define Package/gluon-mesh-batman-adv-15 +kmod-dummy \ +libnl-tiny \ +libbatadv \ - +batctl \ - +@GLUON_SPECIALIZE_KERNEL:KERNEL_DUMMY \ - +@GLUON_SPECIALIZE_KERNEL:KERNEL_CRC16 \ - +@GLUON_SPECIALIZE_KERNEL:KERNEL_LIBCRC32C + +batctl endef $(eval $(call BuildPackageGluon,gluon-mesh-batman-adv-15)) diff --git a/package/gluon-mesh-vpn-core/Makefile b/package/gluon-mesh-vpn-core/Makefile index 1acf17ca..4e4c23c4 100644 --- a/package/gluon-mesh-vpn-core/Makefile +++ b/package/gluon-mesh-vpn-core/Makefile @@ -7,15 +7,7 @@ include ../gluon.mk define Package/gluon-mesh-vpn-core TITLE:=Basic support for connecting meshes via VPN tunnels - DEPENDS:=+gluon-core +gluon-wan-dnsmasq +iptables +iptables-mod-extra +simple-tc \ - +@GLUON_SPECIALIZE_KERNEL:KERNEL_NETFILTER_XT_MATCH_ADDRTYPE \ - +@GLUON_SPECIALIZE_KERNEL:KERNEL_NETFILTER_XT_MATCH_OWNER \ - +@GLUON_SPECIALIZE_KERNEL:KERNEL_NETFILTER_XT_MATCH_PKTTYPE \ - +@GLUON_SPECIALIZE_KERNEL:KERNEL_NETFILTER_XT_MATCH_QUOTA \ - +@GLUON_SPECIALIZE_KERNEL:KERNEL_NET_CLS_BASIC \ - +@GLUON_SPECIALIZE_KERNEL:KERNEL_NET_ACT_POLICE \ - +@GLUON_SPECIALIZE_KERNEL:KERNEL_NET_SCH_TBF \ - +@GLUON_SPECIALIZE_KERNEL:KERNEL_NET_SCH_INGRESS + DEPENDS:=+gluon-core +gluon-wan-dnsmasq +iptables +iptables-mod-extra +simple-tc USERID:=:gluon-mesh-vpn=800 endef diff --git a/package/gluon-mesh-vpn-fastd/Makefile b/package/gluon-mesh-vpn-fastd/Makefile index 087aff5f..de5111ca 100644 --- a/package/gluon-mesh-vpn-fastd/Makefile +++ b/package/gluon-mesh-vpn-fastd/Makefile @@ -7,7 +7,7 @@ include ../gluon.mk define Package/gluon-mesh-vpn-fastd TITLE:=Support for connecting meshes via fastd - DEPENDS:=+gluon-core +libgluonutil +gluon-mesh-vpn-core +fastd +@GLUON_SPECIALIZE_KERNEL:KERNEL_TUN + DEPENDS:=+gluon-core +libgluonutil +gluon-mesh-vpn-core +fastd endef $(eval $(call BuildPackageGluon,gluon-mesh-vpn-fastd)) diff --git a/package/gluon-mesh-vpn-tunneldigger/Makefile b/package/gluon-mesh-vpn-tunneldigger/Makefile index b7a5f18d..376cec09 100644 --- a/package/gluon-mesh-vpn-tunneldigger/Makefile +++ b/package/gluon-mesh-vpn-tunneldigger/Makefile @@ -7,7 +7,7 @@ include ../gluon.mk define Package/gluon-mesh-vpn-tunneldigger TITLE:=Support for connecting meshes via tunneldigger/L2TPv3 pseudowire - DEPENDS:=+gluon-core +gluon-mesh-vpn-core +tunneldigger +@GLUON_SPECIALIZE_KERNEL:KERNEL_L2TP + DEPENDS:=+gluon-core +gluon-mesh-vpn-core +tunneldigger endef $(eval $(call BuildPackageGluon,gluon-mesh-vpn-tunneldigger)) From aed14db84f251a0a400192bbdbb8433f5ef588c5 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 11 Jul 2021 22:48:07 +0200 Subject: [PATCH 12/86] build: remove no_opkg With the removal of ramips-rt305x, all targets come with opkg again. --- scripts/copy_output.lua | 2 +- scripts/target_config_lib.lua | 7 ------- scripts/target_lib.lua | 5 ----- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/scripts/copy_output.lua b/scripts/copy_output.lua index 9f14fba5..b5c6f1b2 100755 --- a/scripts/copy_output.lua +++ b/scripts/copy_output.lua @@ -83,7 +83,7 @@ lib.exec {'cp', kernel_debug_source, kernel_debug_dest} -- Copy opkg repo -if lib.opkg and (env.GLUON_DEVICES or '') == '' then +if (env.GLUON_DEVICES or '') == '' then local package_prefix = string.format('gluon-%s-%s', lib.site_code, env.GLUON_RELEASE) local function dest_dir(prefix) return env.GLUON_PACKAGEDIR..'/'..prefix..'/'..bindir diff --git a/scripts/target_config_lib.lua b/scripts/target_config_lib.lua index 4b107e2b..c2237f72 100644 --- a/scripts/target_config_lib.lua +++ b/scripts/target_config_lib.lua @@ -151,13 +151,6 @@ lib.include(target) lib.check_devices() -if not lib.opkg then - lib.config('SIGNED_PACKAGES', false) - lib.config('CLEAN_IPKG', true) - lib.config('ALL_NONSHARED', false) - lib.packages {'-opkg'} -end - if #lib.devices > 0 then handle_target_pkgs(lib.target_packages) diff --git a/scripts/target_lib.lua b/scripts/target_lib.lua index babec324..36a6ee91 100644 --- a/scripts/target_lib.lua +++ b/scripts/target_lib.lua @@ -28,7 +28,6 @@ M.target_packages = {} M.configs = {} M.devices = {} M.images = {} -M.opkg = true local default_options = { @@ -309,10 +308,6 @@ function F.sysupgrade_image(image, name, ext, options) } end -function F.no_opkg() - M.opkg = false -end - function F.defaults(options) default_options = merge(default_options, options) end From 73b012846894e5fac67d2b12ef5344cbc9273985 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Tue, 13 Jul 2021 22:21:32 +0200 Subject: [PATCH 13/86] modules: update OpenWrt 23cde9d12a mpc85xx: add missing Kconfig symbols fe498dd3f1 netifd: update to the latest version Signed-off-by: David Bauer --- modules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules b/modules index 80d14960..b5770ef0 100644 --- a/modules +++ b/modules @@ -2,7 +2,7 @@ GLUON_FEEDS='packages routing gluon' OPENWRT_REPO=https://github.com/openwrt/openwrt.git OPENWRT_BRANCH=openwrt-21.02 -OPENWRT_COMMIT=38cdc57be6350f4890510c9cece535d340c6a3a6 +OPENWRT_COMMIT=23cde9d12a1318867d87e13c46fe3193555935ae PACKAGES_PACKAGES_REPO=https://github.com/openwrt/packages.git PACKAGES_PACKAGES_BRANCH=openwrt-21.02 From 5ec8676b281ffc3fefa4044b73e629b10d1df3b7 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Wed, 14 Jul 2021 01:49:33 +0200 Subject: [PATCH 14/86] gluon-core: delete all network device sections (#2263) Delete all default network device sections upon first boot. Only LAN & WAN networks are defined at this point. We are using the legacy way of definiting bridges via the interface sections ifname option. The prior filtering was based upon a single device and didn't take into consideration that DSA interface names can be named arbitrarily. Signed-off-by: David Bauer --- package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces b/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces index f9ab73c5..afded6f0 100755 --- a/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces @@ -79,9 +79,7 @@ uci:delete('network', 'lan') uci:delete('network', 'wan') uci:foreach('network', 'device', function(dev) - if dev['type'] ~= 'bridge' then return end - if dev['ifname'] ~= 'lan' and dev['ifname'] ~= 'wan' then return end - + -- Delete all default OpenWrt network device sections. uci:delete('network', dev['.name']) end) From e410a9c2e542bc550c7fa619db550242cda6b345 Mon Sep 17 00:00:00 2001 From: "aiyion.prime" Date: Thu, 17 Jun 2021 22:25:05 +0200 Subject: [PATCH 15/86] gluon-core: implement popen3() in gluon/util.lua [Matthias Schiffer: simplify close_fds() helper and use in child process] --- .../luasrc/usr/lib/lua/gluon/util.lua | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/package/gluon-core/luasrc/usr/lib/lua/gluon/util.lua b/package/gluon-core/luasrc/usr/lib/lua/gluon/util.lua index a5d13a5b..48b8340e 100644 --- a/package/gluon-core/luasrc/usr/lib/lua/gluon/util.lua +++ b/package/gluon-core/luasrc/usr/lib/lua/gluon/util.lua @@ -1,6 +1,8 @@ local bit = require 'bit' +local posix_fcntl = require 'posix.fcntl' local posix_glob = require 'posix.glob' local posix_syslog = require 'posix.syslog' +local posix_unistd = require 'posix.unistd' local hash = require 'hash' local sysconfig = require 'gluon.sysconfig' local site = require 'gluon.site' @@ -193,4 +195,76 @@ function M.log(message, verbose) posix_syslog.syslog(posix_syslog.LOG_INFO, message) end +local function close_fds(fds) + for _, fd in pairs(fds) do + posix_unistd.close(fd) + end +end + +M.subprocess = {} + +M.subprocess.DEVNULL = -1 +M.subprocess.PIPE = 1 + +-- Execute a program found using command PATH search, like the shell. +-- Return the pid, as well as the I/O streams as pipes or nil on error. +function M.subprocess.popen(path, argt, options) + argt = argt or {} + local childfds = {} + local parentfds = {} + local stdiostreams = {stdin = 0, stdout = 1, stderr = 2} + + for iostream in pairs(stdiostreams) do + if options[iostream] == M.subprocess.PIPE then + local piper, pipew = posix_unistd.pipe() + if iostream == "stdin" then + childfds[iostream] = piper + parentfds[iostream] = pipew + else + childfds[iostream] = pipew + parentfds[iostream] = piper + end + end + end + + -- childfds: r0, w1, w2 + -- parentfds: w0, r1, r2 + + local pid, errmsg, errnum = posix_unistd.fork() + + if pid == nil then + close_fds(parentfds) + close_fds(childfds) + return nil, errmsg, errnum + elseif pid == 0 then + local null = -1 + if M.contains(options, M.subprocess.DEVNULL) then + -- only open if there's anything to discard + null = posix_fcntl.open('/dev/null', posix_fcntl.O_RDWR) + end + + for iostream, fd in pairs(stdiostreams) do + local option = options[iostream] + if option == M.subprocess.DEVNULL then + posix_unistd.dup2(null, fd) + elseif option == M.subprocess.PIPE then + posix_unistd.dup2(childfds[iostream], fd) + end + end + close_fds(childfds) + close_fds(parentfds) + + -- close potential null + if null > 2 then + posix_unistd.close(null) + end + + posix_unistd.execp(path, argt) + posix_unistd._exit(127) + end + + close_fds(childfds) + + return pid, parentfds +end return M From c2e27196de7bf089015a20505da167d9c8e489ac Mon Sep 17 00:00:00 2001 From: "aiyion.prime" Date: Sun, 27 Jun 2021 23:04:31 +0200 Subject: [PATCH 16/86] gluon-web-admin: use util.popen3 in remote.lua [Matthias Schiffer: whitespace changes, error handling] --- .../gluon/config-mode/model/admin/remote.lua | 31 ++++++------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/package/gluon-web-admin/luasrc/lib/gluon/config-mode/model/admin/remote.lua b/package/gluon-web-admin/luasrc/lib/gluon/config-mode/model/admin/remote.lua index da6a8a9c..5d614acf 100644 --- a/package/gluon-web-admin/luasrc/lib/gluon/config-mode/model/admin/remote.lua +++ b/package/gluon-web-admin/luasrc/lib/gluon/config-mode/model/admin/remote.lua @@ -12,8 +12,8 @@ You may obtain a copy of the License at local util = require 'gluon.util' local site = require 'gluon.site' +local sp = util.subprocess -local fcntl = require 'posix.fcntl' local unistd = require 'posix.unistd' local wait = require 'posix.sys.wait' @@ -76,29 +76,16 @@ function pw2.cfgvalue() end local function set_password(password) - local inr, inw = unistd.pipe() - local pid = unistd.fork() - - if pid < 0 then + local options = { + stdin = sp.PIPE, + stdout = sp.DEVNULL, + stderr = sp.DEVNULL, + } + local pid, pipe = sp.popen('passwd', {}, options) + if not pid then return false - elseif pid == 0 then - unistd.close(inw) - - local null = fcntl.open('/dev/null', fcntl.O_WRONLY) - unistd.dup2(null, unistd.STDOUT_FILENO) - unistd.dup2(null, unistd.STDERR_FILENO) - if null > 2 then - unistd.close(null) - end - - unistd.dup2(inr, unistd.STDIN_FILENO) - unistd.close(inr) - - unistd.execp('passwd', {[0] = 'passwd'}) - os.exit(127) end - - unistd.close(inr) + local inw = pipe.stdin unistd.write(inw, string.format('%s\n%s\n', password, password)) unistd.close(inw) From f01c62e5943c8dc7013e3e7bfcc304dd23cea45b Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sat, 17 Jul 2021 22:50:02 +0200 Subject: [PATCH 17/86] gluon-core: wireless: support PHY lookup for multi-PHY devices (#2267) The PHY lookup helper "find_phy_by_path" could not lookup the PHY name for paths from multi-phy devices. An example for such a path would be: '1e140000.pcie/pci0000:00/0000:00:01.0/0000:02:00.0+1' The integer after the plus (+) character determines the PHY index of the specific device in relation to the PHY with the lowest index of the device. For example, if the device provides phy2 and phy3, the above path would describe phy3. In case the device provides phy0 and phy1, it would describe phy1. Rewrite the "find_phy_by_path" function to support those paths as well as regular device paths in a universal manner. Signed-off-by: David Bauer --- .../luasrc/usr/lib/lua/gluon/wireless.lua | 34 ++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/package/gluon-core/luasrc/usr/lib/lua/gluon/wireless.lua b/package/gluon-core/luasrc/usr/lib/lua/gluon/wireless.lua index 4f2cf088..0eb68023 100644 --- a/package/gluon-core/luasrc/usr/lib/lua/gluon/wireless.lua +++ b/package/gluon-core/luasrc/usr/lib/lua/gluon/wireless.lua @@ -2,16 +2,42 @@ local sysconfig = require 'gluon.sysconfig' local site = require 'gluon.site' local util = require 'gluon.util' +local unistd = require 'posix.unistd' +local dirent = require 'posix.dirent' + local M = {} local function find_phy_by_path(path) - local phy = util.glob('/sys/devices/' .. path .. '/ieee80211/phy*')[1] - or util.glob('/sys/devices/platform/' .. path .. '/ieee80211/phy*')[1] + local device_path, phy_offset = string.match(path, "^(.+)%+(%d+)$") - if phy then - return phy:match('([^/]+)$') + -- Special handling required for multi-phy devices + if device_path == nil then + device_path = path + phy_offset = '0' end + + -- Find the device path. Either it's located at /sys/devices or /sys/devices/platform + local path_prefix = '' + if not unistd.access('/sys/devices/' .. device_path .. '/ieee80211') then + path_prefix = 'platform/' + end + + -- Get all available PHYs of the device and dertermine the one with the lowest index + local phy_names = dirent.dir('/sys/devices/' .. path_prefix .. device_path .. '/ieee80211') + local device_phy_idxs = {} + for _, v in ipairs(phy_names) do + local phy_idx = v:match('^phy(%d+)$') + + if phy_idx ~= nil then + table.insert(device_phy_idxs, tonumber(phy_idx)) + end + end + + table.sort(device_phy_idxs) + + -- Index starts at 1 + return 'phy' .. device_phy_idxs[tonumber(phy_offset) + 1] end local function find_phy_by_macaddr(macaddr) From bfec08546bd348ad9e425eb42ffe75e7565f999b Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 17 Jul 2021 23:24:01 +0200 Subject: [PATCH 18/86] gluon-core: use uci:delete_all() instead of foreach()+delete() (#2273) --- package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces b/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces index afded6f0..d2814968 100755 --- a/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces @@ -78,9 +78,6 @@ end uci:delete('network', 'lan') uci:delete('network', 'wan') -uci:foreach('network', 'device', function(dev) - -- Delete all default OpenWrt network device sections. - uci:delete('network', dev['.name']) -end) +uci:delete_all('network', 'device') uci:save('network') From 9fa45ac489da2400aaa58d73ba34c1f9ba37f793 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sun, 18 Jul 2021 16:41:27 +0200 Subject: [PATCH 19/86] ramips-mt76x8: add support for RAVPower RP-WD009 (#2265) --- docs/user/supported_devices.rst | 4 ++++ targets/ramips-mt76x8 | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/docs/user/supported_devices.rst b/docs/user/supported_devices.rst index 0020c532..64e7788c 100644 --- a/docs/user/supported_devices.rst +++ b/docs/user/supported_devices.rst @@ -231,6 +231,10 @@ ramips-mt76x8 - R6120 +* RAVPower + + - RP-WD009 + * TP-Link - Archer C50 (v3) diff --git a/targets/ramips-mt76x8 b/targets/ramips-mt76x8 index 0adcfaa4..ef966ebe 100644 --- a/targets/ramips-mt76x8 +++ b/targets/ramips-mt76x8 @@ -21,6 +21,11 @@ device('netgear-r6120', 'netgear_r6120', { }) +-- RAVPower + +device('ravpower-rp-wd009', 'ravpower_rp-wd009') + + -- TP-Link device('tp-link-archer-c50-v3', 'tplink_archer-c50-v3', { From 338a831ae31b23c4ec36831632ad410266192902 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sun, 18 Jul 2021 16:43:46 +0200 Subject: [PATCH 20/86] modules: update OpenWrt df4feb1655 ipq40xx: fix FRITZRepeater 1200 RGMII delay f3f70fb956 netifd: update to the latest version Signed-off-by: David Bauer --- modules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules b/modules index b5770ef0..fc960e7f 100644 --- a/modules +++ b/modules @@ -2,7 +2,7 @@ GLUON_FEEDS='packages routing gluon' OPENWRT_REPO=https://github.com/openwrt/openwrt.git OPENWRT_BRANCH=openwrt-21.02 -OPENWRT_COMMIT=23cde9d12a1318867d87e13c46fe3193555935ae +OPENWRT_COMMIT=df4feb165591fca2c8c16601f31896189af9f636 PACKAGES_PACKAGES_REPO=https://github.com/openwrt/packages.git PACKAGES_PACKAGES_BRANCH=openwrt-21.02 From 3a885a1b2224978332ceb9fc03ac5667d1c8c738 Mon Sep 17 00:00:00 2001 From: lemoer Date: Fri, 23 Jul 2021 19:10:27 +0200 Subject: [PATCH 21/86] gluon-status-page: make "gateway nexthop" a link (#2278) With this commit, the gateway nexthop is now a clickable link, that leads to the status page of the nexthop. --- .../status-page/www/static/status-page.js | 2 +- .../javascript/status-page.js | 30 +++++++++++++++---- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/package/gluon-status-page/files/lib/gluon/status-page/www/static/status-page.js b/package/gluon-status-page/files/lib/gluon/status-page/www/static/status-page.js index 3fe35c37..5be175f8 100644 --- a/package/gluon-status-page/files/lib/gluon/status-page/www/static/status-page.js +++ b/package/gluon-status-page/files/lib/gluon/status-page/www/static/status-page.js @@ -1 +1 @@ -"use strict";!function(){var r=JSON.parse(document.body.getAttribute("data-translations"));function i(t,e){return t.toFixed(e).replace(/\./,r["."])}function o(t,e){e--;for(var n=t;10<=n&&0Channel "+(2484===(t=t.frequency)?14:2412<=t&&t<=2472?(t-2407)/5:5160<=t&&t<=5885?(t-5e3)/5:"unknown"),e.appendChild(n),i.appendChild(e)})}else e.style.display="none"}var n=document.querySelectorAll("[data-statistics]");d("/cgi-bin/dyn/statistics",function(o,a){var c=o.uptime-a.uptime;n.forEach(function(t){var e=t.getAttribute("data-statistics"),n=t.getAttribute("data-format"),i=l(a,e),e=l(o,e);try{var r=s[n](e,i,c);void 0!==r&&(t.textContent=r)}catch(t){console.error(t)}});try{t(o.mesh_vpn)}catch(t){console.error(t)}try{e(o.wireless)}catch(t){console.error(t)}});var c={};function A(n){var i=document.createElement("canvas"),r=i.getContext("2d"),o=null;return{canvas:i,highlight:!1,resize:function(t,e){try{r.getImageData(0,0,t,e)}catch(t){}i.width=t,i.height=e},draw:function(t,e){e=e(o);r.clearRect(t,0,5,i.height),e&&(t=t,e=e,r.beginPath(),r.fillStyle=n,r.arc(t,e,1.2,0,2*Math.PI,!1),r.closePath(),r.fill())},set:function(t){o=t}}}function h(){var c=-100,s=0,n=0,i=[],l=document.createElement("canvas");l.className="signalgraph",l.height=200;var u=l.getContext("2d");function t(){l.width=l.clientWidth,i.forEach(function(t){t.resize(l.width,l.height)})}function r(){var e;0!==l.clientWidth&&(l.width!==l.clientWidth&&t(),u.clearRect(0,0,l.width,l.height),e=!1,i.forEach(function(t){t.highlight&&(e=!0)}),u.save(),i.forEach(function(t){e&&(u.globalAlpha=.2),t.highlight&&(u.globalAlpha=1),t.draw(n,function(t){return e=t,n=c,i=s,t=l.height,(1-(e-n)/(i-n))*t;var e,n,i}),u.drawImage(t.canvas,0,0)}),u.restore(),u.save(),u.beginPath(),u.strokeStyle="rgba(255, 180, 0, 0.15)",u.lineWidth=5,u.moveTo(n+2.5,0),u.lineTo(n+2.5,l.height),u.stroke(),function(){var t=Math.floor(l.height/40);u.save(),u.lineWidth=.5,u.strokeStyle="rgba(0, 0, 0, 0.25)",u.fillStyle="rgba(0, 0, 0, 0.5)",u.textAlign="end",u.textBaseline="bottom",u.beginPath();for(var e,n,i,r=0;re[0]||t[1]e[1]?1:0});t=t[0][2];return t&&!/^fe80:/i.test(t)?t:void 0}}return t.wireless&&((g=a.insertCell()).textContent="-",g.setAttribute("data-label",o.children[Object.keys(l).length+1].textContent),(v=a.insertCell()).textContent="-",v.setAttribute("data-label",o.children[Object.keys(l).length+2].textContent),(m=a.insertCell()).textContent="-",m.setAttribute("data-label",o.children[Object.keys(l).length+3].textContent),p=A(n),t.signalgraph.addSignal(p)),a.onmouseenter=function(){a.classList.add("highlight"),p&&(p.highlight=!0)},a.onmouseleave=function(){a.classList.remove("highlight"),p&&(p.highlight=!1)},C(),{get_hostname:function(){return s.textContent},update_nodeinfo:function(t){var e,n,i,r,o=w(t.network.addresses);o&&("span"===s.nodeName.toLowerCase()&&(r=s,s=document.createElement("a"),r.parentNode.replaceChild(s,r)),s.href="http://["+o+"]/"),s.textContent=t.hostname,x&&t.location&&(e=x.latitude,n=x.longitude,i=t.location.latitude,r=t.location.longitude,o=Math.PI/180,t=(i*=o)-(e*=o),n=(r*=o)-(n*=o),i=Math.sin(t/2)*Math.sin(t/2)+Math.sin(n/2)*Math.sin(n/2)*Math.cos(e)*Math.cos(i),i=6372.8*(2*Math.asin(Math.sqrt(i))),v.textContent=Math.round(1e3*i)+" m"),C()},update_mesh:function(n){Object.keys(l).forEach(function(t){var e=l[t];e.td.textContent=n[t]+e.suffix}),C()},update_wifi:function(t){g.textContent=t.signal,m.textContent=Math.round(t.inactive/1e3)+" s",a.classList.toggle("inactive",200Channel "+(2484===(t=t.frequency)?14:2412<=t&&t<=2472?(t-2407)/5:5160<=t&&t<=5885?(t-5e3)/5:"unknown"),e.appendChild(n),r.appendChild(e)})}else e.style.display="none"}var n=document.querySelectorAll("[data-statistics]");d("/cgi-bin/dyn/statistics",function(a,o){var c=a.uptime-o.uptime;n.forEach(function(t){var e=t.getAttribute("data-statistics"),n=t.getAttribute("data-format"),r=s(o,e),e=s(a,e);try{var i=l[n](e,r,c);switch(typeof i){case"string":t.textContent=i;break;case"object":t.lastChild&&t.removeChild(t.lastChild),t.appendChild(i)}}catch(t){console.error(t)}});try{t(a.mesh_vpn)}catch(t){console.error(t)}try{e(a.wireless)}catch(t){console.error(t)}});var c={};function A(n){var r=document.createElement("canvas"),i=r.getContext("2d"),a=null;return{canvas:r,highlight:!1,resize:function(t,e){try{i.getImageData(0,0,t,e)}catch(t){}r.width=t,r.height=e},draw:function(t,e){e=e(a);i.clearRect(t,0,5,r.height),e&&(t=t,e=e,i.beginPath(),i.fillStyle=n,i.arc(t,e,1.2,0,2*Math.PI,!1),i.closePath(),i.fill())},set:function(t){a=t}}}function h(){var i=-100,a=0,n=0,r=[],o=document.createElement("canvas");o.className="signalgraph",o.height=200;var c=o.getContext("2d");function t(){o.width=o.clientWidth,r.forEach(function(t){t.resize(o.width,o.height)})}function l(){var e;0!==o.clientWidth&&(o.width!==o.clientWidth&&t(),c.clearRect(0,0,o.width,o.height),e=!1,r.forEach(function(t){t.highlight&&(e=!0)}),c.save(),r.forEach(function(t){e&&(c.globalAlpha=.2),t.highlight&&(c.globalAlpha=1),t.draw(n,function(t){return e=o.height,(1-(t-i)/(a-i))*e;var e}),c.drawImage(t.canvas,0,0)}),c.restore(),c.save(),c.beginPath(),c.strokeStyle="rgba(255, 180, 0, 0.15)",c.lineWidth=5,c.moveTo(n+2.5,0),c.lineTo(n+2.5,o.height),c.stroke(),function(){var t=Math.floor(o.height/40);c.save(),c.lineWidth=.5,c.strokeStyle="rgba(0, 0, 0, 0.25)",c.fillStyle="rgba(0, 0, 0, 0.5)",c.textAlign="end",c.textBaseline="bottom",c.beginPath();for(var e=0;ee[0]||t[1]e[1]?1:0});t=t[0][2];return t&&!/^fe80:/i.test(t)?t:void 0}}return t.wireless&&((g=a.insertCell()).textContent="-",g.setAttribute("data-label",i.children[Object.keys(s).length+1].textContent),(p=a.insertCell()).textContent="-",p.setAttribute("data-label",i.children[Object.keys(s).length+2].textContent),(m=a.insertCell()).textContent="-",m.setAttribute("data-label",i.children[Object.keys(s).length+3].textContent),v=A(e),t.signalgraph.addSignal(v)),a.onmouseenter=function(){a.classList.add("highlight"),v&&(v.highlight=!0)},a.onmouseleave=function(){a.classList.remove("highlight"),v&&(v.highlight=!1)},y(),{get_hostname:function(){return l.textContent},get_addr:function(){return o},update_nodeinfo:function(t){var e,n,r,i,a;(o=w(t.network.addresses))&&("span"===l.nodeName.toLowerCase()&&(a=l,l=document.createElement("a"),a.parentNode.replaceChild(l,a)),l.href="http://["+o+"]/"),l.textContent=t.hostname,x&&t.location&&(e=x.latitude,n=x.longitude,r=t.location.latitude,i=t.location.longitude,a=Math.PI/180,t=(r*=a)-(e*=a),n=(i*=a)-(n*=a),r=Math.sin(t/2)*Math.sin(t/2)+Math.sin(n/2)*Math.sin(n/2)*Math.cos(e)*Math.cos(r),r=6372.8*(2*Math.asin(Math.sqrt(r))),p.textContent=Math.round(1e3*r)+" m"),y()},update_mesh:function(n){Object.keys(s).forEach(function(t){var e=s[t];e.td.textContent=n[t]+e.suffix}),y()},update_wifi:function(t){g.textContent=t.signal,m.textContent=Math.round(t.inactive/1e3)+" s",a.classList.toggle("inactive",200 Date: Fri, 23 Jul 2021 19:48:58 +0200 Subject: [PATCH 22/86] treewide: correctly specify conffiles (#2276) Specify conffiles for our packages, so they aren't overwritten during opkg updates. While this only matters during development, it is unintended to have different behaviour for opkg update and full firmware updates. --- package/gluon-core/Makefile | 5 +++++ package/gluon-node-info/Makefile | 4 ++++ package/gluon-setup-mode/Makefile | 4 ++++ package/gluon-wan-dnsmasq/Makefile | 4 ++++ 4 files changed, 17 insertions(+) diff --git a/package/gluon-core/Makefile b/package/gluon-core/Makefile index e8f69535..764affb7 100644 --- a/package/gluon-core/Makefile +++ b/package/gluon-core/Makefile @@ -27,6 +27,11 @@ config GLUON_MINIFY default y endef +define Package/gluon-core/conffiles +/etc/config/gluon +/etc/config/gluon-core +endef + define Package/gluon-core/install $(Gluon/Build/Install) diff --git a/package/gluon-node-info/Makefile b/package/gluon-node-info/Makefile index 7718fa2b..79503a15 100644 --- a/package/gluon-node-info/Makefile +++ b/package/gluon-node-info/Makefile @@ -11,4 +11,8 @@ define Package/gluon-node-info DEPENDS:=+gluon-core +libgluonutil endef +define Package/gluon-node-info/conffiles +/etc/config/gluon-node-info +endef + $(eval $(call BuildPackageGluon,gluon-node-info)) diff --git a/package/gluon-setup-mode/Makefile b/package/gluon-setup-mode/Makefile index dfc1717a..8efa2a4c 100644 --- a/package/gluon-setup-mode/Makefile +++ b/package/gluon-setup-mode/Makefile @@ -17,6 +17,10 @@ define Package/gluon-setup-mode/description Offline mode to perform basic setup in a secure manner. endef +define Package/gluon-setup-mode/conffiles +/etc/config/gluon-setup-mode +endef + init_links := \ K89log \ K98boot \ diff --git a/package/gluon-wan-dnsmasq/Makefile b/package/gluon-wan-dnsmasq/Makefile index adbe0f78..b8dfa71c 100644 --- a/package/gluon-wan-dnsmasq/Makefile +++ b/package/gluon-wan-dnsmasq/Makefile @@ -14,4 +14,8 @@ define Package/gluon-wan-dnsmasq/description Gluon community wifi mesh firmware framework: Support for a secondary DNS server using the WAN interface endef +define Package/gluon-wan-dnsmasq/conffiles +/etc/config/gluon-wan-dnsmasq +endef + $(eval $(call BuildPackageGluon,gluon-wan-dnsmasq)) From d4dee692c671090c10dca8cd1e282575a18469cb Mon Sep 17 00:00:00 2001 From: lemoer Date: Fri, 23 Jul 2021 19:50:15 +0200 Subject: [PATCH 23/86] contrib: add push_pkg.sh to enhance package development workflow (v2) (#2023) v2: In contrast to the last patches, this is now built on top of ssh only, without using e.g. 9pfs. Furthermore it works also with arbitary remote hosts on any target/architecture. Also the scripts were renamed and moved to /scripts. The aim of this commit is to allow fast rebuild cycles during the development of gluon packages. Currently the following workflow can be used: # start a local qemu instance scripts/run_qemu.sh output/images/factory/[...].img # do your changes in the file you want to patch vi package/gluon-ebtables/files/etc/init.d/gluon-ebtables # rebuild and update the package scripts/push_pkg.sh package/gluon-ebtables/ # test your changes ... # do more changes ... # rebuild and update the package scripts/push_pkg.sh package/gluon-ebtables/ # test your changes ... (and so on...) Implementation details: - Currently this is based on ssh/scp. - Opkg is used to install/update the packages in the remote machine. Benefits: - This works with compiled and non-compiled packages. - This works with native OpenWrt and Gluon packages. - This even performs the check_site.lua checks as they are integrated as post_install scripts into the openwrt package. - It works for all architectures/targets. --- contrib/push_pkg.sh | 149 ++++++++++++++++++++++++++++++++++++++++++ contrib/run_qemu.sh | 15 +++++ docs/dev/packages.rst | 79 ++++++++++++++++++++++ 3 files changed, 243 insertions(+) create mode 100755 contrib/push_pkg.sh create mode 100755 contrib/run_qemu.sh diff --git a/contrib/push_pkg.sh b/contrib/push_pkg.sh new file mode 100755 index 00000000..4b9fe740 --- /dev/null +++ b/contrib/push_pkg.sh @@ -0,0 +1,149 @@ +#!/bin/sh + +set -e + +topdir="$(realpath "$(dirname "${0}")/../openwrt")" + +# defaults to qemu run script +ssh_host=localhost +build_only=0 +preserve_config=1 + +print_help() { + echo "$0 [OPTIONS] PACAKGE_DIR [PACKAGE_DIR] ..." + echo "" + echo " -h print this help" + echo " -r HOST use a remote machine as target machine. By default if this" + echo " option is not given, push_pkg.sh will use a locally" + echo " running qemu instance started by run_qemu.sh." + echo " -p PORT use PORT as ssh port (default is 22)" + echo " -b build only, do not push" + echo " -P do not preserve /etc/config. By default, if a package" + echo " defines a config file in /etc/config, this config file" + echo " will be preserved. If you specify this flag, the package" + echo " default will be installed instead." + echo "" + echo ' To change gluon variables, run e.g. "make config GLUON_MINIFY=0"' + echo ' because then the gluon logic will be triggered, and openwrt/.config' + echo ' will be regenerated. The variables from openwrt/.config are already' + echo ' automatically used for this script.' + echo +} + +while getopts "p:r:hbP" opt +do + case $opt in + P) preserve_config=0;; + p) ssh_port="${OPTARG}";; + r) ssh_host="${OPTARG}"; [ -z "$ssh_port" ] && ssh_port=22;; + b) build_only=1;; + h) print_help; exit 0;; + *) ;; + esac +done +shift $(( OPTIND - 1 )) + +[ -z "$ssh_port" ] && ssh_port=2223 + +if [ "$build_only" -eq 0 ]; then + remote_info=$(ssh -p "${ssh_port}" "root@${ssh_host}" ' + source /etc/os-release + printf "%s\t%s\n" "$OPENWRT_BOARD" "$OPENWRT_ARCH" + ') + REMOTE_OPENWRT_BOARD="$(echo "$remote_info" | cut -f 1)" + REMOTE_OPENWRT_ARCH="$(echo "$remote_info" | cut -f 2)" + + # check target + if ! grep -q "CONFIG_TARGET_ARCH_PACKAGES=\"${REMOTE_OPENWRT_ARCH}\"" "${topdir}/.config"; then + echo "Configured OpenWrt Target is not matching with the target machine!" 1>&2 + echo + printf "%s" " Configured architecture: " 1>&2 + grep "CONFIG_TARGET_ARCH_PACKAGES" "${topdir}/.config" 1>&2 + echo "Target machine architecture: ${REMOTE_OPENWRT_ARCH}" 1>&2 + echo 1>&2 + echo "To switch the local with the run with the corresponding GLUON_TARGET:" 1>&2 + echo " make GLUON_TARGET=... config" 1>&2 + exit 1 + fi +fi + +if [ $# -lt 1 ]; then + echo ERROR: Please specify a PACKAGE_DIR. For example: + echo + echo " \$ $0 package/gluon-core" + exit 1 +fi + +while [ $# -gt 0 ]; do + + pkgdir="$1"; shift + echo "Package: ${pkgdir}" + + if ! [ -f "${pkgdir}/Makefile" ]; then + echo "ERROR: ${pkgdir} does not contain a Makefile" + exit 1 + fi + + if ! grep -q BuildPackage "${pkgdir}/Makefile"; then + echo "ERROR: ${pkgdir}/Makefile does not contain a BuildPackage command" + exit 1 + fi + + opkg_packages="$(make TOPDIR="${topdir}" -C "${pkgdir}" DUMP=1 | awk '/^Package: / { print $2 }')" + + search_package() { + find "$2" -name "$1_*.ipk" -printf "%f\n" + } + + make TOPDIR="${topdir}" -C "${pkgdir}" clean + make TOPDIR="${topdir}" -C "${pkgdir}" compile + + if [ "$build_only" -eq 1 ]; then + continue + fi + + # IPv6 addresses need brackets around the ${ssh_host} for scp! + if echo "${ssh_host}" | grep -q :; then + BL=[ + BR=] + fi + + for pkg in ${opkg_packages}; do + + for feed in "${topdir}/bin/packages/${REMOTE_OPENWRT_ARCH}/"*/ "${topdir}/bin/targets/${REMOTE_OPENWRT_BOARD}/packages/"; do + printf "%s" "searching ${pkg} in ${feed}: " + filename=$(search_package "${pkg}" "${feed}") + if [ -n "${filename}" ]; then + echo found! + break + else + echo not found + fi + done + + if [ "$preserve_config" -eq 0 ]; then + opkg_flags=" --force-maintainer" + fi + + # shellcheck disable=SC2029 + if [ -n "$filename" ]; then + scp -P "${ssh_port}" "$feed/$filename" "root@${BL}${ssh_host}${BR}:/tmp/${filename}" + ssh -p "${ssh_port}" "root@${ssh_host}" " + set -e + echo Running opkg: + opkg install --force-reinstall ${opkg_flags} '/tmp/${filename}' + rm '/tmp/${filename}' + gluon-reconfigure + " + else + # Some packages (e.g. procd-seccomp) seem to contain BuildPackage commands + # which do not generate *.ipk files. Till this point, I am not aware why + # this is happening. However, dropping a warning if the corresponding + # *.ipk is not found (maybe due to other reasons as well), seems to + # be more reasonable than aborting. Before this commit, the command + # has failed. + echo "Warning: ${pkg}*.ipk not found! Ignoring." 1>&2 + fi + + done +done diff --git a/contrib/run_qemu.sh b/contrib/run_qemu.sh new file mode 100755 index 00000000..3166f7e0 --- /dev/null +++ b/contrib/run_qemu.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# Note: You can exit the qemu instance by first pressing "CTRL + a" then "c". +# Then you enter the command mode of qemu and can exit by typing "quit". + +qemu-system-x86_64 \ + -d 'cpu_reset' \ + -enable-kvm \ + -gdb tcp::1234 \ + -nographic \ + -netdev user,id=wan,hostfwd=tcp::2223-10.0.2.15:22 \ + -device virtio-net-pci,netdev=wan,addr=0x06,id=nic1 \ + -netdev user,id=lan,hostfwd=tcp::6080-192.168.1.1:80,hostfwd=tcp::2222-192.168.1.1:22,net=192.168.1.100/24 \ + -device virtio-net-pci,netdev=lan,addr=0x05,id=nic2 \ + "$@" diff --git a/docs/dev/packages.rst b/docs/dev/packages.rst index b6032b2e..098b0276 100644 --- a/docs/dev/packages.rst +++ b/docs/dev/packages.rst @@ -3,6 +3,85 @@ Package development Gluon packages are OpenWrt packages and follow the same rules described at https://openwrt.org/docs/guide-developer/packages. +Development workflow +==================== + +When you are developing packages, it often happens that you iteratively want to deploy +and verify the state your development. There are two ways to verify your changes: + +1) One way is to rebuild the complete firmware, flash it, configure it and verify your + development then. This usually takes at least a few minutes to get your changes + working so you can test them. Especially if you iterate a lot, this becomes tedious. +2) Another way is to rebuild only the package you are currently working on and + to deploy this package to your test system. Here not even a reboot is required. + This makes iterating relatively fast. Your test system could be real hardware or + even a qemu in most cases. + +Gluon provides scripts to enhance workflow 2). Here is an example illustrating +the workflow using these scripts: + +.. code-block:: shell + + # start a local qemu instance + contrib/run_qemu.sh output/images/factory/[...]-x86-64.img + + # apply changes to the desired package + vi package/gluon-ebtables/files/etc/init.d/gluon-ebtables + + # rebuild and push the package to the qemu instance + contrib/push_pkg.sh package/gluon-ebtables/ + + # test your changes + ... + + # do more changes + ... + + # rebuild and push the package to the qemu instance + contrib/push_pkg.sh package/gluon-ebtables/ + + # test your changes + ... + + (and so on...) + + # see help of the script for more information + contrib/push_pkg.sh -h + ... + +Features of ``push_pkg.sh``: + +* Works with compiled and non-compiled packages. + + * This means it can be used in the development of C-code, Lua-Code and mostly any other code. + +* Works with native OpenWrt and Gluon packages. +* Pushes to remote machines or local qemu instances. +* Pushes multiple packages in in one call if desired. +* Performs site.conf checks. + +Implementation details of ``push_pkg.sh``: + +* First, the script builds an opkg package using the OpenWrt build system. +* This package is pushed to a *target machine* using scp: + + * By default the *target machine* is a locally running x86 qemu started using ``run_qemu.sh``. + * The *target machine* can also be remote machine. (See the cli switch ``-r``) + * Remote machines are not limited to a specific architecture. All architectures supported by gluon can be used as remote machines. + +* Finally opkg is used to install/update the packages in the target machine. + + * While doing this, it will not override ``/etc/config`` with package defaults by default. (See the cli switch ``-P``). + * While doing this, opkg calls the ``check_site.lua`` from the package as post_install script to validate the ``site.conf``. This means that the ``site.conf`` of the target machine is used for this validation. + +Note that: + +* ``push_pkg.sh`` does neither build nor push dependencies of the packages automatically. If you want to update dependencies, you must explicitly specify them to be pushed. +* If you add new packages, you must run ``make update config GLUON_TARGET=...``. +* You can change the gluon target of the target machine via ``make config GLUON_TARGET=...``. +* If you want to update the ``site.conf`` of the target machine, use ``push_pkg.sh package/gluon-site/``. +* Sometimes when things break, you can heal them by compiling a package with its dependencies: ``cd openwrt; make package/gluon-ebtables/clean; make package/gluon-ebtables/compile; cd ..``. +* You can exit qemu by pressing ``CTRL + a`` and ``c`` afterwards. Gluon package makefiles ======================= From 46194fb87d224f08af24eee4332b4315dd38f621 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Thu, 29 Jul 2021 00:43:24 +0200 Subject: [PATCH 24/86] ath79-generic: remove superluous newline --- targets/ath79-generic | 1 - 1 file changed, 1 deletion(-) diff --git a/targets/ath79-generic b/targets/ath79-generic index 5e66617d..88c2d91d 100644 --- a/targets/ath79-generic +++ b/targets/ath79-generic @@ -85,7 +85,6 @@ device('tp-link-archer-c2-v3', 'tplink_archer-c2-v3', { packages = ATH10K_PACKAGES_QCA9887, class = 'tiny', broken = true, -- 64M ath9k + ath10k - }) device('tp-link-archer-c6-v2', 'tplink_archer-c6-v2', { From 9fb00d137b61431486f20017654050e029f24e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20F=C3=B6rster?= Date: Thu, 29 Jul 2021 08:34:51 +0200 Subject: [PATCH 25/86] ramips-mt76x8: add support for TP-Link RE200 v2 (#2275) TP-Link RE200 v2 is a wireless range extender with Ethernet and 2.4G and 5G WiFi with internal antennas. It's based on MediaTek MT7628AN+MT7610EN. Specifications -------------- - MediaTek MT7628AN (580 Mhz) - 64 MB of RAM - 8 MB of FLASH - 2T2R 2.4 GHz and 1T1R 5 GHz - 1x 10/100 Mbps Ethernet - UART header on PCB (57600 8n1) - 8x LED (GPIO-controlled), 2x button There are 2.4G and 5G LEDs in red and green which are controlled separately. MAC addresses ------------- The MAC address assignment matches stock firmware, i.e.: LAN : *:0D 2.4G: *:0E 5G : *:0F Installation ------------ Web Interface ------------- It is possible to upgrade to OpenWrt via the web interface. Simply flash the -factory.bin from OEM. In contrast to a stock firmware, this will not overwrite U-Boot. --- docs/user/supported_devices.rst | 3 ++- targets/ramips-mt76x8 | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/user/supported_devices.rst b/docs/user/supported_devices.rst index 64e7788c..237699a1 100644 --- a/docs/user/supported_devices.rst +++ b/docs/user/supported_devices.rst @@ -210,7 +210,7 @@ ramips-mt7621 - WG3526-16M - WG3526-32M - + * Xiaomi - Xiaomi Mi Router 4A (Gigabit Edition) @@ -239,6 +239,7 @@ ramips-mt76x8 - Archer C50 (v3) - Archer C50 (v4) + - RE200 (v2) - TL-MR3020 (v3) - TL-MR3420 (v5) - TL-WA801ND (v5) diff --git a/targets/ramips-mt76x8 b/targets/ramips-mt76x8 index ef966ebe..3b7b8ef6 100644 --- a/targets/ramips-mt76x8 +++ b/targets/ramips-mt76x8 @@ -39,6 +39,8 @@ device('tp-link-archer-c50-v4', 'tplink_archer-c50-v4', { factory = false, }) +device('tp-link-re200-v2', 'tplink_re200-v2') + device('tp-link-tl-mr3020-v3', 'tplink_tl-mr3020-v3', { factory = false, extra_images = { From 108d613f1c0fe430b3b07683833fd98c8f6d7d9d Mon Sep 17 00:00:00 2001 From: David Bauer Date: Thu, 29 Jul 2021 20:52:34 +0200 Subject: [PATCH 26/86] modules: update OpenWrt 941ba3ffc4 ath79: fix JT-OR750i switch LED assignment 17cb9a9a9e ath79: enable missing pinmux for JT-OR750i a5850c049e ath79: add support for Joy-IT JT-OR750i 55d9c020a1 netifd: update to the latest version 089efd61e9 netifd: update to the latest version 60fad8f82b glibc: update to latest 2.33 HEAD (bug 28011) c58afca1aa glibc: update to latest 2.33 HEAD (BZ #27646, bug 27896, BZ #15271) 249aeaa9d8 dnsmasq: distinct Ubus names for multiple instances a1d50e7b45 kernel: bump 5.4 to 5.4.132 88c8d0a219 dnsmasq: add /tmp/hosts/ to jail_mount 4633471d74 odhcpd: fix invalid DHCPv6 ADVERTSIE with small configured leasetime (FS#3935) Signed-off-by: David Bauer --- modules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules b/modules index fc960e7f..f9667c3d 100644 --- a/modules +++ b/modules @@ -2,7 +2,7 @@ GLUON_FEEDS='packages routing gluon' OPENWRT_REPO=https://github.com/openwrt/openwrt.git OPENWRT_BRANCH=openwrt-21.02 -OPENWRT_COMMIT=df4feb165591fca2c8c16601f31896189af9f636 +OPENWRT_COMMIT=941ba3ffc4061233da19c03b293705ec13ab78ba PACKAGES_PACKAGES_REPO=https://github.com/openwrt/packages.git PACKAGES_PACKAGES_BRANCH=openwrt-21.02 From 596c6314a923ffceda362077be12bbbbb3fbc4d9 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 30 Jul 2021 20:14:49 +0200 Subject: [PATCH 27/86] modules: update OpenWrt a205de5594 ramips: mt76x8: add missing config symbol 8abe67d6d2 x86: move Kconfig symbol to common config 2e1a5a4353 generic: add missing Kconfig symbol Fixes #2277 Signed-off-by: David Bauer --- modules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules b/modules index f9667c3d..8d421acd 100644 --- a/modules +++ b/modules @@ -2,7 +2,7 @@ GLUON_FEEDS='packages routing gluon' OPENWRT_REPO=https://github.com/openwrt/openwrt.git OPENWRT_BRANCH=openwrt-21.02 -OPENWRT_COMMIT=941ba3ffc4061233da19c03b293705ec13ab78ba +OPENWRT_COMMIT=a205de55941b025f6f85ac19005496c726d6e157 PACKAGES_PACKAGES_REPO=https://github.com/openwrt/packages.git PACKAGES_PACKAGES_BRANCH=openwrt-21.02 From d3d22ba677f3547c105c05fd5e66e80453e4b824 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 30 Jul 2021 20:16:34 +0200 Subject: [PATCH 28/86] ath79-generic: add support for Joy-IT JT-OR750i (#2282) --- docs/user/supported_devices.rst | 4 ++++ targets/ath79-generic | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/docs/user/supported_devices.rst b/docs/user/supported_devices.rst index 237699a1..728a1153 100644 --- a/docs/user/supported_devices.rst +++ b/docs/user/supported_devices.rst @@ -17,6 +17,10 @@ ath79-generic - GL-AR300M-Lite +* Joy-IT + + - JT-OR750i + * OCEDO - Raccoon diff --git a/targets/ath79-generic b/targets/ath79-generic index 88c2d91d..aa5cc3b0 100644 --- a/targets/ath79-generic +++ b/targets/ath79-generic @@ -60,6 +60,14 @@ device('gl.inet-gl-ar300m-lite', 'glinet_gl-ar300m-lite', { factory = false, }) +-- JOY-IT + +device('joy-it-jt-or750i', 'joyit_jt-or750i', { + packages = ATH10K_PACKAGES_QCA9887, + factory = false, +}) + + -- OCEDO device('ocedo-raccoon', 'ocedo_raccoon', { From af74622cb5adddfff0dccac83c5a98874c1a946d Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 7 Aug 2021 21:21:23 +0200 Subject: [PATCH 29/86] ath79-generic: sort TP-Link devices --- targets/ath79-generic | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/ath79-generic b/targets/ath79-generic index aa5cc3b0..53fad9c3 100644 --- a/targets/ath79-generic +++ b/targets/ath79-generic @@ -99,10 +99,10 @@ device('tp-link-archer-c6-v2', 'tplink_archer-c6-v2', { packages = ATH10K_PACKAGES_QCA9888, }) -device('tp-link-cpe220-v3', 'tplink_cpe220-v3') - device('tp-link-archer-d50-v1', 'tplink_archer-d50-v1', { packages = ATH10K_PACKAGES_QCA9880, factory = false, broken = true, -- 64M ath9k + ath10k & power LED not working }) + +device('tp-link-cpe220-v3', 'tplink_cpe220-v3') From 4d21d4134ef15b1a734e5263b7a8cf614ccf0183 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 7 Aug 2021 21:22:09 +0200 Subject: [PATCH 30/86] ath79-generic: add support for TP-Link TL-WDR3600/4300 v1 --- docs/user/supported_devices.rst | 2 ++ targets/ath79-generic | 3 +++ 2 files changed, 5 insertions(+) diff --git a/docs/user/supported_devices.rst b/docs/user/supported_devices.rst index 728a1153..fb564374 100644 --- a/docs/user/supported_devices.rst +++ b/docs/user/supported_devices.rst @@ -38,6 +38,8 @@ ath79-generic - Archer C6 (v2) - CPE220 (v3.0) + - TL-WDR3600 (v1) + - TL-WDR4300 (v1) ath79-nand ---------- diff --git a/targets/ath79-generic b/targets/ath79-generic index 53fad9c3..a593a1fd 100644 --- a/targets/ath79-generic +++ b/targets/ath79-generic @@ -106,3 +106,6 @@ device('tp-link-archer-d50-v1', 'tplink_archer-d50-v1', { }) device('tp-link-cpe220-v3', 'tplink_cpe220-v3') + +device('tp-link-tl-wdr3600-v1', 'tplink_tl-wdr3600-v1') +device('tp-link-tl-wdr4300-v1', 'tplink_tl-wdr4300-v1') From dcb8738a5a4de6631d037cb300c2024b95c78ecf Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 7 Aug 2021 20:52:59 +0200 Subject: [PATCH 31/86] gluon-status-page: fix indentation --- .../files/lib/gluon/status-page/view/status-page.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/gluon-status-page/files/lib/gluon/status-page/view/status-page.html b/package/gluon-status-page/files/lib/gluon/status-page/view/status-page.html index 861c13a4..b7698f4c 100644 --- a/package/gluon-status-page/files/lib/gluon/status-page/view/status-page.html +++ b/package/gluon-status-page/files/lib/gluon/status-page/view/status-page.html @@ -190,7 +190,7 @@ <%:Wireless 2.4 GHz%><%= statistics('clients/wifi24') %> <%:Wireless 5 GHz%><%= statistics('clients/wifi5') %> -