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

mail at adrianschmutzler.de mail at adrianschmutzler.de
Mo Apr 22 13:40:34 CEST 2019


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 at chrisi01.de]
> Sent: Montag, 22. April 2019 09:49
> To: Adrian Schmutzler <freifunk at adrianschmutzler.de>; franken-
> dev at 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 at 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."
> > +
-------------- 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/20190422/751c45d1/attachment.sig>


Mehr Informationen über die Mailingliste franken-dev