[PATCH] fff-hoods/fff-wireless: Don't delete WiFi devices

Christian Dresel fff at chrisi01.de
Sa Nov 4 13:43:28 CET 2017


hi

ich hab das ganze mal eben getestet.

root at Testknoten:/www/ssl/cgi-bin# grep 'config wifi-iface'
/etc/config/wireless | sed -n -e "s/.*'\([^']*\)'.*/\1/p"
w2ap
w2mesh
w5ap
w5mesh
w2configap
w5configap
root at Testknoten:/www/ssl/cgi-bin# uci delete wireless.w5mesh
root at Testknoten:/www/ssl/cgi-bin# uci commit wireless
root at Testknoten:/www/ssl/cgi-bin# #wait a little bit....
root at Testknoten:/www/ssl/cgi-bin# ifconfig w5mesh
w5mesh    Link encap:Ethernet  HWaddr 50:C7:BF:3B:3C:3D
          inet6 addr: fe80::52c7:bfff:fe3b:3c3d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1528  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:115 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:10668 (10.4 KiB)
root at Testknoten:/www/ssl/cgi-bin# ip link show w5mesh
60: w5mesh: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1528 qdisc noqueue
master bat0 state UP mode DEFAULT group default qlen 1000
    link/ether 50:c7:bf:3b:3c:3d brd ff:ff:ff:ff:ff:ff

root at Testknoten:/www/ssl/cgi-bin# whups....
-ash: whups....: not found

Sollte das Interface nicht runterfahren?

man könnte ein wifi dran hängen, dann wirft er die config aber ganz aus
der /etc/config/wireless

Weiß auch allgemein nicht, ob uci dafür gemacht ist, das man nur die
erste Zeile weg wirft und den Rest stehen lässt. Für mich wirkt das dann
wie ne ungültige uci Datei, ob man das so haben will?

mfg

Christian

On 02.11.2017 14:31, Adrian Schmutzler wrote:
> We only want to remove WiFi interfaces, not devices during
> reconfiguration. This still allows for complete reconfiguration,
> but does not remove device attributes like a disabled 5 GHz or
> similar.
> 
> Semi-tested: Tested via command-line, but separate from
> configurehood.
> 
> Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ---
>  src/packages/fff/fff-hoods/files/usr/sbin/configurehood   |  4 ++--
>  .../fff/fff-wireless/files/lib/functions/fff/wireless     | 15 +++++++++++++++
>  2 files changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> index 8437c33..b1b674e 100755
> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> @@ -78,7 +78,7 @@ else
>  		rm -f "$sectorcopy" # always delete: no broadcast for isolated device
>  		rm -f "$sectortmp"
>  
> -		if ! wifiDelAll; then
> +		if ! wifiDelIface; then
>  			echo "Can't delete current wifi setup"
>  			exit 1
>  		fi
> @@ -178,7 +178,7 @@ if [ -s "$hoodfile" ]; then
>  		uci -q set "system. at system[0].hood=$hood"
>  		uci -q commit system
>  
> -		if ! wifiDelAll; then
> +		if ! wifiDelIface; then
>  			echo "Can't delete current wifi setup"
>  			exit 1
>  		fi
> diff --git a/src/packages/fff/fff-wireless/files/lib/functions/fff/wireless b/src/packages/fff/fff-wireless/files/lib/functions/fff/wireless
> index b1ff5a9..5b63397 100644
> --- a/src/packages/fff/fff-wireless/files/lib/functions/fff/wireless
> +++ b/src/packages/fff/fff-wireless/files/lib/functions/fff/wireless
> @@ -14,6 +14,21 @@ wifiDelAll() {
>  	return 0
>  }
>  
> +wifiDelIface() {
> +	if [ $# -ne "0" ]
> +	then
> +		echo "Usage: wifiDelIface"
> +		return 1
> +	fi
> +
> +	grep 'config wifi-iface' /etc/config/wireless | sed -n -e "s/.*'\([^']*\)'.*/\1/p" | while read -r line ; do
> +		uci -q delete "wireless.$line"
> +	done
> +	uci -q commit wireless
> +
> +	return 0
> +}
> +
>  wifiAddPhy() {
>  	if [ $# -ne "2" ]
>  	then
> 

-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigröße  : 833 bytes
Beschreibung: OpenPGP digital signature
URL         : <http://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20171104/ad95de84/attachment.sig>


Mehr Informationen über die Mailingliste franken-dev