mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-02-04 08:13:38 +00:00
networks: Ability to configure for BATMAN
Add a dispatcher script to NetworkManager to configure B.A.T.M.A.N. Advanced interfaces. This quite a bit hacky at it is triggered for network connections that have the keyword "BATMAN" in them. The proper way to implement this is as a core change in NetworkManager itself (as it lacks plugins). It is done is the hope that it will garner some more interest in FreedomBox for mesh networks. Currently, it is possible to create a BATMAN mesh network and shared existing internet connections on it. Other boxes can then join this mesh network and use that internet connection. Known issues: - Very unintuitive setup process. First create a connection with device a Wi-Fi device, mode as ad-hoc, with a known frequency and BSSID. The name of the connection should have contain BATMAN in it. It should also have IPv4 method as disabled. Second connection should be created for 'bat0' interface after the first on is successful. It can be with method 'shared' for sharing internet connection and doing DHCP requests or 'auto' for aqcuiring IP address from another node in the mesh network. - Untested for joining existing mesh networks. - Requires configuring two network connections and the second one needs to be manually enabled after the first one is successfully activated.
This commit is contained in:
parent
28a9933fd9
commit
6cf1cc72b9
44
data/etc/NetworkManager/dispatcher.d/10-freedombox-batman
Executable file
44
data/etc/NetworkManager/dispatcher.d/10-freedombox-batman
Executable file
@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This file is part of Plinth.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
set -e # Exit with code on error
|
||||
|
||||
IFACE="$1"
|
||||
ACTION="$2"
|
||||
|
||||
if [[ "$CONNECTION_ID" != *"BATMAN"* ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case ${ACTION} in
|
||||
up)
|
||||
logger "Setting up B.A.T.M.A.N. Advanced on interface $IFACE"
|
||||
ip link set mtu 1560 dev ${IFACE}
|
||||
modprobe batman-adv
|
||||
echo "bat0" > /sys/class/net/${IFACE}/batman_adv/mesh_iface
|
||||
ip link set up dev bat0
|
||||
;;
|
||||
down)
|
||||
logger "Clearing B.A.T.M.A.N. Advanced on interface $IFACE"
|
||||
ip link set down dev bat0
|
||||
echo "none" > /sys/class/net/${IFACE}/batman_adv/mesh_iface
|
||||
ip link set mtu 1500 dev ${IFACE}
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
2
setup.py
2
setup.py
@ -205,6 +205,8 @@ setuptools.setup(
|
||||
glob.glob('data/etc/apache2/sites-available/*.conf')),
|
||||
('/etc/ikiwiki',
|
||||
glob.glob('data/etc/ikiwiki/*.setup')),
|
||||
('/etc/NetworkManager/dispatcher.d/',
|
||||
['data/etc/NetworkManager/dispatcher.d/10-freedombox-batman']),
|
||||
('/etc/sudoers.d', ['data/etc/sudoers.d/plinth']),
|
||||
('/lib/systemd/system',
|
||||
['data/lib/systemd/system/plinth.service']),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user