diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 824362d7..1c827fb2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,24 +46,8 @@ fix some bug, detail in the remaining commit message exactly how it could be triggered and what you did to fix it. If in question, have a glance at the existing commit messages to get the idea. -Squash commits --------------- -Most changes are trivial enough to fit in one single commit in order to not -clutter the history. While developing a new feature, you are free to use -multiple commits, but if your feature is to be merged, reduce the number of -commits to a minimum. Even huge feature introductions like the 802.11s mesh -(commit [2a93c58]) fit into a single commit. - -If you developed your change in multiple smaller commits, you can easily -[squash] those before opening the pull request. While discussing, it is okay to -do your changes using `git commit --amend` and force-push them to your head of -the pull request. This way, your change always consists of only one commit and -can be merged in the instant everybody is content with the whole thing. - [packages]: http://gluon.readthedocs.org/en/latest/user/site.html#packages [#gluon]: https://webirc.hackint.org/#gluon [mailing list]: mailto:gluon@luebeck.freifunk.net [list of rejected features]: https://github.com/freifunk-gluon/gluon/issues?q=label%3Arejected -[2a93c58]: https://github.com/freifunk-gluon/gluon/commit/2a93c580428d10724116b0d2d1238e2745715a14 -[squash]: https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Squashing-Commits diff --git a/Makefile b/Makefile index 90ea36f3..5c02c752 100644 --- a/Makefile +++ b/Makefile @@ -152,17 +152,21 @@ GLUON_$(1)_FACTORY_SUFFIX := -squashfs-factory GLUON_$(1)_SYSUPGRADE_SUFFIX := -squashfs-sysupgrade GLUON_$(1)_FACTORY_EXT := .bin GLUON_$(1)_SYSUPGRADE_EXT := .bin +GLUON_$(1)_FACTORY_EXTRA := +GLUON_$(1)_SYSUPGRADE_EXTRA := GLUON_$(1)_MODELS := endef define GluonProfileFactorySuffix GLUON_$(1)_FACTORY_SUFFIX := $(2) GLUON_$(1)_FACTORY_EXT := $(3) +GLUON_$(1)_FACTORY_EXTRA := $(4) endef define GluonProfileSysupgradeSuffix GLUON_$(1)_SYSUPGRADE_SUFFIX := $(2) GLUON_$(1)_SYSUPGRADE_EXT := $(3) +GLUON_$(1)_SYSUPGRADE_EXTRA := $(4) endef define GluonModel @@ -447,6 +451,15 @@ image: FORCE cp $(BIN_DIR)/gluon-$(GLUON_$(PROFILE)_MODEL_$(model))$(GLUON_$(PROFILE)_FACTORY_SUFFIX)$(GLUON_$(PROFILE)_FACTORY_EXT) $(GLUON_IMAGEDIR)/factory/$(IMAGE_PREFIX)-$(model)$(GLUON_$(PROFILE)_FACTORY_EXT) && \ ) \ \ + $(if $(GLUON_$(PROFILE)_SYSUPGRADE_EXTRA), \ + rm -f $(GLUON_IMAGEDIR)/sysupgrade/gluon-*-$(model)-sysupgrade$(GLUON_$(PROFILE)_SYSUPGRADE_EXTRA) && \ + cp $(BIN_DIR)/gluon$(GLUON_$(PROFILE)_SYSUPGRADE_EXTRA) $(GLUON_IMAGEDIR)/sysupgrade/$(IMAGE_PREFIX)-$(model)-sysupgrade$(GLUON_$(PROFILE)_SYSUPGRADE_EXTRA) && \ + ) \ + $(if $(GLUON_$(PROFILE)_FACTORY_EXTRA), \ + rm -f $(GLUON_IMAGEDIR)/factory/gluon-*-$(model)$(GLUON_$(PROFILE)_FACTORY_EXTRA) && \ + cp $(BIN_DIR)/gluon$(GLUON_$(PROFILE)_FACTORY_EXTRA) $(GLUON_IMAGEDIR)/factory/$(IMAGE_PREFIX)-$(model)$(GLUON_$(PROFILE)_FACTORY_EXTRA) && \ + ) \ + \ $(foreach alias,$(GLUON_$(PROFILE)_MODEL_$(model)_ALIASES), \ $(if $(GLUON_$(PROFILE)_SYSUPGRADE_EXT), \ rm -f $(GLUON_IMAGEDIR)/sysupgrade/gluon-*-$(alias)-sysupgrade$(GLUON_$(PROFILE)_SYSUPGRADE_EXT) && \ diff --git a/README.md b/README.md index 72113cb0..3ef1f420 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,14 @@ Before opening an issue, make sure to check whether any existing issues (open or closed) match. If you're suggesting a new feature, drop by on IRC or our mailinglist to discuss it first. +We maintain a [Roadmap](https://github.com/freifunk-gluon/gluon/wiki/Roadmap) for +the future development of Gluon. + ## Use a release! Please refrain from using the `master` branch for anything else but development purposes! Use the most recent release instead. You can list all relaseses by running `git branch -a` -and switch to one by running `git checkout v2016.1.4 && make update`. +and switch to one by running `git checkout v2016.1.5 && make update`. If you're using the autoupdater, do not autoupdate nodes with anything but releases. If you upgrade using random master commits the nodes *will break* eventually. diff --git a/contrib/lsupgrade.sh b/contrib/lsupgrade.sh index 7fe11299..eca7a852 100755 --- a/contrib/lsupgrade.sh +++ b/contrib/lsupgrade.sh @@ -2,10 +2,11 @@ # Script to list all upgrade scripts in a clear manner # Limitations: -# * Does only show scripts of packages whose `files' directory represent the whole image filesystem (which are all Gluon packages) +# * Does only show scripts of packages whose `files'/`luasrc' directories represent the whole image filesystem (which are all Gluon packages) -SUFFIX=files/lib/gluon/upgrade +SUFFIX1=files/lib/gluon/upgrade +SUFFIX2=luasrc/lib/gluon/upgrade shopt -s nullglob @@ -35,8 +36,11 @@ find ./package packages -name Makefile | while read makefile; do dirname="$(dirname "$dir" | cut -d/ -f 3-)" package="$(basename "$dir")" - for file in "${SUFFIX}"/*; do - echo "${GREEN}$(basename "${file}")${RESET}" "(${BLUE}${repo}${RESET}/${dirname}${dirname:+/}${RED}${package}${RESET}/${SUFFIX})" + for file in "${SUFFIX1}"/*; do + echo "${GREEN}$(basename "${file}")${RESET}" "(${BLUE}${repo}${RESET}/${dirname}${dirname:+/}${RED}${package}${RESET}/${SUFFIX1})" + done + for file in "${SUFFIX2}"/*; do + echo "${GREEN}$(basename "${file}")${RESET}" "(${BLUE}${repo}${RESET}/${dirname}${dirname:+/}${RED}${package}${RESET}/${SUFFIX2})" done popd >/dev/null done | sort diff --git a/docs/dev/hardware.rst b/docs/dev/hardware.rst index 3bd62a3d..b7f7c174 100644 --- a/docs/dev/hardware.rst +++ b/docs/dev/hardware.rst @@ -51,7 +51,7 @@ may be defined arbitrarily. On devices with multiple WLAN adapters, care must also be taken that the primary MAC address is configured correctly. ``/lib/gluon/core/sysconfig/primary_mac`` should contain the MAC address which -can be found on a label on most hardware; if it does not, ``/lib/gluon/upgrade/core/initial/001-sysconfig`` +can be found on a label on most hardware; if it does not, ``/lib/gluon/upgrade/010-primary-mac`` in ``gluon-core`` might need a fix. (There have also been cases in which the address was incorrect even on devices with only one WLAN adapter, in these cases an OpenWrt bug was the cause). @@ -62,9 +62,10 @@ required for adding a new target: Adjust packages ''''''''''''''' -One package that definitely needs adjustments for every new target added is ``lua-platform-info``. Just -start with a copy of an existing platform info script, adjust it for the new target, and add the new target -to the list of supported targets in the package Makefile. +One package that definitely needs adjustments for every new target added is ``libplatforminfo`` (to be found in +`packages/gluon/libs/libplatforminfo `_). +Start with a copy of an existing platform info source file and adjust it for the new target (or just add a symlink if +there is nothing to adjust). Then add the new target to the DEPENDS variable in the ``libplatforminfo`` package Makefile. On many targets, Gluon's network setup scripts (mainly in the packages ``gluon-core`` and ``gluon-mesh-batman-adv-core``) won't run correctly without some adjustments, so better double check that everything is fine there (and the files diff --git a/docs/dev/i18n.rst b/docs/dev/i18n.rst index b51bfdee..fb7710ca 100644 --- a/docs/dev/i18n.rst +++ b/docs/dev/i18n.rst @@ -5,7 +5,10 @@ General guidelines ------------------ * All config mode packages must be fully translatable, with complete English and German texts. -* All new expert mode packages be fully translatable. English texts are required, German texts recommended. +* All new expert mode packages must be fully translatable. English texts are required. +* German translations are recommended. Other supported languages, especially French, are + nice-to-have, but not required. If you don't know a language well, rather leave the translation + blank, so it is obvious that there is no proper translation yet. * Existing expert mode packages should be made translatable as soon as possible. * The "message IDs" (which are the arguments to the ``translate`` function) should be the English texts. @@ -38,7 +41,7 @@ The entries in the template can be reordered after the generation if desirable. translations like "Cancel" are already available in the LuCI base translation file (see ``packages/luci/po/templates/base.pot``) and can be removed from the template. -In addition, some additions to the Makefile must be made. Instead of OpenWrt's default package.mk, +In addition, some additions to the Makefile must be made. Instead of OpenWrt's default ``package.mk``, the Gluon version ``$(GLUONDIR)/include/package.mk`` must be used. The i18n files must be installed and PKG_CONFIG_DEPENDS must be added:: @@ -73,7 +76,7 @@ The translation file can be updated to a new template version using the ``msgmer msgmerge -U de.po gluon-config-mode-geo-location.pot After the merge, the translation file should be checked for "fuzzy matched" entries where -the original English texts have changed. All entries from the the translation file should be +the original English texts have changed. All entries from the translation file should be translated in the ``.po`` file (or removed from it, so the original English texts are displayed instead). @@ -84,5 +87,6 @@ A list of all languages supported by LuCI can be found in the ``packages/luci/lu Gluon's dependencies have been downloaded using ``make update``. Adding translations for these languages is straightforward using the ``msginit`` command. -For other languages, support must be added tu LuCI first, which constitutes completely translating -the ``base.pot``. Please contact the upstream LuCI maintainers if you'd like to do this. +For other languages, support must be added to LuCI first, which constitutes completely translating +the ``base.pot``. Please contact the upstream LuCI maintainers at https://github.com/openwrt/luci/ +if you'd like to do this. diff --git a/docs/dev/mac_addresses.rst b/docs/dev/mac_addresses.rst new file mode 100644 index 00000000..b221a302 --- /dev/null +++ b/docs/dev/mac_addresses.rst @@ -0,0 +1,18 @@ +MAC addresses +============= + +Many devices don't have enough unique MAC addresses assigned by the vendor +(in batman-adv, each mesh interface needs an own MAC address that must be unique +mesh-wide). + +Gluon tries to solve this issue by using a hash of the primary MAC address as a +45 bit MAC address prefix. The resulting 8 addresses are used as follows: + +* 0: client0; WAN +* 1: mesh0 +* 2: ibss0 +* 3: wan_radio0 (private WLAN); batman-adv primary address +* 4: client1; LAN +* 5: mesh1 +* 6: ibss1 +* 7: wan_radio1 (private WLAN); mesh VPN diff --git a/docs/features/autoupdater.rst b/docs/features/autoupdater.rst index 873f6097..8c4ca73f 100644 --- a/docs/features/autoupdater.rst +++ b/docs/features/autoupdater.rst @@ -70,5 +70,11 @@ These commands can be used on a node: # Force update check, even when the updater is disabled autoupdater -f + +:: + + # If fallback is true the updater will perform an update only if + # the timespan given by the priority and another 24h have passed + autoupdater --fallback diff --git a/docs/features/wired-mesh.rst b/docs/features/wired-mesh.rst index 77c7d6b3..b9996335 100644 --- a/docs/features/wired-mesh.rst +++ b/docs/features/wired-mesh.rst @@ -19,7 +19,7 @@ Configuration ~~~~~~~~~~~~~ Both Mesh-on-WAN and Mesh-on-LAN can be configured on the "Network" page -of the *Expert Mode* (if the package ``gluon-luci-portconfig`` is installed). +of the *Advanced settings* (if the package ``gluon-luci-portconfig`` is installed). It is also possible to enable Mesh-on-WAN and Mesh-on-LAN by default by adding ``mesh_on_wan = true`` and ``mesh_on_lan = true`` to ``site.conf``. @@ -61,5 +61,5 @@ It may be disabled by running:: uci commit Please note that this configuration has changed in Gluon v2016.1. Using -the old commands on v2016.1 will break the corresponding Expert Mode -settings. +the old commands on v2016.1 will break the corresponding options in the +*Advanced settings*. diff --git a/docs/index.rst b/docs/index.rst index 028c65b8..a32c3c1a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -43,6 +43,7 @@ Developer Documentation dev/configmode dev/wan dev/i18n + dev/mac_addresses Packages -------- @@ -54,6 +55,10 @@ Packages package/gluon-config-mode-geo-location package/gluon-ebtables-filter-multicast package/gluon-ebtables-filter-ra-dhcp +<<<<<<< HEAD +======= + package/gluon-ebtables-segment-mld +>>>>>>> gluon-next-node: mark local-node ip6 as deprecated package/gluon-next-node Releases @@ -62,6 +67,7 @@ Releases .. toctree:: :maxdepth: 1 + releases/v2016.1.5 releases/v2016.1.4 releases/v2016.1.3 releases/v2016.1.2 @@ -90,6 +96,9 @@ ar71xx-generic - AP121 - AP121U - Hornet-UB + - Tube2H + - N2 + - N5 * Allnet @@ -108,7 +117,7 @@ ar71xx-generic * D-Link - - DIR-505 (A1) + - DIR-505 (A1, A2) - DIR-615 (C1) - DIR-825 (B1) @@ -131,6 +140,16 @@ ar71xx-generic - Omega +* OpenMesh + + - MR600 (v1, v2) + - MR900 (v1, v2) + - OM2P (v1, v2) + - OM2P-HS (v1, v2, v3) + - OM2P-LC + - OM5P + - OM5P-AN + * TP-Link - CPE210 (v1.0, v1.1) @@ -172,11 +191,13 @@ ar71xx-generic - Air Gateway - Air Router - Bullet M + - Loco M + - Loco M XW - Nanostation M - Nanostation M XW - - Loco M XW - Picostation M - Rocket M + - Rocket M XW - UniFi AP - UniFi AP Pro - UniFi AP Outdoor diff --git a/docs/package/gluon-config-mode-contact-info.rst b/docs/package/gluon-config-mode-contact-info.rst new file mode 100644 index 00000000..a38cc0a5 --- /dev/null +++ b/docs/package/gluon-config-mode-contact-info.rst @@ -0,0 +1,28 @@ +gluon-config-mode-contact-info +============================== + +This package allows the user to provide contact information within config mode to be +distributed in the mesh. You can define whether the owner contact field is +obligatory or not in your site.conf. + +site.conf +--------- + +config_mode.owner.obligatory : this whole section is optional + - ``true`` field is obligatory: gluon-node-info.@owner[0].contact may not be empty + - ``false`` field is optional: gluon-node-info.@owner[0].contact may be empty + - defaults to ``false`` + +# example: + + config_mode = { + geo_location = { + show_altitude = true, + }, + owner = { + obligatory = true + }, + }, + + + \ No newline at end of file diff --git a/docs/package/gluon-ebtables-segment-mld.rst b/docs/package/gluon-ebtables-segment-mld.rst new file mode 100644 index 00000000..7e197ece --- /dev/null +++ b/docs/package/gluon-ebtables-segment-mld.rst @@ -0,0 +1,16 @@ +gluon-ebtables-segment-mld +========================== + +These filters drop IGMP/MLD packets before they enter the mesh and +filter any IGMP/MLD packets coming from the mesh. + +IGMP/MLD have the concept of a local, elected Querier. For more +decentralization and increased robustness, the idea of this package is +to split the IGMP/MLD domain a querier is responsible for, allowing to +have a querier per node. The split IGMP/MLD domain will also reduce +overhead for this packet type, increasing scalability. + +Beware of the consequences of using this package though: You might need +to explicitly, manually mark ports on snooping switches leading towards +your mesh node as multicast router ports for now (Multicast Router +Discovery, MRD, not implemented yet). diff --git a/docs/releases/v2016.1.5.rst b/docs/releases/v2016.1.5.rst new file mode 100644 index 00000000..e5ee1a00 --- /dev/null +++ b/docs/releases/v2016.1.5.rst @@ -0,0 +1,66 @@ +Gluon 2016.1.5 +============== + +Added hardware support +~~~~~~~~~~~~~~~~~~~~~~ + +ar71xx-generic +^^^^^^^^^^^^^^ + +* OpenMesh + + - MR600 (v1, v2) + - MR900 (v1, v2) + - OM2P (v1, v2) + - OM2P-HS (v1, v2) + - OM2P-LC + - OM5P + - OM5P-AN + +* Ubiquiti + + - Rocket M XW + +* TP-LINK + + - TL-WR841N/ND v11 + +Bugfixes +~~~~~~~~ + +* build: fix race condition caused by using certain make targets (like *clean*, *images* or *package/\**) + with parallel build options without doing a full build before +* build: fix package dependency issue causing "recursive dependency" warning + + This dependency issue could lead to broken configurations and reportedly caused failed builds in some cases + when additional (site-specific) packages were used. +* build: Gluon will now build correctly with GCC 6 as host compiler +* Fix configuration of batman-adv when VLANs are used on top of IBSS interfaces (regression due to netifd update in :doc:`v2016.1.4`) +* Add back missing ath10k firmware (regression due to mac80211 update in :doc:`v2016.1.4`) +* Gluon can now be used on all supported Ubiquiti AirMAX devices without downgrading to AirOS 5.5.x before + + :doc:`v2016.1.1` added support for most Ubiquiti AirMAX devices with AirOS 5.6.x without downgrading AirOS, + but left some devices (at least some PicoStations and Bullets) with unwritable flash. This issue has been + resolved (`#687 `_). +* Add upgrade script to automatically remove whitespace from configured geolocation + + The new respondd implementation included in :doc:`v2016.1` is stricter about the number format than the + old one and doesn't accept trailing whitespace (so one or both coordinates are missing from the output). + + The Config Mode has been fixed to strip whitespace from numeric fields in new configurations since :doc:`v2016.1.1`. + This still left old configurations, which are now fixed by this script. + +Known Issues +~~~~~~~~~~~~ + +* Default TX power on many Ubiquiti devices is too high, correct offsets are unknown (`#94 `_) + + Reducing the TX power in the Expert Mode is recommended. + +* The MAC address of the WAN interface is modified even when Mesh-on-WAN is disabled (`#496 `_) + + This may lead to issues in environments where a fixed MAC address is expected (like VMware when promicious mode is disallowed). + +* Inconsistent respondd API (`#522 `_) + + The current API is inconsistent and will be replaced eventually. The old API will still be supported for a while. diff --git a/docs/site-example/i18n/de.po b/docs/site-example/i18n/de.po index 69cf1dd8..30f5c838 100644 --- a/docs/site-example/i18n/de.po +++ b/docs/site-example/i18n/de.po @@ -22,11 +22,11 @@ msgstr "" "er auf den Servern des Entenhausener Freifunk-Projektes eingetragen wurde, " "kann sich dein Knoten mit dem Entenhausener Mesh-VPN verbinden. Bitte " "schicke dazu diesen Schlüssel und den Namen deines Knotens " -"(<%=hostname%>) an " +"(<%=escape(hostname)%>) an " "keys@entenhausen.freifunk.net." "

" "
" -" # <%= hostname %>" +" # <%= escape(hostname) %>" "
" "<%= pubkey %>" "
" diff --git a/docs/site-example/i18n/en.po b/docs/site-example/i18n/en.po index 13273230..e6d1e672 100644 --- a/docs/site-example/i18n/en.po +++ b/docs/site-example/i18n/en.po @@ -20,11 +20,11 @@ msgstr "" "

This is your Freifunk node's public key. The node won't be able to " "connect to the mesh VPN until the key has been registered on the Freifunk " "Duckburg servers. " -"To register, send the key together with your node's name (<%=hostname%>) to " +"To register, send the key together with your node's name (<%=escape(hostname)%>) to " "keys@entenhausen.freifunk.net." "

" "
" -" # <%= hostname %>" +" # <%= escape(hostname) %>" "
" "<%= pubkey %>" "
" diff --git a/docs/site-example/i18n/fr.po b/docs/site-example/i18n/fr.po index 30e21c50..1462fdbf 100644 --- a/docs/site-example/i18n/fr.po +++ b/docs/site-example/i18n/fr.po @@ -22,11 +22,11 @@ msgstr "" "entrée sur les serveurs de votre groupe de Freifunk votre nœud pourra se connecter " "sur les serveur Mesh-VPN de votre groupe Freifunk. Veuillez envoyer la clé avec le " "nom de votre nœud " -"(<%=hostname%>) à " +"(<%=escape(hostname)%>) à " "keys@entenhausen.freifunk.net." "

" "
" -" # <%= hostname %>" +" # <%= escape(hostname) %>" "
" "<%= pubkey %>" "
" diff --git a/docs/site-example/site.conf b/docs/site-example/site.conf index 45719b94..6dee6df2 100644 --- a/docs/site-example/site.conf +++ b/docs/site-example/site.conf @@ -35,6 +35,14 @@ -- Wireless channel. channel = 1, + -- List of supported wifi rates (optional) + -- Example removes 802.11b compatibility for better performance + supported_rates = {6000, 9000, 12000, 18000, 24000, 36000, 48000, 54000}, + + -- List of basic wifi rates (optional, required if supported_rates is set) + -- Example removes 802.11b compatibility for better performance + basic_rate = {6000, 9000, 18000, 36000, 54000}, + -- ESSID used for client network. ap = { ssid = 'entenhausen.freifunk.net', @@ -184,10 +192,15 @@ -- skip = true, -- }, - -- Show/hide the altitude field -- config_mode = { - -- geo_location = { - -- show_altitude = false, - -- }, + -- Show/hide the altitude field + -- geo_location = { + -- show_altitude = false, + -- }, + -- define if the contact field is obligatory (optional) + -- owner = { + -- obligatory = true + -- }, -- }, + } diff --git a/docs/site-example/site.mk b/docs/site-example/site.mk index de8a562a..9f729890 100644 --- a/docs/site-example/site.mk +++ b/docs/site-example/site.mk @@ -52,5 +52,8 @@ GLUON_RELEASE ?= $(DEFAULT_GLUON_RELEASE) # Default priority for updates. GLUON_PRIORITY ?= 0 +# Region code required for some images; supported values: us eu +GLUON_REGION ?= eu + # Languages to include GLUON_LANGS ?= en de diff --git a/docs/user/getting_started.rst b/docs/user/getting_started.rst index 6c614d70..c7519cf0 100644 --- a/docs/user/getting_started.rst +++ b/docs/user/getting_started.rst @@ -8,7 +8,7 @@ Gluon's releases are managed using `Git tags`_. If you are just getting started with Gluon we recommend to use the latest stable release of Gluon. Take a look at the `list of gluon releases`_ and notice the latest release, -e.g. *v2016.1.4*. Always get Gluon using git and don't try to download it +e.g. *v2016.1.5*. Always get Gluon using git and don't try to download it as a Zip archive as the archive will be missing version information. Please keep in mind that there is no "default Gluon" build; a site configuration @@ -42,7 +42,7 @@ Building the images ------------------- To build Gluon, first check out the repository. Replace *RELEASE* with the -version you'd like to checkout, e.g. *v2016.1.4*. +version you'd like to checkout, e.g. *v2016.1.5*. :: @@ -130,7 +130,7 @@ not support IPv6. This is not true for kernel modules; the Gluon kernel is incompatible with the kernel of the default OpenWrt images. Therefore, Gluon will not only generate images, -but also an opkg repositoy containing all kernel modules provided by OpenWrt/Gluon +but also an opkg repository containing all kernel modules provided by OpenWrt/Gluon for the kernel of the generated images. Signing keys diff --git a/docs/user/site.rst b/docs/user/site.rst index 7f56150d..9349a1a5 100644 --- a/docs/user/site.rst +++ b/docs/user/site.rst @@ -98,6 +98,12 @@ wifi24 \: optional This will only affect new installations. Upgrades will not changed the disabled state. + Additionally it is possible to configure the ``supported_rates`` and ``basic_rate`` + of each radio. Both are optional, by default hostapd/driver dictate the rates. + If ``supported_rates`` is set, ``basic_rate`` is required, because ``basic_rate`` + has to be a subset of ``supported_rates``. + The example below disables 802.11b rates. + ``ap`` requires a single parameter, a string, named ``ssid`` which sets the interface's ESSID. @@ -112,6 +118,8 @@ wifi24 \: optional wifi24 = { channel = 11, + supported_rates = {6000, 9000, 12000, 18000, 24000, 36000, 48000, 54000}, + basic_rate = {6000, 9000, 18000, 36000, 54000}, ap = { ssid = 'entenhausen.freifunk.net', }, @@ -229,8 +237,14 @@ mesh_on_wan \: optional mesh_on_lan \: optional Enables the mesh on the LAN port (``true`` or ``false``). +poe_passthrough \: optional + Enable PoE passthrough by default on hardware with such a feature. + autoupdater \: package Configuration for the autoupdater feature of Gluon. + + The mirrors are checked in random order until the manifest could be downloaded + successfully or all mirrors have been tried. :: autoupdater = { @@ -320,6 +334,10 @@ GLUON_PRIORITY The default priority for the generated manifests (see the autoupdater documentation for more information). +GLUON_REGION + Region code to build into images where necessary. Valid values are the empty string, + ``us`` and ``eu``. + GLUON_LANGS List of languages (as two-letter-codes) to be included in the web interface. Should always contain ``en``. @@ -355,6 +373,41 @@ utilities are installed. Depending on the context, you might be able to use comments like ```` as translations to effectively hide the text. +Site modules +------------ + +The file ``modules`` in the site repository is completely optional and can be used +to supply additional package feeds from which packages are built. The git repositories +specified here are retrieved in addition to the default feeds when ``make update`` +it called. + +This file's format is very similar to the toplevel ``modules`` file of the Gluon +tree, with the important different that the list of feeds must be assigned to +the variable ``GLUON_SITE_FEEDS``. Multiple feed names must be separated by spaces, +for example:: + + GLUON_SITE_FEEDS='foo bar' + +The feed names may only contain alphanumerical characters, underscores and slashes. +For each of the feeds, the following variables are used to specify how to update +the feed: + +PACKAGES_${feed}_REPO + The URL of the git repository to clone (usually ``git://`` or ``http(s)://``) + +PACKAGES_${feed}_COMMIT + The commit ID of the repository to use + +PACKAGES_${feed}_BRANCH + Optional: The branch of the repository the given commit ID can be found in. + Defaults to the default branch of the repository (usually ``master``) + +These variables are always all uppercase, so for an entry ``foo`` in GLUON_SITE_FEEDS, +the corresponding configuration variables would be ``PACKAGES_FOO_REPO``, +``PACKAGES_FOO_COMMIT`` and ``PACKAGES_FOO_BRANCH``. Slashes in feed names are +replaced by underscores to get valid shell variable identifiers. + + Examples -------- @@ -394,23 +447,35 @@ site-repos in the wild This is a non-exhaustive list of site-repos from various communities: * `site-ffa `_ (Altdorf, Landshut & Umgebung) +* `site-ffac `_ (Regio Aachen) * `site-ffbs `_ (Braunschweig) * `site-ffhb `_ (Bremen) * `site-ffda `_ (Darmstadt) +* `site-ffeh `_ (Ehingen) +* `site-fffl `_ (Flensburg) * `site-ffgoe `_ (Göttingen) +* `site-ffgt-rhw `_ (Guetersloh) * `site-ffhh `_ (Hamburg) * `site-ffho `_ (Hochstift) * `site-ffhgw `_ (Greifswald) +* `site-ffka `_ (Karlsruhe) +* `site-ffki `_ (Kiel) +* `site-fflz `_ (Lausitz) * `site-ffl `_ (Leipzig) * `site-ffhl `_ (Lübeck) +* `site-fflg `_ (Lüneburg) * `site-ffmd `_ (Magdeburg) * `site-ffmwu `_ (Mainz, Wiesbaden & Umgebung) * `site-ffmyk `_ (Mayen-Koblenz) +* `site-ffmo `_ (Moers) +* `site-ffmg `_ (Mönchengladbach) * `site-ffm `_ (München) +* `site-ffhmue `_ (Münden) * `site-ffms `_ (Münsterland) -* `site-ffnw `_ (Nordwest) -* `site-ffka `_ (Karlsruhe) -* `site-ffrl `_ (Rheinland) -* `site-ffrg `_ (Ruhrgebiet) +* `site-neuss `_ (Neuss) +* `site-ffniers `_ (Niersufer) +* `site-ffnw `_ (Nordwest) +* `site-ffrgb `_ (Regensburg) +* `site-ffruhr `_ (Ruhrgebiet, Multi-Communities) * `site-ffs `_ (Stuttgart) * `site-fftr `_ (Trier) diff --git a/include/gluon.mk b/include/gluon.mk index d49dc13f..ef0f5311 100644 --- a/include/gluon.mk +++ b/include/gluon.mk @@ -75,7 +75,7 @@ GLUON_TARGET_$$(gluon_target)_BOARD := $(1) GLUON_TARGET_$$(gluon_target)_SUBTARGET := $(2) endef -GLUON_DEFAULT_PACKAGES := gluon-core kmod-ipv6 firewall ip6tables -uboot-envtools -wpad-mini hostapd-mini +GLUON_DEFAULT_PACKAGES := gluon-core firewall ip6tables -uboot-envtools -wpad-mini hostapd-mini override DEFAULT_PACKAGES.router := diff --git a/include/package.mk b/include/package.mk index 76e109e2..9d35ad3c 100644 --- a/include/package.mk +++ b/include/package.mk @@ -1,3 +1,6 @@ +# Dependencies for LuaSrcDiet +PKG_BUILD_DEPENDS += luci-base/host lua/host + include $(INCLUDE_DIR)/package.mk # Annoyingly, make's shell function replaces all newlines with spaces, so we have to do some escaping work. Yuck. @@ -33,3 +36,16 @@ define GluonInstallI18N fi; \ done endef + +define GluonSrcDiet + rm -rf $(2) + $(CP) $(1) $(2) + $(FIND) $(2) -type f | while read src; do \ + if $(STAGING_DIR_HOST)/bin/lua $(STAGING_DIR_HOST)/bin/LuaSrcDiet \ + --noopt-binequiv -o "$$$$src.o" "$$$$src"; \ + then \ + chmod $$$$(stat -c%a "$$$$src") "$$$$src.o"; \ + mv "$$$$src.o" "$$$$src"; \ + fi; \ + done +endef diff --git a/modules b/modules index 2a52cdf1..b5c42e11 100644 --- a/modules +++ b/modules @@ -1,18 +1,19 @@ GLUON_FEEDS='openwrt gluon routing luci' -OPENWRT_REPO=git://git.openwrt.org/15.05/openwrt.git -OPENWRT_COMMIT=eadf19c0b43d2f75f196ea8d875a08c7c348530c +OPENWRT_REPO=git://github.com/openwrt/openwrt.git +OPENWRT_COMMIT=e663db7bb1797740c4a29ac0fc96eda1b88f9e6e +OPENWRT_BRANCH=chaos_calmer PACKAGES_OPENWRT_REPO=git://github.com/openwrt/packages.git -PACKAGES_OPENWRT_COMMIT=9622fe984bba3a4547f48bc507ebaba7637eb2b0 +PACKAGES_OPENWRT_COMMIT=73776792f7d58e982be9e5819450d4875b273159 PACKAGES_OPENWRT_BRANCH=for-15.05 PACKAGES_GLUON_REPO=git://github.com/freifunk-gluon/packages.git -PACKAGES_GLUON_COMMIT=087eef9e684fdef066e63c8f64dddfbfd02141a5 +PACKAGES_GLUON_COMMIT=c24cdae83049e22ad35a3908a7d48c7fdc6dad7d PACKAGES_ROUTING_REPO=git://github.com/openwrt-routing/packages.git -PACKAGES_ROUTING_COMMIT=2a8338559de5c4b077cde7a83f43f4700a17d5cc +PACKAGES_ROUTING_COMMIT=a4eae82c155079a4372e4b910ec733f77288b717 PACKAGES_LUCI_REPO=git://github.com/openwrt/luci.git -PACKAGES_LUCI_COMMIT=cdcdfd2594634804ab09dc8105e46116edce0cd6 +PACKAGES_LUCI_COMMIT=70a4d43cc895b7d728b4fc201f2b6fd9f4b8aaec PACKAGES_LUCI_BRANCH=for-15.05 diff --git a/package/gluon-alfred/Makefile b/package/gluon-alfred/Makefile index ca3ae327..f38b0dbe 100644 --- a/package/gluon-alfred/Makefile +++ b/package/gluon-alfred/Makefile @@ -6,7 +6,8 @@ PKG_RELEASE:=1 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) -include $(INCLUDE_DIR)/package.mk +include $(GLUONDIR)/include/package.mk + define Package/gluon-alfred SECTION:=gluon @@ -23,10 +24,12 @@ define Build/Configure endef define Build/Compile + $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) endef define Package/gluon-alfred/install $(CP) ./files/* $(1)/ + $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ endef $(eval $(call BuildPackage,gluon-alfred)) diff --git a/package/gluon-alfred/files/lib/gluon/upgrade/500-enable-alfred b/package/gluon-alfred/luasrc/lib/gluon/upgrade/500-enable-alfred similarity index 100% rename from package/gluon-alfred/files/lib/gluon/upgrade/500-enable-alfred rename to package/gluon-alfred/luasrc/lib/gluon/upgrade/500-enable-alfred diff --git a/package/gluon-authorized-keys/Makefile b/package/gluon-authorized-keys/Makefile index 6ef90da3..83eaf04f 100644 --- a/package/gluon-authorized-keys/Makefile +++ b/package/gluon-authorized-keys/Makefile @@ -7,6 +7,7 @@ PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) include $(GLUONDIR)/include/package.mk + define Package/gluon-authorized-keys SECTION:=gluon CATEGORY:=Gluon @@ -22,10 +23,11 @@ define Build/Configure endef define Build/Compile + $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) endef define Package/gluon-authorized-keys/install - $(CP) ./files/* $(1)/ + $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ endef define Package/gluon-authorized-keys/postinst diff --git a/package/gluon-authorized-keys/files/lib/gluon/upgrade/100-authorized-keys b/package/gluon-authorized-keys/luasrc/lib/gluon/upgrade/100-authorized-keys similarity index 100% rename from package/gluon-authorized-keys/files/lib/gluon/upgrade/100-authorized-keys rename to package/gluon-authorized-keys/luasrc/lib/gluon/upgrade/100-authorized-keys diff --git a/package/gluon-autoupdater/Makefile b/package/gluon-autoupdater/Makefile index 40120fa9..baae06ba 100644 --- a/package/gluon-autoupdater/Makefile +++ b/package/gluon-autoupdater/Makefile @@ -9,6 +9,7 @@ PKG_BUILD_DEPENDS := respondd include $(GLUONDIR)/include/package.mk + define Package/gluon-autoupdater SECTION:=gluon CATEGORY:=Gluon @@ -21,8 +22,14 @@ define Build/Prepare $(CP) ./src/* $(PKG_BUILD_DIR)/ endef +define Build/Compile + $(call Build/Compile/Default) + $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) +endef + define Package/gluon-autoupdater/install $(CP) ./files/* $(1)/ + $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ $(INSTALL_DIR) $(1)/lib/gluon/respondd $(CP) $(PKG_BUILD_DIR)/respondd.so $(1)/lib/gluon/respondd/autoupdater.so diff --git a/package/gluon-autoupdater/files/lib/gluon/upgrade/500-autoupdater b/package/gluon-autoupdater/luasrc/lib/gluon/upgrade/500-autoupdater similarity index 100% rename from package/gluon-autoupdater/files/lib/gluon/upgrade/500-autoupdater rename to package/gluon-autoupdater/luasrc/lib/gluon/upgrade/500-autoupdater diff --git a/package/gluon-client-bridge/Makefile b/package/gluon-client-bridge/Makefile index 6bbfed64..cbd62a38 100644 --- a/package/gluon-client-bridge/Makefile +++ b/package/gluon-client-bridge/Makefile @@ -7,6 +7,7 @@ PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) include $(GLUONDIR)/include/package.mk + define Package/gluon-client-bridge SECTION:=gluon CATEGORY:=Gluon @@ -22,10 +23,11 @@ define Build/Configure endef define Build/Compile + $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) endef define Package/gluon-client-bridge/install - $(CP) ./files/* $(1)/ + $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ endef define Package/gluon-client-bridge/postinst diff --git a/package/gluon-client-bridge/files/lib/gluon/upgrade/300-gluon-client-bridge-network b/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/300-gluon-client-bridge-network similarity index 55% rename from package/gluon-client-bridge/files/lib/gluon/upgrade/300-gluon-client-bridge-network rename to package/gluon-client-bridge/luasrc/lib/gluon/upgrade/300-gluon-client-bridge-network index 4a897f74..f5ab8582 100755 --- a/package/gluon-client-bridge/files/lib/gluon/upgrade/300-gluon-client-bridge-network +++ b/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/300-gluon-client-bridge-network @@ -1,16 +1,16 @@ #!/usr/bin/lua local sysconfig = require 'gluon.sysconfig' + +local lutil = require 'luci.util' local uci = require('luci.model.uci').cursor() -if not uci:get('network', 'client') then - uci:section('network', 'interface', 'client', - { - type = 'bridge', - } - ) -end +uci:section('network', 'interface', 'client', + { + type = 'bridge', + } +) local ifname = uci:get('network', 'client', 'ifname') @@ -21,6 +21,13 @@ if type(ifname) == 'string' then end end +if sysconfig.lan_ifname and not ifname and not uci:get_bool('network', 'mesh_lan', 'auto') then + for _, lanif in ipairs(lutil.split(sysconfig.lan_ifname, ' ')) do + uci:add_to_set('network', 'client', 'ifname', lanif) + end +end + + uci:set('network', 'client', 'macaddr', sysconfig.primary_mac) uci:save('network') diff --git a/package/gluon-client-bridge/files/lib/gluon/upgrade/320-gluon-client-bridge-wireless b/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/320-gluon-client-bridge-wireless similarity index 66% rename from package/gluon-client-bridge/files/lib/gluon/upgrade/320-gluon-client-bridge-wireless rename to package/gluon-client-bridge/luasrc/lib/gluon/upgrade/320-gluon-client-bridge-wireless index 6fc8a72a..6c25f995 100755 --- a/package/gluon-client-bridge/files/lib/gluon/upgrade/320-gluon-client-bridge-wireless +++ b/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/320-gluon-client-bridge-wireless @@ -21,21 +21,26 @@ local function configure_client(config, radio, index, suffix) uci:delete('wireless', name) - macaddr = util.generate_mac(3*index) - - if config and macaddr then - uci:section('wireless', 'wifi-iface', name, - { - device = radio, - network = 'client', - mode = 'ap', - ssid = config.ssid, - macaddr = macaddr, - ifname = suffix and 'client' .. suffix, - disabled = disabled, - } - ) + if not config then + return end + + local macaddr = util.get_wlan_mac(radio, index, 1) + if not macaddr then + return + end + + uci:section('wireless', 'wifi-iface', name, + { + device = radio, + network = 'client', + mode = 'ap', + ssid = config.ssid, + macaddr = macaddr, + ifname = suffix and 'client' .. suffix, + disabled = disabled, + } + ) end local function configure_radio(radio, index, config) diff --git a/package/gluon-config-mode-autoupdater/Makefile b/package/gluon-config-mode-autoupdater/Makefile index 4303940b..ab5d1adc 100644 --- a/package/gluon-config-mode-autoupdater/Makefile +++ b/package/gluon-config-mode-autoupdater/Makefile @@ -30,10 +30,11 @@ endef define Build/Compile $(call GluonBuildI18N,gluon-config-mode-autoupdater,i18n) + $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) endef define Package/gluon-config-mode-autoupdater/install - $(CP) ./files/* $(1)/ + $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ $(call GluonInstallI18N,gluon-config-mode-autoupdater,$(1)) endef diff --git a/package/gluon-config-mode-autoupdater/files/lib/gluon/config-mode/wizard/0050-autoupdater-info.lua b/package/gluon-config-mode-autoupdater/luasrc/lib/gluon/config-mode/wizard/0050-autoupdater-info.lua similarity index 100% rename from package/gluon-config-mode-autoupdater/files/lib/gluon/config-mode/wizard/0050-autoupdater-info.lua rename to package/gluon-config-mode-autoupdater/luasrc/lib/gluon/config-mode/wizard/0050-autoupdater-info.lua diff --git a/package/gluon-config-mode-contact-info/Makefile b/package/gluon-config-mode-contact-info/Makefile index ff9cb57f..3ac8a0b3 100644 --- a/package/gluon-config-mode-contact-info/Makefile +++ b/package/gluon-config-mode-contact-info/Makefile @@ -13,10 +13,15 @@ PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG) define Package/gluon-config-mode-contact-info SECTION:=gluon CATEGORY:=Gluon - TITLE:=Set a custom string that will be distributed in the mesh. + TITLE:=Allows the user to provide contact information to be distributed in the mesh DEPENDS:=gluon-config-mode-core-virtual +gluon-node-info endef +define Package/gluon-config-mode-contact-info/description + Allows the user to provide contact information to be distributed in the mesh. + Can be made obligatory in site.conf +endef + define Build/Prepare mkdir -p $(PKG_BUILD_DIR) endef @@ -26,11 +31,17 @@ endef define Build/Compile $(call GluonBuildI18N,gluon-config-mode-contact-info,i18n) + $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) endef define Package/gluon-config-mode-contact-info/install - $(CP) ./files/* $(1)/ + $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ $(call GluonInstallI18N,gluon-config-mode-contact-info,$(1)) endef +define Package/gluon-config-mode-contact-info/postinst +#!/bin/sh +$(call GluonCheckSite,check_site.lua) +endef + $(eval $(call BuildPackage,gluon-config-mode-contact-info)) diff --git a/package/gluon-config-mode-contact-info/check_site.lua b/package/gluon-config-mode-contact-info/check_site.lua new file mode 100644 index 00000000..fe818616 --- /dev/null +++ b/package/gluon-config-mode-contact-info/check_site.lua @@ -0,0 +1,3 @@ +if need_table('config_mode', nil, false) and need_table('config_mode.owner', nil, false) then + need_boolean('config_mode.owner.obligatory', false) +end diff --git a/package/gluon-config-mode-contact-info/i18n/de.po b/package/gluon-config-mode-contact-info/i18n/de.po index 719246f4..35f0ee95 100644 --- a/package/gluon-config-mode-contact-info/i18n/de.po +++ b/package/gluon-config-mode-contact-info/i18n/de.po @@ -14,13 +14,13 @@ msgid "Contact info" msgstr "Kontakt" msgid "" -"You can provide your contact information here to allow others to contact " -"you. Please note that this information will be visible publicly on " +"Please provide your contact information here to allow others to contact " +"you. Note that this information will be visible publicly on " "the internet together with your node's coordinates." msgstr "" -"Hier kannst du einen öffentlichen Hinweis hinterlegen, um anderen " -"zu ermöglichen, Kontakt mit dir aufzunehmen. Bitte beachte, dass " -"dieser Hinweis auch öffentlich im Internet, zusammen mit den Koordinaten " +"Bitte hinterlege hier einen Hinweis, um anderen zu ermöglichen, " +"Kontakt mit dir aufzunehmen. Beachte, dass dieser Hinweis auch " +"öffentlich im Internet, zusammen mit den Koordinaten " "deines Knotens, einsehbar sein wird." msgid "e.g. E-mail or phone number" diff --git a/package/gluon-config-mode-contact-info/i18n/fr.po b/package/gluon-config-mode-contact-info/i18n/fr.po index 779e15fe..624b1864 100644 --- a/package/gluon-config-mode-contact-info/i18n/fr.po +++ b/package/gluon-config-mode-contact-info/i18n/fr.po @@ -14,11 +14,12 @@ msgid "Contact info" msgstr "Informations de Contact" msgid "" -"You can provide your contact information here to allow others to contact " -"you. Please note that this information will be visible publicly on " +"Please provide your contact information here to allow others to contact " +"you. Note that this information will be visible publicly on " "the internet together with your node's coordinates." msgstr "" -"Ici vous pouvez donner des informations publiques pour permettre aux autres de vous contacter. " +"S'il vous plaît entrez ici des informations publiques pour " +"permettre aux autres de vous contacter. " "Ces informations seront affichées en ligne, avec les coordonnées du nœud." msgid "e.g. E-mail or phone number" diff --git a/package/gluon-config-mode-contact-info/i18n/gluon-config-mode-contact-info.pot b/package/gluon-config-mode-contact-info/i18n/gluon-config-mode-contact-info.pot index 63939a83..9dcaf9ec 100644 --- a/package/gluon-config-mode-contact-info/i18n/gluon-config-mode-contact-info.pot +++ b/package/gluon-config-mode-contact-info/i18n/gluon-config-mode-contact-info.pot @@ -5,8 +5,8 @@ msgid "Contact info" msgstr "" msgid "" -"You can provide your contact information here to allow others to contact " -"you. Please note that this information will be visible publicly on " +"Please provide your contact information here to allow others to contact " +"you. Note that this information will be visible publicly on " "the internet together with your node's coordinates." msgstr "" diff --git a/package/gluon-config-mode-contact-info/files/lib/gluon/config-mode/wizard/0500-contact-info.lua b/package/gluon-config-mode-contact-info/luasrc/lib/gluon/config-mode/wizard/0500-contact-info.lua similarity index 81% rename from package/gluon-config-mode-contact-info/files/lib/gluon/config-mode/wizard/0500-contact-info.lua rename to package/gluon-config-mode-contact-info/luasrc/lib/gluon/config-mode/wizard/0500-contact-info.lua index a2182f95..46ff4567 100644 --- a/package/gluon-config-mode-contact-info/files/lib/gluon/config-mode/wizard/0500-contact-info.lua +++ b/package/gluon-config-mode-contact-info/luasrc/lib/gluon/config-mode/wizard/0500-contact-info.lua @@ -1,13 +1,14 @@ local cbi = require "luci.cbi" local i18n = require "luci.i18n" local uci = luci.model.uci.cursor() +local site = require 'gluon.site_config' local M = {} function M.section(form) local s = form:section(cbi.SimpleSection, nil, i18n.translate( - 'You can provide your contact information here to ' - .. 'allow others to contact you. Please note that ' + 'Please provide your contact information here to ' + .. 'allow others to contact you. Note that ' .. 'this information will be visible publicly ' .. 'on the internet together with your node\'s coordinates.' ) @@ -15,7 +16,7 @@ function M.section(form) local o = s:option(cbi.Value, "_contact", i18n.translate("Contact info")) o.default = uci:get_first("gluon-node-info", "owner", "contact", "") - o.rmempty = true + o.rmempty = not ((site.config_mode or {}).owner or {}).obligatory o.datatype = "string" o.description = i18n.translate("e.g. E-mail or phone number") o.maxlen = 140 diff --git a/package/gluon-config-mode-core/Makefile b/package/gluon-config-mode-core/Makefile index 5d700f7f..52a4f0e1 100644 --- a/package/gluon-config-mode-core/Makefile +++ b/package/gluon-config-mode-core/Makefile @@ -17,7 +17,7 @@ define Package/gluon-config-mode-core SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci based config mode for user friendly setup of new mesh nodes - DEPENDS:=gluon-setup-mode-virtual +gluon-luci-theme +gluon-lock-password $(GLUON_I18N_PACKAGES) + DEPENDS:=gluon-setup-mode-virtual +gluon-luci-theme +gluon-lock-password +pretty-hostname $(GLUON_I18N_PACKAGES) PROVIDES:=gluon-config-mode-core-virtual endef @@ -30,10 +30,12 @@ endef define Build/Compile $(call GluonBuildI18N,gluon-config-mode-core,i18n) + $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) endef define Package/gluon-config-mode-core/install $(CP) ./files/* $(1)/ + $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ $(call GluonInstallI18N,gluon-config-mode-core,$(1)) endef diff --git a/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon/cbi/config-mode.htm b/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon/cbi/config-mode.htm index d2210eca..b4aca92e 100644 --- a/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon/cbi/config-mode.htm +++ b/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon/cbi/config-mode.htm @@ -1,4 +1,5 @@ <%- + local gluon_luci = require 'gluon.luci' local sysconfig = require 'gluon.sysconfig' local i18n = require 'luci.i18n' local template = require 'luci.template' @@ -6,7 +7,12 @@

<%:Welcome!%>

- <%= template.render_string(i18n.translate('gluon-config-mode:welcome'), {hostname=hostname, sysconfig=sysconfig}) %> + <%= template.render_string(i18n.translate('gluon-config-mode:welcome'), { + hostname = hostname, + sysconfig = sysconfig, + escape = gluon_luci.escape, + urlescape = gluon_luci.urlescape, + }) %>

<% if not self.embedded then %> diff --git a/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon/config-mode/reboot.htm b/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon/config-mode/reboot.htm index e8f32d99..25ad20bf 100644 --- a/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon/config-mode/reboot.htm +++ b/package/gluon-config-mode-core/files/usr/lib/lua/luci/view/gluon/config-mode/reboot.htm @@ -3,7 +3,7 @@ - <%=hostname%> is rebooting + <%=escape(hostname)%> is rebooting diff --git a/package/gluon-config-mode-core/files/lib/gluon/config-mode/reboot/0900-msg-reboot.lua b/package/gluon-config-mode-core/luasrc/lib/gluon/config-mode/reboot/0900-msg-reboot.lua similarity index 100% rename from package/gluon-config-mode-core/files/lib/gluon/config-mode/reboot/0900-msg-reboot.lua rename to package/gluon-config-mode-core/luasrc/lib/gluon/config-mode/reboot/0900-msg-reboot.lua diff --git a/package/gluon-config-mode-core/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua b/package/gluon-config-mode-core/luasrc/usr/lib/lua/luci/controller/gluon-config-mode/index.lua similarity index 61% rename from package/gluon-config-mode-core/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua rename to package/gluon-config-mode-core/luasrc/usr/lib/lua/luci/controller/gluon-config-mode/index.lua index 39ba00a9..0a6a5495 100644 --- a/package/gluon-config-mode-core/files/usr/lib/lua/luci/controller/gluon-config-mode/index.lua +++ b/package/gluon-config-mode-core/luasrc/usr/lib/lua/luci/controller/gluon-config-mode/index.lua @@ -48,43 +48,46 @@ function action_reboot() uci:save("gluon-setup-mode") uci:commit("gluon-setup-mode") - if nixio.fork() ~= 0 then - local fs = require "nixio.fs" - local util = require "nixio.util" + local gluon_luci = require "gluon.luci" + local fs = require "nixio.fs" + local util = require "nixio.util" + local pretty_hostname = require "pretty_hostname" - local parts_dir = "/lib/gluon/config-mode/reboot/" - local files = util.consume(fs.dir(parts_dir)) + local parts_dir = "/lib/gluon/config-mode/reboot/" + local files = util.consume(fs.dir(parts_dir)) - table.sort(files) + table.sort(files) - local parts = {} + local parts = {} - for _, entry in ipairs(files) do - if entry:sub(1, 1) ~= '.' then - local f = dofile(parts_dir .. '/' .. entry) - if f ~= nil then - table.insert(parts, f) - end + for _, entry in ipairs(files) do + if entry:sub(1, 1) ~= '.' then + local f = dofile(parts_dir .. '/' .. entry) + if f ~= nil then + table.insert(parts, f) end end + end - local hostname = uci:get_first("system", "system", "hostname") + local hostname = pretty_hostname.get(uci) - luci.template.render("gluon/config-mode/reboot", { parts=parts - , hostname=hostname - }) - else - debug.setfenv(io.stdout, debug.getfenv(io.open '/dev/null')) - io.stdout:close() + luci.template.render("gluon/config-mode/reboot", + { + parts = parts, + hostname = hostname, + escape = gluon_luci.escape, + urlescape = gluon_luci.urlescape, + } + ) + + if nixio.fork() == 0 then + -- Replace stdout with /dev/null + nixio.dup(nixio.open('/dev/null', 'w'), nixio.stdout) -- Sleep a little so the browser can fetch everything required to -- display the reboot page, then reboot the device. - nixio.nanosleep(2) + nixio.nanosleep(1) - -- Run reboot with popen so it gets its own std filehandles. - io.popen("reboot") - - -- Prevent any further execution in this child. - os.exit() + nixio.execp("reboot") end end diff --git a/package/gluon-config-mode-core/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/package/gluon-config-mode-core/luasrc/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua similarity index 100% rename from package/gluon-config-mode-core/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua rename to package/gluon-config-mode-core/luasrc/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua diff --git a/package/gluon-config-mode-geo-location/Makefile b/package/gluon-config-mode-geo-location/Makefile index 03812e54..aa16ad06 100644 --- a/package/gluon-config-mode-geo-location/Makefile +++ b/package/gluon-config-mode-geo-location/Makefile @@ -26,10 +26,11 @@ endef define Build/Compile $(call GluonBuildI18N,gluon-config-mode-geo-location,i18n) + $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) endef define Package/gluon-config-mode-geo-location/install - $(CP) ./files/* $(1)/ + $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ $(call GluonInstallI18N,gluon-config-mode-geo-location,$(1)) endef diff --git a/package/gluon-config-mode-geo-location/files/lib/gluon/config-mode/wizard/0400-geo-location.lua b/package/gluon-config-mode-geo-location/luasrc/lib/gluon/config-mode/wizard/0400-geo-location.lua similarity index 100% rename from package/gluon-config-mode-geo-location/files/lib/gluon/config-mode/wizard/0400-geo-location.lua rename to package/gluon-config-mode-geo-location/luasrc/lib/gluon/config-mode/wizard/0400-geo-location.lua diff --git a/package/gluon-config-mode-hostname/Makefile b/package/gluon-config-mode-hostname/Makefile index 803f018f..6e30466d 100644 --- a/package/gluon-config-mode-hostname/Makefile +++ b/package/gluon-config-mode-hostname/Makefile @@ -26,10 +26,11 @@ endef define Build/Compile $(call GluonBuildI18N,gluon-config-mode-hostname,i18n) + $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) endef define Package/gluon-config-mode-hostname/install - $(CP) ./files/* $(1)/ + $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ $(call GluonInstallI18N,gluon-config-mode-hostname,$(1)) endef diff --git a/package/gluon-config-mode-hostname/files/lib/gluon/config-mode/wizard/0100-hostname.lua b/package/gluon-config-mode-hostname/luasrc/lib/gluon/config-mode/wizard/0100-hostname.lua similarity index 65% rename from package/gluon-config-mode-hostname/files/lib/gluon/config-mode/wizard/0100-hostname.lua rename to package/gluon-config-mode-hostname/luasrc/lib/gluon/config-mode/wizard/0100-hostname.lua index cf8bbf89..2ffde723 100644 --- a/package/gluon-config-mode-hostname/files/lib/gluon/config-mode/wizard/0100-hostname.lua +++ b/package/gluon-config-mode-hostname/luasrc/lib/gluon/config-mode/wizard/0100-hostname.lua @@ -1,5 +1,6 @@ local cbi = require "luci.cbi" local i18n = require "luci.i18n" +local pretty_hostname = require "pretty_hostname" local uci = luci.model.uci.cursor() local M = {} @@ -7,14 +8,12 @@ local M = {} function M.section(form) local s = form:section(cbi.SimpleSection, nil, nil) local o = s:option(cbi.Value, "_hostname", i18n.translate("Node name")) - o.value = uci:get_first("system", "system", "hostname") + o.value = pretty_hostname.get(uci) o.rmempty = false - o.datatype = "hostname" end function M.handle(data) - uci:set("system", uci:get_first("system", "system"), "hostname", data._hostname) - uci:save("system") + pretty_hostname.set(uci, data._hostname) uci:commit("system") end diff --git a/package/gluon-config-mode-mesh-vpn/Makefile b/package/gluon-config-mode-mesh-vpn/Makefile index 35d53ea7..ec819a9c 100644 --- a/package/gluon-config-mode-mesh-vpn/Makefile +++ b/package/gluon-config-mode-mesh-vpn/Makefile @@ -26,10 +26,11 @@ endef define Build/Compile $(call GluonBuildI18N,gluon-config-mode-mesh-vpn,i18n) + $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) endef define Package/gluon-config-mode-mesh-vpn/install - $(CP) ./files/* $(1)/ + $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ $(call GluonInstallI18N,gluon-config-mode-mesh-vpn,$(1)) endef diff --git a/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua b/package/gluon-config-mode-mesh-vpn/luasrc/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua similarity index 56% rename from package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua rename to package/gluon-config-mode-mesh-vpn/luasrc/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua index c6e06975..07b6d228 100644 --- a/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua +++ b/package/gluon-config-mode-mesh-vpn/luasrc/lib/gluon/config-mode/reboot/0100-mesh-vpn.lua @@ -6,21 +6,28 @@ if meshvpn_enabled ~= "1" then else local i18n = require "luci.i18n" local util = require "luci.util" + + local gluon_luci = require 'gluon.luci' local site = require 'gluon.site_config' local sysconfig = require 'gluon.sysconfig' + local pretty_hostname = require 'pretty_hostname' + local pubkey = util.trim(util.exec("/etc/init.d/fastd show_key " .. "mesh_vpn")) - local hostname = uci:get_first("system", "system", "hostname") + local hostname = pretty_hostname.get(uci) local contact = uci:get_first("gluon-node-info", "owner", "contact") local msg = i18n.translate('gluon-config-mode:pubkey') return function () - luci.template.render_string(msg, { pubkey=pubkey - , hostname=hostname - , site=site - , sysconfig=sysconfig - , contact=contact - }) - end + luci.template.render_string(msg, { + pubkey = pubkey, + hostname = hostname, + site = site, + sysconfig = sysconfig, + contact = contact, + escape = gluon_luci.escape, + urlescape = gluon_luci.urlescape, + }) + end end diff --git a/package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/wizard/0300-mesh-vpn.lua b/package/gluon-config-mode-mesh-vpn/luasrc/lib/gluon/config-mode/wizard/0300-mesh-vpn.lua similarity index 100% rename from package/gluon-config-mode-mesh-vpn/files/lib/gluon/config-mode/wizard/0300-mesh-vpn.lua rename to package/gluon-config-mode-mesh-vpn/luasrc/lib/gluon/config-mode/wizard/0300-mesh-vpn.lua diff --git a/package/gluon-core/Makefile b/package/gluon-core/Makefile index 725fb737..2b9cfb47 100644 --- a/package/gluon-core/Makefile +++ b/package/gluon-core/Makefile @@ -8,14 +8,14 @@ PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) include $(GLUONDIR)/include/package.mk + define Package/gluon-core SECTION:=gluon CATEGORY:=Gluon TITLE:=Base files of Gluon - DEPENDS:=+gluon-site +libgluonutil +lua-platform-info +lua-hash +luci-base +luci-lib-jsonc +odhcp6c +firewall + DEPENDS:=+gluon-site +libgluonutil +lua-platform-info +lua-hash +luci-base +luci-lib-jsonc +odhcp6c +firewall +pretty-hostname endef - define Package/gluon-core/description Gluon community wifi mesh firmware framework: core endef @@ -28,10 +28,12 @@ define Build/Configure endef define Build/Compile + $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) endef define Package/gluon-core/install $(CP) ./files/* $(1)/ + $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ $(SED) 's/__GLUON_OPENWRT_FEEDS__/{$(GLUON_OPENWRT_FEEDS:%="%",)}/' $(1)/lib/gluon/upgrade/500-opkg $(INSTALL_DIR) $(1)/lib/gluon diff --git a/package/gluon-core/check_site.lua b/package/gluon-core/check_site.lua index 1647d778..3586149e 100644 --- a/package/gluon-core/check_site.lua +++ b/package/gluon-core/check_site.lua @@ -28,5 +28,15 @@ for _, config in ipairs({'wifi24', 'wifi5'}) do need_string('regdom') -- regdom is only required when wifi24 or wifi5 is configured need_number(config .. '.channel') + + local rates = {1000, 2000, 5500, 6000, 9000, 11000, 12000, 18000, 24000, 36000, 48000, 54000} + local supported_rates = need_array_of(config .. '.supported_rates', rates, false) + if supported_rates then + need_array_of(config .. '.basic_rate', supported_rates, true) + else + need_array_of(config .. '.basic_rate', rates, false) + end end end + +need_boolean('poe_passthrough', false) diff --git a/package/gluon-core/files/lib/gluon/core/mesh/setup.d/.keep b/package/gluon-core/files/lib/gluon/core/mesh/setup.d/.keep new file mode 100644 index 00000000..e69de29b diff --git a/package/gluon-core/files/lib/gluon/core/mesh/teardown.d/.keep b/package/gluon-core/files/lib/gluon/core/mesh/teardown.d/.keep new file mode 100644 index 00000000..e69de29b diff --git a/package/gluon-core/files/lib/gluon/upgrade/200-wireless b/package/gluon-core/files/lib/gluon/upgrade/200-wireless deleted file mode 100755 index 5a4ec0a4..00000000 --- a/package/gluon-core/files/lib/gluon/upgrade/200-wireless +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/lua - -local util = require 'gluon.util' -local uci = require('luci.model.uci').cursor() -local site = require 'gluon.site_config' -local sysconfig = require 'gluon.sysconfig' - --- Initial -if not sysconfig.gluon_version then - uci:delete_all('wireless', 'wifi-iface') -end - -local function get_channel(radio, config) - if uci:get_first('gluon-core', 'wireless', 'preserve_channels') then - return uci:get('wireless', radio, 'channel') or config.channel - else - return config.channel - end -end - -local function configure_radio(radio, index, config) - if config then - local channel = get_channel(radio, config) - - uci:delete('wireless', radio, 'disabled') - - uci:set('wireless', radio, 'channel', channel) - uci:set('wireless', radio, 'htmode', 'HT20') - uci:set('wireless', radio, 'country', site.regdom) - end -end - -util.iterate_radios(configure_radio) - -uci:save('wireless') diff --git a/package/gluon-core/files/lib/netifd/proto/gluon_mesh.sh b/package/gluon-core/files/lib/netifd/proto/gluon_mesh.sh new file mode 100755 index 00000000..aaa24c84 --- /dev/null +++ b/package/gluon-core/files/lib/netifd/proto/gluon_mesh.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +. /lib/functions.sh +. ../netifd-proto.sh +init_proto "$@" + +proto_gluon_mesh_init_config() { + proto_config_add_boolean fixed_mtu + proto_config_add_boolean transitive +} + +proto_gluon_mesh_setup() { + export CONFIG="$1" + export IFNAME="$2" + + local fixed_mtu transitive + json_get_vars fixed_mtu transitive + + export FIXED_MTU="$fixed_mtu" + export TRANSITIVE="$transitive" + + for script in /lib/gluon/core/mesh/setup.d/*; do + [ ! -x "$script" ] || "$script" + done + + proto_init_update "$IFNAME" 1 + proto_send_update "$CONFIG" +} + +proto_gluon_mesh_teardown() { + export CONFIG="$1" + export IFNAME="$2" + + for script in /lib/gluon/core/mesh/teardown.d/*; do + [ ! -x "$script" ] || "$script" + done +} + +add_protocol gluon_mesh diff --git a/package/gluon-core/files/usr/lib/lua/gluon/util.lua b/package/gluon-core/files/usr/lib/lua/gluon/util.lua deleted file mode 100644 index 72b6220d..00000000 --- a/package/gluon-core/files/usr/lib/lua/gluon/util.lua +++ /dev/null @@ -1,129 +0,0 @@ --- Writes all lines from the file input to the file output except those starting with prefix --- Doesn't close the output file, but returns the file object -local function do_filter_prefix(input, output, prefix) - local f = io.open(output, 'w+') - local l = prefix:len() - - for line in io.lines(input) do - if line:sub(1, l) ~= prefix then - f:write(line, '\n') - end - end - - return f -end - - -local function escape_args(ret, arg0, ...) - if not arg0 then - return ret - end - - return escape_args(ret .. "'" .. string.gsub(arg0, "'", "'\\''") .. "' ", ...) -end - - -local os = os -local string = string -local tonumber = tonumber -local ipairs = ipairs -local table = table - -local nixio = require 'nixio' -local hash = require 'hash' -local sysconfig = require 'gluon.sysconfig' -local site = require 'gluon.site_config' -local uci = require('luci.model.uci').cursor() - - -module 'gluon.util' - -function exec(...) - return os.execute(escape_args('', 'exec', ...)) -end - --- Removes all lines starting with a prefix from a file, optionally adding a new one -function replace_prefix(file, prefix, add) - local tmp = file .. '.tmp' - local f = do_filter_prefix(file, tmp, prefix) - if add then - f:write(add) - end - f:close() - os.rename(tmp, file) -end - -function readline(fd) - local line = fd:read('*l') - fd:close() - return line -end - -function lock(file) - exec('lock', file) -end - -function unlock(file) - exec('lock', '-u', file) -end - -function node_id() - return string.gsub(sysconfig.primary_mac, ':', '') -end - --- Generates a (hopefully) unique MAC address --- The parameter defines the ID to add to the mac addr --- --- IDs defined so far: --- 0: client0; mesh-vpn --- 1: mesh0 --- 2: ibss0 --- 3: client1; mesh-on-wan --- 4: mesh1 --- 5: ibss1 --- 6: mesh-on-lan --- 7: unused -function generate_mac(i) - if i > 7 or i < 0 then return nil end -- max allowed id (0b111) - - local hashed = string.sub(hash.md5(sysconfig.primary_mac), 0, 12) - local m1, m2, m3, m4, m5, m6 = string.match(hashed, '(%x%x)(%x%x)(%x%x)(%x%x)(%x%x)(%x%x)') - - m1 = tonumber(m1, 16) - m6 = tonumber(m6, 16) - - m1 = nixio.bit.bor(m1, 0x02) -- set locally administered bit - m1 = nixio.bit.band(m1, 0xFE) -- unset the multicast bit - - -- It's necessary that the first 45 bits of the mac do - -- not vary on a single hardware interface, since some chips are using - -- a hardware mac filter. (e.g 'ramips-rt305x') - - m6 = nixio.bit.band(m6, 0xF8) -- zero the last three bits (space needed for counting) - m6 = m6 + i -- add virtual interface id - - return string.format('%02x:%s:%s:%s:%s:%02x', m1, m2, m3, m4, m5, m6) -end - --- Iterate over all radios defined in UCI calling --- f(radio, index, site.wifiX) for each radio found while passing --- site.wifi24 for 2.4 GHz devices and site.wifi5 for 5 GHz ones. -function iterate_radios(f) - local radios = {} - - uci:foreach('wireless', 'wifi-device', - function(s) - table.insert(radios, s['.name']) - end - ) - - for index, radio in ipairs(radios) do - local hwmode = uci:get('wireless', radio, 'hwmode') - - if hwmode == '11g' or hwmode == '11ng' then - f(radio, index, site.wifi24) - elseif hwmode == '11a' or hwmode == '11na' then - f(radio, index, site.wifi5) - end - end -end diff --git a/package/gluon-core/files/lib/gluon/upgrade/001-upgrade b/package/gluon-core/luasrc/lib/gluon/upgrade/001-upgrade similarity index 100% rename from package/gluon-core/files/lib/gluon/upgrade/001-upgrade rename to package/gluon-core/luasrc/lib/gluon/upgrade/001-upgrade diff --git a/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac b/package/gluon-core/luasrc/lib/gluon/upgrade/010-primary-mac similarity index 53% rename from package/gluon-core/files/lib/gluon/upgrade/010-primary-mac rename to package/gluon-core/luasrc/lib/gluon/upgrade/010-primary-mac index a913db90..c4f44065 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/010-primary-mac +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/010-primary-mac @@ -18,13 +18,26 @@ local try_files = { '/sys/class/net/eth0/address' } -if not util.contains({'x86', 'brcm2708'}, platform.get_target()) then +if not ( + util.contains({'x86', 'brcm2708'}, platform.get_target()) or + platform.match('ar71xx', 'mikrotik') +) then table.insert(try_files, 1, '/sys/class/ieee80211/phy0/macaddress') end if platform.match('ar71xx', 'generic', {'tl-wdr3600', 'tl-wdr4300'}) then table.insert(try_files, 1, '/sys/class/ieee80211/phy1/macaddress') -elseif platform.match('ar71xx', 'generic', {'unifi-outdoor-plus', 'carambola2'}) then +elseif platform.match('ramips', 'mt7621', {'dir-860l-b1'}) then + table.insert(try_files, 1, '/sys/class/ieee80211/phy1/macaddress') +elseif platform.match('ar71xx', 'generic', {'unifi-outdoor-plus', 'carambola2', + 'mr600', 'mr600v2', + 'mr900', 'mr900v2', + 'mr1750', 'mr1750v2', + 'om2p', 'om2pv2', + 'om2p-hs', 'om2p-hsv2', 'om2p-hsv3', + 'om2p-lc', + 'om5p', 'om5p-an', + 'om5p-ac', 'om5p-acv2'}) then table.insert(try_files, 1, '/sys/class/net/eth0/address') elseif platform.match('ar71xx', 'generic', {'archer-c5', 'archer-c7'}) then table.insert(try_files, 1, '/sys/class/net/eth1/address') diff --git a/package/gluon-core/files/lib/gluon/upgrade/020-interfaces b/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces similarity index 91% rename from package/gluon-core/files/lib/gluon/upgrade/020-interfaces rename to package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces index 1818ad00..34e1c8bb 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/020-interfaces +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces @@ -16,7 +16,7 @@ if not (sysconfig.lan_ifname or sysconfig.wan_ifname) then local lan_ifname = uci:get('network', 'lan', 'ifname') local wan_ifname = uci:get('network', 'wan', 'ifname') - if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus'}) then + if platform.match('ar71xx', 'generic', {'cpe510', 'nanostation-m', 'nanostation-m-xw', 'unifi-outdoor-plus', 'uap-pro', 'unifiac-pro'}) then lan_ifname, wan_ifname = wan_ifname, lan_ifname end diff --git a/package/gluon-core/files/lib/gluon/upgrade/030-system b/package/gluon-core/luasrc/lib/gluon/upgrade/030-system similarity index 74% rename from package/gluon-core/files/lib/gluon/upgrade/030-system rename to package/gluon-core/luasrc/lib/gluon/upgrade/030-system index 0086a5dc..90ad1ba5 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/030-system +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/030-system @@ -1,5 +1,6 @@ #!/usr/bin/lua +local pretty_hostname = require 'pretty_hostname' local sysconfig = require 'gluon.sysconfig' -- Initial @@ -10,7 +11,7 @@ if not sysconfig.gluon_version then local system = uci:get_first('system', 'system') - uci:set('system', system, 'hostname', (site.hostname_prefix or '') .. util.node_id()) + pretty_hostname.set(uci, (site.hostname_prefix or '') .. util.node_id()) uci:set('system', system, 'timezone', site.timezone) uci:save('system') diff --git a/package/gluon-core/files/lib/gluon/upgrade/110-network b/package/gluon-core/luasrc/lib/gluon/upgrade/110-network similarity index 95% rename from package/gluon-core/files/lib/gluon/upgrade/110-network rename to package/gluon-core/luasrc/lib/gluon/upgrade/110-network index bf87d47f..c61b81d1 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/110-network +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/110-network @@ -9,11 +9,12 @@ uci:section('network', 'interface', 'wan', { ifname = sysconfig.wan_ifname, type = 'bridge', - igmp_snooping = 0, + multicast_querier = 0, peerdns = 0, auto = 1, } ) +uci:delete('network', 'wan', 'igmp_snooping') if not uci:get('network', 'wan', 'proto') then uci:set('network', 'wan', 'proto', 'dhcp') diff --git a/package/gluon-core/files/lib/gluon/upgrade/120-ntp-servers b/package/gluon-core/luasrc/lib/gluon/upgrade/120-ntp-servers similarity index 100% rename from package/gluon-core/files/lib/gluon/upgrade/120-ntp-servers rename to package/gluon-core/luasrc/lib/gluon/upgrade/120-ntp-servers diff --git a/package/gluon-core/files/lib/gluon/upgrade/130-reboot-on-oom b/package/gluon-core/luasrc/lib/gluon/upgrade/130-reboot-on-oom similarity index 100% rename from package/gluon-core/files/lib/gluon/upgrade/130-reboot-on-oom rename to package/gluon-core/luasrc/lib/gluon/upgrade/130-reboot-on-oom diff --git a/package/gluon-core/files/lib/gluon/upgrade/140-firewall-rules b/package/gluon-core/luasrc/lib/gluon/upgrade/140-firewall-rules similarity index 100% rename from package/gluon-core/files/lib/gluon/upgrade/140-firewall-rules rename to package/gluon-core/luasrc/lib/gluon/upgrade/140-firewall-rules diff --git a/package/gluon-core/luasrc/lib/gluon/upgrade/150-poe-passthrough b/package/gluon-core/luasrc/lib/gluon/upgrade/150-poe-passthrough new file mode 100755 index 00000000..81e6740b --- /dev/null +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/150-poe-passthrough @@ -0,0 +1,13 @@ +#!/usr/bin/lua + +local sysconfig = require 'gluon.sysconfig' +local site = require 'gluon.site_config' + +if (not sysconfig.gluon_version) and (site.poe_passthrough == true) then + local uci = require('luci.model.uci').cursor() + + if uci:get('system', 'gpio_switch_poe_passthrough') then + uci:set('system', 'gpio_switch_poe_passthrough', 'value', 1) + uci:save('system') + end +end diff --git a/package/gluon-core/luasrc/lib/gluon/upgrade/200-wireless b/package/gluon-core/luasrc/lib/gluon/upgrade/200-wireless new file mode 100755 index 00000000..6e809572 --- /dev/null +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/200-wireless @@ -0,0 +1,213 @@ +#!/usr/bin/lua + +local util = require 'gluon.util' +local site = require 'gluon.site_config' +local sysconfig = require 'gluon.sysconfig' + +local uci = require('luci.model.uci').cursor() + +-- Initial +if not sysconfig.gluon_version then + uci:delete_all('wireless', 'wifi-iface') +end + +local function get_channel(radio, config) + if uci:get_first('gluon-core', 'wireless', 'preserve_channels') then + return uci:get('wireless', radio, 'channel') or config.channel + else + return config.channel + end +end + +local function is_disabled(name) + if uci:get('wireless', name) then + return uci:get_bool('wireless', name, 'disabled') + end +end + +-- Returns the first argument that is not nil; don't call without any non-nil arguments! +local function first_non_nil(first, ...) + if first ~= nil then + return first + else + return first_non_nil(...) + end +end + + +local function configure_ibss(config, radio, index, suffix, disabled) + local name = 'ibss_' .. radio + + uci:delete('network', name) + uci:delete('network', name .. '_vlan') + uci:delete('wireless', name) + + if not config then + return + end + + local macaddr = util.get_wlan_mac(radio, index, 3) + if not macaddr then + return + end + + if config.vlan then + uci:section('network', 'interface', name, + { + proto = 'none', + } + ) + + uci:section('network', 'interface', name .. '_vlan', + { + ifname = '@' .. name .. '.' .. config.vlan, + proto = 'gluon_mesh', + } + ) + else + uci:section('network', 'interface', name, + { + proto = 'gluon_mesh', + } + ) + end + + uci:section('wireless', 'wifi-iface', name, + { + device = radio, + network = name, + mode = 'adhoc', + ssid = config.ssid, + bssid = config.bssid, + macaddr = macaddr, + mcast_rate = config.mcast_rate, + ifname = suffix and 'ibss' .. suffix, + disabled = disabled and 1 or 0, + } + ) +end + +local function configure_mesh(config, radio, index, suffix, disabled) + local name = 'mesh_' .. radio + local macfilter = uci:get('wireless', name, 'macfilter') + local maclist = uci:get('wireless', name, 'maclist') + + uci:delete('network', name) + uci:delete('wireless', name) + + if not config then + return + end + + local macaddr = util.get_wlan_mac(radio, index, 2) + if not macaddr then + return + end + + uci:section('network', 'interface', name, + { + proto = 'gluon_mesh', + } + ) + + uci:section('wireless', 'wifi-iface', name, + { + device = radio, + network = name, + mode = 'mesh', + mesh_id = config.id, + mesh_fwding = 0, + macaddr = macaddr, + mcast_rate = config.mcast_rate, + ifname = suffix and 'mesh' .. suffix, + disabled = disabled and 1 or 0, + macfilter = macfilter, + maclist = maclist, + } + ) +end + +local function fixup_wan(radio, index) + local name = 'wan_' .. radio + + if not uci:get('wireless', name) then + return + end + + local macaddr = util.get_wlan_mac(radio, index, 4) + if not macaddr then + return + end + + uci:set('wireless', name, 'macaddr', macaddr) +end + +local function configure_radio(radio, index, config) + if not config then + return + end + + local suffix = radio:match('^radio(%d+)$') + if not suffix then + return + end + + local channel = get_channel(radio, config) + + uci:delete('wireless', radio, 'disabled') + + uci:set('wireless', radio, 'channel', channel) + uci:set('wireless', radio, 'htmode', 'HT20') + uci:set('wireless', radio, 'country', site.regdom) + + if config.supported_rates then + uci:set_list('wireless', radio, 'supported_rates', config.supported_rates) + else + uci:delete('wireless', radio, 'supported_rates') + end + + if config.basic_rate then + uci:set_list('wireless', radio, 'basic_rate', config.basic_rate) + else + uci:delete('wireless', radio, 'basic_rate') + end + + + local ibss_disabled = is_disabled('ibss_' .. radio) + local mesh_disabled = is_disabled('mesh_' .. radio) + + configure_ibss(config.ibss, radio, index, suffix, + first_non_nil( + ibss_disabled, + mesh_disabled, + (config.ibss or {}).disabled, -- will be nil if config.ibss or config.ibss.disabled is unset + false + ) + ) + configure_mesh(config.mesh, radio, index, suffix, + first_non_nil( + mesh_disabled, + ibss_disabled, + (config.mesh or {}).disabled, -- will be nil if config.mesh or config.mesh.disabled is unset + false + ) + ) + + fixup_wan(radio, index) +end + +util.iterate_radios(configure_radio) + + +if uci:get('system', 'rssid_wlan0') then + if uci:get('wireless', 'mesh_radio0') then + uci:set('system', 'rssid_wlan0', 'dev', 'mesh0') + else + uci:set('system', 'rssid_wlan0', 'dev', 'ibss0') + end + + uci:save('system') +end + +uci:save('wireless') +uci:save('network') diff --git a/package/gluon-core/luasrc/lib/gluon/upgrade/210-interface-wan b/package/gluon-core/luasrc/lib/gluon/upgrade/210-interface-wan new file mode 100755 index 00000000..0c780f07 --- /dev/null +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/210-interface-wan @@ -0,0 +1,16 @@ +#!/usr/bin/lua + +local site = require 'gluon.site_config' +local uci = require('luci.model.uci').cursor() + +if not uci:get('network', 'mesh_wan') then + uci:section('network', 'interface', 'mesh_wan', { + ifname = 'br-wan', + proto = 'gluon_mesh', + transitive = 1, + fixed_mtu = 1, + auto = site.mesh_on_wan and 1 or 0, + }) +end + +uci:save('network') diff --git a/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/340-gluon-mesh-batman-adv-core-mesh-on-lan b/package/gluon-core/luasrc/lib/gluon/upgrade/220-interface-lan similarity index 83% rename from package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/340-gluon-mesh-batman-adv-core-mesh-on-lan rename to package/gluon-core/luasrc/lib/gluon/upgrade/220-interface-lan index 99ca4213..21759aa9 100755 --- a/package/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/340-gluon-mesh-batman-adv-core-mesh-on-lan +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/220-interface-lan @@ -12,13 +12,12 @@ if not sysconfig.lan_ifname then end uci:section('network', 'interface', 'mesh_lan', { - ifname = sysconfig.lan_ifname, - type = 'bridge', + ifname = sysconfig.lan_ifname, + type = 'bridge', igmp_snooping = 0, - proto = 'batadv', - mesh = 'bat0', - mesh_no_rebroadcast = '1', - macaddr = util.generate_mac(6), + proto = 'gluon_mesh', + transitive = 1, + fixed_mtu = 1, }) if uci:get('network', 'mesh_lan', 'auto') == nil then diff --git a/package/gluon-core/files/lib/gluon/upgrade/500-opkg b/package/gluon-core/luasrc/lib/gluon/upgrade/500-opkg similarity index 100% rename from package/gluon-core/files/lib/gluon/upgrade/500-opkg rename to package/gluon-core/luasrc/lib/gluon/upgrade/500-opkg diff --git a/package/gluon-core/luasrc/lib/gluon/upgrade/800-migrate-batadv b/package/gluon-core/luasrc/lib/gluon/upgrade/800-migrate-batadv new file mode 100755 index 00000000..7843e6a1 --- /dev/null +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/800-migrate-batadv @@ -0,0 +1,24 @@ +#!/usr/bin/lua + +local uci = require('luci.model.uci').cursor() + +local function migrate_iface(iface) + if iface.proto ~= 'batadv' or iface.mesh ~= 'bat0' then + return + end + + local s = iface['.name'] + + uci:set('network', s, 'proto', 'gluon_mesh') + uci:set('network', s, 'fixed_mtu', '1') + + if iface.mesh_no_rebroadcast then + uci:set('network', s, 'transitive', iface.mesh_no_rebroadcast) + end + + uci:delete('network', s, 'mesh') + uci:delete('network', s, 'mesh_no_rebroadcast') +end + +uci:foreach('network', 'interface', migrate_iface) +uci:save('network') diff --git a/package/gluon-core/files/lib/gluon/upgrade/999-version b/package/gluon-core/luasrc/lib/gluon/upgrade/999-version similarity index 100% rename from package/gluon-core/files/lib/gluon/upgrade/999-version rename to package/gluon-core/luasrc/lib/gluon/upgrade/999-version diff --git a/package/gluon-core/files/usr/lib/lua/gluon/platform.lua b/package/gluon-core/luasrc/usr/lib/lua/gluon/platform.lua similarity index 86% rename from package/gluon-core/files/usr/lib/lua/gluon/platform.lua rename to package/gluon-core/luasrc/usr/lib/lua/gluon/platform.lua index 3d56f081..6483ad2e 100644 --- a/package/gluon-core/files/usr/lib/lua/gluon/platform.lua +++ b/package/gluon-core/luasrc/usr/lib/lua/gluon/platform.lua @@ -21,7 +21,7 @@ function match(target, subtarget, boards) return false end - if not util.contains(boards, get_board_name()) then + if boards and not util.contains(boards, get_board_name()) then return false end diff --git a/package/gluon-core/files/usr/lib/lua/gluon/site_config.lua b/package/gluon-core/luasrc/usr/lib/lua/gluon/site_config.lua similarity index 100% rename from package/gluon-core/files/usr/lib/lua/gluon/site_config.lua rename to package/gluon-core/luasrc/usr/lib/lua/gluon/site_config.lua diff --git a/package/gluon-core/files/usr/lib/lua/gluon/sysconfig.lua b/package/gluon-core/luasrc/usr/lib/lua/gluon/sysconfig.lua similarity index 100% rename from package/gluon-core/files/usr/lib/lua/gluon/sysconfig.lua rename to package/gluon-core/luasrc/usr/lib/lua/gluon/sysconfig.lua diff --git a/package/gluon-core/files/usr/lib/lua/gluon/sysctl.lua b/package/gluon-core/luasrc/usr/lib/lua/gluon/sysctl.lua similarity index 100% rename from package/gluon-core/files/usr/lib/lua/gluon/sysctl.lua rename to package/gluon-core/luasrc/usr/lib/lua/gluon/sysctl.lua diff --git a/package/gluon-core/files/usr/lib/lua/gluon/users.lua b/package/gluon-core/luasrc/usr/lib/lua/gluon/users.lua similarity index 100% rename from package/gluon-core/files/usr/lib/lua/gluon/users.lua rename to package/gluon-core/luasrc/usr/lib/lua/gluon/users.lua diff --git a/package/gluon-core/luasrc/usr/lib/lua/gluon/util.lua b/package/gluon-core/luasrc/usr/lib/lua/gluon/util.lua new file mode 100644 index 00000000..0ae50b4d --- /dev/null +++ b/package/gluon-core/luasrc/usr/lib/lua/gluon/util.lua @@ -0,0 +1,195 @@ +-- Writes all lines from the file input to the file output except those starting with prefix +-- Doesn't close the output file, but returns the file object +local function do_filter_prefix(input, output, prefix) + local f = io.open(output, 'w+') + local l = prefix:len() + + for line in io.lines(input) do + if line:sub(1, l) ~= prefix then + f:write(line, '\n') + end + end + + return f +end + + +local function escape_args(ret, arg0, ...) + if not arg0 then + return ret + end + + return escape_args(ret .. "'" .. string.gsub(arg0, "'", "'\\''") .. "' ", ...) +end + + +local io = io +local os = os +local string = string +local tonumber = tonumber +local ipairs = ipairs +local table = table + +local nixio = require 'nixio' +local hash = require 'hash' +local sysconfig = require 'gluon.sysconfig' +local site = require 'gluon.site_config' +local uci = require('luci.model.uci').cursor() +local lutil = require 'luci.util' +local fs = require 'nixio.fs' + + +module 'gluon.util' + +function exec(...) + return os.execute(escape_args('', 'exec', ...)) +end + +-- Removes all lines starting with a prefix from a file, optionally adding a new one +function replace_prefix(file, prefix, add) + local tmp = file .. '.tmp' + local f = do_filter_prefix(file, tmp, prefix) + if add then + f:write(add) + end + f:close() + os.rename(tmp, file) +end + +function readline(fd) + local line = fd:read('*l') + fd:close() + return line +end + +function lock(file) + exec('lock', file) +end + +function unlock(file) + exec('lock', '-u', file) +end + +function node_id() + return string.gsub(sysconfig.primary_mac, ':', '') +end + + +local function find_phy_by_path(path) + for phy in fs.glob('/sys/devices/' .. path .. '/ieee80211/phy*') do + return phy:match('([^/]+)$') + end +end + +local function find_phy_by_macaddr(macaddr) + local addr = macaddr:lower() + for file in fs.glob('/sys/class/ieee80211/*/macaddress') do + if lutil.trim(fs.readfile(file)) == addr then + return file:match('([^/]+)/macaddress$') + end + end +end + +local function find_phy(radio) + local config = uci:get_all('wireless', radio) + + if not config or config.type ~= 'mac80211' then + return nil + elseif config.path then + return find_phy_by_path(config.path) + elseif config.macaddr then + return find_phy_by_macaddr(config.macaddr) + else + return nil + end +end + +local function get_addresses(radio) + local phy = find_phy(radio) + if not phy then + return function() end + end + + return io.lines('/sys/class/ieee80211/' .. phy .. '/addresses') +end + +-- Generates a (hopefully) unique MAC address +-- The parameter defines the ID to add to the MAC address +-- +-- IDs defined so far: +-- 0: client0; WAN +-- 1: mesh0 +-- 2: ibss0 +-- 3: wan_radio0 (private WLAN); batman-adv primary address +-- 4: client1; LAN +-- 5: mesh1 +-- 6: ibss1 +-- 7: wan_radio1 (private WLAN); mesh VPN +function generate_mac(i) + if i > 7 or i < 0 then return nil end -- max allowed id (0b111) + + local hashed = string.sub(hash.md5(sysconfig.primary_mac), 0, 12) + local m1, m2, m3, m4, m5, m6 = string.match(hashed, '(%x%x)(%x%x)(%x%x)(%x%x)(%x%x)(%x%x)') + + m1 = tonumber(m1, 16) + m6 = tonumber(m6, 16) + + m1 = nixio.bit.bor(m1, 0x02) -- set locally administered bit + m1 = nixio.bit.band(m1, 0xFE) -- unset the multicast bit + + -- It's necessary that the first 45 bits of the MAC address don't + -- vary on a single hardware interface, since some chips are using + -- a hardware MAC filter. (e.g 'rt305x') + + m6 = nixio.bit.band(m6, 0xF8) -- zero the last three bits (space needed for counting) + m6 = m6 + i -- add virtual interface id + + return string.format('%02x:%s:%s:%s:%s:%02x', m1, m2, m3, m4, m5, m6) +end + +local function get_wlan_mac_from_driver(radio, vif) + local primary = sysconfig.primary_mac:lower() + + local i = 1 + for addr in get_addresses(radio) do + if addr:lower() ~= primary then + if i == vif then + return addr + end + + i = i + 1 + end + end +end + +function get_wlan_mac(radio, index, vif) + local addr = get_wlan_mac_from_driver(radio, vif) + if addr then + return addr + end + + return generate_mac(4*(index-1) + (vif-1)) +end + +-- Iterate over all radios defined in UCI calling +-- f(radio, index, site.wifiX) for each radio found while passing +-- site.wifi24 for 2.4 GHz devices and site.wifi5 for 5 GHz ones. +function iterate_radios(f) + local radios = {} + + uci:foreach('wireless', 'wifi-device', + function(s) + table.insert(radios, s['.name']) + end + ) + + for index, radio in ipairs(radios) do + local hwmode = uci:get('wireless', radio, 'hwmode') + + if hwmode == '11g' or hwmode == '11ng' then + f(radio, index, site.wifi24) + elseif hwmode == '11a' or hwmode == '11na' then + f(radio, index, site.wifi5) + end + end +end diff --git a/package/gluon-ebtables-filter-multicast/Makefile b/package/gluon-ebtables-filter-multicast/Makefile index 93b7f9a5..2b622902 100644 --- a/package/gluon-ebtables-filter-multicast/Makefile +++ b/package/gluon-ebtables-filter-multicast/Makefile @@ -8,6 +8,7 @@ PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) include $(INCLUDE_DIR)/package.mk + define Package/gluon-ebtables-filter-multicast SECTION:=gluon CATEGORY:=Gluon diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/100-mcast-chain b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/100-mcast-chain deleted file mode 100644 index ec0013a3..00000000 --- a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/100-mcast-chain +++ /dev/null @@ -1 +0,0 @@ -chain('MULTICAST_OUT', 'DROP') diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 index 8d3b7ec2..0058ed86 100644 --- a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/110-mcast-allow-icmpv6 @@ -1,5 +1,3 @@ -rule 'MULTICAST_OUT -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type echo-request -j DROP' -rule 'MULTICAST_OUT -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type 139 -j DROP' -rule 'MULTICAST_OUT -p IPv6 --ip6-protocol ipv6-icmp -j RETURN' - -rule 'MULTICAST_OUT -p IPv6 --ip6-protocol 0 -j RETURN' -- hop-by-hop +rule 'MULTICAST_OUT_ICMPV6 -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type echo-request -j RETURN' +rule 'MULTICAST_OUT_ICMPV6 -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type 139 -j RETURN' -- ICMP Node Information Query +rule 'MULTICAST_OUT_ICMPV6 -j ACCEPT' diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/300-mcast b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/300-mcast deleted file mode 100644 index c52f122f..00000000 --- a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/300-mcast +++ /dev/null @@ -1,2 +0,0 @@ -rule 'FORWARD --logical-out br-client -o bat0 -d Multicast -j MULTICAST_OUT' -rule 'OUTPUT --logical-out br-client -o bat0 -d Multicast -j MULTICAST_OUT' diff --git a/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/355-mcast-drop b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/355-mcast-drop new file mode 100644 index 00000000..46ac01a5 --- /dev/null +++ b/package/gluon-ebtables-filter-multicast/files/lib/gluon/ebtables/355-mcast-drop @@ -0,0 +1 @@ +rule ('MULTICAST_OUT -j DROP') diff --git a/package/gluon-ebtables-filter-ra-dhcp/Makefile b/package/gluon-ebtables-filter-ra-dhcp/Makefile index ea6a737d..acec081f 100644 --- a/package/gluon-ebtables-filter-ra-dhcp/Makefile +++ b/package/gluon-ebtables-filter-ra-dhcp/Makefile @@ -8,6 +8,7 @@ PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) include $(INCLUDE_DIR)/package.mk + define Package/gluon-ebtables-filter-ra-dhcp SECTION:=gluon CATEGORY:=Gluon diff --git a/package/gluon-ebtables-segment-mld/Makefile b/package/gluon-ebtables-segment-mld/Makefile new file mode 100644 index 00000000..e3aacde1 --- /dev/null +++ b/package/gluon-ebtables-segment-mld/Makefile @@ -0,0 +1,51 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-ebtables-segment-mld +PKG_VERSION:=1 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-ebtables-segment-mld + SECTION:=gluon + CATEGORY:=Gluon + TITLE:=Ebtables filters for IGMP/MLD packets + DEPENDS:=+gluon-core +gluon-ebtables +endef + +define Package/gluon-ebtables-segment-mld/description + Gluon community wifi mesh firmware framework: Ebtables filters for + IGMP/MLD packets + + These filters drop IGMP/MLD packets before they enter the mesh and + filter any IGMP/MLD packets coming from the mesh. + + IGMP/MLD have the concept of a local, elected Querier. For more + decentralization and increased robustness, the idea of this package is + to split the IGMP/MLD domain a querier is responsible for, allowing to + have a querier per node. The split IGMP/MLD domain will also reduce + overhead for this packet type, increasing scalability. + + Beware of the consequences of using this package though: You might need + to explicitly, manually mark ports on snooping switches leading towards + your mesh node as multicast router ports for now (Multicast Router + Discovery, MRD, not implemented yet). +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-ebtables-segment-mld/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-ebtables-segment-mld)) diff --git a/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/100-mcast-in-chain b/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/100-mcast-in-chain new file mode 100644 index 00000000..69d6bf18 --- /dev/null +++ b/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/100-mcast-in-chain @@ -0,0 +1,2 @@ +chain('MULTICAST_IN', 'RETURN', 'nat') +chain('MULTICAST_IN_ICMPV6', 'RETURN', 'nat') diff --git a/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/101-mcast-in-rule b/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/101-mcast-in-rule new file mode 100644 index 00000000..4eef2e7e --- /dev/null +++ b/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/101-mcast-in-rule @@ -0,0 +1,2 @@ +rule ('PREROUTING -d Multicast --logical-in br-client -i bat0 -j MULTICAST_IN', 'nat') +rule ('MULTICAST_IN -p IPv6 --ip6-protocol ipv6-icmp -j MULTICAST_IN_ICMPV6', 'nat') diff --git a/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/105-mcast-drop-igmp b/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/105-mcast-drop-igmp new file mode 100644 index 00000000..08052721 --- /dev/null +++ b/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/105-mcast-drop-igmp @@ -0,0 +1,2 @@ +rule('MULTICAST_OUT -p IPv4 --ip-protocol igmp -j DROP') +rule('MULTICAST_IN -p IPv4 --ip-protocol igmp -j DROP', 'nat') diff --git a/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/105-mcast-drop-mld b/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/105-mcast-drop-mld new file mode 100644 index 00000000..b6090c22 --- /dev/null +++ b/package/gluon-ebtables-segment-mld/files/lib/gluon/ebtables/105-mcast-drop-mld @@ -0,0 +1,9 @@ +rule('MULTICAST_OUT_ICMPV6 -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type 130 -j DROP') -- MLD Query +rule('MULTICAST_OUT_ICMPV6 -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type 131 -j DROP') -- MLDv1 Report +rule('MULTICAST_OUT_ICMPV6 -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type 132 -j DROP') -- MLDv1 Done +rule('MULTICAST_OUT_ICMPV6 -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type 143 -j DROP') -- MLDv2 Report + +rule('MULTICAST_IN_ICMPV6 -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type 130 -j DROP', 'nat') -- MLD Query +rule('MULTICAST_IN_ICMPV6 -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type 131 -j DROP', 'nat') -- MLDv1 Report +rule('MULTICAST_IN_ICMPV6 -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type 132 -j DROP', 'nat') -- MLDv1 Done +rule('MULTICAST_IN_ICMPV6 -p IPv6 --ip6-protocol ipv6-icmp --ip6-icmp-type 143 -j DROP', 'nat') -- MLDv2 Report diff --git a/package/gluon-ebtables/Makefile b/package/gluon-ebtables/Makefile index 39c654c1..43185c73 100644 --- a/package/gluon-ebtables/Makefile +++ b/package/gluon-ebtables/Makefile @@ -8,6 +8,7 @@ PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) include $(INCLUDE_DIR)/package.mk + define Package/gluon-ebtables SECTION:=gluon CATEGORY:=Gluon diff --git a/package/gluon-ebtables/files/etc/init.d/gluon-ebtables b/package/gluon-ebtables/files/etc/init.d/gluon-ebtables index 5a770452..e6bffe96 100755 --- a/package/gluon-ebtables/files/etc/init.d/gluon-ebtables +++ b/package/gluon-ebtables/files/etc/init.d/gluon-ebtables @@ -24,12 +24,15 @@ exec_file() { local file="$1" /usr/bin/lua -e " - function rule(command) + function rule(command, table) + table = table or 'filter' os.execute($EBTABLES_RULE) end - function chain(name, policy) + function chain(name, policy, table) + table = table or 'filter' os.execute($EBTABLES_CHAIN) end + " "$file" } @@ -48,8 +51,8 @@ exec_all() { start() { ( - export EBTABLES_RULE='"ebtables -A " .. command' - export EBTABLES_CHAIN='"ebtables -N " .. name .. " -P " .. policy' + export EBTABLES_RULE='"ebtables -t " .. table .. " -A " .. command' + export EBTABLES_CHAIN='"ebtables -t " .. table .. " -N " .. name .. " -P " .. policy' if [ -z "$1" ]; then exec_all '' @@ -61,8 +64,8 @@ start() { stop() { ( - export EBTABLES_RULE='"ebtables -D " .. command' - export EBTABLES_CHAIN='"ebtables -X " .. name' + export EBTABLES_RULE='"ebtables -t " .. table .. " -D " .. command' + export EBTABLES_CHAIN='"ebtables -t " .. table .. " -X " .. name' if [ -z "$1" ]; then exec_all '-r' diff --git a/package/gluon-ebtables/files/lib/gluon/ebtables/100-dir-chain b/package/gluon-ebtables/files/lib/gluon/ebtables/100-dir-chain index 31c19c53..e6bf98e3 100644 --- a/package/gluon-ebtables/files/lib/gluon/ebtables/100-dir-chain +++ b/package/gluon-ebtables/files/lib/gluon/ebtables/100-dir-chain @@ -1,2 +1,5 @@ chain('IN_ONLY', 'RETURN') chain('OUT_ONLY', 'RETURN') + +chain('MULTICAST_OUT', 'RETURN') +chain('MULTICAST_OUT_ICMPV6', 'RETURN') diff --git a/package/gluon-ebtables/files/lib/gluon/ebtables/350-mcast-dir-rules b/package/gluon-ebtables/files/lib/gluon/ebtables/350-mcast-dir-rules new file mode 100644 index 00000000..01609068 --- /dev/null +++ b/package/gluon-ebtables/files/lib/gluon/ebtables/350-mcast-dir-rules @@ -0,0 +1,4 @@ +rule 'OUTPUT -d Multicast --logical-out br-client -o bat0 -j MULTICAST_OUT' +rule 'FORWARD -d Multicast --logical-out br-client -o bat0 -j MULTICAST_OUT' + +rule 'MULTICAST_OUT -p IPv6 --ip6-protocol ipv6-icmp -j MULTICAST_OUT_ICMPV6' diff --git a/package/gluon-legacy/Makefile b/package/gluon-legacy/Makefile index 7320fba6..1cb2e5f4 100644 --- a/package/gluon-legacy/Makefile +++ b/package/gluon-legacy/Makefile @@ -7,6 +7,7 @@ PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) include $(GLUONDIR)/include/package.mk + define Package/gluon-legacy SECTION:=gluon CATEGORY:=Gluon @@ -26,10 +27,11 @@ define Build/Configure endef define Build/Compile + $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) endef define Package/gluon-legacy/install - $(CP) ./files/* $(1)/ + $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ endef define Package/gluon-legacy/postinst diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/000-legacy b/package/gluon-legacy/luasrc/lib/gluon/upgrade/000-legacy similarity index 100% rename from package/gluon-legacy/files/lib/gluon/upgrade/000-legacy rename to package/gluon-legacy/luasrc/lib/gluon/upgrade/000-legacy diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/019-legacy-interfaces b/package/gluon-legacy/luasrc/lib/gluon/upgrade/019-legacy-interfaces similarity index 100% rename from package/gluon-legacy/files/lib/gluon/upgrade/019-legacy-interfaces rename to package/gluon-legacy/luasrc/lib/gluon/upgrade/019-legacy-interfaces diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/210-legacy-wireless b/package/gluon-legacy/luasrc/lib/gluon/upgrade/210-legacy-wireless similarity index 100% rename from package/gluon-legacy/files/lib/gluon/upgrade/210-legacy-wireless rename to package/gluon-legacy/luasrc/lib/gluon/upgrade/210-legacy-wireless diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/290-legacy-setup-mode b/package/gluon-legacy/luasrc/lib/gluon/upgrade/290-legacy-setup-mode similarity index 100% rename from package/gluon-legacy/files/lib/gluon/upgrade/290-legacy-setup-mode rename to package/gluon-legacy/luasrc/lib/gluon/upgrade/290-legacy-setup-mode diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/290-legacy-simple-tc b/package/gluon-legacy/luasrc/lib/gluon/upgrade/290-legacy-simple-tc similarity index 100% rename from package/gluon-legacy/files/lib/gluon/upgrade/290-legacy-simple-tc rename to package/gluon-legacy/luasrc/lib/gluon/upgrade/290-legacy-simple-tc diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/390-legacy-mesh-vpn-fastd b/package/gluon-legacy/luasrc/lib/gluon/upgrade/390-legacy-mesh-vpn-fastd similarity index 100% rename from package/gluon-legacy/files/lib/gluon/upgrade/390-legacy-mesh-vpn-fastd rename to package/gluon-legacy/luasrc/lib/gluon/upgrade/390-legacy-mesh-vpn-fastd diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/990-legacy-late b/package/gluon-legacy/luasrc/lib/gluon/upgrade/990-legacy-late similarity index 100% rename from package/gluon-legacy/files/lib/gluon/upgrade/990-legacy-late rename to package/gluon-legacy/luasrc/lib/gluon/upgrade/990-legacy-late diff --git a/package/gluon-lock-password/Makefile b/package/gluon-lock-password/Makefile index d0e99373..0583f96c 100644 --- a/package/gluon-lock-password/Makefile +++ b/package/gluon-lock-password/Makefile @@ -8,6 +8,7 @@ PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) include $(INCLUDE_DIR)/package.mk + define Package/gluon-lock-password SECTION:=gluon CATEGORY:=Gluon diff --git a/package/gluon-luci-admin/Makefile b/package/gluon-luci-admin/Makefile index 3e20d179..7b5f632a 100644 --- a/package/gluon-luci-admin/Makefile +++ b/package/gluon-luci-admin/Makefile @@ -13,11 +13,12 @@ include $(GLUONDIR)/include/package.mk PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG) + define Package/gluon-luci-admin SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci based simple administration interface for mesh nodes - DEPENDS:=gluon-config-mode-core-virtual + DEPENDS:=gluon-config-mode-core-virtual +pretty-hostname endef define Build/Prepare @@ -29,10 +30,12 @@ endef define Build/Compile $(call GluonBuildI18N,gluon-luci-admin,i18n) + $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) endef define Package/gluon-luci-admin/install $(CP) ./files/* $(1)/ + $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ $(call GluonInstallI18N,gluon-luci-admin,$(1)) endef diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/info.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/info.htm index da403c1b..03f3f2ca 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/info.htm +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/info.htm @@ -1,45 +1,47 @@ <%- - local fs = require 'nixio.fs' - local uci = require('luci.model.uci').cursor() - local util = require 'luci.util' - local i18n = require 'luci.i18n' + local fs = require 'nixio.fs' + local uci = require('luci.model.uci').cursor() + local util = require 'luci.util' + local i18n = require 'luci.i18n' + local pretty_hostname = require 'pretty_hostname' - local site = require 'gluon.site_config' - local sysconfig = require 'gluon.sysconfig' - local platform = require 'gluon.platform' + local gluon_luci = require "gluon.luci" + local site = require 'gluon.site_config' + local sysconfig = require 'gluon.sysconfig' + local platform = require 'gluon.platform' - local keys = { - hostname = i18n.translate('Hostname'), - primary_mac = i18n.translate('MAC address'), - model = i18n.translate('Hardware model'), - version = i18n.translate('Gluon version'), - release = i18n.translate('Firmware release'), - site = i18n.translate('Site'), - pubkey = i18n.translate('Public VPN key'), - } + local keys = { + hostname = i18n.translate('Hostname'), + primary_mac = i18n.translate('MAC address'), + model = i18n.translate('Hardware model'), + version = i18n.translate('Gluon version'), + release = i18n.translate('Firmware release'), + site = i18n.translate('Site'), + pubkey = i18n.translate('Public VPN key'), + } - local values = { - hostname = uci:get_first('system', 'system', 'hostname'), - primary_mac = sysconfig.primary_mac, - model = platform.get_model(), - version = util.trim(fs.readfile('/lib/gluon/gluon-version')), - release = util.trim(fs.readfile('/lib/gluon/release')), - site = site.site_name, - pubkey = 'n/a', - } + local values = { + hostname = pretty_hostname.get(uci), + primary_mac = sysconfig.primary_mac, + model = platform.get_model(), + version = util.trim(fs.readfile('/lib/gluon/gluon-version')), + release = util.trim(fs.readfile('/lib/gluon/release')), + site = site.site_name, + pubkey = 'n/a', + } - local meshvpn_enabled = uci:get("fastd", "mesh_vpn", "enabled", "0") - if meshvpn_enabled == "1" then - local pubkey = util.trim(util.exec('/etc/init.d/fastd show_key mesh_vpn')) - if pubkey ~= '' then - values.pubkey = pubkey - end - end + local meshvpn_enabled = uci:get("fastd", "mesh_vpn", "enabled", "0") + if meshvpn_enabled == "1" then + local pubkey = util.trim(util.exec('/etc/init.d/fastd show_key mesh_vpn')) + if pubkey ~= '' then + values.pubkey = pubkey + end + end -%>

<%:Information%>

<% for _, key in ipairs({'hostname', 'primary_mac', 'model', 'version', 'release', 'site', 'pubkey'}) do %>
-
<%=keys[key]%>
<%=values[key] or 'n/a'%>
+
<%=keys[key]%>
<%=gluon_luci.escape(values[key] or 'n/a')%>
<% end %> diff --git a/package/gluon-luci-admin/i18n/de.po b/package/gluon-luci-admin/i18n/de.po index ec109ae0..e2a371d8 100644 --- a/package/gluon-luci-admin/i18n/de.po +++ b/package/gluon-luci-admin/i18n/de.po @@ -26,8 +26,8 @@ msgstr "Fortfahren" msgid "Don't switch off the device in any circumstance!" msgstr "Unterbrich auf keinen Fall die Stromversorgung!" -msgid "Expert Mode" -msgstr "Expert Mode" +msgid "Advanced settings" +msgstr "Erweiterte Einstellungen" msgid "Firmware image" msgstr "Firmware-Datei" diff --git a/package/gluon-luci-admin/i18n/fr.po b/package/gluon-luci-admin/i18n/fr.po index 23eeb7ff..0a876a35 100644 --- a/package/gluon-luci-admin/i18n/fr.po +++ b/package/gluon-luci-admin/i18n/fr.po @@ -1,12 +1,12 @@ msgid "" msgstr "" -"Content-Type: text/plain; charset=UTF-8\n" "Project-Id-Version: PACKAGE VERSION\n" "PO-Revision-Date: 2015-08-19 20:20+0100\n" "Last-Translator: Bernot Tobias \n" "Language-Team: French\n" "Language: fr\n" "MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" @@ -15,10 +15,11 @@ msgid "" "secure password you don't use anywhere else.

If you set an empty " "password, login via password will be disabled. This is the default." msgstr "" -"Alternativement, vous pouvez mettre un mot de passe pour accéder à votre nœud, " -"Penseiz à choisir un mot de passe sûr, que vous n'utilisez nulle part ailleurs. " -"

Si vous n'entrez pas de mot de passe, la connexion par mot de passe " -"sera désactivée. La connexion par mot de passe est désactivée par défaut." +"Alternativement, vous pouvez mettre un mot de passe pour accéder à votre " +"nœud, Penseiz à choisir un mot de passe sûr, que vous n'utilisez nulle part " +"ailleurs.

Si vous n'entrez pas de mot de passe, la connexion " +"par mot de passe sera désactivée. La connexion par mot de passe est " +"désactivée par défaut." msgid "Continue" msgstr "Continuer" @@ -26,8 +27,8 @@ msgstr "Continuer" msgid "Don't switch off the device in any circumstance!" msgstr "N'interrompez en aucun cas l'alimentation!" -msgid "Expert Mode" -msgstr "Mode Expert" +msgid "Advanced settings" +msgstr "Paramètres avancés" msgid "Firmware image" msgstr "Fichier image" @@ -88,8 +89,8 @@ msgid "" "The upgrade will take a few minutes. When it is finished, your node will " "reboot automatically." msgstr "" -"La mise à jour va prendre quelques minutes. Quand elle sera finie, " -"votre nœud va redémarrer automatiquement." +"La mise à jour va prendre quelques minutes. Quand elle sera finie, votre " +"nœud va redémarrer automatiquement." msgid "Unable to change the password." msgstr "Le mot de passe n'a pas pu être changé." diff --git a/package/gluon-luci-admin/i18n/gluon-luci-admin.pot b/package/gluon-luci-admin/i18n/gluon-luci-admin.pot index 197b6367..d8a0adb0 100644 --- a/package/gluon-luci-admin/i18n/gluon-luci-admin.pot +++ b/package/gluon-luci-admin/i18n/gluon-luci-admin.pot @@ -13,7 +13,7 @@ msgstr "" msgid "Don't switch off the device in any circumstance!" msgstr "" -msgid "Expert Mode" +msgid "Advanced settings" msgstr "" msgid "Firmware image" diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua b/package/gluon-luci-admin/luasrc/usr/lib/lua/luci/controller/admin/index.lua similarity index 92% rename from package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua rename to package/gluon-luci-admin/luasrc/usr/lib/lua/luci/controller/admin/index.lua index 55c0a248..6598c83a 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua +++ b/package/gluon-luci-admin/luasrc/usr/lib/lua/luci/controller/admin/index.lua @@ -29,7 +29,7 @@ function index() root.index = true end - local page = entry({"admin"}, alias("admin", "index"), _("Expert Mode"), 10) + local page = entry({"admin"}, alias("admin", "index"), _("Advanced settings"), 10) page.sysauth = "root" page.sysauth_authenticator = function() return "root" end page.index = true diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua b/package/gluon-luci-admin/luasrc/usr/lib/lua/luci/controller/admin/upgrade.lua similarity index 97% rename from package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua rename to package/gluon-luci-admin/luasrc/usr/lib/lua/luci/controller/admin/upgrade.lua index 29aecb95..2365f02c 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/upgrade.lua +++ b/package/gluon-luci-admin/luasrc/usr/lib/lua/luci/controller/admin/upgrade.lua @@ -101,9 +101,7 @@ end function image_supported(tmpfile) -- XXX: yay... return ( 0 == os.execute( - ". /lib/functions.sh; " .. - "include /lib/upgrade; " .. - "platform_check_image %q >/dev/null" + "/sbin/sysupgrade -T %q >/dev/null" % tmpfile ) ) end diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/info.lua b/package/gluon-luci-admin/luasrc/usr/lib/lua/luci/model/cbi/admin/info.lua similarity index 100% rename from package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/info.lua rename to package/gluon-luci-admin/luasrc/usr/lib/lua/luci/model/cbi/admin/info.lua diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/remote.lua b/package/gluon-luci-admin/luasrc/usr/lib/lua/luci/model/cbi/admin/remote.lua similarity index 100% rename from package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/remote.lua rename to package/gluon-luci-admin/luasrc/usr/lib/lua/luci/model/cbi/admin/remote.lua diff --git a/package/gluon-luci-autoupdater/Makefile b/package/gluon-luci-autoupdater/Makefile index 650c4692..908a0879 100644 --- a/package/gluon-luci-autoupdater/Makefile +++ b/package/gluon-luci-autoupdater/Makefile @@ -13,6 +13,7 @@ include $(GLUONDIR)/include/package.mk PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG) + define Package/gluon-luci-autoupdater SECTION:=gluon CATEGORY:=Gluon @@ -29,10 +30,11 @@ endef define Build/Compile $(call GluonBuildI18N,gluon-luci-autoupdater,i18n) + $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) endef define Package/gluon-luci-autoupdater/install - $(CP) ./files/* $(1)/ + $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ $(call GluonInstallI18N,gluon-luci-autoupdater,$(1)) endef diff --git a/package/gluon-luci-autoupdater/files/usr/lib/lua/luci/controller/admin/autoupdater.lua b/package/gluon-luci-autoupdater/luasrc/usr/lib/lua/luci/controller/admin/autoupdater.lua similarity index 100% rename from package/gluon-luci-autoupdater/files/usr/lib/lua/luci/controller/admin/autoupdater.lua rename to package/gluon-luci-autoupdater/luasrc/usr/lib/lua/luci/controller/admin/autoupdater.lua diff --git a/package/gluon-luci-autoupdater/files/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua b/package/gluon-luci-autoupdater/luasrc/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua similarity index 100% rename from package/gluon-luci-autoupdater/files/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua rename to package/gluon-luci-autoupdater/luasrc/usr/lib/lua/luci/model/cbi/admin/autoupdater.lua diff --git a/package/gluon-luci-mesh-vpn-fastd/Makefile b/package/gluon-luci-mesh-vpn-fastd/Makefile index 1be12ccc..b6b7ce4f 100644 --- a/package/gluon-luci-mesh-vpn-fastd/Makefile +++ b/package/gluon-luci-mesh-vpn-fastd/Makefile @@ -10,6 +10,7 @@ include $(GLUONDIR)/include/package.mk PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG) + define Package/gluon-luci-mesh-vpn-fastd SECTION:=gluon CATEGORY:=Gluon @@ -26,10 +27,12 @@ endef define Build/Compile $(call GluonBuildI18N,gluon-mesh-vpn-fastd,i18n) + $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) endef define Package/gluon-luci-mesh-vpn-fastd/install $(CP) ./files/* $(1)/ + $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ $(call GluonInstallI18N,gluon-mesh-vpn-fastd,$(1)) endef diff --git a/package/gluon-luci-mesh-vpn-fastd/files/usr/lib/lua/luci/controller/admin/mesh_vpn_fastd.lua b/package/gluon-luci-mesh-vpn-fastd/luasrc/usr/lib/lua/luci/controller/admin/mesh_vpn_fastd.lua similarity index 100% rename from package/gluon-luci-mesh-vpn-fastd/files/usr/lib/lua/luci/controller/admin/mesh_vpn_fastd.lua rename to package/gluon-luci-mesh-vpn-fastd/luasrc/usr/lib/lua/luci/controller/admin/mesh_vpn_fastd.lua diff --git a/package/gluon-luci-mesh-vpn-fastd/files/usr/lib/lua/luci/model/cbi/admin/mesh_vpn_fastd.lua b/package/gluon-luci-mesh-vpn-fastd/luasrc/usr/lib/lua/luci/model/cbi/admin/mesh_vpn_fastd.lua similarity index 100% rename from package/gluon-luci-mesh-vpn-fastd/files/usr/lib/lua/luci/model/cbi/admin/mesh_vpn_fastd.lua rename to package/gluon-luci-mesh-vpn-fastd/luasrc/usr/lib/lua/luci/model/cbi/admin/mesh_vpn_fastd.lua diff --git a/package/gluon-luci-node-role/Makefile b/package/gluon-luci-node-role/Makefile index ded7bd3f..2c862610 100644 --- a/package/gluon-luci-node-role/Makefile +++ b/package/gluon-luci-node-role/Makefile @@ -10,6 +10,7 @@ include $(GLUONDIR)/include/package.mk PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG) + define Package/gluon-luci-node-role SECTION:=gluon CATEGORY:=Gluon @@ -26,10 +27,11 @@ endef define Build/Compile $(call GluonBuildI18N,gluon-luci-node-role,i18n) + $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) endef define Package/gluon-luci-node-role/install - $(CP) ./files/* $(1)/ + $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ $(call GluonInstallI18N,gluon-luci-node-role,$(1)) endef diff --git a/package/gluon-luci-node-role/files/usr/lib/lua/luci/controller/admin/noderole.lua b/package/gluon-luci-node-role/luasrc/usr/lib/lua/luci/controller/admin/noderole.lua similarity index 100% rename from package/gluon-luci-node-role/files/usr/lib/lua/luci/controller/admin/noderole.lua rename to package/gluon-luci-node-role/luasrc/usr/lib/lua/luci/controller/admin/noderole.lua diff --git a/package/gluon-luci-node-role/files/usr/lib/lua/luci/model/cbi/admin/noderole.lua b/package/gluon-luci-node-role/luasrc/usr/lib/lua/luci/model/cbi/admin/noderole.lua similarity index 100% rename from package/gluon-luci-node-role/files/usr/lib/lua/luci/model/cbi/admin/noderole.lua rename to package/gluon-luci-node-role/luasrc/usr/lib/lua/luci/model/cbi/admin/noderole.lua diff --git a/package/gluon-luci-portconfig/Makefile b/package/gluon-luci-portconfig/Makefile index 007c5fea..d4590864 100644 --- a/package/gluon-luci-portconfig/Makefile +++ b/package/gluon-luci-portconfig/Makefile @@ -13,11 +13,12 @@ include $(GLUONDIR)/include/package.mk PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG) + define Package/gluon-luci-portconfig SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci module for advanced ethernet port configuration - DEPENDS:=+gluon-luci-admin +gluon-mesh-batman-adv + DEPENDS:=+gluon-luci-admin +gluon-client-bridge endef define Build/Prepare @@ -29,10 +30,11 @@ endef define Build/Compile $(call GluonBuildI18N,gluon-luci-portconfig,i18n) + $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) endef define Package/gluon-luci-portconfig/install - $(CP) ./files/* $(1)/ + $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ $(call GluonInstallI18N,gluon-luci-portconfig,$(1)) endef diff --git a/package/gluon-luci-portconfig/i18n/de.po b/package/gluon-luci-portconfig/i18n/de.po index 2197fdbe..a94e7d41 100644 --- a/package/gluon-luci-portconfig/i18n/de.po +++ b/package/gluon-luci-portconfig/i18n/de.po @@ -1,12 +1,12 @@ msgid "" msgstr "" -"Content-Type: text/plain; charset=UTF-8\n" "Project-Id-Version: PACKAGE VERSION\n" "PO-Revision-Date: 2015-05-04 02:08+0200\n" "Last-Translator: \n" "Language-Team: German\n" "Language: de\n" "MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" @@ -16,12 +16,15 @@ msgstr "Automatisch (DHCP)" msgid "Automatic (RA/DHCPv6)" msgstr "Automatisch (RA/DHCPv6)" -msgid "Enable meshing on the WAN interface" -msgstr "Mesh auf dem WAN-Port aktivieren" +msgid "Enable PoE passthrough" +msgstr "PoE-Passthrough aktivieren" msgid "Enable meshing on the LAN interface" msgstr "Mesh auf dem LAN-Port aktivieren" +msgid "Enable meshing on the WAN interface" +msgstr "Mesh auf dem WAN-Port aktivieren" + msgid "Static" msgstr "Statisch" diff --git a/package/gluon-luci-portconfig/i18n/fr.po b/package/gluon-luci-portconfig/i18n/fr.po index b5f7405d..3ec59395 100644 --- a/package/gluon-luci-portconfig/i18n/fr.po +++ b/package/gluon-luci-portconfig/i18n/fr.po @@ -1,28 +1,30 @@ msgid "" msgstr "" -"Content-Type: text/plain; charset=UTF-8\n" "Project-Id-Version: PACKAGE VERSION\n" "PO-Revision-Date: 2015-08-19 23:30+0100\n" "Last-Translator:Tobias Bernot \n" "Language-Team: French\n" "Language: fr\n" "MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" - msgid "Automatic (DHCP)" msgstr "Automatique (DHCP)" msgid "Automatic (RA/DHCPv6)" msgstr "Automatique (RA/DHCPv6)" -msgid "Enable meshing on the WAN interface" -msgstr "Activer le réseau MESH sur les ports WAN" +msgid "Enable PoE passthrough" +msgstr "" msgid "Enable meshing on the LAN interface" msgstr "Activer le réseau MESH sur le port LAN" +msgid "Enable meshing on the WAN interface" +msgstr "Activer le réseau MESH sur les ports WAN" + msgid "Static" msgstr "Statique" diff --git a/package/gluon-luci-portconfig/i18n/gluon-luci-portconfig.pot b/package/gluon-luci-portconfig/i18n/gluon-luci-portconfig.pot index 31ac71d3..5945016b 100644 --- a/package/gluon-luci-portconfig/i18n/gluon-luci-portconfig.pot +++ b/package/gluon-luci-portconfig/i18n/gluon-luci-portconfig.pot @@ -7,12 +7,15 @@ msgstr "" msgid "Automatic (RA/DHCPv6)" msgstr "" -msgid "Enable meshing on the WAN interface" +msgid "Enable PoE passthrough" msgstr "" msgid "Enable meshing on the LAN interface" msgstr "" +msgid "Enable meshing on the WAN interface" +msgstr "" + msgid "Static" msgstr "" diff --git a/package/gluon-luci-portconfig/files/usr/lib/lua/luci/controller/admin/portconfig.lua b/package/gluon-luci-portconfig/luasrc/usr/lib/lua/luci/controller/admin/portconfig.lua similarity index 100% rename from package/gluon-luci-portconfig/files/usr/lib/lua/luci/controller/admin/portconfig.lua rename to package/gluon-luci-portconfig/luasrc/usr/lib/lua/luci/controller/admin/portconfig.lua diff --git a/package/gluon-luci-portconfig/files/usr/lib/lua/luci/model/cbi/admin/portconfig.lua b/package/gluon-luci-portconfig/luasrc/usr/lib/lua/luci/model/cbi/admin/portconfig.lua similarity index 89% rename from package/gluon-luci-portconfig/files/usr/lib/lua/luci/model/cbi/admin/portconfig.lua rename to package/gluon-luci-portconfig/luasrc/usr/lib/lua/luci/model/cbi/admin/portconfig.lua index 994f3077..2e40577a 100644 --- a/package/gluon-luci-portconfig/files/usr/lib/lua/luci/model/cbi/admin/portconfig.lua +++ b/package/gluon-luci-portconfig/luasrc/usr/lib/lua/luci/model/cbi/admin/portconfig.lua @@ -94,6 +94,13 @@ if sysconfig.lan_ifname then o.rmempty = false end +if uci:get('system', 'gpio_switch_poe_passthrough') then + s = f:section(SimpleSection, nil, nil) + o = s:option(Flag, "poe_passthrough", translate("Enable PoE passthrough")) + o.default = uci:get_bool("system", "gpio_switch_poe_passthrough", "value") and o.enabled or o.disabled + o.rmempty = false +end + function f.handle(self, state, data) if state == FORM_VALID then @@ -137,6 +144,12 @@ function f.handle(self, state, data) uci:save("network") uci:commit("network") + if uci:get('system', 'gpio_switch_poe_passthrough') then + uci:set('system', 'gpio_switch_poe_passthrough', 'value', data.poe_passthrough) + uci:save('system') + uci:commit('system') + end + if dns then if #data.dns > 0 then uci:set("gluon-wan-dnsmasq", dns, "server", data.dns) diff --git a/package/gluon-luci-private-wifi/Makefile b/package/gluon-luci-private-wifi/Makefile index 604929dd..34608900 100644 --- a/package/gluon-luci-private-wifi/Makefile +++ b/package/gluon-luci-private-wifi/Makefile @@ -10,6 +10,7 @@ include $(GLUONDIR)/include/package.mk PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG) + define Package/gluon-luci-private-wifi SECTION:=gluon CATEGORY:=Gluon @@ -26,10 +27,11 @@ endef define Build/Compile $(call GluonBuildI18N,gluon-luci-private-wifi,i18n) + $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) endef define Package/gluon-luci-private-wifi/install - $(CP) ./files/* $(1)/ + $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ $(call GluonInstallI18N,gluon-luci-private-wifi,$(1)) endef diff --git a/package/gluon-luci-private-wifi/files/usr/lib/lua/luci/controller/admin/privatewifi.lua b/package/gluon-luci-private-wifi/luasrc/usr/lib/lua/luci/controller/admin/privatewifi.lua similarity index 100% rename from package/gluon-luci-private-wifi/files/usr/lib/lua/luci/controller/admin/privatewifi.lua rename to package/gluon-luci-private-wifi/luasrc/usr/lib/lua/luci/controller/admin/privatewifi.lua diff --git a/package/gluon-luci-private-wifi/files/usr/lib/lua/luci/model/cbi/admin/privatewifi.lua b/package/gluon-luci-private-wifi/luasrc/usr/lib/lua/luci/model/cbi/admin/privatewifi.lua similarity index 67% rename from package/gluon-luci-private-wifi/files/usr/lib/lua/luci/model/cbi/admin/privatewifi.lua rename to package/gluon-luci-private-wifi/luasrc/usr/lib/lua/luci/model/cbi/admin/privatewifi.lua index 788ff430..46a1a9d7 100644 --- a/package/gluon-luci-private-wifi/files/usr/lib/lua/luci/model/cbi/admin/privatewifi.lua +++ b/package/gluon-luci-private-wifi/luasrc/usr/lib/lua/luci/model/cbi/admin/privatewifi.lua @@ -1,10 +1,11 @@ -local f, s, o, ssid local uci = luci.model.uci.cursor() -local config = 'wireless' +local util = require 'gluon.util' + +local f, s, o, ssid -- where to read the configuration from local primary_iface = 'wan_radio0' -local ssid = uci:get(config, primary_iface, "ssid") +local ssid = uci:get('wireless', primary_iface, "ssid") f = SimpleForm("wifi", translate("Private WLAN")) f.template = "admin/expertmode" @@ -17,46 +18,50 @@ s = f:section(SimpleSection, nil, translate( )) o = s:option(Flag, "enabled", translate("Enabled")) -o.default = (ssid and not uci:get_bool(config, primary_iface, "disabled")) and o.enabled or o.disabled +o.default = (ssid and not uci:get_bool('wireless', primary_iface, "disabled")) and o.enabled or o.disabled o.rmempty = false o = s:option(Value, "ssid", translate("Name (SSID)")) o:depends("enabled", '1') +o.datatype = "maxlength(32)" o.default = ssid o = s:option(Value, "key", translate("Key"), translate("8-63 characters")) o:depends("enabled", '1') o.datatype = "wpakey" -o.default = uci:get(config, primary_iface, "key") +o.default = uci:get('wireless', primary_iface, "key") function f.handle(self, state, data) if state == FORM_VALID then - uci:foreach(config, "wifi-device", - function(s) - local device = s['.name'] - local name = "wan_" .. device + util.iterate_radios( + function(radio, index) + local name = "wan_" .. radio if data.enabled == '1' then + local macaddr = util.get_wlan_mac(radio, index, 4) + -- set up WAN wifi-iface - uci:section(config, "wifi-iface", name, + uci:section('wireless', "wifi-iface", name, { - device = device, + device = radio, network = "wan", mode = 'ap', encryption = 'psk2', ssid = data.ssid, key = data.key, + macaddr = macaddr, disabled = 0, } ) else -- disable WAN wifi-iface - uci:set(config, name, "disabled", 1) + uci:set('wireless', name, "disabled", 1) end - end) + end + ) - uci:save(config) - uci:commit(config) + uci:save('wireless') + uci:commit('wireless') end end diff --git a/package/gluon-luci-theme/Makefile b/package/gluon-luci-theme/Makefile index 4fc947c4..6e65db3c 100644 --- a/package/gluon-luci-theme/Makefile +++ b/package/gluon-luci-theme/Makefile @@ -9,13 +9,14 @@ PKG_RELEASE:=1 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) -include $(INCLUDE_DIR)/package.mk +include $(GLUONDIR)/include/package.mk + define Package/gluon-luci-theme SECTION:=gluon CATEGORY:=Gluon TITLE:=Luci theme for Gluon - DEPENDS:= + DEPENDS:=+pretty-hostname endef define Package/gluon-luci-theme/description @@ -30,10 +31,12 @@ define Build/Configure endef define Build/Compile + $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) endef define Package/gluon-luci-theme/install $(CP) ./files/* $(1)/ + $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ endef $(eval $(call BuildPackage,gluon-luci-theme)) diff --git a/package/gluon-luci-theme/files/usr/lib/lua/luci/view/themes/gluon/header.htm b/package/gluon-luci-theme/files/usr/lib/lua/luci/view/themes/gluon/header.htm index 2fe1004b..7e894603 100644 --- a/package/gluon-luci-theme/files/usr/lib/lua/luci/view/themes/gluon/header.htm +++ b/package/gluon-luci-theme/files/usr/lib/lua/luci/view/themes/gluon/header.htm @@ -16,9 +16,12 @@ $Id$ local sys = require "luci.sys" local http = require "luci.http" local disp = require "luci.dispatcher" + local uci = require("luci.model.uci").cursor() local fs = require "nixio.fs" + local gluon_luci = require "gluon.luci" + local pretty_hostname = require "pretty_hostname" - local hostname = sys.hostname() + local hostname = pretty_hostname.get(uci) local release = fs.readfile("/lib/gluon/release") local request = disp.context.path @@ -110,15 +113,15 @@ $Id$ <% end -%> -<%=striptags( hostname .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI +<%=gluon_luci.escape( hostname .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI