[PATCH] fff-network: add dummy iface to force bridge to up
Tim Niemeyer
tim at tn-x.org
Sa Jan 20 19:05:42 CET 2018
Fixes #78
Signed-off-by: Tim Niemeyer <tim at tn-x.org>
---
src/packages/fff/fff-network/Makefile | 4 ++--
.../fff/fff-network/files/etc/config/network | 6 ++++++
.../fff-network/files/lib/netifd/proto/dummy.sh | 24 ++++++++++++++++++++++
.../fff-network/files/usr/sbin/configurenetwork | 8 ++++----
4 files changed, 36 insertions(+), 6 deletions(-)
create mode 100755 src/packages/fff/fff-network/files/lib/netifd/proto/dummy.sh
diff --git a/src/packages/fff/fff-network/Makefile b/src/packages/fff/fff-network/Makefile
index 348897d..6700682 100644
--- a/src/packages/fff/fff-network/Makefile
+++ b/src/packages/fff/fff-network/Makefile
@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-network
-PKG_VERSION:=10
+PKG_VERSION:=11
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
@@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
CATEGORY:=Freifunk
TITLE:= Freifunk-Franken network configuration
URL:=http://www.freifunk-franken.de
- DEPENDS:=+fff-uradvd +fff-boardname
+ DEPENDS:=+fff-uradvd +fff-boardname +kmod-dummy
endef
define Package/$(PKG_NAME)/description
diff --git a/src/packages/fff/fff-network/files/etc/config/network b/src/packages/fff/fff-network/files/etc/config/network
index 08a897b..6ee3443 100644
--- a/src/packages/fff/fff-network/files/etc/config/network
+++ b/src/packages/fff/fff-network/files/etc/config/network
@@ -4,9 +4,15 @@ config interface 'loopback'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
+config interface 'dummy'
+ option proto 'dummy'
+
config interface 'mesh'
option type 'bridge'
+ option ifname 'dummy0'
option auto '1'
+ option bridge_empty '1'
+ option force_link '1'
config interface 'wan'
option proto 'dhcp'
diff --git a/src/packages/fff/fff-network/files/lib/netifd/proto/dummy.sh b/src/packages/fff/fff-network/files/lib/netifd/proto/dummy.sh
new file mode 100755
index 0000000..8cb9994
--- /dev/null
+++ b/src/packages/fff/fff-network/files/lib/netifd/proto/dummy.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+. /lib/functions.sh
+. ../netifd-proto.sh
+init_proto "$@"
+
+proto_dummy_setup() {
+ local config="$1"
+ local iface="$2"
+
+ ip link add "$iface" type dummy
+
+ proto_init_update "$iface" 1
+ proto_send_update "$config"
+}
+
+proto_dummy_teardown() {
+ local config="$1"
+ local iface="$2"
+
+ ip link delete dev "$iface"
+}
+
+add_protocol dummy
diff --git a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
index f318d8e..51a3487 100755
--- a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
+++ b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
@@ -110,7 +110,7 @@ if ! uci -q get network.$SWITCHDEV > /dev/null || [ "$FORCEPARSE" = '1' ] ; then
uci set network.${SWITCHDEV}_3.vlan=3
uci set network.${SWITCHDEV}_3.ports="$BATMAN_PORTS"
- uci set network.mesh.ifname="$SWITCHDEV.1 bat0"
+ uci set network.mesh.ifname="dummy0 $SWITCHDEV.1 bat0"
uci set network.ethmesh.ifname="$SWITCHDEV.3"
@@ -131,7 +131,7 @@ if [ "$ONE_PORT" = "YES" ] && ( ! uci -q get network.$SWITCHDEV.ifname || [ "$FO
echo "net.ipv6.conf.$WANDEV.accept_ra_pinfo = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.$WANDEV.autoconf = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.$WANDEV.accept_ra_rtr_pref = 1" >> /etc/sysctl.conf
- uci set network.mesh.ifname="bat0"
+ uci set network.mesh.ifname="dummy0 bat0"
uci set network.wan.ifname="$WANDEV"
uci del uci set network.ethmesh.ifname
uci del network.eth0.macaddr
@@ -140,7 +140,7 @@ if [ "$ONE_PORT" = "YES" ] && ( ! uci -q get network.$SWITCHDEV.ifname || [ "$FO
echo "net.ipv6.conf.$WANDEV.accept_ra_pinfo = 0" >> /etc/sysctl.conf
echo "net.ipv6.conf.$WANDEV.autoconf = 0" >> /etc/sysctl.conf
echo "net.ipv6.conf.$WANDEV.accept_ra_rtr_pref = 0" >> /etc/sysctl.conf
- uci set network.mesh.ifname="bat0 $SWITCHDEV"
+ uci set network.mesh.ifname="dummy0 bat0 $SWITCHDEV"
uci set network.wan.ifname="eth1" #eth1 because it is default in config file
uci del network.ethmesh.ifname
uci del network.eth0.macaddr
@@ -149,7 +149,7 @@ if [ "$ONE_PORT" = "YES" ] && ( ! uci -q get network.$SWITCHDEV.ifname || [ "$FO
echo "net.ipv6.conf.$WANDEV.accept_ra_pinfo = 0" >> /etc/sysctl.conf
echo "net.ipv6.conf.$WANDEV.autoconf = 0" >> /etc/sysctl.conf
echo "net.ipv6.conf.$WANDEV.accept_ra_rtr_pref = 0" >> /etc/sysctl.conf
- uci set network.mesh.ifname="bat0"
+ uci set network.mesh.ifname="dummy0 bat0"
uci set network.wan.ifname="eth1" #eth1 because it is default in config file
uci set network.ethmesh.ifname="$SWITCHDEV"
ETH0MAC="w2ap"
--
2.11.0
Mehr Informationen über die Mailingliste franken-dev