From patchwork Mon Oct 30 18:57:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [v2] consistently use same webserver port for hoodfile on wifi and lan From: Adrian Schmutzler X-Patchwork-Id: 641 Message-Id: <1509389865-6768-1-git-send-email-freifunk@adrianschmutzler.de> To: franken-dev@freifunk.net Date: Mon, 30 Oct 2017 19:57:45 +0100 From: Fabian Blaese Rebased onto sector-patch v5: Apply after that Signed-off-by: Fabian Bläse Tested-by: Fabian Bläse --- src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange | 4 ++-- src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 8 ++++---- src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd | 10 ++++++++++ src/packages/fff/fff-web/files/www/hood/.keep | 0 src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html | 2 +- 5 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 src/packages/fff/fff-web/files/www/hood/.keep diff --git a/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange b/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange index d7c2c13..a2fc651 100644 --- a/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange +++ b/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange @@ -6,8 +6,8 @@ getJsonPath() { jsonfile="" - if [ -s /www/public/keyxchangev2data ] ; then - jsonfile="/www/public/keyxchangev2data" + if [ -s /www/hood/keyxchangev2data ] ; then + jsonfile="/www/hood/keyxchangev2data" elif [ -s /tmp/keyxchangev2data ] ; then jsonfile="/tmp/keyxchangev2data" fi diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood index 12cb395..5e72993 100755 --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood @@ -74,7 +74,7 @@ else if ! isGatewayAvailable ; then #now we haven't a gateway in Range, we search for a hidden AP to get a keyxchangev2data file! #first we delete all wifi settings - rm -f /www/public/keyxchangev2data # delete this, so interfaces are recreated if reconnect with unchanged hood file takes place + rm -f /www/hood/keyxchangev2data # delete this, so interfaces are recreated if reconnect with unchanged hood file takes place rm -f "$sectorcopy" # always delete: no broadcast for isolated device rm -f "$sectortmp" @@ -108,7 +108,7 @@ else # wait a moment to start the interface sleep 10; # and here we can download the Hoodfile from the other node - wget -T15 -t5 "http://[fe80::1%w2sta]/keyxchangev2data" -O /tmp/keyxchangev2data + wget -T15 -t5 "http://[fe80::1%w2sta]:2342/keyxchangev2data" -O /tmp/keyxchangev2data #UPLINK: Set up uplink data on first contact: if [ -s /tmp/keyxchangev2data ]; then wget -T15 -t5 "http://[fe80::1%w2sta]/sectorfile" -O "$sectortmp" @@ -141,7 +141,7 @@ if [ -s /tmp/keyxchangev2data ]; then fi catnew="$(cat /tmp/keyxchangev2data | sed 's/"timestamp":[0-9]*/"timestamp":0/')" - catold="$(cat /www/public/keyxchangev2data 2>/dev/null | sed 's/"timestamp":[0-9]*/"timestamp":0/')" + catold="$(cat /www/hood/keyxchangev2data 2>/dev/null | sed 's/"timestamp":[0-9]*/"timestamp":0/')" sumnew=$(echo "$catnew" | sha256sum | cut -f1 -d " ") sumold=$(echo "$catold" | sha256sum | cut -f1 -d " ") @@ -221,7 +221,7 @@ if [ -s /tmp/keyxchangev2data ]; then # copy the file to webroot so that other mesh routers can download it; # copy only after all other steps so IF can be reentered if something goes wrong - cp /tmp/keyxchangev2data /www/public/ + cp /tmp/keyxchangev2data /www/hood/ cp "$sectortmp" "$sectorcopy" else diff --git a/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd b/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd index 28ae2b5..42376ad 100644 --- a/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd +++ b/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd @@ -5,6 +5,7 @@ uci batch < /dev/null + rm /www/hood/keyxchangev2data 2> /dev/null MSG='Hood-Daten werden innerhalb von 5 Minuten neu prozessiert.' fi fi