<div dir="auto">So nachdem ich jetzt doch recht lange hier gegrübelt habe.<div dir="auto">Doch, ja, ich denke ich habe den Patch verstanden und sieht für mich soweit gut aus.</div><div dir="auto"><br></div><div dir="auto">Wie geht das jetzt?</div><div dir="auto">Ich mach jetzt einfach Mal.</div><div dir="auto"><br></div><div dir="auto">Reviewed by Alex Gutzeit</div></div><br><div class="gmail_quote"><div dir="ltr">Fabian Bläse <<a href="mailto:fabian@blaese.de">fabian@blaese.de</a>> schrieb am Sa., 9. Juni 2018, 19:31:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Anmerkung am Rand: Indentation ist kaputt, mach ich dann in der nächsten Version ganz..<br>
<br>
Gruß<br>
Fabian<br>
<br>
> On 9. Jun 2018, at 16:51, Fabian Bläse <<a href="mailto:fabian@blaese.de" target="_blank" rel="noreferrer">fabian@blaese.de</a>> wrote:<br>
> <br>
> Signed-off-by: Fabian Bläse <<a href="mailto:fabian@blaese.de" target="_blank" rel="noreferrer">fabian@blaese.de</a>><br>
> ---<br>
> .../fff-hoods/files/usr/lib/functions/fff/hoodfile | 87 ++++++++++++++++++++++<br>
> .../fff/fff-hoods/files/usr/sbin/configurehood | 38 ++--------<br>
> 2 files changed, 92 insertions(+), 33 deletions(-)<br>
> create mode 100644 src/packages/fff/fff-hoods/files/usr/lib/functions/fff/hoodfile<br>
> <br>
> diff --git a/src/packages/fff/fff-hoods/files/usr/lib/functions/fff/hoodfile b/src/packages/fff/fff-hoods/files/usr/lib/functions/fff/hoodfile<br>
> new file mode 100644<br>
> index 0000000..62487f9<br>
> --- /dev/null<br>
> +++ b/src/packages/fff/fff-hoods/files/usr/lib/functions/fff/hoodfile<br>
> @@ -0,0 +1,87 @@<br>
> +#!/bin/sh<br>
> +<br>
> +. /usr/share/libubox/jshn.sh<br>
> +. /lib/functions/fff/wireless<br>
> +<br>
> +getWirelessHoodfile() {<br>
> + if [ $# != 1 ]<br>
> + then<br>
> + echo "Usage: getWirelessHoodfile <download-location>"<br>
> + return 1<br>
> + fi<br>
> + file=$1<br>
> +<br>
> + echo "Trying to get hoodfile from wireless neighbor..."<br>
> + echo "All wireless interfaces will be disabled temporarily!"<br>
> +<br>
> + # only change temporarily<br>
> +<br>
> + if ! wifiDelIface; then<br>
> + echo "Can't delete current wifi setup"<br>
> + exit 1<br>
> + fi<br>
> + #now we look for phy and add this<br>
> + for phy in $(iw phy | awk '/^Wiphy/{ print $2 }'); do<br>
> + radio="$(wifiAddPhyCond "$phy" "2" "auto")"<br>
> + radio5="$(wifiAddPhyCond "$phy" "5" "auto5")"<br>
> + if [ -n "$radio5" ] ; then<br>
> + radio="$radio5"<br>
> + staiface="w5sta"<br>
> + else<br>
> + staiface="w2sta"<br>
> + fi<br>
> +<br>
> + #and here we add the station<br>
> + if ! wifiAddSta "$radio" "<a href="http://config.franken.freifunk.net" rel="noreferrer noreferrer" target="_blank">config.franken.freifunk.net</a>" "configSta" "$staiface" ; then<br>
> + echo "Can't add Sta interface on $radio."<br>
> + exit 1<br>
> + else<br>
> + uci -q set network.configSta=interface<br>
> + uci -q set network.configSta.proto='static'<br>
> + uci -q commit network<br>
> + reload_config<br>
> + fi<br>
> + done<br>
> +<br>
> + wifi<br>
> + # wait a moment to start the interface<br>
> + sleep 10;<br>
> +<br>
> + if wget -T15 -t5 -O "$file" "http://[fe80::1%w2sta]:2342/keyxchangev2data"; then<br>
> + return 0<br>
> + elif wget -T15 -t5 -O "$file" "http://[fe80::1%w5sta]:2342/keyxchangev2data"; then<br>
> + return 0<br>
> + else<br>
> + return 1<br>
> + fi<br>
> +}<br>
> +<br>
> +getGatewayHoodfile() {<br>
> + if [ $# != 1 ]<br>
> + then<br>
> + echo "Usage: getGatewayHoodfile <download-location>"<br>
> + return 1<br>
> + fi<br>
> + file=$1<br>
> +<br>
> + echo "Trying to get hoodfile from gateway..."<br>
> +<br>
> + if wget -T15 -t5 -O "$file" "http://[fe80::1%br-mesh]:2342/keyxchangev2data"; then<br>
> + return 0<br>
> + else<br>
> + return 1<br>
> + fi<br>
> +}<br>
> +<br>
> +getKeyserverHoodfile() {<br>
> + if [ $# != 1 ]<br>
> + then<br>
> + echo "Usage: getKeyserverHoodfile <download-location>"<br>
> + return 1<br>
> + fi<br>
> + file=$1<br>
> +<br>
> + echo "Getting hoodfile from Keyserver"<br>
> +<br>
> + wget -T15 -t5 -O "$file" "<a href="http://keyserver.freifunk-franken.de/v2/?lat=$lat&long=$long" rel="noreferrer noreferrer" target="_blank">http://keyserver.freifunk-franken.de/v2/?lat=$lat&long=$long</a>"<br>
> +}<br>
> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood<br>
> index e2c1fab..aee20e5 100755<br>
> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood<br>
> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood<br>
> @@ -5,6 +5,7 @@<br>
> . /lib/functions/fff/network<br>
> . /lib/functions/fff/wireless<br>
> . /lib/functions/fff/timeserver<br>
> +. /usr/lib/functions/fff/hoodfile<br>
> <br>
> sectorlocal=/etc/sectorfile<br>
> sectortmp=/tmp/sectorfile<br>
> @@ -78,7 +79,8 @@ if [ -s "$hoodlocal" ]; then<br>
> else<br>
> # if we have Internet, we download the Hoodfile from the keyxchangev2<br>
> if hasInternet ; then<br>
> - wget -T15 -t5 "<a href="http://keyserver.freifunk-franken.de/v2/?lat=$lat&long=$long" rel="noreferrer noreferrer" target="_blank">http://keyserver.freifunk-franken.de/v2/?lat=$lat&long=$long</a>" -O "$hoodfile"<br>
> + getKeyserverHoodfile "$hoodfile"<br>
> +<br>
> rm -f "$sectortmp"<br>
> [ -s "$sectorlocal" ] || rm -f "$sectorcopy" # If internet present, no custom config should be distributed, except when local file is present<br>
> #UPLINK: No uplink download if internet present<br>
> @@ -99,45 +101,15 @@ else<br>
> <br>
> sleep 30 # Wait for the config AP, which may be created at the same time as this script has started<br>
> <br>
> - if ! wifiDelIface; then<br>
> - echo "Can't delete current wifi setup"<br>
> - exit 1<br>
> - fi<br>
> - #now we look for phy and add this<br>
> - for phy in $(iw phy | awk '/^Wiphy/{ print $2 }'); do<br>
> - radio="$(wifiAddPhyCond "$phy" "2" "auto")"<br>
> - radio5="$(wifiAddPhyCond "$phy" "5" "auto5")"<br>
> - if [ -n "$radio5" ] ; then<br>
> - radio="$radio5"<br>
> - staiface="w5sta"<br>
> - else<br>
> - staiface="w2sta"<br>
> - fi<br>
> + getWirelessHoodfile "$hoodfile"<br>
> <br>
> - #and here we add the station<br>
> - if ! wifiAddSta "$radio" "<a href="http://config.franken.freifunk.net" rel="noreferrer noreferrer" target="_blank">config.franken.freifunk.net</a>" "configSta" "$staiface" ; then<br>
> - echo "Can't add Sta interface on $radio."<br>
> - exit 1<br>
> - else<br>
> - uci -q set network.configSta=interface<br>
> - uci -q set network.configSta.proto='static'<br>
> - uci -q commit network<br>
> - reload_config<br>
> - fi<br>
> - done<br>
> -<br>
> - wifi<br>
> - # wait a moment to start the interface<br>
> - sleep 10;<br>
> - # and here we can download the Hoodfile from the other node<br>
> - wget -T15 -t5 "http://[fe80::1%w2sta]:2342/keyxchangev2data" -O "$hoodfile" || wget -T15 -t5 "http://[fe80::1%w5sta]:2342/keyxchangev2data" -O "$hoodfile"<br>
> #UPLINK: Set up uplink data on first contact:<br>
> if [ -s /tmp/keyxchangev2data ]; then<br>
> wget -T15 -t5 "http://[fe80::1%w2sta]:2342/sectorfile" -O "$sectortmp" || wget -T15 -t5 "http://[fe80::1%w5sta]:2342/sectorfile" -O "$sectortmp"<br>
> fi<br>
> else<br>
> echo "We have a Gateway in Range, we load the keyxchangev2data from fe80::1"<br>
> - wget -T15 -t5 "http://[fe80::1%br-mesh]:2342/keyxchangev2data" -O "$hoodfile"<br>
> + getGatewayHoodfile "$hoodfile"<br>
> #UPLINK: Do nothing<br>
> fi<br>
> fi<br>
> --<br>
> 2.11.0<br>
> <br>
<br>
</blockquote></div>