From 47db8d31bee3368bf6033b361bed048a8387952c Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Wed, 5 Aug 2020 22:31:19 +0200 Subject: [PATCH 01/10] fff-network: fix code flow for one-port devices in configurenetwork MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So far, all one-port devices also triggered the switch-based setup in configurenetwork, as the one-port condition was not checked there. While the relevant parts are overwritten by the one-port config which comes later in the script, it still creates a lot of useless/broken switch/vlan setup entries in /etc/config/network. Properly check for one-port vs. non-one-port in the file, without touching anything else. Signed-off-by: Adrian Schmutzler Acked-by: Fabian Bläse Reviewed-by: Fabian Bläse --- .../files/usr/sbin/configurenetwork | 110 +++++++++--------- 1 file changed, 56 insertions(+), 54 deletions(-) diff --git a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork index 42dee1e2..de737500 100755 --- a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork +++ b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork @@ -65,66 +65,68 @@ if [ -n "$LAN1PORT" ] ; then setupPorts "$LAN1PORT" "${LAN1MODE}" fi -if ! uci -q get network.$SWITCHDEV > /dev/null || [ "$FORCEPARSE" = '1' ] ; then +if [ "$ONE_PORT" != "YES" ]; then + if ! uci -q get network.$SWITCHDEV > /dev/null || [ "$FORCEPARSE" = '1' ] ; then - SWITCHHW=$(swconfig list | awk '{ print $4 }') + 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=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" + 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" + 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" + 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.client.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 - - 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.client.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 +else + if ! uci -q get network.$SWITCHDEV.ifname || [ "$FORCEPARSE" = '1' ] ; then + uci set network.$SWITCHDEV=interface + uci set network.$SWITCHDEV.ifname=$SWITCHDEV + if [ "$ETHMODE" = "WAN" ]; then + uci set network.client.ifname="bat0" + uci set network.wan.ifname="$WANDEV" + uci del network.ethmesh.ifname + uci del network.${SWITCHDEV}.macaddr + elif [ "$ETHMODE" = "CLIENT" ] ; then + uci set network.client.ifname="bat0 $SWITCHDEV" + uci set network.wan.ifname="eth2" #eth2 because it is default in config file + uci del network.ethmesh.ifname + uci del network.${SWITCHDEV}.macaddr + elif [ "$ETHMODE" = "BATMAN" ] ; then + uci set network.client.ifname="bat0" + uci set network.wan.ifname="eth2" #eth2 because it is default in config file + uci set network.ethmesh.ifname="$SWITCHDEV" + ETH0MAC="w2ap" + fi + uci commit network 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 - uci set network.client.ifname="bat0" - uci set network.wan.ifname="$WANDEV" - uci del network.ethmesh.ifname - uci del network.${SWITCHDEV}.macaddr - elif [ "$ETHMODE" = "CLIENT" ] ; then - uci set network.client.ifname="bat0 $SWITCHDEV" - uci set network.wan.ifname="eth2" #eth2 because it is default in config file - uci del network.ethmesh.ifname - uci del network.${SWITCHDEV}.macaddr - elif [ "$ETHMODE" = "BATMAN" ] ; then - uci set network.client.ifname="bat0" - uci set network.wan.ifname="eth2" #eth2 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 From c22032e2543025aa2ba465d8c4e6562edbb5a99e Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Tue, 8 Jun 2021 21:58:03 +0200 Subject: [PATCH 02/10] fff-network: support native two-port devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Support native two-port devices by adding TWO_PORT variable and exploiting the LAN0PORT and LAN1PORT variables designed for the TP-Link CPE devices. Since the latter have been converted to real two-port devices, we can now repurpose these variable for the new setup. This exploits the existing WANDEV and SWITCHDEV variables to define the primary and secondary interfaces. Note that by default this takes the initial values from network.mode, so if initial WAN/CLIENT should swapped, this has to be added to the relevant network.* file of the devices. No device-specific changes are done in this patch. Signed-off-by: Adrian Schmutzler Reviewed-by: Fabian Bläse --- src/packages/fff/fff-network/Makefile | 2 +- .../files/usr/sbin/configurenetwork | 143 ++++++++++-------- 2 files changed, 84 insertions(+), 61 deletions(-) diff --git a/src/packages/fff/fff-network/Makefile b/src/packages/fff/fff-network/Makefile index 057e3ccb..81b29cb1 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_RELEASE:=40 +PKG_RELEASE:=41 include $(INCLUDE_DIR)/package.mk diff --git a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork index de737500..b1559758 100755 --- a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork +++ b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork @@ -4,23 +4,6 @@ . /lib/functions/system.sh . /lib/functions/fff/network -setupPorts() { - # Add a single port to the *_PORTS config - # Usage: setupPorts - - 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 -} - BOARD="$(uci get board.model.name)" . /etc/network.$BOARD [ -n "$ROUTERMAC" ] || ROUTERMAC=$(get_mac_label) @@ -37,10 +20,8 @@ else if [ "$ONE_PORT" = "YES" ] || [ -n "$ETHPORT" ] ; then echo "ETHMODE='$ETHMODE' # use BATMAN, CLIENT or WAN" >> /etc/network.config fi - if [ -n "$LAN0PORT" ] ; then + if [ -n "$TWO_PORT" ] ; 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 @@ -52,20 +33,84 @@ if [ "$FORCEPARSE" = '2' ] ; then FORCEPARSE='1' fi -if [ -n "$ETHPORT" ] ; then - #LAN@AR150: default: BATMAN - setupPorts "$ETHPORT" "${ETHMODE}" -fi -if [ -n "$LAN0PORT" ] ; then - #LAN0@two-port: default: BATMAN - setupPorts "$LAN0PORT" "${LAN0MODE}" -fi -if [ -n "$LAN1PORT" ] ; then - #LAN1@two-port: default: BATMAN - setupPorts "$LAN1PORT" "${LAN1MODE}" -fi +if [ "$ONE_PORT" = "YES" ]; then + if ! uci -q get network.$SWITCHDEV.ifname || [ "$FORCEPARSE" = '1' ] ; then + uci set network.$SWITCHDEV=interface + uci set network.$SWITCHDEV.ifname=$SWITCHDEV + if [ "$ETHMODE" = "WAN" ]; then + uci set network.client.ifname="bat0" + uci set network.wan.ifname="$WANDEV" + uci del network.ethmesh.ifname + uci del network.${SWITCHDEV}.macaddr + elif [ "$ETHMODE" = "CLIENT" ] ; then + uci set network.client.ifname="bat0 $SWITCHDEV" + uci set network.wan.ifname="eth2" #eth2 because it is default in config file + uci del network.ethmesh.ifname + uci del network.${SWITCHDEV}.macaddr + elif [ "$ETHMODE" = "BATMAN" ] ; then + uci set network.client.ifname="bat0" + uci set network.wan.ifname="eth2" #eth2 because it is default in config file + uci set network.ethmesh.ifname="$SWITCHDEV" + ETH0DEV="$SWITCHDEV" + ETH0MAC="w2ap" + fi + uci commit network + fi +elif [ "$TWO_PORT" = "YES" ]; then + if ! uci -q get network.$WANDEV.ifname || [ "$FORCEPARSE" = '1' ] ; then + uci set network.$WANDEV=interface + uci set network.$WANDEV.ifname="$WANDEV" + uci set network.$SWITCHDEV=interface + uci set network.$SWITCHDEV.ifname="$SWITCHDEV" + # Only one WAN possible, second port will be unset if both are WAN + if [ "$LAN0MODE" = "WAN" ]; then + if [ "$LAN1MODE" = "CLIENT" ]; then + uci set network.client.ifname="bat0 $SWITCHDEV"; else + uci set network.client.ifname=bat0; fi + # WAN + uci set network.wan.ifname="$WANDEV" + if [ "$LAN1MODE" = "BATMAN" ]; then + uci set network.ethmesh.ifname="$SWITCHDEV"; else + uci del network.ethmesh.ifname; fi + # Two client ports are possible + elif [ "$LAN0MODE" = "CLIENT" ]; then + if [ "$LAN1MODE" = "CLIENT" ]; then + uci set network.client.ifname="bat0 $WANDEV $SWITCHDEV"; else + uci set network.client.ifname="bat0 $WANDEV"; fi + if [ "$LAN1MODE" = "WAN" ]; then + uci set network.wan.ifname="$SWITCHDEV"; else + uci set network.wan.ifname=eth2; fi #eth2 because it is default in config file + if [ "$LAN1MODE" = "BATMAN" ]; then + uci set network.ethmesh.ifname="$SWITCHDEV"; else + uci del network.ethmesh.ifname; fi + # Only one BATMAN port possible, second port will be unset if both are BATMAN + elif [ "$LAN0MODE" = "BATMAN" ] ; then + if [ "$LAN1MODE" = "CLIENT" ]; then + uci set network.client.ifname="bat0 $SWITCHDEV"; else + uci set network.client.ifname=bat0; fi + if [ "$LAN1MODE" = "WAN" ]; then + uci set network.wan.ifname="$SWITCHDEV"; else + uci set network.wan.ifname=eth2; fi #eth2 because it is default in config file + # BATMAN + uci set network.ethmesh.ifname="$WANDEV" + fi + if [ "$LAN0MODE" = "BATMAN" ]; then + ETH0DEV="$WANDEV" # only needed for setting macaddr + ETH0MAC=w2ap + uci del network.$SWITCHDEV.macaddr + elif [ "$LAN1MODE" = "BATMAN" ]; then + # $WANDEV will win if both are set to BATMAN, as above + ETH0DEV="$SWITCHDEV" # only needed for setting macaddr + ETH0MAC=w2ap + uci del network.$WANDEV.macaddr + else + uci del network.$WANDEV.macaddr + uci del network.$SWITCHDEV.macaddr + fi -if [ "$ONE_PORT" != "YES" ]; then + uci commit network + fi +else if ! uci -q get network.$SWITCHDEV > /dev/null || [ "$FORCEPARSE" = '1' ] ; then SWITCHHW=$(swconfig list | awk '{ print $4 }') @@ -103,28 +148,6 @@ if [ "$ONE_PORT" != "YES" ]; then uci set network.wan.ifname=$WANDEV fi - uci commit network - fi -else - if ! uci -q get network.$SWITCHDEV.ifname || [ "$FORCEPARSE" = '1' ] ; then - uci set network.$SWITCHDEV=interface - uci set network.$SWITCHDEV.ifname=$SWITCHDEV - if [ "$ETHMODE" = "WAN" ]; then - uci set network.client.ifname="bat0" - uci set network.wan.ifname="$WANDEV" - uci del network.ethmesh.ifname - uci del network.${SWITCHDEV}.macaddr - elif [ "$ETHMODE" = "CLIENT" ] ; then - uci set network.client.ifname="bat0 $SWITCHDEV" - uci set network.wan.ifname="eth2" #eth2 because it is default in config file - uci del network.ethmesh.ifname - uci del network.${SWITCHDEV}.macaddr - elif [ "$ETHMODE" = "BATMAN" ] ; then - uci set network.client.ifname="bat0" - uci set network.wan.ifname="eth2" #eth2 because it is default in config file - uci set network.ethmesh.ifname="$SWITCHDEV" - ETH0MAC="w2ap" - fi uci commit network fi fi @@ -168,14 +191,14 @@ if [ -n "$ROUTERMAC" ]; then fi if [ -n "$ETH0MAC" ]; then - echo "Fixing MAC on $SWITCHDEV" + echo "Fixing MAC on $ETH0DEV" sleep 10 NEW_MACADDR=$(cat "/sys/class/net/${ETH0MAC}/address") - uci set network.${SWITCHDEV}.macaddr=$NEW_MACADDR + uci set network.$ETH0DEV.macaddr=$NEW_MACADDR uci commit network - ifconfig $SWITCHDEV down - ifconfig $SWITCHDEV hw ether $NEW_MACADDR - ifconfig $SWITCHDEV up + ifconfig $ETH0DEV down + ifconfig $ETH0DEV hw ether $NEW_MACADDR + ifconfig $ETH0DEV up /etc/init.d/network restart fi From 950dcd1f1cbeee45aa39ec5ef0cb5d9bdd9eb64b Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Wed, 9 Jun 2021 12:31:29 +0200 Subject: [PATCH 03/10] fff-network: improve "-n" vs. "-z" test in configurenetwork MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simplify a single test. Signed-off-by: Adrian Schmutzler Reviewed-by: Fabian Bläse --- src/packages/fff/fff-network/Makefile | 2 +- src/packages/fff/fff-network/files/usr/sbin/configurenetwork | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/packages/fff/fff-network/Makefile b/src/packages/fff/fff-network/Makefile index 81b29cb1..cdbfa5cb 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_RELEASE:=41 +PKG_RELEASE:=42 include $(INCLUDE_DIR)/package.mk diff --git a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork index b1559758..75edf03c 100755 --- a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork +++ b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork @@ -126,7 +126,7 @@ else uci set network.${SWITCHDEV}_1.vlan=1 uci set network.${SWITCHDEV}_1.ports="$CLIENT_PORTS" - if [ "$WANDEV" = "$SWITCHDEV" ] || ! [ -z "$WAN_PORTS" ]; then + if [ "$WANDEV" = "$SWITCHDEV" ] || [ -n "$WAN_PORTS" ]; then uci set network.${SWITCHDEV}_2=switch_vlan uci set network.${SWITCHDEV}_2.device=$SWITCHHW uci set network.${SWITCHDEV}_2.vlan=2 From e39e986a59487e7e229f1149d951e31bc386ab88 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Wed, 9 Jun 2021 12:37:52 +0200 Subject: [PATCH 04/10] fff-network: adapt support for TP-Link CPE210/510 v1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This migrates the support for the TP-Link CPE210 v1 and CPE510 v1 so they are recognized by the new two-port setup code. Assignment of ports should be consistent to the ar71xx implementation, i.e. primary port (PoE in) assigned to WAN and secondary port (PoE out) assigned to CLIENT by default. Note that this is the exact opposite of the default configuration of what OpenWrt does (but both have been consistent in behavior). Since they work again, also re-enable image transfer. Signed-off-by: Adrian Schmutzler Reviewed-by: Fabian Bläse --- bsp/ath79-generic.bsp | 4 ++-- src/packages/fff/fff-network/Makefile | 2 +- .../fff-network/mips/network.tplink,cpe210-v1 | 16 ++-------------- .../fff-network/mips/network.tplink,cpe510-v1 | 16 ++-------------- 4 files changed, 7 insertions(+), 31 deletions(-) diff --git a/bsp/ath79-generic.bsp b/bsp/ath79-generic.bsp index b530d160..0402ee23 100644 --- a/bsp/ath79-generic.bsp +++ b/bsp/ath79-generic.bsp @@ -6,10 +6,10 @@ images=("openwrt-${chipset}-${subtarget}-glinet_gl-ar150-squashfs-*" "openwrt-${chipset}-${subtarget}-tplink_archer-c60-v2-squashfs-*" "openwrt-${chipset}-${subtarget}-tplink_archer-c7-v2-squashfs-*" "openwrt-${chipset}-${subtarget}-tplink_archer-c7-v5-squashfs-*" -# "openwrt-${chipset}-${subtarget}-tplink_cpe210-v1-squashfs-*" + "openwrt-${chipset}-${subtarget}-tplink_cpe210-v1-squashfs-*" "openwrt-${chipset}-${subtarget}-tplink_cpe210-v2-squashfs-*" "openwrt-${chipset}-${subtarget}-tplink_cpe210-v3-squashfs-*" -# "openwrt-${chipset}-${subtarget}-tplink_cpe510-v1-squashfs-*" + "openwrt-${chipset}-${subtarget}-tplink_cpe510-v1-squashfs-*" "openwrt-${chipset}-${subtarget}-tplink_tl-wdr3500-v1-squashfs-*" "openwrt-${chipset}-${subtarget}-tplink_tl-wdr3600-v1-squashfs-*" "openwrt-${chipset}-${subtarget}-tplink_tl-wdr4300-v1-squashfs-*" diff --git a/src/packages/fff/fff-network/Makefile b/src/packages/fff/fff-network/Makefile index cdbfa5cb..25f81c54 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_RELEASE:=42 +PKG_RELEASE:=43 include $(INCLUDE_DIR)/package.mk diff --git a/src/packages/fff/fff-network/mips/network.tplink,cpe210-v1 b/src/packages/fff/fff-network/mips/network.tplink,cpe210-v1 index 3c0a422b..0f2898fd 100644 --- a/src/packages/fff/fff-network/mips/network.tplink,cpe210-v1 +++ b/src/packages/fff/fff-network/mips/network.tplink,cpe210-v1 @@ -1,17 +1,5 @@ -. /lib/functions/fff/network - -WANDEV=eth0 +WANDEV=eth1 SWITCHDEV=eth0 -CLIENT_PORTS="0t" -WAN_PORTS="0t" -BATMAN_PORTS="0t" - -# use mac address from phy0 with 'locally administered' bit set to '1' -# only possible, because wXmesh is created first and therefore gets the 'universally administered address' - -ETHMESHMAC=$(macFlipLocalBit "$(cat /sys/class/ieee80211/phy0/macaddress)") +TWO_PORT=YES . /etc/network.mode - -LAN0PORT=5 -LAN1PORT=4 diff --git a/src/packages/fff/fff-network/mips/network.tplink,cpe510-v1 b/src/packages/fff/fff-network/mips/network.tplink,cpe510-v1 index 3c0a422b..0f2898fd 100644 --- a/src/packages/fff/fff-network/mips/network.tplink,cpe510-v1 +++ b/src/packages/fff/fff-network/mips/network.tplink,cpe510-v1 @@ -1,17 +1,5 @@ -. /lib/functions/fff/network - -WANDEV=eth0 +WANDEV=eth1 SWITCHDEV=eth0 -CLIENT_PORTS="0t" -WAN_PORTS="0t" -BATMAN_PORTS="0t" - -# use mac address from phy0 with 'locally administered' bit set to '1' -# only possible, because wXmesh is created first and therefore gets the 'universally administered address' - -ETHMESHMAC=$(macFlipLocalBit "$(cat /sys/class/ieee80211/phy0/macaddress)") +TWO_PORT=YES . /etc/network.mode - -LAN0PORT=5 -LAN1PORT=4 From 6e9685048bd484b5afac98fa9ab141e1e5c95674 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Sun, 20 Jun 2021 20:17:44 +0200 Subject: [PATCH 05/10] OpenWrt: bump to v21.02.0-rc3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bump core, packages and routing. Refresh patches. This includes babeld 1.10. Signed-off-by: Adrian Schmutzler Reviewed-by: Fabian Bläse --- buildscript | 6 +++--- .../0020-fastd_generate_key_from_urandom.patch | 13 ++----------- ...beld-Include-PKG_RELEASE-in-babeld-version.patch | 4 ++-- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/buildscript b/buildscript index 47b29c13..b33624ef 100755 --- a/buildscript +++ b/buildscript @@ -4,9 +4,9 @@ builddir=./build # OpenWrt: package hashes correspond to core repo version -OPENWRTREV="v21.02.0-rc1" -PACKAGEREV="4ceeb8fc90ed2c2e650ddddc855e7ed1df071c22" -ROUTINGREV="5b4d4c7fb6a97cac68c7d8b156fd0ab27bab4dcc" +OPENWRTREV="v21.02.0-rc3" +PACKAGEREV="e738d2faf1c4ed68094f1d5da075d2d92fb35049" +ROUTINGREV="2baff33918c089fd3744c7192f8ae7a29c47a8d7" # Gluon packages: master from 2020-02-04 GLUONREV="12e41d0ff07ec54bbd67a31ab50d12ca04f2238c" diff --git a/feed_patches/openwrt/0020-fastd_generate_key_from_urandom.patch b/feed_patches/openwrt/0020-fastd_generate_key_from_urandom.patch index 4b7beb18..55ed7090 100644 --- a/feed_patches/openwrt/0020-fastd_generate_key_from_urandom.patch +++ b/feed_patches/openwrt/0020-fastd_generate_key_from_urandom.patch @@ -1,16 +1,10 @@ -From 8e7de199282ba76a94a1b4370ac7712325b81fc2 Mon Sep 17 00:00:00 2001 From: Robert Langhammer Date: Mon, 13 Nov 2017 21:04:55 +0100 -Subject: [PATCH] fastd_generate_key_from_urandom - ---- - net/fastd/patches/001-generate_key_from_urandom.patch | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - create mode 100644 net/fastd/patches/001-generate_key_from_urandom.patch +Subject: fastd_generate_key_from_urandom diff --git a/net/fastd/patches/001-generate_key_from_urandom.patch b/net/fastd/patches/001-generate_key_from_urandom.patch new file mode 100644 -index 000000000..e06739a1e +index 0000000000000000000000000000000000000000..e06739a1e715ab310d9b30ae704f615572d6b4b9 --- /dev/null +++ b/net/fastd/patches/001-generate_key_from_urandom.patch @@ -0,0 +1,14 @@ @@ -28,6 +22,3 @@ index 000000000..e06739a1e + ecc_25519_gf_sanitize_secret(&secret_key, &secret_key); + + ecc_25519_work_t work; --- -2.25.1 - diff --git a/feed_patches/routing/0001-babeld-Include-PKG_RELEASE-in-babeld-version.patch b/feed_patches/routing/0001-babeld-Include-PKG_RELEASE-in-babeld-version.patch index e85bd91b..db594e58 100644 --- a/feed_patches/routing/0001-babeld-Include-PKG_RELEASE-in-babeld-version.patch +++ b/feed_patches/routing/0001-babeld-Include-PKG_RELEASE-in-babeld-version.patch @@ -10,10 +10,10 @@ Signed-off-by: Adrian Schmutzler Signed-off-by: Fabian Bläse diff --git a/babeld/Makefile b/babeld/Makefile -index 0b611286092464528135c15e100b3d6928f5a677..b0ed749e98714bf146b4e4be34d71484447b8ecb 100644 +index 056ce43d5ddb461ba94e51a5b18ffac0ef971468..16cc86fe5c2ae8731b0d7d2f64517e9b92d029f9 100644 --- a/babeld/Makefile +++ b/babeld/Makefile -@@ -49,6 +49,11 @@ MAKE_FLAGS+= \ +@@ -50,6 +50,11 @@ MAKE_FLAGS+= \ LDLIBS="" \ LDLIBS+="-lubus -lubox" From 2090c9124b0353c647c7bee5e139d9ac3b00092e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Bl=C3=A4se?= Date: Wed, 9 Jun 2021 00:05:20 +0200 Subject: [PATCH 06/10] buildscript: Use fff OpenWrt mirror MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the git.freifunk-franken.de OpenWrt mirror for OpenWrt itsel and OpenWrt feeds to reduce upstream traffic. This is especially important since a clean build currently requires a fresh clone of all repositories. Signed-off-by: Fabian Bläse Tested-by: Fabian Bläse --- buildscript | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/buildscript b/buildscript index b33624ef..f39897aa 100755 --- a/buildscript +++ b/buildscript @@ -17,13 +17,13 @@ GLUON_PKGS="simple-tc uradvd" FFF_VARIANTS="node layer3" -OPENWRTURL="https://git.openwrt.org/openwrt/openwrt.git" +OPENWRTURL="https://git.freifunk-franken.de/mirror/openwrt.git" ## Feed definition [0]: name aka directory, [1]: url, [2]: revision #official openwrt packages OPENWRT=(openwrt - https://git.openwrt.org/feed/packages.git + https://git.freifunk-franken.de/mirror/openwrt-packages.git $PACKAGEREV) #gluon packages @@ -33,7 +33,7 @@ GLUON=(gluon #official openwrt routing packages ROUTING=(routing - https://git.openwrt.org/feed/routing.git + https://git.freifunk-franken.de/mirror/openwrt-routing.git $ROUTINGREV) FFF=(fff) From 50e7d6a238157bc8af55e2a34536f8b24d1ac411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Bl=C3=A4se?= Date: Wed, 9 Jun 2021 00:17:01 +0200 Subject: [PATCH 07/10] buildscript: exit on errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Exit on errors, to make unsuccessful runs more obvious. Signed-off-by: Fabian Bläse Tested-by: Fabian Bläse --- buildscript | 3 +++ 1 file changed, 3 insertions(+) diff --git a/buildscript b/buildscript index f39897aa..da096193 100755 --- a/buildscript +++ b/buildscript @@ -1,6 +1,9 @@ #!/bin/bash # SPDX-License-Identifier: GPL-3.0-or-later +set -e +set -o pipefail + builddir=./build # OpenWrt: package hashes correspond to core repo version From 5d5eb295189ef9e453748f0f00447a905aecbf2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Bl=C3=A4se?= Date: Mon, 19 Apr 2021 18:52:31 +0200 Subject: [PATCH 08/10] fff-network: Remove obsolete and unnecessary sysctls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Many of the set sysctls are either unnecessary, are already default in the kernel or in OpenWrts defaults, or the reason for them being explicitly set is unknown. Remove all those sysctls from fff-network, as unfounded deviations from default values will cause hard-to-debug problems in the future. The original motivation for this patch is the netdev_max_backlog sysctl, which was set to a very low value without any reason or comment. This hurt forwarding performance on mt7621 with DSA significantly and took quite a while to discover. Signed-off-by: Fabian Bläse Tested-by: Fabian Bläse --- src/packages/fff/fff-network/Makefile | 2 +- .../files/etc/sysctl.d/50-fff-network.conf | 37 ------------------- 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/src/packages/fff/fff-network/Makefile b/src/packages/fff/fff-network/Makefile index 25f81c54..b3f8fe45 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_RELEASE:=43 +PKG_RELEASE:=44 include $(INCLUDE_DIR)/package.mk diff --git a/src/packages/fff/fff-network/files/etc/sysctl.d/50-fff-network.conf b/src/packages/fff/fff-network/files/etc/sysctl.d/50-fff-network.conf index ab536b4b..3cfd81dd 100644 --- a/src/packages/fff/fff-network/files/etc/sysctl.d/50-fff-network.conf +++ b/src/packages/fff/fff-network/files/etc/sysctl.d/50-fff-network.conf @@ -1,46 +1,9 @@ -net.ipv4.conf.default.arp_ignore=1 -net.ipv4.conf.all.arp_ignore=1 -net.ipv4.conf.all.forwarding=0 -net.ipv4.conf.all.send_redirects=0 -net.ipv4.tcp_ecn=0 -net.ipv4.tcp_fin_timeout=30 -net.ipv4.tcp_keepalive_time=120 -net.ipv4.tcp_syncookies=1 -net.core.netdev_max_backlog=30 -net.netfilter.nf_conntrack_checksum=0 - -#Do not accept source routing -net.ipv4.conf.all.accept_source_route=0 -net.ipv4.conf.all.accept_redirects=0 -net.ipv4.conf.default.accept_source_route=0 -net.ipv4.conf.default.accept_redirects=0 -net.ipv4.icmp_echo_ignore_broadcasts=1 -net.ipv4.icmp_ignore_bogus_error_responses=1 net.ipv4.ip_forward=0 net.ipv6.conf.default.accept_dad=0 net.ipv6.conf.default.accept_ra=0 -net.ipv6.conf.default.accept_redirects=0 net.ipv6.conf.all.accept_dad=0 net.ipv6.conf.all.accept_ra=0 -net.ipv6.conf.all.accept_redirects=0 -# Learn Prefix Information in Router Advertisement -net.ipv6.conf.default.accept_ra_pinfo = 0 -net.ipv6.conf.all.accept_ra_pinfo = 0 - -# Setting controls whether the system will accept Hop Limit settings from a router advertisement -net.ipv6.conf.default.accept_ra_defrtr = 0 -net.ipv6.conf.all.accept_ra_defrtr = 0 - -#router advertisements can cause the system to assign a global unicast address to an interface -net.ipv6.conf.default.autoconf = 0 -net.ipv6.conf.all.autoconf = 0 - -#how many neighbor solicitations to send out per address? -net.ipv6.conf.default.dad_transmits = 3 -net.ipv6.conf.all.dad_transmits = 3 - -# Enable forwarding, otherwise not all local route are examined net.ipv6.conf.all.forwarding=1 net.ipv6.conf.default.forwarding=0 From d252d5110a0210425845b886d96d9fde5271b2ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Bl=C3=A4se?= Date: Mon, 19 Apr 2021 19:01:31 +0200 Subject: [PATCH 09/10] fff-network: Add comments to set sysctls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To make it clear why the set sysctls are necessary, add appropriate comments to them. Also reorder them for improved readability. Signed-off-by: Fabian Bläse Tested-by: Fabian Bläse --- src/packages/fff/fff-network/Makefile | 2 +- .../files/etc/sysctl.d/50-fff-network.conf | 25 +++++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/packages/fff/fff-network/Makefile b/src/packages/fff/fff-network/Makefile index b3f8fe45..25cef9ee 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_RELEASE:=44 +PKG_RELEASE:=45 include $(INCLUDE_DIR)/package.mk diff --git a/src/packages/fff/fff-network/files/etc/sysctl.d/50-fff-network.conf b/src/packages/fff/fff-network/files/etc/sysctl.d/50-fff-network.conf index 3cfd81dd..d6b89df3 100644 --- a/src/packages/fff/fff-network/files/etc/sysctl.d/50-fff-network.conf +++ b/src/packages/fff/fff-network/files/etc/sysctl.d/50-fff-network.conf @@ -1,9 +1,24 @@ +# Disable IPv4 forwarding. +# This has to be set first, because it resets some of the +# net.ipv4.conf.* sysctls. net.ipv4.ip_forward=0 -net.ipv6.conf.default.accept_dad=0 -net.ipv6.conf.default.accept_ra=0 -net.ipv6.conf.all.accept_dad=0 -net.ipv6.conf.all.accept_ra=0 - +# Enable IPv6 forwarding, otherwise the fc00::/7 route sometimes is +# not used if a default route is available, which breaks fc00::/7 +# inside Freifunk. +# To ensure no packets are routed to different interfaces, fff-firewall +# sets appropriate iptables rules net.ipv6.conf.all.forwarding=1 net.ipv6.conf.default.forwarding=0 + +# Do not accept Router Advertisements, so no public +# addresses are assigned to interfaces, where we don't +# want them. OpenWrts netifd overwrites this option for the WAN +# interface, so IPv6 WAN connectivity is still possible. +net.ipv6.conf.default.accept_ra=0 +net.ipv6.conf.all.accept_ra=0 + +# Disable DAD, so fdff::1 on br-client does not get erroneously disabled. +# This should be done on a per-interface basis in the future. +net.ipv6.conf.default.accept_dad=0 +net.ipv6.conf.all.accept_dad=0 From 68ec1a616b106c46400fe452c546a1ddbaf121be Mon Sep 17 00:00:00 2001 From: Robert Langhammer Date: Tue, 9 Mar 2021 18:24:19 +0100 Subject: [PATCH 10/10] treewide: colorize command ip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is hard to read non colorized ip output. This adds an alias to colorize ip by default. Signed-off-by: Robert Langhammer Reviewed-by: Fabian Bläse --- bsp/default/root_file_system/etc/profile | 1 + 1 file changed, 1 insertion(+) diff --git a/bsp/default/root_file_system/etc/profile b/bsp/default/root_file_system/etc/profile index 8de20517..63105744 100644 --- a/bsp/default/root_file_system/etc/profile +++ b/bsp/default/root_file_system/etc/profile @@ -23,6 +23,7 @@ alias l='ls -CF' alias la='ls -A' alias ll='ls -alF' alias ls='ls --color=auto' +alias ip='ip --color=auto' # and color my prompt export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '