configurehood: Don't remove timestamp for checksum comparison

Submitted by Adrian Schmutzler on June 16, 2018, 1:04 p.m.

Details

Message ID 1529154243-2744-1-git-send-email-freifunk@adrianschmutzler.de
State Superseded
Headers show

Commit Message

Adrian Schmutzler June 16, 2018, 1:04 p.m.
Timestamps in hood file currently only change if changes are
made. Thus, there is no reason to remove them for comparison.

This also fixes the wrong quote characters in the script, which
changed the script in a way the timestamps aren't removed right
now anyway.

After this change, a hood reconfiguration may be triggered by
just changing the timestamp at the keyxchange.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
---
 src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

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 1399e11..7fa9a24 100755
--- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
+++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
@@ -132,10 +132,8 @@  if [ -s "$hoodfile" ]; then
 		json_get_var mesh_type5 mesh_type5
 	fi
 
-	catnew="$(cat "$hoodfile" | sed 's/"timestamp”: *"[0-9]*"/"timestamp":0/')"
-	catold="$(cat "$hoodfilecopy" 2>/dev/null | sed 's/"timestamp”: *"[0-9]*"/"timestamp":0/')"
-	sumnew=$(echo "$catnew" | sha256sum | cut -f1 -d " ")
-	sumold=$(echo "$catold" | sha256sum | cut -f1 -d " ")
+	sumnew=$(cat "$hoodfile" 2>/dev/null | sha256sum | cut -f1 -d " ")
+	sumold=$(cat "$hoodfilecopy" 2>/dev/null | sha256sum | cut -f1 -d " ")
 
 	json_load "$(cat "$hoodfile")"
 

Comments

Tim Niemeyer June 17, 2018, 8:15 a.m.
Hi

Reviewed-by: Tim Niemeyer <tim@tn-x.org>

Tim

Am Samstag, den 16.06.2018, 15:04 +0200 schrieb Adrian Schmutzler:
> Timestamps in hood file currently only change if changes are
> made. Thus, there is no reason to remove them for comparison.
> 
> This also fixes the wrong quote characters in the script, which
> changed the script in a way the timestamps aren't removed right
> now anyway.
> 
> After this change, a hood reconfiguration may be triggered by
> just changing the timestamp at the keyxchange.
> 
> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> ---
>  src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> index 1399e11..7fa9a24 100755
> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> @@ -132,10 +132,8 @@ if [ -s "$hoodfile" ]; then
>  		json_get_var mesh_type5 mesh_type5
>  	fi
>  
> -	catnew="$(cat "$hoodfile" | sed 's/"timestamp”: *"[0-
> 9]*"/"timestamp":0/')"
> -	catold="$(cat "$hoodfilecopy" 2>/dev/null | sed
> 's/"timestamp”: *"[0-9]*"/"timestamp":0/')"
> -	sumnew=$(echo "$catnew" | sha256sum | cut -f1 -d " ")
> -	sumold=$(echo "$catold" | sha256sum | cut -f1 -d " ")
> +	sumnew=$(cat "$hoodfile" 2>/dev/null | sha256sum | cut -f1
> -d " ")
> +	sumold=$(cat "$hoodfilecopy" 2>/dev/null | sha256sum | cut
> -f1 -d " ")
>  
>  	json_load "$(cat "$hoodfile")"
>