[v2,10/10] Add support for second port of Nanostation M

Submitted by Adrian Schmutzler on April 13, 2019, 11:25 p.m.

Details

Message ID 20190413232535.9834-11-freifunk@adrianschmutzler.de
State Superseded
Headers show

Commit Message

Adrian Schmutzler April 13, 2019, 11:25 p.m.
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>

---

This is not tested.

Changes in v2:
- Added patch
---
 .../files/etc/uci-defaults/22b-config-ports        |  6 +++-
 .../files/lib/functions/fff/networksetup           | 33 ++++++++++++++++++++++
 .../fff/fff-network/files/usr/sbin/settwoeth       | 26 +++++++++++++++++
 3 files changed, 64 insertions(+), 1 deletion(-)
 create mode 100755 src/packages/fff/fff-network/files/usr/sbin/settwoeth

Patch hide | download patch | download mbox

diff --git a/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-ports b/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-ports
index e2887228..372a6c59 100644
--- a/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-ports
+++ b/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-ports
@@ -71,6 +71,11 @@  case "$BOARD" in
 		setupSwitch "eth0" "1 2 0t" "3 4 0t" "5 0t"
 		setupWan "eth0.2"
 		;;
+	ubnt-nano-m)
+		setupOnePort "eth0" "WAN"
+		setup2ndEth "eth1" "CLIENT"
+		uci -q set "fff.ui.portsetup=twoeth"
+		;;
 	cpe210-v2|\
 	cpe210-v3|\
 	tl-mr3020-v1|\
@@ -80,7 +85,6 @@  case "$BOARD" in
 	ubnt-bullet-m|\
 	ubnt-loco-m|\
 	ubnt-loco-m-xw|\
-	ubnt-nano-m|\
 	ubnt-pico-m|\
 	ubnt-power-m-xw|\
 	ubnt-unifi|\
diff --git a/src/packages/fff/fff-network/files/lib/functions/fff/networksetup b/src/packages/fff/fff-network/files/lib/functions/fff/networksetup
index d9f91200..0478cf59 100644
--- a/src/packages/fff/fff-network/files/lib/functions/fff/networksetup
+++ b/src/packages/fff/fff-network/files/lib/functions/fff/networksetup
@@ -161,3 +161,36 @@  setupOnePort() {
 	fi
 	uci commit network
 }
+
+setup2ndEth() {
+	# Set up second port for devices with to ports directly connected to ethX (no switch)
+	# This is intended for initial setup and for updates
+	#
+	# Use this in combination with setupOnePort() for the first port.
+	# Calling setupOnePort() will overwrite the settings made here, so always call in succession, e.g.
+	# setupOnePort eth0 "WAN"
+	# setup2ndEth eth1 "BATMAN"
+	#
+	# Usage: setup2ndEth <DEV, e.g. eth1> <ETHMODE: BATMAN or CLIENT>
+
+	local DEV=$1
+	local ETHMODE=$2
+
+	uci set "network.$DEV=interface"
+	uci set "network.$DEV.ifname=$DEV"
+
+	local meshif="$(uci -q get network.mesh.ifname | sed "s/ *$DEV//")"
+	local ethmeshif="$(uci -q get network.ethmesh.ifname | sed "s/ *$DEV//")"
+	if [ "$ETHMODE" = "CLIENT" ] ; then
+		uci set network.mesh.ifname="$meshif $DEV"
+		if [ -n "$ethmesif" ]; then
+			uci set network.ethmesh.ifname="$ethmesif"
+		else
+			uci del network.ethmesh.ifname
+		fi
+	else # default=BATMAN
+		uci set network.mesh.ifname="$meshif"
+		uci set network.ethmesh.ifname="$ethmesif $DEV"
+	fi
+	uci commit network
+}
diff --git a/src/packages/fff/fff-network/files/usr/sbin/settwoeth b/src/packages/fff/fff-network/files/usr/sbin/settwoeth
new file mode 100755
index 00000000..b2489789
--- /dev/null
+++ b/src/packages/fff/fff-network/files/usr/sbin/settwoeth
@@ -0,0 +1,26 @@ 
+#!/bin/sh
+
+if ! [ "$(uci -q get fff.ui.portsetup)" = "twoeth" ] ; then
+	echo "Wrong device. This is for Nanostation M only!"
+	exit 1
+fi
+
+. /lib/functions/fff/networksetup
+
+ETHMODE1=$1
+ETHMODE2=$2
+
+if ! ([ "$ETHMODE1" = "WAN" ] || [ "$ETHMODE1" = "CLIENT" ] || [ "$ETHMODE1" = "BATMAN" ]); then
+	echo "Wrong port mode for first port. Choose one of: WAN, CLIENT, BATMAN"
+	exit 1
+fi
+if ! ([ "$ETHMODE2" = "CLIENT" ] || [ "$ETHMODE2" = "BATMAN" ]); then
+	echo "Wrong port mode for second port. Choose one of: CLIENT, BATMAN"
+	exit 1
+fi
+
+setupOnePort "eth0" "$ETHMODE1"
+setup2ndEth "eth1" "$ETHMODE2"
+/etc/init.d/network restart
+echo "Port updated successfully."
+

Comments

Adrian Schmutzler April 18, 2019, 9:16 a.m.
Auch hier gibt es noch ein paar Änderungen.

Diese sind bereits als erster Patch der FritzBox-Serie im Patchwork:
https://pw.freifunk-franken.de/patch/1071/

Der FritzBox-Patch 1 wird dann quasi hier reingematscht.

Grüße

Adrian

> -----Original Message-----
> From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On Behalf Of
> Adrian Schmutzler
> Sent: Sonntag, 14. April 2019 01:26
> To: franken-dev@freifunk.net
> Subject: [PATCH v2 10/10] Add support for second port of Nanostation M
> 
> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> 
> ---
> 
> This is not tested.
> 
> Changes in v2:
> - Added patch
> ---
>  .../files/etc/uci-defaults/22b-config-ports        |  6 +++-
>  .../files/lib/functions/fff/networksetup           | 33
> ++++++++++++++++++++++
>  .../fff/fff-network/files/usr/sbin/settwoeth       | 26 +++++++++++++++++
>  3 files changed, 64 insertions(+), 1 deletion(-)
>  create mode 100755 src/packages/fff/fff-network/files/usr/sbin/settwoeth
> 
> diff --git
> a/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-ports
> b/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-ports
> index e2887228..372a6c59 100644
> --- a/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-ports
> +++ b/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-ports
> @@ -71,6 +71,11 @@ case "$BOARD" in
>  		setupSwitch "eth0" "1 2 0t" "3 4 0t" "5 0t"
>  		setupWan "eth0.2"
>  		;;
> +	ubnt-nano-m)
> +		setupOnePort "eth0" "WAN"
> +		setup2ndEth "eth1" "CLIENT"
> +		uci -q set "fff.ui.portsetup=twoeth"
> +		;;
>  	cpe210-v2|\
>  	cpe210-v3|\
>  	tl-mr3020-v1|\
> @@ -80,7 +85,6 @@ case "$BOARD" in
>  	ubnt-bullet-m|\
>  	ubnt-loco-m|\
>  	ubnt-loco-m-xw|\
> -	ubnt-nano-m|\
>  	ubnt-pico-m|\
>  	ubnt-power-m-xw|\
>  	ubnt-unifi|\
> diff --git
> a/src/packages/fff/fff-network/files/lib/functions/fff/networksetup
> b/src/packages/fff/fff-network/files/lib/functions/fff/networksetup
> index d9f91200..0478cf59 100644
> --- a/src/packages/fff/fff-network/files/lib/functions/fff/networksetup
> +++ b/src/packages/fff/fff-network/files/lib/functions/fff/networksetup
> @@ -161,3 +161,36 @@ setupOnePort() {
>  	fi
>  	uci commit network
>  }
> +
> +setup2ndEth() {
> +	# Set up second port for devices with to ports directly connected
> to ethX (no switch)
> +	# This is intended for initial setup and for updates
> +	#
> +	# Use this in combination with setupOnePort() for the first port.
> +	# Calling setupOnePort() will overwrite the settings made here, so
> always call in succession, e.g.
> +	# setupOnePort eth0 "WAN"
> +	# setup2ndEth eth1 "BATMAN"
> +	#
> +	# Usage: setup2ndEth <DEV, e.g. eth1> <ETHMODE: BATMAN or
> CLIENT>
> +
> +	local DEV=$1
> +	local ETHMODE=$2
> +
> +	uci set "network.$DEV=interface"
> +	uci set "network.$DEV.ifname=$DEV"
> +
> +	local meshif="$(uci -q get network.mesh.ifname | sed "s/
> *$DEV//")"
> +	local ethmeshif="$(uci -q get network.ethmesh.ifname | sed "s/
> *$DEV//")"
> +	if [ "$ETHMODE" = "CLIENT" ] ; then
> +		uci set network.mesh.ifname="$meshif $DEV"
> +		if [ -n "$ethmesif" ]; then
> +			uci set network.ethmesh.ifname="$ethmesif"
> +		else
> +			uci del network.ethmesh.ifname
> +		fi
> +	else # default=BATMAN
> +		uci set network.mesh.ifname="$meshif"
> +		uci set network.ethmesh.ifname="$ethmesif $DEV"
> +	fi
> +	uci commit network
> +}
> diff --git a/src/packages/fff/fff-network/files/usr/sbin/settwoeth
> b/src/packages/fff/fff-network/files/usr/sbin/settwoeth
> new file mode 100755
> index 00000000..b2489789
> --- /dev/null
> +++ b/src/packages/fff/fff-network/files/usr/sbin/settwoeth
> @@ -0,0 +1,26 @@
> +#!/bin/sh
> +
> +if ! [ "$(uci -q get fff.ui.portsetup)" = "twoeth" ] ; then
> +	echo "Wrong device. This is for Nanostation M only!"
> +	exit 1
> +fi
> +
> +. /lib/functions/fff/networksetup
> +
> +ETHMODE1=$1
> +ETHMODE2=$2
> +
> +if ! ([ "$ETHMODE1" = "WAN" ] || [ "$ETHMODE1" = "CLIENT" ] || [
> "$ETHMODE1" = "BATMAN" ]); then
> +	echo "Wrong port mode for first port. Choose one of: WAN, CLIENT,
> BATMAN"
> +	exit 1
> +fi
> +if ! ([ "$ETHMODE2" = "CLIENT" ] || [ "$ETHMODE2" = "BATMAN" ]); then
> +	echo "Wrong port mode for second port. Choose one of: CLIENT,
> BATMAN"
> +	exit 1
> +fi
> +
> +setupOnePort "eth0" "$ETHMODE1"
> +setup2ndEth "eth1" "$ETHMODE2"
> +/etc/init.d/network restart
> +echo "Port updated successfully."
> +
> --
> 2.11.0
Christian Dresel April 22, 2019, 7:48 a.m.
hi

prinzipiell sieht es gut aus, auch wenn es keiner getestet hat würde ich
es einfach mit aufnehmen. Kleinigkeit Inline:


On 14.04.19 01:25, Adrian Schmutzler wrote:
> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
>
> ---
>
> This is not tested.
>
> Changes in v2:
> - Added patch
> ---
>  .../files/etc/uci-defaults/22b-config-ports        |  6 +++-
>  .../files/lib/functions/fff/networksetup           | 33 ++++++++++++++++++++++
>  .../fff/fff-network/files/usr/sbin/settwoeth       | 26 +++++++++++++++++
>  3 files changed, 64 insertions(+), 1 deletion(-)
>  create mode 100755 src/packages/fff/fff-network/files/usr/sbin/settwoeth
>
> diff --git a/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-ports b/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-ports
> index e2887228..372a6c59 100644
> --- a/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-ports
> +++ b/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-ports
> @@ -71,6 +71,11 @@ case "$BOARD" in
>  		setupSwitch "eth0" "1 2 0t" "3 4 0t" "5 0t"
>  		setupWan "eth0.2"
>  		;;
> +	ubnt-nano-m)
> +		setupOnePort "eth0" "WAN"
> +		setup2ndEth "eth1" "CLIENT"

Haben wir nicht gesagt wir machen hier Batman? Fritzbox steht auf
Batman, wir sollten uns mal einigen ;)

Gruß

Christian

> +		uci -q set "fff.ui.portsetup=twoeth"
> +		;;
>  	cpe210-v2|\
>  	cpe210-v3|\
>  	tl-mr3020-v1|\
> @@ -80,7 +85,6 @@ case "$BOARD" in
>  	ubnt-bullet-m|\
>  	ubnt-loco-m|\
>  	ubnt-loco-m-xw|\
> -	ubnt-nano-m|\
>  	ubnt-pico-m|\
>  	ubnt-power-m-xw|\
>  	ubnt-unifi|\
> diff --git a/src/packages/fff/fff-network/files/lib/functions/fff/networksetup b/src/packages/fff/fff-network/files/lib/functions/fff/networksetup
> index d9f91200..0478cf59 100644
> --- a/src/packages/fff/fff-network/files/lib/functions/fff/networksetup
> +++ b/src/packages/fff/fff-network/files/lib/functions/fff/networksetup
> @@ -161,3 +161,36 @@ setupOnePort() {
>  	fi
>  	uci commit network
>  }
> +
> +setup2ndEth() {
> +	# Set up second port for devices with to ports directly connected to ethX (no switch)
> +	# This is intended for initial setup and for updates
> +	#
> +	# Use this in combination with setupOnePort() for the first port.
> +	# Calling setupOnePort() will overwrite the settings made here, so always call in succession, e.g.
> +	# setupOnePort eth0 "WAN"
> +	# setup2ndEth eth1 "BATMAN"
> +	#
> +	# Usage: setup2ndEth <DEV, e.g. eth1> <ETHMODE: BATMAN or CLIENT>
> +
> +	local DEV=$1
> +	local ETHMODE=$2
> +
> +	uci set "network.$DEV=interface"
> +	uci set "network.$DEV.ifname=$DEV"
> +
> +	local meshif="$(uci -q get network.mesh.ifname | sed "s/ *$DEV//")"
> +	local ethmeshif="$(uci -q get network.ethmesh.ifname | sed "s/ *$DEV//")"
> +	if [ "$ETHMODE" = "CLIENT" ] ; then
> +		uci set network.mesh.ifname="$meshif $DEV"
> +		if [ -n "$ethmesif" ]; then
> +			uci set network.ethmesh.ifname="$ethmesif"
> +		else
> +			uci del network.ethmesh.ifname
> +		fi
> +	else # default=BATMAN
> +		uci set network.mesh.ifname="$meshif"
> +		uci set network.ethmesh.ifname="$ethmesif $DEV"
> +	fi
> +	uci commit network
> +}
> diff --git a/src/packages/fff/fff-network/files/usr/sbin/settwoeth b/src/packages/fff/fff-network/files/usr/sbin/settwoeth
> new file mode 100755
> index 00000000..b2489789
> --- /dev/null
> +++ b/src/packages/fff/fff-network/files/usr/sbin/settwoeth
> @@ -0,0 +1,26 @@
> +#!/bin/sh
> +
> +if ! [ "$(uci -q get fff.ui.portsetup)" = "twoeth" ] ; then
> +	echo "Wrong device. This is for Nanostation M only!"
> +	exit 1
> +fi
> +
> +. /lib/functions/fff/networksetup
> +
> +ETHMODE1=$1
> +ETHMODE2=$2
> +
> +if ! ([ "$ETHMODE1" = "WAN" ] || [ "$ETHMODE1" = "CLIENT" ] || [ "$ETHMODE1" = "BATMAN" ]); then
> +	echo "Wrong port mode for first port. Choose one of: WAN, CLIENT, BATMAN"
> +	exit 1
> +fi
> +if ! ([ "$ETHMODE2" = "CLIENT" ] || [ "$ETHMODE2" = "BATMAN" ]); then
> +	echo "Wrong port mode for second port. Choose one of: CLIENT, BATMAN"
> +	exit 1
> +fi
> +
> +setupOnePort "eth0" "$ETHMODE1"
> +setup2ndEth "eth1" "$ETHMODE2"
> +/etc/init.d/network restart
> +echo "Port updated successfully."
> +
Adrian Schmutzler April 22, 2019, 11:40 a.m.
Hallo Christian,

ändere ich auf Batman. Dan muss aber die alte CPE mit zwei Ports auch Batman kriegen. Das ändere ich auch. 

Grüße

Adrian

> -----Original Message-----
> From: Christian Dresel [mailto:fff@chrisi01.de]
> Sent: Montag, 22. April 2019 09:49
> To: Adrian Schmutzler <freifunk@adrianschmutzler.de>; franken-
> dev@freifunk.net
> Subject: Re: [PATCH v2 10/10] Add support for second port of Nanostation M
> 
> hi
> 
> prinzipiell sieht es gut aus, auch wenn es keiner getestet hat würde ich es
> einfach mit aufnehmen. Kleinigkeit Inline:
> 
> 
> On 14.04.19 01:25, Adrian Schmutzler wrote:
> > Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> >
> > ---
> >
> > This is not tested.
> >
> > Changes in v2:
> > - Added patch
> > ---
> >  .../files/etc/uci-defaults/22b-config-ports        |  6 +++-
> >  .../files/lib/functions/fff/networksetup           | 33
> ++++++++++++++++++++++
> >  .../fff/fff-network/files/usr/sbin/settwoeth       | 26 +++++++++++++++++
> >  3 files changed, 64 insertions(+), 1 deletion(-)  create mode 100755
> > src/packages/fff/fff-network/files/usr/sbin/settwoeth
> >
> > diff --git
> > a/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-ports
> > b/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-ports
> > index e2887228..372a6c59 100644
> > ---
> > a/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-ports
> > +++ b/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-p
> > +++ orts
> > @@ -71,6 +71,11 @@ case "$BOARD" in
> >  		setupSwitch "eth0" "1 2 0t" "3 4 0t" "5 0t"
> >  		setupWan "eth0.2"
> >  		;;
> > +	ubnt-nano-m)
> > +		setupOnePort "eth0" "WAN"
> > +		setup2ndEth "eth1" "CLIENT"
> 
> Haben wir nicht gesagt wir machen hier Batman? Fritzbox steht auf Batman,
> wir sollten uns mal einigen ;)
> 
> Gruß
> 
> Christian
> 
> > +		uci -q set "fff.ui.portsetup=twoeth"
> > +		;;
> >  	cpe210-v2|\
> >  	cpe210-v3|\
> >  	tl-mr3020-v1|\
> > @@ -80,7 +85,6 @@ case "$BOARD" in
> >  	ubnt-bullet-m|\
> >  	ubnt-loco-m|\
> >  	ubnt-loco-m-xw|\
> > -	ubnt-nano-m|\
> >  	ubnt-pico-m|\
> >  	ubnt-power-m-xw|\
> >  	ubnt-unifi|\
> > diff --git
> > a/src/packages/fff/fff-network/files/lib/functions/fff/networksetup
> > b/src/packages/fff/fff-network/files/lib/functions/fff/networksetup
> > index d9f91200..0478cf59 100644
> > ---
> > a/src/packages/fff/fff-network/files/lib/functions/fff/networksetup
> > +++ b/src/packages/fff/fff-network/files/lib/functions/fff/networksetu
> > +++ p
> > @@ -161,3 +161,36 @@ setupOnePort() {
> >  	fi
> >  	uci commit network
> >  }
> > +
> > +setup2ndEth() {
> > +	# Set up second port for devices with to ports directly connected to
> ethX (no switch)
> > +	# This is intended for initial setup and for updates
> > +	#
> > +	# Use this in combination with setupOnePort() for the first port.
> > +	# Calling setupOnePort() will overwrite the settings made here, so
> always call in succession, e.g.
> > +	# setupOnePort eth0 "WAN"
> > +	# setup2ndEth eth1 "BATMAN"
> > +	#
> > +	# Usage: setup2ndEth <DEV, e.g. eth1> <ETHMODE: BATMAN or
> CLIENT>
> > +
> > +	local DEV=$1
> > +	local ETHMODE=$2
> > +
> > +	uci set "network.$DEV=interface"
> > +	uci set "network.$DEV.ifname=$DEV"
> > +
> > +	local meshif="$(uci -q get network.mesh.ifname | sed "s/ *$DEV//")"
> > +	local ethmeshif="$(uci -q get network.ethmesh.ifname | sed "s/
> *$DEV//")"
> > +	if [ "$ETHMODE" = "CLIENT" ] ; then
> > +		uci set network.mesh.ifname="$meshif $DEV"
> > +		if [ -n "$ethmesif" ]; then
> > +			uci set network.ethmesh.ifname="$ethmesif"
> > +		else
> > +			uci del network.ethmesh.ifname
> > +		fi
> > +	else # default=BATMAN
> > +		uci set network.mesh.ifname="$meshif"
> > +		uci set network.ethmesh.ifname="$ethmesif $DEV"
> > +	fi
> > +	uci commit network
> > +}
> > diff --git a/src/packages/fff/fff-network/files/usr/sbin/settwoeth
> > b/src/packages/fff/fff-network/files/usr/sbin/settwoeth
> > new file mode 100755
> > index 00000000..b2489789
> > --- /dev/null
> > +++ b/src/packages/fff/fff-network/files/usr/sbin/settwoeth
> > @@ -0,0 +1,26 @@
> > +#!/bin/sh
> > +
> > +if ! [ "$(uci -q get fff.ui.portsetup)" = "twoeth" ] ; then
> > +	echo "Wrong device. This is for Nanostation M only!"
> > +	exit 1
> > +fi
> > +
> > +. /lib/functions/fff/networksetup
> > +
> > +ETHMODE1=$1
> > +ETHMODE2=$2
> > +
> > +if ! ([ "$ETHMODE1" = "WAN" ] || [ "$ETHMODE1" = "CLIENT" ] || [
> "$ETHMODE1" = "BATMAN" ]); then
> > +	echo "Wrong port mode for first port. Choose one of: WAN, CLIENT,
> BATMAN"
> > +	exit 1
> > +fi
> > +if ! ([ "$ETHMODE2" = "CLIENT" ] || [ "$ETHMODE2" = "BATMAN" ]); then
> > +	echo "Wrong port mode for second port. Choose one of: CLIENT,
> BATMAN"
> > +	exit 1
> > +fi
> > +
> > +setupOnePort "eth0" "$ETHMODE1"
> > +setup2ndEth "eth1" "$ETHMODE2"
> > +/etc/init.d/network restart
> > +echo "Port updated successfully."
> > +
Christian Dresel April 22, 2019, 12:02 p.m.
Wenn das geändert ist, kannst du auch ein

Reviewed-by: Christian Dresel <fff@chrisi01.de>

Dran hängen. CPE dann auch ja.

Gruß

Christian

On 22.04.19 13:40, mail@adrianschmutzler.de wrote:
> Hallo Christian,
>
> ändere ich auf Batman. Dan muss aber die alte CPE mit zwei Ports auch Batman kriegen. Das ändere ich auch. 
>
> Grüße
>
> Adrian
>
>> -----Original Message-----
>> From: Christian Dresel [mailto:fff@chrisi01.de]
>> Sent: Montag, 22. April 2019 09:49
>> To: Adrian Schmutzler <freifunk@adrianschmutzler.de>; franken-
>> dev@freifunk.net
>> Subject: Re: [PATCH v2 10/10] Add support for second port of Nanostation M
>>
>> hi
>>
>> prinzipiell sieht es gut aus, auch wenn es keiner getestet hat würde ich es
>> einfach mit aufnehmen. Kleinigkeit Inline:
>>
>>
>> On 14.04.19 01:25, Adrian Schmutzler wrote:
>>> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
>>>
>>> ---
>>>
>>> This is not tested.
>>>
>>> Changes in v2:
>>> - Added patch
>>> ---
>>>  .../files/etc/uci-defaults/22b-config-ports        |  6 +++-
>>>  .../files/lib/functions/fff/networksetup           | 33
>> ++++++++++++++++++++++
>>>  .../fff/fff-network/files/usr/sbin/settwoeth       | 26 +++++++++++++++++
>>>  3 files changed, 64 insertions(+), 1 deletion(-)  create mode 100755
>>> src/packages/fff/fff-network/files/usr/sbin/settwoeth
>>>
>>> diff --git
>>> a/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-ports
>>> b/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-ports
>>> index e2887228..372a6c59 100644
>>> ---
>>> a/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-ports
>>> +++ b/src/packages/fff/fff-network/files/etc/uci-defaults/22b-config-p
>>> +++ orts
>>> @@ -71,6 +71,11 @@ case "$BOARD" in
>>>  		setupSwitch "eth0" "1 2 0t" "3 4 0t" "5 0t"
>>>  		setupWan "eth0.2"
>>>  		;;
>>> +	ubnt-nano-m)
>>> +		setupOnePort "eth0" "WAN"
>>> +		setup2ndEth "eth1" "CLIENT"
>> Haben wir nicht gesagt wir machen hier Batman? Fritzbox steht auf Batman,
>> wir sollten uns mal einigen ;)
>>
>> Gruß
>>
>> Christian
>>
>>> +		uci -q set "fff.ui.portsetup=twoeth"
>>> +		;;
>>>  	cpe210-v2|\
>>>  	cpe210-v3|\
>>>  	tl-mr3020-v1|\
>>> @@ -80,7 +85,6 @@ case "$BOARD" in
>>>  	ubnt-bullet-m|\
>>>  	ubnt-loco-m|\
>>>  	ubnt-loco-m-xw|\
>>> -	ubnt-nano-m|\
>>>  	ubnt-pico-m|\
>>>  	ubnt-power-m-xw|\
>>>  	ubnt-unifi|\
>>> diff --git
>>> a/src/packages/fff/fff-network/files/lib/functions/fff/networksetup
>>> b/src/packages/fff/fff-network/files/lib/functions/fff/networksetup
>>> index d9f91200..0478cf59 100644
>>> ---
>>> a/src/packages/fff/fff-network/files/lib/functions/fff/networksetup
>>> +++ b/src/packages/fff/fff-network/files/lib/functions/fff/networksetu
>>> +++ p
>>> @@ -161,3 +161,36 @@ setupOnePort() {
>>>  	fi
>>>  	uci commit network
>>>  }
>>> +
>>> +setup2ndEth() {
>>> +	# Set up second port for devices with to ports directly connected to
>> ethX (no switch)
>>> +	# This is intended for initial setup and for updates
>>> +	#
>>> +	# Use this in combination with setupOnePort() for the first port.
>>> +	# Calling setupOnePort() will overwrite the settings made here, so
>> always call in succession, e.g.
>>> +	# setupOnePort eth0 "WAN"
>>> +	# setup2ndEth eth1 "BATMAN"
>>> +	#
>>> +	# Usage: setup2ndEth <DEV, e.g. eth1> <ETHMODE: BATMAN or
>> CLIENT>
>>> +
>>> +	local DEV=$1
>>> +	local ETHMODE=$2
>>> +
>>> +	uci set "network.$DEV=interface"
>>> +	uci set "network.$DEV.ifname=$DEV"
>>> +
>>> +	local meshif="$(uci -q get network.mesh.ifname | sed "s/ *$DEV//")"
>>> +	local ethmeshif="$(uci -q get network.ethmesh.ifname | sed "s/
>> *$DEV//")"
>>> +	if [ "$ETHMODE" = "CLIENT" ] ; then
>>> +		uci set network.mesh.ifname="$meshif $DEV"
>>> +		if [ -n "$ethmesif" ]; then
>>> +			uci set network.ethmesh.ifname="$ethmesif"
>>> +		else
>>> +			uci del network.ethmesh.ifname
>>> +		fi
>>> +	else # default=BATMAN
>>> +		uci set network.mesh.ifname="$meshif"
>>> +		uci set network.ethmesh.ifname="$ethmesif $DEV"
>>> +	fi
>>> +	uci commit network
>>> +}
>>> diff --git a/src/packages/fff/fff-network/files/usr/sbin/settwoeth
>>> b/src/packages/fff/fff-network/files/usr/sbin/settwoeth
>>> new file mode 100755
>>> index 00000000..b2489789
>>> --- /dev/null
>>> +++ b/src/packages/fff/fff-network/files/usr/sbin/settwoeth
>>> @@ -0,0 +1,26 @@
>>> +#!/bin/sh
>>> +
>>> +if ! [ "$(uci -q get fff.ui.portsetup)" = "twoeth" ] ; then
>>> +	echo "Wrong device. This is for Nanostation M only!"
>>> +	exit 1
>>> +fi
>>> +
>>> +. /lib/functions/fff/networksetup
>>> +
>>> +ETHMODE1=$1
>>> +ETHMODE2=$2
>>> +
>>> +if ! ([ "$ETHMODE1" = "WAN" ] || [ "$ETHMODE1" = "CLIENT" ] || [
>> "$ETHMODE1" = "BATMAN" ]); then
>>> +	echo "Wrong port mode for first port. Choose one of: WAN, CLIENT,
>> BATMAN"
>>> +	exit 1
>>> +fi
>>> +if ! ([ "$ETHMODE2" = "CLIENT" ] || [ "$ETHMODE2" = "BATMAN" ]); then
>>> +	echo "Wrong port mode for second port. Choose one of: CLIENT,
>> BATMAN"
>>> +	exit 1
>>> +fi
>>> +
>>> +setupOnePort "eth0" "$ETHMODE1"
>>> +setup2ndEth "eth1" "$ETHMODE2"
>>> +/etc/init.d/network restart
>>> +echo "Port updated successfully."
>>> +