[v1,3/4] fff-hoods: call reload_config after uci commit

Submitted by Tim Niemeyer on June 10, 2018, 12:06 p.m.

Details

Message ID 20180610120601.21151-4-tim@tn-x.org
State Accepted
Headers show

Commit Message

Tim Niemeyer June 10, 2018, 12:06 p.m.
Signed-off-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Christian Dresel <fff@chrisi01.de>
---

Changes in v1: None

 src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 4 ++++
 1 file changed, 4 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
index 42a489d..eaf2578 100755
--- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
+++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
@@ -56,6 +56,7 @@  if [ -s "$hoodfilecopy" ] && isGatewayAvailable ; then
 		uci set network.${iface}.proto='static'
 		uci set network.${iface}.ip6addr='fe80::1/64'
 		uci commit network
+		reload_config
 		if ! wifiAddAP "$radio" "config.franken.freifunk.net" "$iface" "configap" "1"; then
 			echo "Can't add Config interface on $radio."
 			exit 1
@@ -101,6 +102,7 @@  else
 
 			uci -q del "system.@system[0].hood"
 			uci -q commit system
+			reload_config
 		
 			sleep 30 # Wait for the config AP, which may be created at the same time as this script has started
 
@@ -127,6 +129,7 @@  else
 					uci -q set network.configSta=interface
 					uci -q set network.configSta.proto='static'
 					uci -q commit network
+					reload_config
 				fi
 			done
 		
@@ -232,6 +235,7 @@  if [ -s "$hoodfile" ]; then
 		echo "Setting hood name: $hood"
 		uci -q set "system.@system[0].hood=$hood"
 		uci -q commit system
+		reload_config
 
 		if ! wifiDelIface; then
 			echo "Can't delete current wifi setup"

Comments

Adrian Schmutzler June 10, 2018, 12:22 p.m.
Hallo,

ich frage mich gerade, ob man reload_config da an jeder Stelle callen muss
oder ob es ausreicht, das ein einer oder zwei bestimmten Stellen, wo die
config quasi "fertig" ist, dann nur einmal für alles auszulösen?

Grüße

Adrian

> -----Original Message-----
> From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On Behalf
> Of Tim Niemeyer
> Sent: Sonntag, 10. Juni 2018 14:06
> To: franken-dev@freifunk.net
> Subject: [PATCH v1 3/4] fff-hoods: call reload_config after uci commit
> 
> Signed-off-by: Tim Niemeyer <tim@tn-x.org>
> Reviewed-by: Christian Dresel <fff@chrisi01.de>
> ---
> 
> Changes in v1: None
> 
>  src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> index 42a489d..eaf2578 100755
> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> @@ -56,6 +56,7 @@ if [ -s "$hoodfilecopy" ] && isGatewayAvailable ; then
>  		uci set network.${iface}.proto='static'
>  		uci set network.${iface}.ip6addr='fe80::1/64'
>  		uci commit network
> +		reload_config
>  		if ! wifiAddAP "$radio" "config.franken.freifunk.net"
"$iface"
> "configap" "1"; then
>  			echo "Can't add Config interface on $radio."
>  			exit 1
> @@ -101,6 +102,7 @@ else
> 
>  			uci -q del "system.@system[0].hood"
>  			uci -q commit system
> +			reload_config
> 
>  			sleep 30 # Wait for the config AP, which may be
> created at the same time as this script has started
> 
> @@ -127,6 +129,7 @@ else
>  					uci -q set
network.configSta=interface
>  					uci -q set
> network.configSta.proto='static'
>  					uci -q commit network
> +					reload_config
>  				fi
>  			done
> 
> @@ -232,6 +235,7 @@ if [ -s "$hoodfile" ]; then
>  		echo "Setting hood name: $hood"
>  		uci -q set "system.@system[0].hood=$hood"
>  		uci -q commit system
> +		reload_config
> 
>  		if ! wifiDelIface; then
>  			echo "Can't delete current wifi setup"
> --
> 2.11.0
Tim Niemeyer June 10, 2018, 12:30 p.m.
Am Sonntag, den 10.06.2018, 14:22 +0200 schrieb
mail@adrianschmutzler.de:
> Hallo,
> 
> ich frage mich gerade, ob man reload_config da an jeder Stelle callen
> muss
> oder ob es ausreicht, das ein einer oder zwei bestimmten Stellen, wo
> die
> config quasi "fertig" ist, dann nur einmal für alles auszulösen?

Das ist im Moment eher noch ein größeres Chaos. :(

Wie callen ja z.B. auch noch hin und wieder "wifi". Das ist falsch und
sollte nicht nötig sein. Auch machen wir scheinbar öfters ein commit,
obwohl es nicht nötig wäre.

Das muss dringend aufgeräumt werden, aber ich trau mich da jetzt nicht
das anzupacken.

Für den macnocker ist es wichtig, dass er aufgerufen wird, so bald sich
die hood geändert hat. Das wird über reload_config gemacht. Von mir
aus, können wir uns darauf reduzieren. Langfristig müssten wir aber die
anderen Sachen auch reparieren.

Tim


> Grüße
> 
> Adrian
> 
> > -----Original Message-----
> > From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On
> > Behalf
> > Of Tim Niemeyer
> > Sent: Sonntag, 10. Juni 2018 14:06
> > To: franken-dev@freifunk.net
> > Subject: [PATCH v1 3/4] fff-hoods: call reload_config after uci
> > commit
> > 
> > Signed-off-by: Tim Niemeyer <tim@tn-x.org>
> > Reviewed-by: Christian Dresel <fff@chrisi01.de>
> > ---
> > 
> > Changes in v1: None
> > 
> >  src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/src/packages/fff/fff-
> > hoods/files/usr/sbin/configurehood
> > b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> > index 42a489d..eaf2578 100755
> > --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> > +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> > @@ -56,6 +56,7 @@ if [ -s "$hoodfilecopy" ] && isGatewayAvailable ;
> > then
> >  		uci set network.${iface}.proto='static'
> >  		uci set network.${iface}.ip6addr='fe80::1/64'
> >  		uci commit network
> > +		reload_config
> >  		if ! wifiAddAP "$radio"
> > "config.franken.freifunk.net"
> 
> "$iface"
> > "configap" "1"; then
> >  			echo "Can't add Config interface on
> > $radio."
> >  			exit 1
> > @@ -101,6 +102,7 @@ else
> > 
> >  			uci -q del "system.@system[0].hood"
> >  			uci -q commit system
> > +			reload_config
> > 
> >  			sleep 30 # Wait for the config AP, which
> > may be
> > created at the same time as this script has started
> > 
> > @@ -127,6 +129,7 @@ else
> >  					uci -q set
> 
> network.configSta=interface
> >  					uci -q set
> > network.configSta.proto='static'
> >  					uci -q commit network
> > +					reload_config
> >  				fi
> >  			done
> > 
> > @@ -232,6 +235,7 @@ if [ -s "$hoodfile" ]; then
> >  		echo "Setting hood name: $hood"
> >  		uci -q set "system.@system[0].hood=$hood"
> >  		uci -q commit system
> > +		reload_config
> > 
> >  		if ! wifiDelIface; then
> >  			echo "Can't delete current wifi setup"
> > --
> > 2.11.0
> 
>
Adrian Schmutzler June 10, 2018, 12:41 p.m.
Okay, das akzeptiere ich dann mal so.

Acked-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>

Weiß nicht, ob ich für den noch nen Review mache, im Zweifel aber nicht darauf warten.

> -----Original Message-----
> From: Tim Niemeyer [mailto:tim@tn-x.org]
> Sent: Sonntag, 10. Juni 2018 14:31
> To: mail@adrianschmutzler.de; franken-dev@freifunk.net
> Subject: Re: [PATCH v1 3/4] fff-hoods: call reload_config after uci commit
> 
> Am Sonntag, den 10.06.2018, 14:22 +0200 schrieb
> mail@adrianschmutzler.de:
> > Hallo,
> >
> > ich frage mich gerade, ob man reload_config da an jeder Stelle callen
> > muss oder ob es ausreicht, das ein einer oder zwei bestimmten Stellen,
> > wo die config quasi "fertig" ist, dann nur einmal für alles
> > auszulösen?
> 
> Das ist im Moment eher noch ein größeres Chaos. :(
> 
> Wie callen ja z.B. auch noch hin und wieder "wifi". Das ist falsch und sollte
> nicht nötig sein. Auch machen wir scheinbar öfters ein commit, obwohl es
> nicht nötig wäre.
> 
> Das muss dringend aufgeräumt werden, aber ich trau mich da jetzt nicht das
> anzupacken.
> 
> Für den macnocker ist es wichtig, dass er aufgerufen wird, so bald sich die
> hood geändert hat. Das wird über reload_config gemacht. Von mir aus,
> können wir uns darauf reduzieren. Langfristig müssten wir aber die anderen
> Sachen auch reparieren.
> 
> Tim
> 
> 
> > Grüße
> >
> > Adrian
> >
> > > -----Original Message-----
> > > From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On
> > > Behalf Of Tim Niemeyer
> > > Sent: Sonntag, 10. Juni 2018 14:06
> > > To: franken-dev@freifunk.net
> > > Subject: [PATCH v1 3/4] fff-hoods: call reload_config after uci
> > > commit
> > >
> > > Signed-off-by: Tim Niemeyer <tim@tn-x.org>
> > > Reviewed-by: Christian Dresel <fff@chrisi01.de>
> > > ---
> > >
> > > Changes in v1: None
> > >
> > >  src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > >
> > > diff --git a/src/packages/fff/fff-
> > > hoods/files/usr/sbin/configurehood
> > > b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> > > index 42a489d..eaf2578 100755
> > > --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> > > +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> > > @@ -56,6 +56,7 @@ if [ -s "$hoodfilecopy" ] && isGatewayAvailable ;
> > > then
> > >  		uci set network.${iface}.proto='static'
> > >  		uci set network.${iface}.ip6addr='fe80::1/64'
> > >  		uci commit network
> > > +		reload_config
> > >  		if ! wifiAddAP "$radio"
> > > "config.franken.freifunk.net"
> >
> > "$iface"
> > > "configap" "1"; then
> > >  			echo "Can't add Config interface on $radio."
> > >  			exit 1
> > > @@ -101,6 +102,7 @@ else
> > >
> > >  			uci -q del "system.@system[0].hood"
> > >  			uci -q commit system
> > > +			reload_config
> > >
> > >  			sleep 30 # Wait for the config AP, which may be
> created at the
> > > same time as this script has started
> > >
> > > @@ -127,6 +129,7 @@ else
> > >  					uci -q set
> >
> > network.configSta=interface
> > >  					uci -q set
> > > network.configSta.proto='static'
> > >  					uci -q commit network
> > > +					reload_config
> > >  				fi
> > >  			done
> > >
> > > @@ -232,6 +235,7 @@ if [ -s "$hoodfile" ]; then
> > >  		echo "Setting hood name: $hood"
> > >  		uci -q set "system.@system[0].hood=$hood"
> > >  		uci -q commit system
> > > +		reload_config
> > >
> > >  		if ! wifiDelIface; then
> > >  			echo "Can't delete current wifi setup"
> > > --
> > > 2.11.0
> >
> >
Robert Langhammer June 11, 2018, 4:28 p.m.
Zur Diskussion, ob das zu oft drin ist: Erstmal so lassen.

Das reload_config bzw. der procd ist intelligent genug, dass ein Aufruf
zu viel nicht schadet, da er nichts tut wenn es keine Aenderungen gab.

Reviewed-by: Robert Langhammer <rlanghammer@web.de>

Am 10.06.2018 um 14:06 schrieb Tim Niemeyer:
> Signed-off-by: Tim Niemeyer <tim@tn-x.org>
> Reviewed-by: Christian Dresel <fff@chrisi01.de>
> ---
>
> Changes in v1: None
>
>  src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> index 42a489d..eaf2578 100755
> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> @@ -56,6 +56,7 @@ if [ -s "$hoodfilecopy" ] && isGatewayAvailable ; then
>  		uci set network.${iface}.proto='static'
>  		uci set network.${iface}.ip6addr='fe80::1/64'
>  		uci commit network
> +		reload_config
>  		if ! wifiAddAP "$radio" "config.franken.freifunk.net" "$iface" "configap" "1"; then
>  			echo "Can't add Config interface on $radio."
>  			exit 1
> @@ -101,6 +102,7 @@ else
>  
>  			uci -q del "system.@system[0].hood"
>  			uci -q commit system
> +			reload_config
>  		
>  			sleep 30 # Wait for the config AP, which may be created at the same time as this script has started
>  
> @@ -127,6 +129,7 @@ else
>  					uci -q set network.configSta=interface
>  					uci -q set network.configSta.proto='static'
>  					uci -q commit network
> +					reload_config
>  				fi
>  			done
>  		
> @@ -232,6 +235,7 @@ if [ -s "$hoodfile" ]; then
>  		echo "Setting hood name: $hood"
>  		uci -q set "system.@system[0].hood=$hood"
>  		uci -q commit system
> +		reload_config
>  
>  		if ! wifiDelIface; then
>  			echo "Can't delete current wifi setup"