[PATCH] fff-network: add dummy iface to force bridge to up

Christian Dresel fff at chrisi01.de
So Jan 21 10:22:56 CET 2018


Hallo Tim

Tested-by: Christian Dresel <fff at chrisi01.de>

Prinzipiell gesagt:
Dies ist "sauberer" als Alfred neu zu starten im configurehood, von der
Seite gefällt es mir besser. Es legt aber wieder ein neues Interface an
(sind ja eh schon genug...), und braucht anscheinend einen weiteren kmod
(keine Ahnung wieviel Speicher das frisst, hab nicht nachgeguckt, 841er
FW hat aber noch gebaut).
Im Endeffekt bin ich aber für diese Idee da einfach sauberer.

bridge_empty '1' & force_link '1' alleine ohne den dummy Interface
reichen nicht damit die Bridge immer "an" ist?

bisschen was Inline:

On 20.01.2018 19:05, Tim Niemeyer wrote:
> 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

kannst du mir (grob) erklären was dieses Script tut? Wird irgendwie
nirgens aufgerufen und versteh daher nicht warum es nötig ist.

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

Tab statt Leerzeichen

> +
> +	proto_init_update "$iface" 1
> +	proto_send_update "$config"
> +}
> +
> +proto_dummy_teardown() {
> +	local config="$1"
> +	local iface="$2"
> +
> +    ip link delete dev "$iface"

Tab statt Leerzeichen

mfg

Christian

> +}
> +
> +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"
> 

-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigröße  : 833 bytes
Beschreibung: OpenPGP digital signature
URL         : <http://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20180121/f291766b/attachment.sig>


Mehr Informationen über die Mailingliste franken-dev