This commit is contained in:
Christof Schulze 2016-09-08 22:23:13 +00:00 committed by GitHub
commit 2d59380a4b
334 changed files with 33680 additions and 1248 deletions

View File

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

View File

@ -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) && \

View File

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

View File

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

View File

@ -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 <https://github.com/freifunk-gluon/packages/tree/master/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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 <https://github.com/freifunk-gluon/gluon/issues/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 <https://github.com/freifunk-gluon/gluon/issues/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 <https://github.com/freifunk-gluon/gluon/issues/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 <https://github.com/freifunk-gluon/gluon/issues/522>`_)
The current API is inconsistent and will be replaced eventually. The old API will still be supported for a while.

View File

@ -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 "
"(<em><%=hostname%></em>) an "
"(<em><%=escape(hostname)%></em>) an "
"<a href=\"mailto:keys@entenhausen.freifunk.net\">keys@entenhausen.freifunk.net</a>."
"</p>"
"<div class=\"the-key\">"
" # <%= hostname %>"
" # <%= escape(hostname) %>"
" <br/>"
"<%= pubkey %>"
"</div>"

View File

@ -20,11 +20,11 @@ msgstr ""
"<p>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 (<em><%=hostname%></em>) to "
"To register, send the key together with your node's name (<em><%=escape(hostname)%></em>) to "
"<a href=\"mailto:keys@entenhausen.freifunk.net\">keys@entenhausen.freifunk.net</a>."
"</p>"
"<div class=\"the-key\">"
" # <%= hostname %>"
" # <%= escape(hostname) %>"
" <br/>"
"<%= pubkey %>"
"</div>"

View File

@ -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 "
"(<em><%=hostname%></em>) à "
"(<em><%=escape(hostname)%></em>) à "
"<a href=\"mailto:keys@entenhausen.freifunk.net\">keys@entenhausen.freifunk.net</a>."
"</p>"
"<div class=\"the-key\">"
" # <%= hostname %>"
" # <%= escape(hostname) %>"
" <br/>"
"<%= pubkey %>"
"</div>"

View File

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

View File

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

View File

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

View File

@ -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
``<!-- empty -->`` 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 <https://github.com/tecff/site-ffa>`_ (Altdorf, Landshut & Umgebung)
* `site-ffac <https://github.com/ffac/site>`_ (Regio Aachen)
* `site-ffbs <https://github.com/ffbs/site-ffbs>`_ (Braunschweig)
* `site-ffhb <https://github.com/FreifunkBremen/gluon-site-ffhb>`_ (Bremen)
* `site-ffda <https://github.com/freifunk-darmstadt/site-ffda>`_ (Darmstadt)
* `site-ffeh <https://github.com/freifunk-ehingen/site-ffeh>`_ (Ehingen)
* `site-fffl <https://github.com/freifunk-flensburg/site-fffl>`_ (Flensburg)
* `site-ffgoe <https://github.com/freifunk-goettingen/site-ffgoe>`_ (Göttingen)
* `site-ffgt-rhw <https://github.com/ffgtso/site-ffgt-rhw>`_ (Guetersloh)
* `site-ffhh <https://github.com/freifunkhamburg/site-ffhh>`_ (Hamburg)
* `site-ffho <https://git.c3pb.de/freifunk-pb/site-ffho>`_ (Hochstift)
* `site-ffhgw <https://github.com/lorenzo-greifswald/site-ffhgw>`_ (Greifswald)
* `site-ffka <https://github.com/ffka/site-ffka>`_ (Karlsruhe)
* `site-ffki <http://git.freifunk.in-kiel.de/ffki-site/>`_ (Kiel)
* `site-fflz <https://github.com/freifunk-lausitz/site-fflz>`_ (Lausitz)
* `site-ffl <https://github.com/freifunk-leipzig/freifunk-gluon-leipzig>`_ (Leipzig)
* `site-ffhl <https://github.com/freifunk-luebeck/site-ffhl>`_ (Lübeck)
* `site-fflg <https://github.com/kartenkarsten/site-fflg>`_ (Lüneburg)
* `site-ffmd <https://github.com/FreifunkMD/site-ffmd>`_ (Magdeburg)
* `site-ffmwu <https://github.com/freifunk-mwu/site-ffmwu>`_ (Mainz, Wiesbaden & Umgebung)
* `site-ffmyk <https://github.com/FreifunkMYK/site-ffmyk>`_ (Mayen-Koblenz)
* `site-ffmo <https://github.com/ffruhr/site-ffmo>`_ (Moers)
* `site-ffmg <https://github.com/ffruhr/site-ffmg>`_ (Mönchengladbach)
* `site-ffm <https://github.com/freifunkMUC/site-ffm>`_ (München)
* `site-ffhmue <https://github.com/Freifunk-Muenden/site-conf>`_ (Münden)
* `site-ffms <https://github.com/FreiFunkMuenster/site-ffms>`_ (Münsterland)
* `site-ffnw <https://git.nordwest.freifunk.net/ffnw/siteconf/tree/master>`_ (Nordwest)
* `site-ffka <https://github.com/ffka/site-ffka>`_ (Karlsruhe)
* `site-ffrl <https://github.com/ffrl/sites-ffrl>`_ (Rheinland)
* `site-ffrg <https://github.com/ffruhr/site-ffruhr>`_ (Ruhrgebiet)
* `site-neuss <https://github.com/ffne/site-neuss>`_ (Neuss)
* `site-ffniers <https://github.com/ffruhr/site-ffniers>`_ (Niersufer)
* `site-ffnw <https://git.nordwest.freifunk.net/ffnw-firmware/siteconf/tree/master>`_ (Nordwest)
* `site-ffrgb <https://github.com/ffrgb/site-ffrgb>`_ (Regensburg)
* `site-ffruhr <https://github.com/ffruhr?utf8=✓&query=site>`_ (Ruhrgebiet, Multi-Communities)
* `site-ffs <https://github.com/freifunk-stuttgart/site-ffs>`_ (Stuttgart)
* `site-fftr <https://github.com/freifunktrier/site-fftr>`_ (Trier)

View File

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

View File

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

13
modules
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 <em>publicly</em> on "
"Please provide your contact information here to allow others to contact "
"you. Note that this information will be visible <em>publicly</em> on "
"the internet together with your node's coordinates."
msgstr ""
"Hier kannst du einen <em>öffentlichen</em> 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 "
"<em>öffentlich</em> im Internet, zusammen mit den Koordinaten "
"deines Knotens, einsehbar sein wird."
msgid "e.g. E-mail or phone number"

View File

@ -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 <em>publicly</em> on "
"Please provide your contact information here to allow others to contact "
"you. Note that this information will be visible <em>publicly</em> on "
"the internet together with your node's coordinates."
msgstr ""
"Ici vous pouvez donner des informations <em>publiques</em> pour permettre aux autres de vous contacter. "
"S'il vous plaît entrez ici des informations <em>publiques</em> 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"

View File

@ -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 <em>publicly</em> on "
"Please provide your contact information here to allow others to contact "
"you. Note that this information will be visible <em>publicly</em> on "
"the internet together with your node's coordinates."
msgstr ""

View File

@ -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 <em>publicly</em> '
.. '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

View File

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

View File

@ -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 @@
<h2><%:Welcome!%></h2>
<p>
<%= 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,
}) %>
</p>
<% if not self.embedded then %>

View File

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%=luci.i18n.context.lang%>" lang="<%=luci.i18n.context.lang%>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%=hostname%> is rebooting</title>
<title><%=escape(hostname)%> is rebooting</title>
<link rel="stylesheet" type="text/css" media="screen" href="<%=media%>/cascade.css" />
</head>
<body>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1 +0,0 @@
chain('MULTICAST_OUT', 'DROP')

View File

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

View File

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

View File

@ -0,0 +1 @@
rule ('MULTICAST_OUT -j DROP')

View File

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

View File

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

View File

@ -0,0 +1,2 @@
chain('MULTICAST_IN', 'RETURN', 'nat')
chain('MULTICAST_IN_ICMPV6', 'RETURN', 'nat')

View File

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

View File

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

View File

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

View File

@ -8,6 +8,7 @@ PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/gluon-ebtables
SECTION:=gluon
CATEGORY:=Gluon

View File

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

View File

@ -1,2 +1,5 @@
chain('IN_ONLY', 'RETURN')
chain('OUT_ONLY', 'RETURN')
chain('MULTICAST_OUT', 'RETURN')
chain('MULTICAST_OUT_ICMPV6', 'RETURN')

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More