[PATCH v3 03/14] fff-network: Reorganize network initialization

Adrian Schmutzler mail at adrianschmutzler.de
Di Apr 23 13:07:03 CEST 2019


Hallo zusammen,

ich bräuchte noch folgende Reviews:
Robert 3/14
Christian 6/14
Christian 14/14

Folgende Änderungen habe ich jetzt berücksichtigt (ich will nicht nochmal ein Patchset schicken):
- default-case für Ports wie in Mail enthalten.
- sleep 5 weg
- etc/init.d/network restart weg bei Skripten, dafür Hinweis bei echo ("Port updated successfully. Please restart network or device!")
- 90-firstbootfff von fff-support nach fff-network verschoben

Der CPUPORT-Patch hat zwar auch nur ein Review, das wäre mir aber wurscht, da der im Moment ja noch keine Abhängigkeiten hat.

Grüße

Adrian

> -----Original Message-----
> From: franken-dev [mailto:franken-dev-bounces at freifunk.net] On Behalf Of
> Adrian Schmutzler
> Sent: Montag, 22. April 2019 14:35
> To: franken-dev at freifunk.net
> Subject: [PATCH v3 03/14] fff-network: Reorganize network initialization
> 
> This removes the configurenetwork script and replaces it by some
> scripts run only during first boot.
> 
> This introduces several changes:
> - The different tasks dealt with in configurenetwork are split.
>   Thus, one script deals with switch/port setup, one with br-mesh
>   MAC address, one with ETHMESHMAC, and one with IP addresses.
>   This makes the whole approach more modular, compared to the
>   monolithic configurenetwork.
> - Where configurenetwork contained sophisticated, nested conditions
>   to account for all possible combinations of variables, the new
>   approach is inspired by OpenWrt's board.d subfiles. Instead of
>   defining variables, we now directly call function in a
>   select-case. This is much more flexible, as we can just put code
>   there for a special case instead of bending configurenetwork for
>   it.
> - The select-case accounts for the various cases of similar/same
>   parameters of multiple devices, which can be grouped now.
> - Scripts are run only at first boot. Later changes have to be
>   done manually (we will provide some scripts later). Those will
>   typically be limited to changing only the ports; no need to run
>   whole network config again.
> - network.mode and network.config will disappear. For switch-based
>   devices, there is no advantage of using network.config compared
>   directly editing /etc/config/network. Upgrade-safety can be
>   established by putting uci commands in an upgrade-safe script
>   file (to be provided in a later patch).
> 
> After this patch, show_info and the ports display in WebUI are
> broken. Those will be fixed in a later patch.
> 
> Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> 
> ---
> 
> Changed in v2:
> - Fixed archer-c60-v2 to v1
> - Added network functions file in uci-defaults/22c
> - Removed some -q from uci
> - Removed all commands only needed for running devices (this is
>   uci only)
> - Added descriptions for functions in networksetup
> 
> Changed in v3:
> - Changed order of 22a and 22b
> - uci del instead uci set for WAN on one-port
> - switch/vlanX instead of eth#/eth#.# for switch-based devices
> ---
>  bsp/default/root_file_system/etc/rc.local          |   4 -
>  src/packages/fff/fff-network/Makefile              |   4 +-
>  .../files/etc/uci-defaults/22a-config-ports        |  89 +++++++
>  .../files/etc/uci-defaults/22b-config-routermac    |  55 +++++
>  .../files/etc/uci-defaults/22c-config-ethmesh      |  75 ++++++
>  .../files/etc/uci-defaults/23-config-ipaddr        |  31 +++
>  .../files/lib/functions/fff/networksetup           | 163 +++++++++++++
>  .../fff-network/files/lib/functions/fff/portorder  |  31 +++
>  .../fff-network/files/usr/sbin/configurenetwork    | 263
> ---------------------
>  src/packages/fff/fff-sysupgrade/Makefile           |   3 +-
>  .../files/etc/uci-defaults/99-fff-sysupgrade       |   1 -
>  11 files changed, 446 insertions(+), 273 deletions(-)
>  create mode 100644
> src/packages/fff/fff-network/files/etc/uci-defaults/22a-config-ports
>  create mode 100644
> src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-routermac
>  create mode 100644
> src/packages/fff/fff-network/files/etc/uci-defaults/22c-config-ethmesh
>  create mode 100644
> src/packages/fff/fff-network/files/etc/uci-defaults/23-config-ipaddr
>  create mode 100644
> src/packages/fff/fff-network/files/lib/functions/fff/networksetup
>  create mode 100644
> src/packages/fff/fff-network/files/lib/functions/fff/portorder
>  delete mode 100755
> src/packages/fff/fff-network/files/usr/sbin/configurenetwork
> 
> diff --git a/bsp/default/root_file_system/etc/rc.local
> b/bsp/default/root_file_system/etc/rc.local
> index 59042c37..e02368a5 100755
> --- a/bsp/default/root_file_system/etc/rc.local
> +++ b/bsp/default/root_file_system/etc/rc.local
> @@ -2,10 +2,6 @@
>  # Put your custom commands here that should be executed once
>  # the system init finished. By default this file does nothing.
> 
> -/usr/sbin/configurenetwork
> -
> -sleep 3
> -
>  /usr/sbin/configurehood
> 
>  touch /tmp/started
> diff --git a/src/packages/fff/fff-network/Makefile
> b/src/packages/fff/fff-network/Makefile
> index e9335884..11796797 100644
> --- a/src/packages/fff/fff-network/Makefile
> +++ b/src/packages/fff/fff-network/Makefile
> @@ -1,8 +1,7 @@
>  include $(TOPDIR)/rules.mk
> 
>  PKG_NAME:=fff-network
> -PKG_VERSION:=10
> -PKG_RELEASE:=1
> +PKG_RELEASE:=11
> 
>  PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
> 
> @@ -34,7 +33,6 @@ endef
> 
>  define Package/$(PKG_NAME)/install
>  	$(CP) ./files/* $(1)/
> -	test -d ./$(BOARD) && $(CP) ./$(BOARD)/* $(1)/etc/
>  endef
> 
>  $(eval $(call BuildPackage,$(PKG_NAME)))
> diff --git
> a/src/packages/fff/fff-network/files/etc/uci-defaults/22a-config-ports
> b/src/packages/fff/fff-network/files/etc/uci-defaults/22a-config-ports
> new file mode 100644
> index 00000000..b8eaceab
> --- /dev/null
> +++ b/src/packages/fff/fff-network/files/etc/uci-defaults/22a-config-ports
> @@ -0,0 +1,89 @@
> +#!/bin/sh
> +# Copyright 2019 Adrian Schmutzler
> +# License GPLv3
> +
> +BOARD="$(uci get board.model.name)"
> +
> +. /lib/functions/fff/networksetup
> +
> +case "$BOARD" in
> +	archer-c7-v2)
> +		setupSwitch "eth1" "4 5 0t" "2 3 0t" "1 6"
> +		setupWan "eth0"
> +		;;
> +	archer-c25-v1|\
> +	archer-c60-v1)
> +		setupSwitch "eth1" "1 2 0t" "3 4 0t"
> +		setupWan "eth0"
> +		;;
> +	cpe210|\
> +	cpe510)
> +		# Default: LAN0: WAN, LAN1: CLIENT
> +		setupSwitch "eth0" "0t 4" "0t" "0t 5"
> +		setupWan "eth0.2"
> +		;;
> +	gl-ar150)
> +		# Default: CLIENT
> +		setupSwitch "eth1" "0t 1" "0t"
> +		setupWan "eth0"
> +		;;
> +	tl-wdr3500-v1|\
> +	tl-wr741nd-v2|\
> +	tl-wr841-v7|\
> +	tl-wr841-v9|\
> +	tl-wr841-v10|\
> +	tl-wr841-v11|\
> +	tl-wr841-v12)
> +		setupSwitch "eth0" "1 2 0t" "3 4 0t"
> +		setupWan "eth1"
> +		;;
> +	tl-wdr3600-v1|\
> +	tl-wdr4300-v1|\
> +	tl-wdr4310-v1|\
> +	tl-wdr4900-v1)
> +		setupSwitch "eth0" "4 5 0t" "2 3 0t" "1 0t"
> +		setupWan "eth0.2"
> +		;;
> +	tl-wr841-v8|\
> +	tl-wr842n-v2)
> +		setupSwitch "eth1" "1 4 0t" "2 3 0t"
> +		setupWan "eth0"
> +		;;
> +	tl-wr740n-v4|\
> +	tl-wr740nd-v4|\
> +	tl-wr741nd-v4)
> +		setupSwitch "eth0" "1 4 0t" "2 3 0t"
> +		setupWan "eth1"
> +		;;
> +	tl-wr1043nd-v1)
> +		setupSwitch "eth0" "3 4 5t" "1 2 5t" "0 5t"
> +		setupWan "eth0.2"
> +		;;
> +	tl-wr1043nd-v2|\
> +	tl-wr1043nd-v3)
> +		setupSwitch "eth0" "1 2 6t" "3 4 6t" "5 6t"
> +		setupWan "eth0.2"
> +		;;
> +	tl-wr1043nd-v4|\
> +	tl-wr1043n-v5)
> +		setupSwitch "eth0" "1 2 0t" "3 4 0t" "5 0t"
> +		setupWan "eth0.2"
> +		;;
> +	cpe210-v2|\
> +	cpe210-v3|\
> +	tl-mr3020-v1|\
> +	tl-wa850re-v1|\
> +	tl-wa860re-v1|\
> +	tl-wa901nd-v2|\
> +	ubnt-bullet-m|\
> +	ubnt-loco-m|\
> +	ubnt-loco-m-xw|\
> +	ubnt-nano-m|\
> +	ubnt-pico-m|\
> +	ubnt-power-m-xw|\
> +	ubnt-unifi|\
> +	ubnt-unifiac-lite|\
> +	ubnt-unifiac-mesh)
> +		setupOnePort "eth0" "CLIENT"
> +		;;
> +esac
> diff --git
> a/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-routermac
> b/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-routermac
> new file mode 100644
> index 00000000..d1a5e50c
> --- /dev/null
> +++
> b/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-routermac
> @@ -0,0 +1,55 @@
> +#!/bin/sh
> +# Copyright 2019 Adrian Schmutzler
> +# License GPLv3
> +
> +BOARD="$(uci get board.model.name)"
> +
> +. /lib/functions/fff/networksetup
> +
> +. /lib/functions.sh
> +. /lib/functions/system.sh
> +
> +case "$BOARD" in
> +	archer-c7-v2|\
> +	tl-wr841-v8|\
> +	tl-wr842n-v2|\
> +	tl-wr1043nd-v2|\
> +	tl-wr1043nd-v3)
> +		ROUTERMAC=$(cat /sys/class/net/eth1/address)
> +		;;
> +	cpe210-v2|\
> +	cpe210-v3|\
> +	tl-wa850re-v1|\
> +	tl-wa860re-v1|\
> +	tl-wa901nd-v2|\
> +	tl-wdr3500-v1|\
> +	tl-wr740n-v4|\
> +	tl-wr740nd-v4|\
> +	tl-wr741nd-v2|\
> +	tl-wr741nd-v4|\
> +	tl-wr841-v7|\
> +	ubnt-bullet-m|\
> +	ubnt-loco-m|\
> +	ubnt-loco-m-xw|\
> +	ubnt-nano-m|\
> +	ubnt-pico-m|\
> +	ubnt-power-m-xw|\
> +	ubnt-unifi)
> +		ROUTERMAC=$(cat /sys/class/ieee80211/phy0/macaddress)
> +		;;
> +	tl-wdr3600-v1|\
> +	tl-wdr4300-v1|\
> +	tl-wdr4310-v1)
> +		ROUTERMAC=$(cat /sys/class/ieee80211/phy1/macaddress)
> +		;;
> +	ubnt-unifiac-lite|\
> +	ubnt-unifiac-mesh)
> +		ROUTERMAC=$(mtd_get_mac_binary EEPROM 0x0)
> +		;;
> +	*)
> +		ROUTERMAC=$(cat /sys/class/net/eth0/address)
> +		;;
> +esac
> +
> +uci set "network.mesh.macaddr=$ROUTERMAC"
> +uci commit network
> diff --git
> a/src/packages/fff/fff-network/files/etc/uci-defaults/22c-config-ethmesh
> b/src/packages/fff/fff-network/files/etc/uci-defaults/22c-config-ethmesh
> new file mode 100644
> index 00000000..86c840c3
> --- /dev/null
> +++
> b/src/packages/fff/fff-network/files/etc/uci-defaults/22c-config-ethmesh
> @@ -0,0 +1,75 @@
> +#!/bin/sh
> +# Copyright 2019 Adrian Schmutzler
> +# License GPLv3
> +
> +BOARD="$(uci get board.model.name)"
> +
> +. /lib/functions/fff/network
> +. /lib/functions/fff/networksetup
> +
> +. /lib/functions.sh
> +. /lib/functions/system.sh
> +
> +# macFlipLocalBit:
> +# use mac address from phyX with 'locally administered' bit set to '1'
> +# only possible, because wXmesh is created first and therefore gets the
> 'universally administered address'
> +
> +case "$BOARD" in
> +	archer-c7-v2|\
> +	tl-wr841-v8|\
> +	tl-wr842n-v2)
> +		ETHMESHMAC=$(cat /sys/class/net/eth0/address)
> +		;;
> +	archer-c25-v1|\
> +	archer-c60-v1|\
> +	tl-wr740n-v4|\
> +	tl-wr740nd-v4|\
> +	tl-wr741nd-v2|\
> +	tl-wr741nd-v4|\
> +	tl-wr841-v7|\
> +	tl-wr841-v9|\
> +	tl-wr841-v10|\
> +	tl-wr841-v11|\
> +	tl-wr841-v12)
> +		ETHMESHMAC=$(cat /sys/class/net/eth1/address)
> +		;;
> +	cpe210|\
> +	cpe210-v2|\
> +	cpe210-v3|\
> +	cpe510|\
> +	tl-wa850re-v1|\
> +	tl-wa860re-v1|\
> +	tl-wa901nd-v2|\
> +	tl-wr1043nd-v1|\
> +	ubnt-bullet-m|\
> +	ubnt-loco-m|\
> +	ubnt-loco-m-xw|\
> +	ubnt-nano-m|\
> +	ubnt-pico-m|\
> +	ubnt-power-m-xw|\
> +	ubnt-unifi)
> +		ETHMESHMAC=$(macFlipLocalBit "$(cat
> /sys/class/ieee80211/phy0/macaddress)")
> +		;;
> +	gl-ar150|\
> +	tl-mr3020-v1)
> +		ETHMESHMAC=$(macFlipLocalBit "$(cat
> /sys/class/net/eth0/address)")
> +		;;
> +	tl-wdr4900-v1)
> +		ETHMESHMAC=$(macFlipLocalBit "$(cat
> /sys/class/ieee80211/phy1/macaddress)")
> +		;;
> +	tl-wr1043nd-v4)
> +		ETHMESHMAC=$(mtd_get_mac_binary config 0x1017c)
> +		;;
> +	tl-wr1043n-v5)
> +		ETHMESHMAC=$(macaddr_add $(mtd_get_mac_binary
> product-info
> 8) 1)
> +		;;
> +	ubnt-unifiac-lite|\
> +	ubnt-unifiac-mesh)
> +		ETHMESHMAC=$(macFlipLocalBit "$(mtd_get_mac_binary
> EEPROM
> 0x0)")
> +		;;
> +esac
> +
> +if [ -n "$ETHMESHMAC" ]; then
> +	uci set "network.ethmesh.macaddr=$ETHMESHMAC"
> +	uci commit network
> +fi
> diff --git
> a/src/packages/fff/fff-network/files/etc/uci-defaults/23-config-ipaddr
> b/src/packages/fff/fff-network/files/etc/uci-defaults/23-config-ipaddr
> new file mode 100644
> index 00000000..db500c15
> --- /dev/null
> +++ b/src/packages/fff/fff-network/files/etc/uci-defaults/23-config-ipaddr
> @@ -0,0 +1,31 @@
> +#!/bin/sh
> +# Copyright 2019 Adrian Schmutzler
> +# License GPLv3
> +
> +. /lib/functions/fff/network
> +
> +echo "Setting IPv6 addresses"
> +# Some time needed :(
> +sleep 5
> +
> +ROUTERMAC=$(uci get network.mesh.macaddr)
> +prefix="fdff:0::/64"
> +
> +# Set $prefix as prefix
> +uci set network.globals=globals
> +uci set "network.globals.ula_prefix=$prefix"
> +
> +# Set $prefix::MAC as IP
> +addr="$(ipMacAssemble "$prefix" "$ROUTERMAC")"
> +uci add_list "network.mesh.ip6addr=$addr"
> +uci set network.mesh.proto=static
> +
> +# Set $prefix::1 as IP
> +addr="$(ipAssemble "$prefix" "1")"
> +uci add_list "network.mesh.ip6addr=$addr"
> +
> +# Set $prefix::link-local as IP
> +addr="$(ipEUIAssemble "$prefix" "$ROUTERMAC")"
> +uci add_list "network.mesh.ip6addr=$addr"
> +
> +uci commit network
> diff --git
> a/src/packages/fff/fff-network/files/lib/functions/fff/networksetup
> b/src/packages/fff/fff-network/files/lib/functions/fff/networksetup
> new file mode 100644
> index 00000000..ccc943df
> --- /dev/null
> +++ b/src/packages/fff/fff-network/files/lib/functions/fff/networksetup
> @@ -0,0 +1,163 @@
> +# Copyright 2019 Adrian Schmutzler
> +# License GPLv3
> +
> +. /lib/functions/network.sh
> +
> +setAutoConf() {
> +	# Sets ipv6 auto configuration on an interface to on/off
> +	# Usage: setAutoConf <interface> <[0|1]>
> +	local iface=$1
> +	local on=$2
> +
> +	sysctlfile="/etc/sysctl.d/51-fff-network-$iface.conf"
> +	echo "# Generated from configurenetwork" > "$sysctlfile"
> +	echo "net.ipv6.conf.$iface.accept_ra = $on" >> "$sysctlfile"
> +	echo "net.ipv6.conf.$iface.accept_ra_defrtr = $on" >>
> "$sysctlfile"
> +	echo "net.ipv6.conf.$iface.accept_ra_pinfo = $on" >> "$sysctlfile"
> +	echo "net.ipv6.conf.$iface.autoconf = $on" >> "$sysctlfile"
> +	echo "net.ipv6.conf.$iface.accept_ra_rtr_pref = $on" >>
> "$sysctlfile"
> +	echo "net.ipv6.conf.$iface.forwarding = 0" >> "$sysctlfile"
> +
> +	/sbin/sysctl -p "$sysctlfile"
> +}
> +
> +enableAutoConf() {
> +	# Enables ipv6 auto configuration on an interface
> +	# Usage: enableAutoConf <interface>
> +	local iface=$1
> +
> +	setAutoConf "$iface" "1"
> +}
> +
> +disableAutoConf() {
> +	# Disables ipv6 auto configuration on an interface
> +	# Usage: disableAutoConf <interface>
> +	local iface=$1
> +
> +	setAutoConf "$iface" "0"
> +}
> +
> +fixMac() {
> +	# Update MAC address on live device/interface
> +	#
> +	# fixMac <newmac> <interface>
> +	#
> +	# newmac: MAC address to be set
> +	# interface: Interface to be updated as in uci (e.g. mesh)
> +
> +	local newmac=$1
> +	local iface=$2
> +	local dev
> +
> +	echo "Fixing MAC on $iface"
> +	sleep 10
> +
> +	network_get_physdev dev "$iface"
> +
> +	uci set "network.${iface}.macaddr=$newmac"
> +	uci commit network
> +
> +	if [ -n "$dev" ]; then
> +		ip link set "$dev" down
> +		ip link set "$dev" address "$newmac"
> +		ip link set "$dev" up
> +	fi
> +
> +	/etc/init.d/network restart
> +}
> +
> +setupSwitch() {
> +	# Set up switch for switch-based devices
> +	# This is intended for initial setup, not for updates
> +	# (changing ports will be sufficient then)
> +	#
> +	# Usage: setupSwitch <SWITCHDEV, e.g. eth0> <CLIENT_PORTS>
> <BATMAN_PORTS> [<WAN_PORTS>]
> +
> +	local SWITCHDEV=$1
> +	local CLIENT_PORTS=$2
> +	local BATMAN_PORTS=$3
> +	local WAN_PORTS=$4
> +	local SWITCHHW
> +
> +	SWITCHHW="$(swconfig list | awk '{ print $4 }')"
> +
> +	uci set "network.switch=switch"
> +	uci set "network.switch.name=$SWITCHHW"
> +	uci set "network.switch.enable=1"
> +	uci set "network.switch.reset=1"
> +	uci set "network.switch.enable_vlan=1"
> +
> +	uci set "network.vlan1=switch_vlan"
> +	uci set "network.vlan1.device=$SWITCHHW"
> +	uci set "network.vlan1.vlan=1"
> +	uci set "network.vlan1.ports=$CLIENT_PORTS"
> +
> +	# This defines the VLAN for WAN ports inside the switch.
> +	# This is required even if the WAN eth is separate, but the WAN
> port is in the switch!
> +	if [ -n "$WAN_PORTS" ]; then
> +		uci set "network.vlan2=switch_vlan"
> +		uci set "network.vlan2.device=$SWITCHHW"
> +		uci set "network.vlan2.vlan=2"
> +		uci set "network.vlan2.ports=$WAN_PORTS"
> +	fi
> +
> +	uci set "network.vlan3=switch_vlan"
> +	uci set "network.vlan3.device=$SWITCHHW"
> +	uci set "network.vlan3.vlan=3"
> +	uci set "network.vlan3.ports=$BATMAN_PORTS"
> +
> +	uci set network.mesh.ifname="$SWITCHDEV.1 bat0"
> +	uci set network.ethmesh.ifname="$SWITCHDEV.3"
> +
> +	uci commit network
> +}
> +
> +setupWan() {
> +	# Set up WAN for any device with dedicated port (no one-port where
> mode is changed)
> +	# This is intended for initial setup, not for updates
> +	# (updates are only possible by changing ports in a switch)
> +	#
> +	# Usage: setupWan <WANDEV, e.g. eth0, eth0.2>
> +
> +	local WANDEV=$1
> +
> +	# This defines the WAN interface. We use the VLAN ID only if we do
> NOT have a separate eth.
> +	# This is different from the criterion for the WAN port dealt with
> above!
> +	# If the WANDEV is different from the SWITCHDEV, but the WAN port
> is in the switch,
> +	# the WAN eth has to be connected to the switch untagged!
> +	enableAutoConf "$WANDEV"
> +	uci set network.wan.ifname="$WANDEV"
> +
> +	uci commit network
> +}
> +
> +setupOnePort() {
> +	# Set up port mode for one-port devices
> +	# This is intended for initial setup and for updates
> +	# (latter will require network restart)
> +	#
> +	# Usage: setupOnePort <DEV, e.g. eth0> <ETHMODE, e.g. BATMAN,
> CLIENT, WAN>
> +
> +	local DEV=$1
> +	local ETHMODE=$2
> +
> +	uci set "network.$DEV=interface"
> +	uci set "network.$DEV.ifname=$DEV"
> +	if [ "$ETHMODE" = "WAN" ]; then
> +		enableAutoConf "$DEV"
> +		uci set network.mesh.ifname="bat0"
> +		uci set network.wan.ifname="$DEV"
> +		uci del network.ethmesh.ifname
> +	elif [ "$ETHMODE" = "CLIENT" ] ; then
> +		disableAutoConf "$DEV"
> +		uci set network.mesh.ifname="bat0 $DEV"
> +		uci del network.wan.ifname
> +		uci del network.ethmesh.ifname
> +	else # default=BATMAN
> +		disableAutoConf "$DEV"
> +		uci set network.mesh.ifname="bat0"
> +		uci del network.wan.ifname
> +		uci set network.ethmesh.ifname="$DEV"
> +	fi
> +	uci commit network
> +}
> diff --git
> a/src/packages/fff/fff-network/files/lib/functions/fff/portorder
> b/src/packages/fff/fff-network/files/lib/functions/fff/portorder
> new file mode 100644
> index 00000000..377c302f
> --- /dev/null
> +++ b/src/packages/fff/fff-network/files/lib/functions/fff/portorder
> @@ -0,0 +1,31 @@
> +# Copyright 2019 Adrian Schmutzler
> +# License GPLv3
> +
> +BOARD="$(uci get board.model.name)"
> +
> +case "$BOARD" in
> +	archer-c25-v1|\
> +	archer-c60-v1|\
> +	tl-wr841-v10|\
> +	tl-wr841-v11|\
> +	tl-wr841-v12)
> +		PORTORDER="4 3 2 1"
> +		;;
> +	cpe210|\
> +	cpe510)
> +		PORTORDER="5 4"
> +		;;
> +	gl-ar150)
> +		PORTORDER="1"
> +		;;
> +	tl-wdr4300-v1)
> +		PORTORDER="1 2 3 4 5"
> +		;;
> +	tl-wr841-v8)
> +		PORTORDER="2 3 4 1"
> +		;;
> +	tl-wr1043nd-v4|\
> +	tl-wr1043n-v5)
> +		PORTORDER="5 4 3 2 1"
> +		;;
> +esac
> diff --git a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
> b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
> deleted file mode 100755
> index 448bd04b..00000000
> --- a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
> +++ /dev/null
> @@ -1,263 +0,0 @@
> -#!/bin/sh
> -# This program is free software; you can redistribute it and/or modify
> -# it under the terms of the GNU 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 General Public License for more details.
> -
> -. /lib/functions/fff/network
> -
> -setupPorts() {
> -    # Add a single port to the *_PORTS config
> -    # Usage: setupPorts <port id> <port mode>
> -
> -    local port=$1
> -    local mode=$2
> -
> -    #default: BATMAN
> -    if [ "$mode" = "WAN" ] ; then
> -        WAN_PORTS="${WAN_PORTS} $port"
> -    elif [ "$mode" = "CLIENT" ] ; then
> -        CLIENT_PORTS="${CLIENT_PORTS} $port"
> -    else
> -        BATMAN_PORTS="${BATMAN_PORTS} $port"
> -    fi
> -}
> -
> -setAutoConf() {
> -    # Sets ipv6 auto configuration on an interface to on/off
> -    # Usage: setAutoConf <interface> <[0|1]>
> -    local iface=$1
> -    local on=$2
> -
> -    sysctlfile="/etc/sysctl.d/51-fff-network-$iface.conf"
> -    echo "# Generated from configurenetwork" > "$sysctlfile"
> -    echo "net.ipv6.conf.$iface.accept_ra = $on" >> "$sysctlfile"
> -    echo "net.ipv6.conf.$iface.accept_ra_defrtr = $on" >> "$sysctlfile"
> -    echo "net.ipv6.conf.$iface.accept_ra_pinfo = $on" >> "$sysctlfile"
> -    echo "net.ipv6.conf.$iface.autoconf = $on" >> "$sysctlfile"
> -    echo "net.ipv6.conf.$iface.accept_ra_rtr_pref = $on" >> "$sysctlfile"
> -    echo "net.ipv6.conf.$iface.forwarding = 0" >> "$sysctlfile"
> -
> -    /sbin/sysctl -p "$sysctlfile"
> -}
> -
> -enableAutoConf() {
> -    # Enables ipv6 auto configuration on an interface
> -    # Usage: enableAutoConf <interface>
> -    local iface=$1
> -
> -    setAutoConf "$iface" "1"
> -}
> -
> -disableAutoConf() {
> -    # Disables ipv6 auto configuration on an interface
> -    # Usage: disableAutoConf <interface>
> -    local iface=$1
> -
> -    setAutoConf "$iface" "0"
> -}
> -
> -BOARD="$(uci get board.model.name)"
> -. /etc/network.$BOARD
> -
> -if [ -s /etc/network.config ] ; then
> -    . /etc/network.config
> -else
> -    # Write network.config
> -    echo "CLIENT_PORTS='$CLIENT_PORTS'" > /etc/network.config
> -    echo "BATMAN_PORTS='$BATMAN_PORTS'" >> /etc/network.config
> -    if [ -n "$WAN_PORTS" ] ; then
> -        echo "WAN_PORTS='$WAN_PORTS'" >> /etc/network.config
> -    fi
> -    if [ "$ONE_PORT" = "YES" ] || [ -n "$ETHPORT" ] ; then
> -        echo "ETHMODE='$ETHMODE' # use BATMAN, CLIENT or WAN" >>
> /etc/network.config
> -    fi
> -    if [ -n "$LAN0PORT" ] ; then
> -        echo "LAN0MODE='$LAN0MODE' # use BATMAN, CLIENT or WAN" >>
> /etc/network.config
> -    fi
> -    if [ -n "$LAN1PORT" ] ; then
> -        echo "LAN1MODE='$LAN1MODE' # use BATMAN, CLIENT or WAN" >>
> /etc/network.config
> -    fi
> -    echo "FORCEPARSE='0' # Parse at: 0=first boot only, 1=every reboot,
> 2=next reboot (once)" >> /etc/network.config
> -fi
> -
> -if [ "$FORCEPARSE" = '2' ] ; then
> -    sed -i '/^FORCEPARSE/d' /etc/network.config
> -    echo "FORCEPARSE='0' # Parse at: 0=first boot only, 1=every reboot,
> 2=next reboot (once)" >> /etc/network.config
> -    FORCEPARSE='1'
> -fi
> -
> -if [ -n "$ETHPORT" ] ; then
> -    #LAN at AR150: default: BATMAN
> -    setupPorts "$ETHPORT" "${ETHMODE}"
> -fi
> -if [ -n "$LAN0PORT" ] ; then
> -    #LAN0 at two-port: default: BATMAN
> -    setupPorts "$LAN0PORT" "${LAN0MODE}"
> -fi
> -if [ -n "$LAN1PORT" ] ; then
> -    #LAN1 at two-port: default: BATMAN
> -    setupPorts "$LAN1PORT" "${LAN1MODE}"
> -fi
> -
> -if ! uci -q get network.$SWITCHDEV > /dev/null || [ "$FORCEPARSE" = '1' ]
> ; then
> -
> -    SWITCHHW=$(swconfig list | awk '{ print $4 }')
> -
> -    uci set network.$SWITCHDEV=switch
> -    uci set network.$SWITCHDEV.name=$SWITCHHW
> -    uci set network.$SWITCHDEV.enable=1
> -    uci set network.$SWITCHDEV.reset=1
> -    uci set network.$SWITCHDEV.enable_vlan=1
> -
> -    uci set network.${SWITCHDEV}_1=switch_vlan
> -    uci set network.${SWITCHDEV}_1.device=$SWITCHHW
> -    uci set network.${SWITCHDEV}_1.vlan=1
> -    uci set network.${SWITCHDEV}_1.ports="$CLIENT_PORTS"
> -
> -    if [ "$WANDEV" = "$SWITCHDEV" ] || ! [ -z "$WAN_PORTS" ]; then
> -        uci set network.${SWITCHDEV}_2=switch_vlan
> -        uci set network.${SWITCHDEV}_2.device=$SWITCHHW
> -        uci set network.${SWITCHDEV}_2.vlan=2
> -        uci set network.${SWITCHDEV}_2.ports="$WAN_PORTS"
> -
> -        enableAutoConf "$WANDEV.2"
> -    else
> -        enableAutoConf "$WANDEV"
> -    fi
> -
> -    uci set network.${SWITCHDEV}_3=switch_vlan
> -    uci set network.${SWITCHDEV}_3.device=$SWITCHHW
> -    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.ethmesh.ifname="$SWITCHDEV.3"
> -
> -    if [ "$WANDEV" = "$SWITCHDEV" ]; then
> -        uci set network.wan.ifname=$WANDEV.2
> -    else
> -        uci set network.wan.ifname=$WANDEV
> -    fi
> -
> -    uci commit network
> -fi
> -
> -if [ "$ONE_PORT" = "YES" ] && ( ! uci -q get network.$SWITCHDEV.ifname ||
> [ "$FORCEPARSE" = '1' ] ) ; then
> -    uci set network.$SWITCHDEV=interface
> -    uci set network.$SWITCHDEV.ifname=$SWITCHDEV
> -    if [ "$ETHMODE" = "WAN" ]; then
> -        enableAutoConf "$WANDEV"
> -        uci set network.mesh.ifname="bat0"
> -        uci set network.wan.ifname="$WANDEV"
> -        uci del uci set network.ethmesh.ifname
> -        uci del network.eth0.macaddr
> -    elif [ "$ETHMODE" = "CLIENT" ] ; then
> -        disableAutoConf "$WANDEV"
> -        uci set network.mesh.ifname="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
> -    elif [ "$ETHMODE" = "BATMAN" ] ; then
> -        disableAutoConf "$WANDEV"
> -        uci set network.mesh.ifname="bat0"
> -        uci set network.wan.ifname="eth1" #eth1 because it is default in
> config file
> -        uci set network.ethmesh.ifname="$SWITCHDEV"
> -        ETH0MAC="w2ap"
> -    fi
> -    uci commit network
> -fi
> -
> -/etc/init.d/network restart
> -
> -if [ -n "$ETHMESHMAC" ]; then
> -    if uci get network.ethmesh.macaddr
> -    then
> -        echo "MAC for ethmesh is set already"
> -    else
> -        echo "Fixing MAC on $SWITCHDEV.3 (ethmesh)"
> -        sleep 10
> -
> -        uci set network.ethmesh.macaddr=$ETHMESHMAC
> -        uci commit network
> -
> -        ifconfig $SWITCHDEV.3 down
> -        ifconfig $SWITCHDEV.3 hw ether $ETHMESHMAC
> -        ifconfig $SWITCHDEV.3 up
> -        /etc/init.d/network restart
> -    fi
> -fi
> -
> -if [ -n "$ROUTERMAC" ]; then
> -    if uci get network.mesh.macaddr
> -    then
> -        echo "MAC for mesh is set already"
> -    else
> -        echo "Fixing MAC on br-mesh (mesh)"
> -        sleep 10
> -
> -        uci set network.mesh.macaddr=$ROUTERMAC
> -        uci commit network
> -
> -        ifconfig br-mesh down
> -        ifconfig br-mesh hw ether $ROUTERMAC
> -        ifconfig br-mesh up
> -        /etc/init.d/network restart
> -    fi
> -fi
> -
> -if [ -n "$ETH0MAC" ]; then
> -        echo "Fixing MAC on eth0"
> -        sleep 10
> -        NEW_MACADDR=$(cat "/sys/class/net/${ETH0MAC}/address")
> -        uci set network.eth0.macaddr=$NEW_MACADDR
> -        uci commit network
> -        ifconfig eth0 down
> -        ifconfig eth0 hw ether $NEW_MACADDR
> -        ifconfig eth0 up
> -        /etc/init.d/network restart
> -fi
> -
> -if uci -q get "network.mesh.ip6addr" > /dev/null
> -then
> -    echo "IPv6 for mesh is set already"
> -else
> -    echo "Setting IPv6 addresses"
> -    # Some time needed :(
> -    sleep 5
> -
> -    for ip in $(ip -6 addr show br-mesh | awk '/fdff/{ print $2 }'); do
> -        ip -6 addr del $ip dev br-mesh
> -    done
> -
> -    prefix="fdff:0::/64"
> -    # Set $prefix::MAC as IP
> -    addr="$(ipMacAssemble "$prefix" "$ROUTERMAC")"
> -    ip -6 addr add $addr dev br-mesh
> -
> -    uci -q del network.globals
> -    uci -q set network.globals=globals
> -    uci -q set network.globals.ula_prefix=$prefix
> -    uci -q add_list network.mesh.ip6addr=$addr
> -    uci -q set network.mesh.proto=static
> -
> -    # Set $prefix::1 as IP
> -    addr="$(ipAssemble "$prefix" "1")"
> -    ip -6 addr add $addr dev br-mesh
> -    uci -q add_list network.mesh.ip6addr=$addr
> -
> -    # Set $prefix::link-local as IP
> -    addr="$(ipEUIAssemble "$prefix" "$ROUTERMAC")"
> -    ip -6 addr add $addr dev br-mesh
> -    uci -q add_list network.mesh.ip6addr=$addr
> -
> -    uci -q commit network
> -
> -    /etc/init.d/fff-uradvd restart
> -fi
> diff --git a/src/packages/fff/fff-sysupgrade/Makefile
> b/src/packages/fff/fff-sysupgrade/Makefile
> index 90ef66af..0e6c08ec 100644
> --- a/src/packages/fff/fff-sysupgrade/Makefile
> +++ b/src/packages/fff/fff-sysupgrade/Makefile
> @@ -1,8 +1,7 @@
>  include $(TOPDIR)/rules.mk
> 
>  PKG_NAME:=fff-sysupgrade
> -PKG_VERSION:=9
> -PKG_RELEASE:=1
> +PKG_RELEASE:=10
> 
>  PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
> 
> diff --git
> a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupgrade
> b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupgrade
> index 7ff83f54..f5783687 100644
> ---
> a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupgrade
> +++
> b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupgrade
> @@ -7,7 +7,6 @@ cat > /etc/sysupgrade.conf <<-__EOF__
>  /etc/dropbear/dropbear_dss_host_key
>  /etc/dropbear/dropbear_rsa_host_key
>  /etc/dropbear/authorized_keys
> -/etc/network.config
>  /etc/config/fff
>  /etc/hoodfile
>  __EOF__
> --
> 2.11.0
-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : nicht verfügbar
Dateityp    : application/pgp-signature
Dateigröße  : 834 bytes
Beschreibung: nicht verfügbar
URL         : <https://{'listname': 'franken-dev-freifunk.net', 'hostname': 'lists.freifunk.net'}/pipermail/franken-dev-freifunk.net/attachments/20190423/cd982124/attachment.sig>


Mehr Informationen über die Mailingliste franken-dev