[PATCH v2 06/10] fff-network/-support/-web: Nice setup of special-port devices

Christian Dresel fff at chrisi01.de
Mo Apr 22 14:04:48 CEST 2019


Hab grad gesehen da sind auch nochmal Änderungen mit drinnen, bitte auch
nochmal sauber schicken dann tue ich es mir mal an

Gruß

Christian

On 22.04.19 13:37, mail at adrianschmutzler.de wrote:
> Hallo Christian,
>
> das ist auch der Patch, der mir am wenigsten gefällt.
>
> Aber irgendwie muss man dem User ja ne Möglichkeit geben, zur Laufzeit zu ändern.
>
> Grüße
>
> Adrian
>
>> -----Original Message-----
>> From: Christian Dresel [mailto:fff at chrisi01.de]
>> Sent: Montag, 22. April 2019 09:46
>> To: Adrian Schmutzler <freifunk at adrianschmutzler.de>; franken-
>> dev at freifunk.net
>> Subject: Re: [PATCH v2 06/10] fff-network/-support/-web: Nice setup of
>> special-port devices
>>
>> das ist mir gerade zu viel gefrickel, das muss ich mir evtl. in Ruhe nochmal
>> angucken.
>>
>> Gruß
>>
>> Christian
>>
>> On 14.04.19 01:25, Adrian Schmutzler wrote:
>>> This patch:
>>> - provides scripts to easily change port configuration on the
>>>   "special" devices
>>> - provides a file to store upgrade-safe script lines run at
>>>   first boot (to be used for port adjustments)
>>> - fixes the port page in WebUI
>>> - fixes show_info
>>>
>>> With this patch, instead of specifying data in network.config and then
>>> have a script to deal with it, we define a script /etc/firstbootfff
>>> where COMMANDS can be stored. Thus, one can just make switch ports
>>> permanent by putting the uci commands there.
>>>
>>> To keep the convenient setup of one-port (and other special) devices,
>>> we implement script, e.g.
>>> setoneport "WAN"
>>> will set the port of a one-port device to WAN mode. Those scripts are
>>> used in the WebUI and may also be implemented manually in the
>>> /etc/firstbootfff file.
>>>
>>> This patch misses the selection of the current port mode in the WebUI.
>>> It would have been too much additional code for this tiny feature.
>>>
>>> Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
>>>
>>> ---
>>>
>>> This patch is built to reintroduce as much of the previous
>>> functionality as possible. One could however consider removing the CPE
>>> and AR150 special cases and leave only the real one-ports in the
>>> WebUI.
>>>
>>> Changes in v2:
>>> - Removed some -q
>>> - Changed another PORTORDER in show_info
>>> - Renamed "twoport" to "cpev1"
>>> - Add ui.portsetup in 10-setup-fff
>>> - Restart network in scripts, no reboot necessary
>>> - Make 99-fff-sysupgrade append instead of overwrite
>>> ---
>>>  .../fff-config/files/etc/uci-defaults/10-setup-fff |  3 +
>>>  .../files/etc/uci-defaults/22b-config-ports        |  3 +
>>>  .../fff/fff-network/files/usr/sbin/set2ndport      | 30 +++++++++
>>>  .../fff/fff-network/files/usr/sbin/setcpev1        | 46 +++++++++++++
>>>  .../fff/fff-network/files/usr/sbin/setoneport      | 21 ++++++
>>>  src/packages/fff/fff-support/Makefile              |  2 +-
>>>  .../files/etc/uci-defaults/90-firstbootfff         | 13 ++++
>>>  .../fff/fff-support/files/usr/sbin/show_info       | 13 ++--
>>>  src/packages/fff/fff-sysupgrade/Makefile           |  2 +-
>>>  .../files/etc/uci-defaults/99-fff-sysupgrade       |  2 +-
>>>  src/packages/fff/fff-web/Makefile                  |  2 +-
>>>  .../fff/fff-web/files/www/ssl/cgi-bin/ports.html   | 78 +++++++++-----------
>> --
>>>  12 files changed, 157 insertions(+), 58 deletions(-)  create mode
>>> 100755 src/packages/fff/fff-network/files/usr/sbin/set2ndport
>>>  create mode 100755
>>> src/packages/fff/fff-network/files/usr/sbin/setcpev1
>>>  create mode 100755
>>> src/packages/fff/fff-network/files/usr/sbin/setoneport
>>>  create mode 100644
>>> src/packages/fff/fff-support/files/etc/uci-defaults/90-firstbootfff
>>>
>>> diff --git
>>> a/src/packages/fff/fff-config/files/etc/uci-defaults/10-setup-fff
>>> b/src/packages/fff/fff-config/files/etc/uci-defaults/10-setup-fff
>>> index 3014f50d..a63ff6a9 100644
>>> --- a/src/packages/fff/fff-config/files/etc/uci-defaults/10-setup-fff
>>> +++ b/src/packages/fff/fff-config/files/etc/uci-defaults/10-setup-fff
>>> @@ -11,4 +11,7 @@ if ! uci -q get fff.system > /dev/null ; then
>>>  	uci set "fff.system.hostname=FFF"
>>>  fi
>>>
>>> +uci set fff.ui=fff
>>> +uci -q get fff.ui.portsetup > /dev/null || uci set "fff.ui.portsetup=default"
>>> +
>>>  uci commit fff
>>> 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 b8eaceab..e2887228 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
>>> @@ -21,11 +21,13 @@ case "$BOARD" in
>>>  		# Default: LAN0: WAN, LAN1: CLIENT
>>>  		setupSwitch "eth0" "0t 4" "0t" "0t 5"
>>>  		setupWan "eth0.2"
>>> +		uci set "fff.ui.portsetup=cpev1"
>>>  		;;
>>>  	gl-ar150)
>>>  		# Default: CLIENT
>>>  		setupSwitch "eth1" "0t 1" "0t"
>>>  		setupWan "eth0"
>>> +		uci set "fff.ui.portsetup=2ndport"
>>>  		;;
>>>  	tl-wdr3500-v1|\
>>>  	tl-wr741nd-v2|\
>>> @@ -85,5 +87,6 @@ case "$BOARD" in
>>>  	ubnt-unifiac-lite|\
>>>  	ubnt-unifiac-mesh)
>>>  		setupOnePort "eth0" "CLIENT"
>>> +		uci set "fff.ui.portsetup=oneport"
>>>  		;;
>>>  esac
>>> diff --git a/src/packages/fff/fff-network/files/usr/sbin/set2ndport
>>> b/src/packages/fff/fff-network/files/usr/sbin/set2ndport
>>> new file mode 100755
>>> index 00000000..13a7d1a6
>>> --- /dev/null
>>> +++ b/src/packages/fff/fff-network/files/usr/sbin/set2ndport
>>> @@ -0,0 +1,30 @@
>>> +#!/bin/sh
>>> +
>>> +# This sets the port mode on second port without switch
>>> +
>>> +if ! [ "$(uci -q get fff.ui.portsetup)" = "2ndport" ] ; then
>>> +	echo "Wrong device. This is for two-port devices without switch
>> only!"
>>> +	exit 1
>>> +fi
>>> +
>>> +LAN0MODE=$1
>>> +
>>> +CLIENT_PORTS="0t"
>>> +BATMAN_PORTS="0t"
>>> +
>>> +if [ "$LAN0MODE" = "CLIENT" ] ; then
>>> +	CLIENT_PORTS="$CLIENT_PORTS 1"
>>> +elif [ "$LAN0MODE" = "BATMAN" ] ; then
>>> +	BATMAN_PORTS="$BATMAN_PORTS 1"
>>> +else
>>> +	echo "Wrong port mode. Choose one of: CLIENT, BATMAN"
>>> +	exit 1
>>> +fi
>>> +
>>> +uci set "network.eth1_1.ports=$CLIENT_PORTS"
>>> +uci set "network.eth1_3.ports=$BATMAN_PORTS"
>>> +uci commit network
>>> +
>>> +/etc/init.d/network restart
>>> +
>>> +echo "Port updated successfully."
>>> diff --git a/src/packages/fff/fff-network/files/usr/sbin/setcpev1
>>> b/src/packages/fff/fff-network/files/usr/sbin/setcpev1
>>> new file mode 100755
>>> index 00000000..c1498441
>>> --- /dev/null
>>> +++ b/src/packages/fff/fff-network/files/usr/sbin/setcpev1
>>> @@ -0,0 +1,46 @@
>>> +#!/bin/sh
>>> +
>>> +# This sets the port mode on CPE210 v1 and CPE510 v1
>>> +
>>> +if ! [ "$(uci -q get fff.ui.portsetup)" = "cpev1" ] ; then
>>> +	echo "Wrong device. This is for CPE210 v1 or CPE510 v1 only!"
>>> +	exit 1
>>> +fi
>>> +
>>> +LAN0MODE=$1
>>> +LAN1MODE=$2
>>> +
>>> +CLIENT_PORTS="0t"
>>> +WAN_PORTS="0t"
>>> +BATMAN_PORTS="0t"
>>> +
>>> +if [ "$LAN0MODE" = "WAN" ] ; then
>>> +	WAN_PORTS="$WAN_PORTS 5"
>>> +elif [ "$LAN0MODE" = "CLIENT" ] ; then
>>> +	CLIENT_PORTS="$CLIENT_PORTS 5"
>>> +elif [ "$LAN0MODE" = "BATMAN" ] ; then
>>> +	BATMAN_PORTS="$BATMAN_PORTS 5"
>>> +else
>>> +	echo "Wrong port mode for 1st port. Choose one of: WAN, CLIENT,
>> BATMAN"
>>> +	exit 1
>>> +fi
>>> +
>>> +if [ "$LAN1MODE" = "WAN" ] ; then
>>> +	WAN_PORTS="$WAN_PORTS 4"
>>> +elif [ "$LAN1MODE" = "CLIENT" ] ; then
>>> +	CLIENT_PORTS="$CLIENT_PORTS 4"
>>> +elif [ "$LAN1MODE" = "BATMAN" ] ; then
>>> +	BATMAN_PORTS="$BATMAN_PORTS 4"
>>> +else
>>> +	echo "Wrong port mode for 2nd port. Choose one of: WAN, CLIENT,
>> BATMAN"
>>> +	exit 1
>>> +fi
>>> +
>>> +uci set "network.eth0_1.ports=$CLIENT_PORTS"
>>> +uci set "network.eth0_2.ports=$WAN_PORTS"
>>> +uci set "network.eth0_3.ports=$BATMAN_PORTS"
>>> +uci commit network
>>> +
>>> +/etc/init.d/network restart
>>> +
>>> +echo "Ports updated successfully."
>>> diff --git a/src/packages/fff/fff-network/files/usr/sbin/setoneport
>>> b/src/packages/fff/fff-network/files/usr/sbin/setoneport
>>> new file mode 100755
>>> index 00000000..6812bf17
>>> --- /dev/null
>>> +++ b/src/packages/fff/fff-network/files/usr/sbin/setoneport
>>> @@ -0,0 +1,21 @@
>>> +#!/bin/sh
>>> +
>>> +# This sets the port mode on one-port devices
>>> +
>>> +if ! [ "$(uci -q get fff.ui.portsetup)" = "oneport" ] ; then
>>> +	echo "Wrong device. This is for one-port devices only!"
>>> +	exit 1
>>> +fi
>>> +
>>> +. /lib/functions/fff/networksetup
>>> +
>>> +ETHMODE=$1
>>> +
>>> +if [ "$ETHMODE" = "WAN" ] || [ "$ETHMODE" = "CLIENT" ] || [
>> "$ETHMODE" = "BATMAN" ]; then
>>> +	setupOnePort "eth0" "$ETHMODE"
>>> +	/etc/init.d/network restart
>>> +	echo "Port updated successfully."
>>> +else
>>> +	echo "Wrong port mode. Choose one of: WAN, CLIENT, BATMAN"
>>> +	exit 1
>>> +fi
>>> diff --git a/src/packages/fff/fff-support/Makefile
>>> b/src/packages/fff/fff-support/Makefile
>>> index 56e35740..2fc74b0c 100644
>>> --- a/src/packages/fff/fff-support/Makefile
>>> +++ b/src/packages/fff/fff-support/Makefile
>>> @@ -1,7 +1,7 @@
>>>  include $(TOPDIR)/rules.mk
>>>
>>>  PKG_NAME:=fff-support
>>> -PKG_RELEASE:=2
>>> +PKG_RELEASE:=3
>>>
>>>  PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
>>>
>>> diff --git
>>> a/src/packages/fff/fff-support/files/etc/uci-defaults/90-firstbootfff
>>> b/src/packages/fff/fff-support/files/etc/uci-defaults/90-firstbootfff
>>> new file mode 100644
>>> index 00000000..30c5ab12
>>> --- /dev/null
>>> +++ b/src/packages/fff/fff-support/files/etc/uci-defaults/90-firstboot
>>> +++ fff
>>> @@ -0,0 +1,13 @@
>>> +#!/bin/sh
>>> +# Copyright 2019 Adrian Schmutzler
>>> +# License GPLv3
>>> +
>>> +LOCALUPGRADESCRIPT="/etc/firstbootfff"
>>> +
>>> +#add LOCALUPGRADESCRIPT to sysupgrade grep -q
>>> +^"${LOCALUPGRADESCRIPT}"$ /etc/sysupgrade.conf || echo
>>> +"$LOCALUPGRADESCRIPT" >> /etc/sysupgrade.conf
>>> +
>>> +# process user commands
>>> +[ -s "$LOCALCONFIGSCRIPT" ] && {
>>> +	sh /etc/firstbootfff
>>> +}
>>> diff --git a/src/packages/fff/fff-support/files/usr/sbin/show_info
>>> b/src/packages/fff/fff-support/files/usr/sbin/show_info
>>> index d7ec8247..fb7f7d25 100755
>>> --- a/src/packages/fff/fff-support/files/usr/sbin/show_info
>>> +++ b/src/packages/fff/fff-support/files/usr/sbin/show_info
>>> @@ -3,6 +3,7 @@
>>>  . /etc/firmware_release
>>>  . /lib/functions/fff/evalhoodinfo
>>>  . /lib/functions/fff/evalbytes
>>> +. /lib/functions/fff/portorder
>>>  . /lib/functions.sh # required for config_load and config_foreach
>>>
>>>  board_name=$(uci -q get board.model.name) @@ -187,13 +188,9 @@ fi
>>> echo "Download-Limit: $(uci -q get 'simple-tc.example.limit_ingress')
>> kBit/s"
>>>  echo "Upload-Limit: $(uci -q get 'simple-tc.example.limit_egress') kBit/s"
>>>
>>> -if grep -q 'PORTORDER=' /etc/network.$board_name ; then
>>> -	portorder=$(awk -F= '/PORTORDER=/ { print $2 }'
>> /etc/network.$board_name | sed "s/\"//g")
>>> -fi
>>> -
>>>  echo ""
>>>  if swconfig list | grep -q switch0 ; then
>>> -	if [ -n "$portorder" ] ; then
>>> +	if [ -n "$PORTORDER" ] ; then
>>>  		echo "-> SWITCH (tatsaechliche Portreihenfolge)"
>>>  	else
>>>  		echo "-> SWITCH (interne logische Portreihenfolge)"
>>> @@ -218,7 +215,7 @@ if swconfig list | grep -q switch0 ; then
>>>  		printf '%-10s%-5s%-13s%s\n' "WAN-Port: " "${link} " "- WAN "
>> "@ $speed"
>>>  	fi
>>>
>>> -	for internalport in $portorder
>>> +	for internalport in $PORTORDER
>>>  	do
>>>  		line=$(swconfig dev switch0 port "$internalport" show | tr -d
>> '\n' | tr -d '\t')
>>>  		port=$(echo "$line" | sed 's/.* port:\([^ ]*\) .*/\1/') @@ -
>> 230,9
>>> +227,7 @@ if swconfig list | grep -q switch0 ; then
>>>  	swconfig dev switch0 show | grep "\t*link:" | while read line ; do
>>>  		line=$(echo "$line" | tr -d '\n' | tr -d '\t')
>>>  		port=$(echo "$line" | sed 's/.* port:\([^ ]*\) .*/\1/')
>>> -		if echo "$portorder" | grep -q "$port" ; then
>>> -			continue
>>> -		fi
>>> +		echo "$PORTORDER" | grep -q "$port" && continue
>>>  		printf '%-10s' "Port #${port}: "
>>>  		format_port "${line}"
>>>  	done
>>> diff --git a/src/packages/fff/fff-sysupgrade/Makefile
>>> b/src/packages/fff/fff-sysupgrade/Makefile
>>> index 0e6c08ec..0f2e6a1e 100644
>>> --- a/src/packages/fff/fff-sysupgrade/Makefile
>>> +++ b/src/packages/fff/fff-sysupgrade/Makefile
>>> @@ -1,7 +1,7 @@
>>>  include $(TOPDIR)/rules.mk
>>>
>>>  PKG_NAME:=fff-sysupgrade
>>> -PKG_RELEASE:=10
>>> +PKG_RELEASE:=11
>>>
>>>  PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
>>>
>>> diff --git
>>> a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupg
>>> rade
>>> b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupg
>>> rade
>>> index f5783687..07f991e0 100644
>>> ---
>>> a/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sysupg
>>> rade
>>> +++ b/src/packages/fff/fff-sysupgrade/files/etc/uci-defaults/99-fff-sy
>>> +++ supgrade
>>> @@ -2,7 +2,7 @@
>>>  # Copyright 2017 Tim Niemeyer
>>>  # License GPLv3
>>>
>>> -cat > /etc/sysupgrade.conf <<-__EOF__
>>> +cat >> /etc/sysupgrade.conf <<-__EOF__
>>>  /etc/shadow
>>>  /etc/dropbear/dropbear_dss_host_key
>>>  /etc/dropbear/dropbear_rsa_host_key
>>> diff --git a/src/packages/fff/fff-web/Makefile
>>> b/src/packages/fff/fff-web/Makefile
>>> index 9bb10f71..819644a5 100644
>>> --- a/src/packages/fff/fff-web/Makefile
>>> +++ b/src/packages/fff/fff-web/Makefile
>>> @@ -1,7 +1,7 @@
>>>  include $(TOPDIR)/rules.mk
>>>
>>>  PKG_NAME:=fff-web
>>> -PKG_RELEASE:=7
>>> +PKG_RELEASE:=8
>>>
>>>  PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
>>>
>>> diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/ports.html
>>> b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/ports.html
>>> index 01506fce..f990d4e4 100755
>>> --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/ports.html
>>> +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/ports.html
>>> @@ -2,22 +2,27 @@
>>>
>>>  <%
>>>  board_name=$(uci -q get board.model.name)
>>> +LOCALUPGRADESCRIPT="/etc/firstbootfff"
>>> +
>>>  # write
>>>  if [ "$REQUEST_METHOD" = "POST" ] ; then
>>>  	if [ "$POST_change_mode" != "" ] ; then
>>> -		sed -i '/^.*# set via WebUI/d' /etc/network.config
>>> -		echo "ETHMODE=\"${POST_mode}\" # set via WebUI" >>
>> /etc/network.config
>>> -		sed -i '/^FORCEPARSE/d' /etc/network.config
>>> -		echo "FORCEPARSE='2'" >> /etc/network.config
>>> +		if [ "$(uci -q get fff.ui.portsetup)" = "oneport" ]; then
>>> +			setoneport "${POST_mode}"
>>> +			sed -i '/^setoneport.*/d' $LOCALUPGRADESCRIPT
>>> +			echo "setoneport \"${POST_mode}\" # set via
>> WebUI" >> $LOCALUPGRADESCRIPT
>>> +		elif [ "$(uci -q get fff.ui.portsetup)" = "2ndport" ]; then
>>> +			set2ndport "${POST_mode}"
>>> +			sed -i '/^set2ndport.*/d' $LOCALUPGRADESCRIPT
>>> +			echo "set2ndport \"${POST_mode}\" # set via
>> WebUI" >> $LOCALUPGRADESCRIPT
>>> +		fi
>>>  		do_reboot=1
>>>  		MSG='<span class="green">Port Modus geändert!
>> Router startet neu...</span>'
>>>  	fi
>>>  	if [ "$POST_change_twoport" != "" ] ; then
>>> -		sed -i '/^.*# set via WebUI/d' /etc/network.config
>>> -		echo "LAN0MODE=\"${POST_mode0}\" # set via WebUI" >>
>> /etc/network.config
>>> -		echo "LAN1MODE=\"${POST_mode1}\" # set via WebUI" >>
>> /etc/network.config
>>> -		sed -i '/^FORCEPARSE/d' /etc/network.config
>>> -		echo "FORCEPARSE='2'" >> /etc/network.config
>>> +		setcpev1 "${POST_mode0}" "${POST_mode1}"
>>> +		sed -i '/^setcpev1.*/d' $LOCALUPGRADESCRIPT
>>> +		echo "setcpev1 \"${POST_mode0}\" \"${POST_mode1}\" #
>> set via WebUI"
>>> +>> $LOCALUPGRADESCRIPT
>>>  		do_reboot=1
>>>  		MSG='<span class="green">Port Modus geändert!
>> Router startet neu...</span>'
>>>  	fi
>>> @@ -108,11 +113,8 @@ format_port() {
>>>  					echo "</td>"
>>>  				fi
>>>
>>> -				if grep -q 'PORTORDER='
>> /etc/network.$board_name ; then
>>> -					portorder=$(awk -F= '/PORTORDER=/
>> { print $2 }' /etc/network.$board_name | sed "s/\"//g")
>>> -				fi
>>> -				for internalport in $portorder
>>> -				do
>>> +				. /lib/functions/fff/portorder
>>> +				for internalport in $PORTORDER ; do
>>>  					line=$(swconfig dev switch0 port
>> "$internalport" show | tr -d '\n' | tr -d '\t')
>>>  					port=$(echo "$line" | sed 's/.*
>> port:\([^ ]*\) .*/\1/')
>>>  					echo "<td class=\"swport\">"
>>> @@ -120,16 +122,12 @@ format_port() {
>>>  					format_port "${line}"
>>>  					echo "</td>"
>>>  				done
>>> -				if [ -n "$portorder" ] ; then
>>> -					echo "<td class=\"swport\"
>> style=\"width:4em\"></td>"
>>> -				fi
>>> +				[ -n "$PORTORDER" ] && echo "<td
>> class=\"swport\" style=\"width:4em\"></td>"
>>>  				swconfig dev switch0 show | grep "\t*link:" |
>> while read line ; do
>>>  					line=$(echo "$line" | tr -d '\n' | tr -d
>> '\t')
>>>  					port=$(echo "$line" | sed 's/.*
>> port:\([^ ]*\) .*/\1/')
>>> -					if echo "$portorder" | grep -q "$port" ;
>> then
>>> -						continue
>>> -					fi
>>> +					echo "$PORTORDER" | grep -q "$port"
>> && continue
>>>  					echo "<td class=\"swport\">"
>>>  					echo "<span class=\"port\">Port
>> #${port}</span><br />"
>>>  					format_port "${line}"
>>> @@ -141,7 +139,7 @@ format_port() {
>>>  		<table>
>>>  			<tr><td></td></tr>
>>>  			<tr><td>
>>> -				<% if [ -n "$portorder" ] ; then %>
>>> +				<% if [ -n "$PORTORDER" ] ; then %>
>>>  				Dies zeigt die tatsächliche Zuordnung
>> der Ports, wobei der WAN Port auf der linken Seite liegt. Die Nummerierung
>> entspricht der internen Zuordnung!<br />
>>>  				<% else %>
>>>  				Die Nummerierung und Reihenfolge der Ports
>> entspricht nicht
>>> notwendigerweise der der Netzwerkanschlüsse am Router!<br />
>> @@ -152,12 +150,7 @@ format_port() {
>>>  	</fieldset>
>>>  	</td></tr>
>>>  <% fi %>
>>> -<% if grep -q "ONE_PORT" "/etc/network.$board_name" || grep -q
>> "ETHPORT" "/etc/network.$board_name" ; then %>
>>> -	<%
>>> -		# Device has a port set by $ETHMODE
>>> -		. /etc/network.mode
>>> -		. /etc/network.config
>>> -	%>
>>> +<% if [ "$(uci -q get fff.ui.portsetup)" = "oneport" ] || [ "$(uci -q
>>> +get fff.ui.portsetup)" = "2ndport" ] ; then %>
>>>  	<tr><td>
>>>  	<fieldset>
>>>  		<legend>Ethernet Anschluss</legend> @@ -166,10 +159,10
>> @@
>>> format_port() {
>>>  				<th style="width:
>> 1em;">Anschluss Modus:</th>
>>>  				<td>
>>>  					<select name="mode">
>>> -						<option value="BATMAN" <%
>> [ "$ETHMODE" = "BATMAN" ] && echo -n 'selected="selected" '
>> %>>BATMAN</option>
>>> -						<option value="CLIENT" <% [
>> "$ETHMODE" = "CLIENT" ] && echo -n 'selected="selected" '
>> %>>CLIENT</option>
>>> -						<% if grep -q "ONE_PORT"
>> "/etc/network.$board_name" ; then %>
>>> -						<option value="WAN" <% [
>> "$ETHMODE" = "WAN" ] && echo -n 'selected="selected" '
>> %>>WAN</option>
>>> +						<option
>> value="BATMAN">BATMAN</option>
>>> +						<option
>> value="CLIENT">CLIENT</option>
>>> +						<% if [ "$(uci -q get
>> fff.ui.portsetup)" = "oneport" ] ; then %>
>>> +						<option
>> value="WAN">WAN</option>
>>>  						<% fi %>
>>>  					</select>
>>>  				</td>
>>> @@ -178,7 +171,7 @@ format_port() {
>>>  			<tr><td colspan="2"></td></tr>
>>>  			<tr><td colspan="2">
>>>  				WAN: Knoten stellt über Ethernet
>> Anschluss Verbindung zum Internet her.<br />
>>> -				Client: Normale Clients stellen über
>> Ethernet Anschluss des Knotens Verbindung zum Freifunk Netz her.<br />
>>> +				CLIENT: Normale Clients stellen über
>> Ethernet Anschluss des
>>> +Knotens Verbindung zum Freifunk Netz her.<br />
>>>  				BATMAN: Knoten stellt über Ethernet
>> Anschluss Verbindung zu
>>> anderen MESH Knoten her.<br /><br />
>>>
>>>  				Wenn diese Einstellung verändert wird,
>> wird eine evtl.
>>> vorhandene manuelle Netzwerkkonfiguration in der @@ -189,12 +182,7
>> @@ format_port() {
>>>  	</fieldset>
>>>  	</td></tr>
>>>  <% fi %>
>>> -<% if grep -q "LAN0PORT" "/etc/network.$board_name" || grep -q
>> "LAN1PORT" "/etc/network.$board_name" ; then %>
>>> -	<%
>>> -		# Device has two ports
>>> -		. /etc/network.mode
>>> -		. /etc/network.config
>>> -	%>
>>> +<% if [ "$(uci -q get fff.ui.portsetup)" = "cpev1" ] ; then %>
>>>  	<tr><td>
>>>  	<fieldset>
>>>  		<legend>Ethernet Anschlüsse</legend> @@ -207,16
>> +195,16 @@
>>> format_port() {
>>>  			<tr>
>>>  				<td>
>>>  					<select name="mode0">
>>> -						<option value="BATMAN" <%
>> [ "$LAN0MODE" = "BATMAN" ] && echo -n 'selected="selected" '
>> %>>BATMAN</option>
>>> -						<option value="CLIENT" <% [
>> "$LAN0MODE" = "CLIENT" ] && echo -n 'selected="selected" '
>> %>>CLIENT</option>
>>> -						<option value="WAN" <% [
>> "$LAN0MODE" = "WAN" ] && echo -n 'selected="selected" '
>> %>>WAN</option>
>>> +						<option
>> value="BATMAN">BATMAN</option>
>>> +						<option
>> value="CLIENT">CLIENT</option>
>>> +						<option
>> value="WAN">WAN</option>
>>>  					</select>
>>>  				</td>
>>>  				<td>
>>>  					<select name="mode1">
>>> -						<option value="BATMAN" <%
>> [ "$LAN1MODE" = "BATMAN" ] && echo -n 'selected="selected" '
>> %>>BATMAN</option>
>>> -						<option value="CLIENT" <% [
>> "$LAN1MODE" = "CLIENT" ] && echo -n 'selected="selected" '
>> %>>CLIENT</option>
>>> -						<option value="WAN" <% [
>> "$LAN1MODE" = "WAN" ] && echo -n 'selected="selected" '
>> %>>WAN</option>
>>> +						<option
>> value="BATMAN">BATMAN</option>
>>> +						<option
>> value="CLIENT">CLIENT</option>
>>> +						<option
>> value="WAN">WAN</option>
>>>  					</select>
>>>  				</td>
>>>  				<td><input type="submit"
>> name="change_twoport" /></td> @@ -224,7
>>> +212,7 @@ format_port() {
>>>  			<tr><td colspan="3"></td></tr>
>>>  			<tr><td colspan="3">
>>>  				WAN: Knoten stellt über Ethernet
>> Anschluss Verbindung zum Internet her.<br />
>>> -				Client: Normale Clients stellen über
>> Ethernet Anschluss des Knotens Verbindung zum Freifunk Netz her.<br />
>>> +				CLIENT: Normale Clients stellen über
>> Ethernet Anschluss des
>>> +Knotens Verbindung zum Freifunk Netz her.<br />
>>>  				BATMAN: Knoten stellt über Ethernet
>> Anschluss Verbindung zu
>>> anderen MESH Knoten her.<br /><br />
>>>
>>>  				Wenn diese Einstellung verändert wird,
>> wird eine evtl.
>>> vorhandene manuelle Netzwerkkonfiguration in der


Mehr Informationen über die Mailingliste franken-dev