From patchwork Tue May 3 21:20:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [RFC,2/8] fff-hoods: add initial hood configuration package From: Jan Kraus X-Patchwork-Id: 102 Message-Id: <1462310457-9633-3-git-send-email-mayosemmel@gmail.com> To: franken-dev@freifunk.net Cc: Jan Kraus Date: Tue, 3 May 2016 23:20:51 +0200 From: Tim Niemeyer Signed-off-by: Tim Niemeyer Rebased Patch Signed-off-by: Jan Kraus --- src/packages/fff/fff-hoods/Makefile | 39 ++++++ .../fff/fff-hoods/files/etc/hoods/fuerth.hood | 18 +++ .../fff/fff-hoods/files/etc/hoods/nuernberg.hood | 18 +++ .../fff/fff-hoods/files/etc/hoods/test.hood | 18 +++ .../fff-hoods/files/etc/hoods/trainstation.hood | 17 +++ .../fff/fff-hoods/files/etc/uci-defaults/hood-dhcp | 18 +++ .../fff/fff-hoods/files/usr/sbin/configurehood | 144 +++++++++++++++++++++ src/packages/fff/fff/Makefile | 5 +- 8 files changed, 275 insertions(+), 2 deletions(-) create mode 100644 src/packages/fff/fff-hoods/Makefile create mode 100644 src/packages/fff/fff-hoods/files/etc/hoods/fuerth.hood create mode 100644 src/packages/fff/fff-hoods/files/etc/hoods/nuernberg.hood create mode 100644 src/packages/fff/fff-hoods/files/etc/hoods/test.hood create mode 100644 src/packages/fff/fff-hoods/files/etc/hoods/trainstation.hood create mode 100644 src/packages/fff/fff-hoods/files/etc/uci-defaults/hood-dhcp create mode 100755 src/packages/fff/fff-hoods/files/usr/sbin/configurehood diff --git a/src/packages/fff/fff-hoods/Makefile b/src/packages/fff/fff-hoods/Makefile new file mode 100644 index 0000000..bf92689 --- /dev/null +++ b/src/packages/fff/fff-hoods/Makefile @@ -0,0 +1,39 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=fff-hoods +PKG_VERSION:=0.0.1 +PKG_RELEASE:=1 + +PKG_BUILD_DIR:=$(BUILD_DIR)/fff-hoods + +include $(INCLUDE_DIR)/package.mk + +define Package/fff-hoods + SECTION:=base + CATEGORY:=Freifunk + TITLE:= Freifunk-Franken hoods + URL:=http://www.freifunk-franken.de + DEPENDS:=+mdns +odhcpd +endef + +define Package/fff-hoods/description + This package load and configures the current hood +endef + +define Build/Prepare + echo "all: " > $(PKG_BUILD_DIR)/Makefile +endef + +define Build/Configure + # nothing +endef + +define Build/Compile + # nothing +endef + +define Package/fff-hoods/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,fff-hoods)) diff --git a/src/packages/fff/fff-hoods/files/etc/hoods/fuerth.hood b/src/packages/fff/fff-hoods/files/etc/hoods/fuerth.hood new file mode 100644 index 0000000..fd5c9ea --- /dev/null +++ b/src/packages/fff/fff-hoods/files/etc/hoods/fuerth.hood @@ -0,0 +1,18 @@ +{ + "version": 1, + "hood": { + "name": "fuerth", + "bssid": "ca:ff:ee:ba:be:02", + "protocol": "batman-adv-v14", + "channel2": 1, + "mode2": "ht20", + "type2": "adhoc", + "channel5": 40, + "mode5": "ht40+", + "type5": "adhoc", + "location": { "lat": 49.478330, "lon": 10.990270 }, + }, + "network": { + "ula_prefix": "fdff:2::/64" + } +} diff --git a/src/packages/fff/fff-hoods/files/etc/hoods/nuernberg.hood b/src/packages/fff/fff-hoods/files/etc/hoods/nuernberg.hood new file mode 100644 index 0000000..6c26ab3 --- /dev/null +++ b/src/packages/fff/fff-hoods/files/etc/hoods/nuernberg.hood @@ -0,0 +1,18 @@ +{ + "version": 1, + "hood": { + "name": "nuernberg", + "bssid": "ca:ff:ee:ba:be:03", + "protocol": "batman-adv-v14", + "channel2": 1, + "mode2": "HT20", + "type": "adhoc", + "channel5": 40, + "mode5": "HT40+", + "type": "adhoc", + "location": { "lat": 49.448856, "lon": 11.082108 }, + }, + "network": { + "ula_prefix": "fdff:3::/64" + } +} diff --git a/src/packages/fff/fff-hoods/files/etc/hoods/test.hood b/src/packages/fff/fff-hoods/files/etc/hoods/test.hood new file mode 100644 index 0000000..18a93f1 --- /dev/null +++ b/src/packages/fff/fff-hoods/files/etc/hoods/test.hood @@ -0,0 +1,18 @@ +{ + "version": 0, + "hood": { + "name": "test", + "bssid": "ca:ff:ee:ba:be:ff", + "protocol": "batman-adv-v14", + "channel2": 13, + "mode2": "ht20", + "type2": "adhoc", + "channel5": 40, + "mode5": "ht40+", + "type5": "adhoc", + "location": { "lat": 49.46654, "lon": 10.992 }, + }, + "network": { + "ula_prefix": "fdff:ff::/64" + } +} diff --git a/src/packages/fff/fff-hoods/files/etc/hoods/trainstation.hood b/src/packages/fff/fff-hoods/files/etc/hoods/trainstation.hood new file mode 100644 index 0000000..41ac75e --- /dev/null +++ b/src/packages/fff/fff-hoods/files/etc/hoods/trainstation.hood @@ -0,0 +1,17 @@ +{ + "version": 1, + "hood": { + "name": "trainstation", + "bssid": "ca:ff:ee:ba:be:00", + "protocol": "batman-adv-v14", + "channel2": 1, + "mode2": "ht20", + "type2": "adhoc", + "channel5": 40, + "mode5": "ht40+", + "type5": "adhoc", + }, + "network": { + "ula_prefix": "fdff:0::/64" + } +} diff --git a/src/packages/fff/fff-hoods/files/etc/uci-defaults/hood-dhcp b/src/packages/fff/fff-hoods/files/etc/uci-defaults/hood-dhcp new file mode 100644 index 0000000..d9fdb6d --- /dev/null +++ b/src/packages/fff/fff-hoods/files/etc/uci-defaults/hood-dhcp @@ -0,0 +1,18 @@ +#!/bin/sh +>/etc/config/dhcp + +uci batch </dev/null + del network.globals + add network.globals + set network.globals.ula_prefix=$prefix + set network.mesh.ip6addr=$addr + commit network +EOF + +echo "Restarting network" +for ip in $(ip -6 addr show br-mesh | awk '/fdff/{ print $2 }'); do + ip -6 addr del $ip dev br-mesh +done +ip -6 addr add $addr dev br-mesh +#/etc/init.d/odhcpd stop +#/etc/init.d/network restart +#/etc/init.d/odhcpd start + +echo "Finding fastd Gateways, if online. Configure fastd." + +echo "Done" diff --git a/src/packages/fff/fff/Makefile b/src/packages/fff/fff/Makefile index e709987..bbfa99e 100644 --- a/src/packages/fff/fff/Makefile +++ b/src/packages/fff/fff/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=fff PKG_VERSION:=0.0.2 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_BUILD_DIR:=$(BUILD_DIR)/fff @@ -20,7 +20,8 @@ define Package/fff-base +fff-uradvd \ +fff-batman-adv-legacy \ +fff-fastd \ - +fff-firewall + +fff-firewall \ + +fff-hoods endef define Package/fff-base/description