[RFC PATCH] Add package fff-vxlan-node
Robert Langhammer
rlanghammer at web.de
Fr Aug 7 01:33:48 CEST 2020
This package adds vxlan support to the node variant and configures the vxlan-vpn tunnels to the gateways.
A vpn section has to be added to the hoodfile for every peer (GW) supporting vxlan:
{
"version": 1,
"network": {
"ula_prefix": "fd43:5602:29bd:16:\/64"
},
"vpn": [
{
"name": "rl-fff1-vx",
"protocol": "vxlan",
"vid": "7",
"address": "rl-fff1.fff.community"
},
{
"name": "fff-gw-mc",
"protocol": "fastd",
...
For testing the hoods schweinfurt, hassfurt, coburg, ebern and geo can be used. "address" is the same for all hoods: rl-fff1.fff.community. The respective hood-id is used as vid.
This patch depends on "[RFC,v2] vxlan: netifd and vxlan package patches" and "Make vpn select modular.patch"
Happy testing!
Signed-off-by: Robert Langhammer <rlanghammer at web.de>
---
src/packages/fff/fff-node/Makefile | 3 +-
src/packages/fff/fff-vxlan-node/Makefile | 39 +++++++++++++++++++
.../files/etc/uci-defaults/55-vxlan | 15 +++++++
.../files/etc/vpn-select.d/vxlan | 26 +++++++++++++
4 files changed, 82 insertions(+), 1 deletion(-)
create mode 100644 src/packages/fff/fff-vxlan-node/Makefile
create mode 100644 src/packages/fff/fff-vxlan-node/files/etc/uci-defaults/55-vxlan
create mode 100644 src/packages/fff/fff-vxlan-node/files/etc/vpn-select.d/vxlan
diff --git a/src/packages/fff/fff-node/Makefile b/src/packages/fff/fff-node/Makefile
index 0292725..8b31202 100644
--- a/src/packages/fff/fff-node/Makefile
+++ b/src/packages/fff/fff-node/Makefile
@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-node
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_BUILD_DIR:=$(BUILD_DIR)/fff-node
@@ -14,6 +14,7 @@ define Package/fff-node
URL:=https://www.freifunk-franken.de
DEPENDS:=+fff-batman-adv \
+fff-fastd \
+ +fff-vxlan-node \
+fff-firewall \
+fff-hoods \
+fff-uradvd
diff --git a/src/packages/fff/fff-vxlan-node/Makefile b/src/packages/fff/fff-vxlan-node/Makefile
new file mode 100644
index 0000000..233badd
--- /dev/null
+++ b/src/packages/fff/fff-vxlan-node/Makefile
@@ -0,0 +1,39 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=fff-vxlan-node
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/$(PKG_NAME)
+ SECTION:=base
+ CATEGORY:=Freifunk
+ TITLE:=Freifunk-Franken vxlan-node configuration
+ URL:=http://www.freifunk-franken.de
+ DEPENDS:=+vxlan
+endef
+
+define Package/$(PKG_NAME)/description
+ This is the vxlan for the Freifunk Franken node-Firmware
+ It is used to configure vxlan.
+endef
+
+define Build/Prepare
+ echo "all: " > $(PKG_BUILD_DIR)/Makefile
+endef
+
+define Build/Configure
+ # nothing
+endef
+
+define Build/Compile
+ # nothing
+endef
+
+define Package/$(PKG_NAME)/install
+ $(CP) ./files/* $(1)/
+endef
+
+$(eval $(call BuildPackage,$(PKG_NAME)))
diff --git a/src/packages/fff/fff-vxlan-node/files/etc/uci-defaults/55-vxlan b/src/packages/fff/fff-vxlan-node/files/etc/uci-defaults/55-vxlan
new file mode 100644
index 0000000..2e6ab69
--- /dev/null
+++ b/src/packages/fff/fff-vxlan-node/files/etc/uci-defaults/55-vxlan
@@ -0,0 +1,15 @@
+uci batch <<EOF
+ set network.vx0=interface
+ set network.vx0.proto=vxlan6
+ set network.vx0.ip6addr=auto
+ set network.vx0.port=8472
+ set network.vx0.srcport=8472
+ set network.vx0.mtu=1422
+ set network.vx0.disabled=1
+
+ set network.vxbat=interface
+ set network.vxbat.master=bat0
+ set network.vxbat.proto=batadv_hardif
+ set network.vxbat.ifname=vx0
+EOF
+
diff --git a/src/packages/fff/fff-vxlan-node/files/etc/vpn-select.d/vxlan b/src/packages/fff/fff-vxlan-node/files/etc/vpn-select.d/vxlan
new file mode 100644
index 0000000..0850c56
--- /dev/null
+++ b/src/packages/fff/fff-vxlan-node/files/etc/vpn-select.d/vxlan
@@ -0,0 +1,26 @@
+protocol=vxlan
+
+vxlan_clear() {
+ uci set network.vx0.disabled="1"
+ while uci delete network. at vxlan_peer[0]; do :; done
+}
+
+vxlan_addpeer() {
+ json_get_var vid vid
+ json_get_var address address
+ address="$( ping6 -w1 -c1 "$address" | awk -F '[()]' '{print $2; exit}' )"
+ [ -z $address ] && return
+ uci set network.vx0.vid="$vid"
+ uci set network.vx0.peer6addr="$address"
+ uci set network.vx0.disabled="0"
+
+ uci add network vxlan_peer
+ uci set network. at vxlan_peer[-1].vxlan="vx0"
+ uci set network. at vxlan_peer[-1].dst="$address"
+}
+
+vxlan_start_stop() {
+ uci commit network
+ reload_config
+}
+
--
2.20.1
Mehr Informationen über die Mailingliste franken-dev