[1/2] Tunnelaufbau erst, wenn Position und Kontakt Adresse gesetzt.

Submitted by Christoph süpke on March 21, 2016, 11:04 p.m.

Details

Message ID 1458601448-23088-1-git-send-email-suepke.christoph@gmail.com
State Not Applicable, archived
Headers show

Commit Message

Christoph süpke March 21, 2016, 11:04 p.m.
Signed-off-by: Christoph <suepke.christoph@gmail.com>
---
 bsp/default/root_file_system/etc/fastdstart.sh.tpl | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/bsp/default/root_file_system/etc/fastdstart.sh.tpl b/bsp/default/root_file_system/etc/fastdstart.sh.tpl
index 5bb5165..56f5eda 100755
--- a/bsp/default/root_file_system/etc/fastdstart.sh.tpl
+++ b/bsp/default/root_file_system/etc/fastdstart.sh.tpl
@@ -13,10 +13,20 @@  if [ "$SERVER" = "no" ]; then
 	test -f /tmp/started || exit
 fi
 
-# Only do something with fastd when the router has internet connection
+# Only do something with fastd when the router has internet connection and is configured
+
+uci get system.@system[0].latitude
+lat=$?
+uci get system.@system[0].longitude
+lon=$?
+uci get system.@system[0].contact
+mail=$?
+
+
 if ping -w5 -c3 "$test_ipv4_host1" &>/dev/null || 
    ping -w5 -c3 "$test_ipv4_host2" &>/dev/null ||
-   ping6 -w5 -c3 "$test_ipv6_host1" &>/dev/null; then
+   ping6 -w5 -c3 "$test_ipv6_host1" &>/dev/null || 
+	[ $lat -eq 0 ] && [ $lon -eq 0 ] && [ $mail -eq 0 ]; then
 	mac=$(awk '{ mac=toupper($1); gsub(":", "", mac); print mac }' /sys/class/net/br-mesh/address 2>/dev/null)
 	if [ "$SERVER" = "no" ]; then
 		hostname=$(cat /proc/sys/kernel/hostname)

Comments

Tom Green March 22, 2016, 6:23 a.m.
Hi,

Ist löblich, fragt sich nur ob die Leute Längen und Breitengrad ohne
Karte korrekt setzen können.

LG

On 22.03.2016 00:04, Christoph wrote:
> Signed-off-by: Christoph <suepke.christoph@gmail.com>
> ---
>  bsp/default/root_file_system/etc/fastdstart.sh.tpl | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/bsp/default/root_file_system/etc/fastdstart.sh.tpl b/bsp/default/root_file_system/etc/fastdstart.sh.tpl
> index 5bb5165..56f5eda 100755
> --- a/bsp/default/root_file_system/etc/fastdstart.sh.tpl
> +++ b/bsp/default/root_file_system/etc/fastdstart.sh.tpl
> @@ -13,10 +13,20 @@ if [ "$SERVER" = "no" ]; then
>  	test -f /tmp/started || exit
>  fi
>  
> -# Only do something with fastd when the router has internet connection
> +# Only do something with fastd when the router has internet connection and is configured
> +
> +uci get system.@system[0].latitude
> +lat=$?
> +uci get system.@system[0].longitude
> +lon=$?
> +uci get system.@system[0].contact
> +mail=$?
> +
> +
>  if ping -w5 -c3 "$test_ipv4_host1" &>/dev/null || 
>     ping -w5 -c3 "$test_ipv4_host2" &>/dev/null ||
> -   ping6 -w5 -c3 "$test_ipv6_host1" &>/dev/null; then
> +   ping6 -w5 -c3 "$test_ipv6_host1" &>/dev/null || 
> +	[ $lat -eq 0 ] && [ $lon -eq 0 ] && [ $mail -eq 0 ]; then
>  	mac=$(awk '{ mac=toupper($1); gsub(":", "", mac); print mac }' /sys/class/net/br-mesh/address 2>/dev/null)
>  	if [ "$SERVER" = "no" ]; then
>  		hostname=$(cat /proc/sys/kernel/hostname)
Tim Niemeyer March 22, 2016, 6:55 a.m.
Hi

Am 22. März 2016 00:04:07 MEZ, schrieb Christoph <suepke.christoph@gmail.com>:
>Signed-off-by: Christoph <suepke.christoph@gmail.com>
>---
> bsp/default/root_file_system/etc/fastdstart.sh.tpl | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
>diff --git a/bsp/default/root_file_system/etc/fastdstart.sh.tpl
>b/bsp/default/root_file_system/etc/fastdstart.sh.tpl
>index 5bb5165..56f5eda 100755
>--- a/bsp/default/root_file_system/etc/fastdstart.sh.tpl
>+++ b/bsp/default/root_file_system/etc/fastdstart.sh.tpl
>@@ -13,10 +13,20 @@ if [ "$SERVER" = "no" ]; then
> 	test -f /tmp/started || exit
> fi
> 
>-# Only do something with fastd when the router has internet connection
>+# Only do something with fastd when the router has internet connection
>and is configured
>+
>+uci get system.@system[0].latitude
>+lat=$?
>+uci get system.@system[0].longitude
>+lon=$?
>+uci get system.@system[0].contact
>+mail=$?
>+
>+
> if ping -w5 -c3 "$test_ipv4_host1" &>/dev/null || 
>    ping -w5 -c3 "$test_ipv4_host2" &>/dev/null ||
>-   ping6 -w5 -c3 "$test_ipv6_host1" &>/dev/null; then
>+   ping6 -w5 -c3 "$test_ipv6_host1" &>/dev/null || 
>+	[ $lat -eq 0 ] && [ $lon -eq 0 ] && [ $mail -eq 0 ]; then

PingOk oder PingOk oder PingOk oder (lat gesetzt und lon gesetzt und mail gesetzt)

Wenn ich das richtig gelesen hab, willst du eigentlich (PingOk oder PingOk oder pingok ) und lat und lon und mail.

Mit dem Patch würde fastd gestartet, wenn die Config da ist aber kein Netz vorhanden ist.

Damit das ganze leserlich bleibt sollten die Verknüpfungen geklammert werden.

Tim

>	mac=$(awk '{ mac=toupper($1); gsub(":", "", mac); print mac }'
>/sys/class/net/br-mesh/address 2>/dev/null)
> 	if [ "$SERVER" = "no" ]; then
> 		hostname=$(cat /proc/sys/kernel/hostname)
Christoph süpke March 22, 2016, 7:43 a.m.
Guten Morgen,

jetzt wo ich das lese fällt es mir natürlich auf das ich das falsch
verknüpft habe.

Sorry mein Fehler.

ich poste heute Abend die korrektur komme gerade nicht an meinen
Produktiv Rechner daheim ran.

Ist das dann besser?

if ( ping -w5 -c3 "$test_ipv4_host1" &>/dev/null ||
    ping -w5 -c3 "$test_ipv4_host2" &>/dev/null ||
 ping6 -w5 -c3 "$test_ipv6_host1" &>/dev/null )  &&
[ "$lat" -eq 0 ] && [ "$lon" -eq 0 ] && [ "$mail" -eq 0 ]; then


MfG Mister Crumble




2016-03-22 7:55 GMT+01:00 Tim Niemeyer <tim@tn-x.org>:
> Hi
>
> Am 22. März 2016 00:04:07 MEZ, schrieb Christoph <suepke.christoph@gmail.com>:
>>Signed-off-by: Christoph <suepke.christoph@gmail.com>
>>---
>> bsp/default/root_file_system/etc/fastdstart.sh.tpl | 14 ++++++++++++--
>> 1 file changed, 12 insertions(+), 2 deletions(-)
>>
>>diff --git a/bsp/default/root_file_system/etc/fastdstart.sh.tpl
>>b/bsp/default/root_file_system/etc/fastdstart.sh.tpl
>>index 5bb5165..56f5eda 100755
>>--- a/bsp/default/root_file_system/etc/fastdstart.sh.tpl
>>+++ b/bsp/default/root_file_system/etc/fastdstart.sh.tpl
>>@@ -13,10 +13,20 @@ if [ "$SERVER" = "no" ]; then
>>       test -f /tmp/started || exit
>> fi
>>
>>-# Only do something with fastd when the router has internet connection
>>+# Only do something with fastd when the router has internet connection
>>and is configured
>>+
>>+uci get system.@system[0].latitude
>>+lat=$?
>>+uci get system.@system[0].longitude
>>+lon=$?
>>+uci get system.@system[0].contact
>>+mail=$?
>>+
>>+
>> if ping -w5 -c3 "$test_ipv4_host1" &>/dev/null ||
>>    ping -w5 -c3 "$test_ipv4_host2" &>/dev/null ||
>>-   ping6 -w5 -c3 "$test_ipv6_host1" &>/dev/null; then
>>+   ping6 -w5 -c3 "$test_ipv6_host1" &>/dev/null ||
>>+      [ $lat -eq 0 ] && [ $lon -eq 0 ] && [ $mail -eq 0 ]; then
>
> PingOk oder PingOk oder PingOk oder (lat gesetzt und lon gesetzt und mail gesetzt)
>
> Wenn ich das richtig gelesen hab, willst du eigentlich (PingOk oder PingOk oder pingok ) und lat und lon und mail.
>
> Mit dem Patch würde fastd gestartet, wenn die Config da ist aber kein Netz vorhanden ist.
>
> Damit das ganze leserlich bleibt sollten die Verknüpfungen geklammert werden.
>
> Tim
>
>>       mac=$(awk '{ mac=toupper($1); gsub(":", "", mac); print mac }'
>>/sys/class/net/br-mesh/address 2>/dev/null)
>>       if [ "$SERVER" = "no" ]; then
>>               hostname=$(cat /proc/sys/kernel/hostname)
>
Christian Dresel March 23, 2016, 11:45 a.m.
hi

weil ich im IRC mitbekommen habe, das der Seiteneffekt die Karte im
WebUI ist um die Koordinaten zu setzen wäre vllt. folgendes eine Lösung
(Achtung Pseudocode):

If
(ping a OR ping b OR ping c)
AND
((lat != "" && long != "" && mail != "") OR $Ausgabe von$"iw dev w2mesh
station dump" == "")
THEN
BAUE VPN AUF

bitte nochmal drüber nachdenken, ich verwuschtel solche langen IFs gerne
mal ;)

Problem was vielleicht entsteht, wenn iw dev w2mesh station dump zwar
einen Nachbar hat aber von der Signalqualität ganz schlecht ist (-88dBm
und 1Mbit oder sowas) so das keine sinnvollen Daten drüber gehen.
Eventuell noch ein grep drüber und gucken das auch ein Router da ist der
eine brauchbare Verbindung hat, Problem dann wieder das bei sehr
schlechter Verbindung u.U. wieder zu einen Hoodmesh kommen kann.
Vielleicht kann man auch mit batctl (direkte Nachbarn anzeigen) arbeiten
und die Metrik da rausziehen?
Alles nicht ganz leicht das passend abzuwägen, ich grübel langsam obs
überhaupt eine gute Idee ist? Anderseits haben wir laufend Verbindungen
zwischen Hoods und default, ich bekomm ständig Mails seitdem die neue
Version released ist.

mfg

Christian


Am 22.03.2016 um 08:43 schrieb Christoph süpke:
> Guten Morgen,
> 
> jetzt wo ich das lese fällt es mir natürlich auf das ich das falsch
> verknüpft habe.
> 
> Sorry mein Fehler.
> 
> ich poste heute Abend die korrektur komme gerade nicht an meinen
> Produktiv Rechner daheim ran.
> 
> Ist das dann besser?
> 
> if ( ping -w5 -c3 "$test_ipv4_host1" &>/dev/null ||
>     ping -w5 -c3 "$test_ipv4_host2" &>/dev/null ||
>  ping6 -w5 -c3 "$test_ipv6_host1" &>/dev/null )  &&
> [ "$lat" -eq 0 ] && [ "$lon" -eq 0 ] && [ "$mail" -eq 0 ]; then
> 
> 
> MfG Mister Crumble
> 
> 
> 
> 
> 2016-03-22 7:55 GMT+01:00 Tim Niemeyer <tim@tn-x.org>:
>> Hi
>>
>> Am 22. März 2016 00:04:07 MEZ, schrieb Christoph <suepke.christoph@gmail.com>:
>>> Signed-off-by: Christoph <suepke.christoph@gmail.com>
>>> ---
>>> bsp/default/root_file_system/etc/fastdstart.sh.tpl | 14 ++++++++++++--
>>> 1 file changed, 12 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/bsp/default/root_file_system/etc/fastdstart.sh.tpl
>>> b/bsp/default/root_file_system/etc/fastdstart.sh.tpl
>>> index 5bb5165..56f5eda 100755
>>> --- a/bsp/default/root_file_system/etc/fastdstart.sh.tpl
>>> +++ b/bsp/default/root_file_system/etc/fastdstart.sh.tpl
>>> @@ -13,10 +13,20 @@ if [ "$SERVER" = "no" ]; then
>>>       test -f /tmp/started || exit
>>> fi
>>>
>>> -# Only do something with fastd when the router has internet connection
>>> +# Only do something with fastd when the router has internet connection
>>> and is configured
>>> +
>>> +uci get system.@system[0].latitude
>>> +lat=$?
>>> +uci get system.@system[0].longitude
>>> +lon=$?
>>> +uci get system.@system[0].contact
>>> +mail=$?
>>> +
>>> +
>>> if ping -w5 -c3 "$test_ipv4_host1" &>/dev/null ||
>>>    ping -w5 -c3 "$test_ipv4_host2" &>/dev/null ||
>>> -   ping6 -w5 -c3 "$test_ipv6_host1" &>/dev/null; then
>>> +   ping6 -w5 -c3 "$test_ipv6_host1" &>/dev/null ||
>>> +      [ $lat -eq 0 ] && [ $lon -eq 0 ] && [ $mail -eq 0 ]; then
>>
>> PingOk oder PingOk oder PingOk oder (lat gesetzt und lon gesetzt und mail gesetzt)
>>
>> Wenn ich das richtig gelesen hab, willst du eigentlich (PingOk oder PingOk oder pingok ) und lat und lon und mail.
>>
>> Mit dem Patch würde fastd gestartet, wenn die Config da ist aber kein Netz vorhanden ist.
>>
>> Damit das ganze leserlich bleibt sollten die Verknüpfungen geklammert werden.
>>
>> Tim
>>
>>>       mac=$(awk '{ mac=toupper($1); gsub(":", "", mac); print mac }'
>>> /sys/class/net/br-mesh/address 2>/dev/null)
>>>       if [ "$SERVER" = "no" ]; then
>>>               hostname=$(cat /proc/sys/kernel/hostname)
>>
Mister Crumble March 23, 2016, 3:05 p.m.
Guten Tag liebes developer Team,

ich möchte meinen Patch hiermit offiziell zurückziehen, nach test bei
mir daheim hat sich der Router in einer nach 2-3 Minuten Neustart
Schleife befunden.

Der Abfrage Code steht unter
https://pad.freifunk.net/p/looper
allerdings ist das PAD wohl gerade DOWN.

MFG MisterCrumble



Am 22. März 2016 um 08:43 schrieb Christoph süpke <suepke.christoph@gmail.com>:
> Guten Morgen,
>
> jetzt wo ich das lese fällt es mir natürlich auf das ich das falsch
> verknüpft habe.
>
> Sorry mein Fehler.
>
> ich poste heute Abend die korrektur komme gerade nicht an meinen
> Produktiv Rechner daheim ran.
>
> Ist das dann besser?
>
> if ( ping -w5 -c3 "$test_ipv4_host1" &>/dev/null ||
>     ping -w5 -c3 "$test_ipv4_host2" &>/dev/null ||
>  ping6 -w5 -c3 "$test_ipv6_host1" &>/dev/null )  &&
> [ "$lat" -eq 0 ] && [ "$lon" -eq 0 ] && [ "$mail" -eq 0 ]; then
>
>
> MfG Mister Crumble
>
>
>
>
> 2016-03-22 7:55 GMT+01:00 Tim Niemeyer <tim@tn-x.org>:
>> Hi
>>
>> Am 22. März 2016 00:04:07 MEZ, schrieb Christoph <suepke.christoph@gmail.com>:
>>>Signed-off-by: Christoph <suepke.christoph@gmail.com>
>>>---
>>> bsp/default/root_file_system/etc/fastdstart.sh.tpl | 14 ++++++++++++--
>>> 1 file changed, 12 insertions(+), 2 deletions(-)
>>>
>>>diff --git a/bsp/default/root_file_system/etc/fastdstart.sh.tpl
>>>b/bsp/default/root_file_system/etc/fastdstart.sh.tpl
>>>index 5bb5165..56f5eda 100755
>>>--- a/bsp/default/root_file_system/etc/fastdstart.sh.tpl
>>>+++ b/bsp/default/root_file_system/etc/fastdstart.sh.tpl
>>>@@ -13,10 +13,20 @@ if [ "$SERVER" = "no" ]; then
>>>       test -f /tmp/started || exit
>>> fi
>>>
>>>-# Only do something with fastd when the router has internet connection
>>>+# Only do something with fastd when the router has internet connection
>>>and is configured
>>>+
>>>+uci get system.@system[0].latitude
>>>+lat=$?
>>>+uci get system.@system[0].longitude
>>>+lon=$?
>>>+uci get system.@system[0].contact
>>>+mail=$?
>>>+
>>>+
>>> if ping -w5 -c3 "$test_ipv4_host1" &>/dev/null ||
>>>    ping -w5 -c3 "$test_ipv4_host2" &>/dev/null ||
>>>-   ping6 -w5 -c3 "$test_ipv6_host1" &>/dev/null; then
>>>+   ping6 -w5 -c3 "$test_ipv6_host1" &>/dev/null ||
>>>+      [ $lat -eq 0 ] && [ $lon -eq 0 ] && [ $mail -eq 0 ]; then
>>
>> PingOk oder PingOk oder PingOk oder (lat gesetzt und lon gesetzt und mail gesetzt)
>>
>> Wenn ich das richtig gelesen hab, willst du eigentlich (PingOk oder PingOk oder pingok ) und lat und lon und mail.
>>
>> Mit dem Patch würde fastd gestartet, wenn die Config da ist aber kein Netz vorhanden ist.
>>
>> Damit das ganze leserlich bleibt sollten die Verknüpfungen geklammert werden.
>>
>> Tim
>>
>>>       mac=$(awk '{ mac=toupper($1); gsub(":", "", mac); print mac }'
>>>/sys/class/net/br-mesh/address 2>/dev/null)
>>>       if [ "$SERVER" = "no" ]; then
>>>               hostname=$(cat /proc/sys/kernel/hostname)
>>