<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Consolas",serif;
        color:black;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=DE link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>Danke.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>Ich würde anstreben, dass das in ein stable-Release noch mit reinkommt.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>Grüße<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>Adrian<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext'>From:</span></b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext'> franken-dev [mailto:franken-dev-bounces@freifunk.net] <b>On Behalf Of </b>robert<br><b>Sent:</b> Mittwoch, 1. August 2018 19:59<br><b>To:</b> franken-dev@freifunk.net<br><b>Subject:</b> Re: [PATCH v2 1/2] vpn-select: Demand hood file to be provided as argument<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p>Hallo Adrian,<o:p></o:p></p><pre>Reviewed-by: Robert Langhammer <a href="mailto:rlanghammer@web.de"><rlanghammer@web.de></a><o:p></o:p></pre><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>Am 29.07.2018 um 12:36 schrieb Adrian Schmutzler:<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre>By removing the reference to the hood file from vpn-select, we<o:p></o:p></pre><pre>remove the entire dependency from fff-hoodutils.<o:p></o:p></pre><pre>vpn-select will now work with any file provided, as long as<o:p></o:p></pre><pre>it has the correct syntax. At the moment, the only provider<o:p></o:p></pre><pre>is the configurehood script. Since the various hood file variants<o:p></o:p></pre><pre>are handled there, it seems logical that configurehood also<o:p></o:p></pre><pre>chooses and provides the correct hood file for vpn-select, instead<o:p></o:p></pre><pre>of vpn-select which had no other contact with hood file choice.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>This is simple, tidy and effective.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Adjusted some comments.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Fixes #106<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Signed-off-by: Adrian Schmutzler <a href="mailto:freifunk@adrianschmutzler.de"><freifunk@adrianschmutzler.de></a><o:p></o:p></pre><pre><o:p> </o:p></pre><pre>---<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Changes in v2:<o:p></o:p></pre><pre>- Added usage comment<o:p></o:p></pre><pre>- Added exit 0<o:p></o:p></pre><pre>- Added error and exit 1 for missing file<o:p></o:p></pre><pre>- Removed sh call in configurehood<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Since multiple things changed, I did NOT copy the reviews.<o:p></o:p></pre><pre>Please redo!<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>I raised the version for fff-vpn-select by 2, since it still was<o:p></o:p></pre><pre>on 1. The never existant version 2 would have been the initial<o:p></o:p></pre><pre>KeyXchangeV2 version.<o:p></o:p></pre><pre>---<o:p></o:p></pre><pre> src/packages/fff/fff-hoods/Makefile                       |  2 +-<o:p></o:p></pre><pre> src/packages/fff/fff-hoods/files/usr/sbin/configurehood   |  4 ++--<o:p></o:p></pre><pre> src/packages/fff/fff-vpn-select/Makefile                  |  2 +-<o:p></o:p></pre><pre> src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select | 15 +++++++++++----<o:p></o:p></pre><pre> 4 files changed, 15 insertions(+), 8 deletions(-)<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>diff --git a/src/packages/fff/fff-hoods/Makefile b/src/packages/fff/fff-hoods/Makefile<o:p></o:p></pre><pre>index b565ac7..93fd430 100644<o:p></o:p></pre><pre>--- a/src/packages/fff/fff-hoods/Makefile<o:p></o:p></pre><pre>+++ b/src/packages/fff/fff-hoods/Makefile<o:p></o:p></pre><pre>@@ -1,7 +1,7 @@<o:p></o:p></pre><pre> include $(TOPDIR)/rules.mk<o:p></o:p></pre><pre> <o:p></o:p></pre><pre> PKG_NAME:=fff-hoods<o:p></o:p></pre><pre>-PKG_VERSION:=2<o:p></o:p></pre><pre>+PKG_VERSION:=3<o:p></o:p></pre><pre> PKG_RELEASE:=1<o:p></o:p></pre><pre> <o:p></o:p></pre><pre> PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)<o:p></o:p></pre><pre>diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood<o:p></o:p></pre><pre>index 57c6f9f..47e228b 100755<o:p></o:p></pre><pre>--- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood<o:p></o:p></pre><pre>+++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood<o:p></o:p></pre><pre>@@ -195,9 +195,9 @@ if [ -s "$hoodfiletmp" ]; then<o:p></o:p></pre><pre>        # and now we get to vpn-select script and load VPNs directly from /tmp/keyxchangev2data<o:p></o:p></pre><pre>        <o:p></o:p></pre><pre>        if hasInternet ; then<o:p></o:p></pre><pre>-               sh /usr/sbin/vpn-select<o:p></o:p></pre><pre>+               /usr/sbin/vpn-select "$hoodfiletmp"<o:p></o:p></pre><pre>        else<o:p></o:p></pre><pre>-               sh /usr/sbin/vpn-stop<o:p></o:p></pre><pre>+               /usr/sbin/vpn-stop<o:p></o:p></pre><pre>        fi<o:p></o:p></pre><pre> <o:p></o:p></pre><pre>        # now we load the prefix from the hoodfile and set this to br-mesh<o:p></o:p></pre><pre>diff --git a/src/packages/fff/fff-vpn-select/Makefile b/src/packages/fff/fff-vpn-select/Makefile<o:p></o:p></pre><pre>index 4e2d89b..27cff09 100644<o:p></o:p></pre><pre>--- a/src/packages/fff/fff-vpn-select/Makefile<o:p></o:p></pre><pre>+++ b/src/packages/fff/fff-vpn-select/Makefile<o:p></o:p></pre><pre>@@ -1,7 +1,7 @@<o:p></o:p></pre><pre> include $(TOPDIR)/rules.mk<o:p></o:p></pre><pre> <o:p></o:p></pre><pre> PKG_NAME:=fff-vpn-select<o:p></o:p></pre><pre>-PKG_VERSION:=1<o:p></o:p></pre><pre>+PKG_VERSION:=3<o:p></o:p></pre><pre> PKG_RELEASE:=1<o:p></o:p></pre><pre> <o:p></o:p></pre><pre> PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)<o:p></o:p></pre><pre>diff --git a/src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select b/src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select<o:p></o:p></pre><pre>index 7c9bced..ddd21a1 100755<o:p></o:p></pre><pre>--- a/src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select<o:p></o:p></pre><pre>+++ b/src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select<o:p></o:p></pre><pre>@@ -1,15 +1,18 @@<o:p></o:p></pre><pre> #!/bin/sh<o:p></o:p></pre><pre> <o:p></o:p></pre><pre>-. /lib/functions/fff/keyxchange<o:p></o:p></pre><pre>+# Usage: vpn-select <path-to-hood-file><o:p></o:p></pre><pre>+<o:p></o:p></pre><pre> . /usr/share/libubox/jshn.sh<o:p></o:p></pre><pre> <o:p></o:p></pre><pre>+hoodfile="$1"<o:p></o:p></pre><pre>+<o:p></o:p></pre><pre> make_config() {<o:p></o:p></pre><pre> # remove old config<o:p></o:p></pre><pre> >/etc/config/tunneldigger<o:p></o:p></pre><pre> rm /tmp/fastd_fff_peers/*<o:p></o:p></pre><pre> count=0<o:p></o:p></pre><pre> Index=1<o:p></o:p></pre><pre>-json_load "$(cat "$hoodfiletmp")"<o:p></o:p></pre><pre>+json_load "$(cat "$hoodfile")"<o:p></o:p></pre><pre> json_select vpn<o:p></o:p></pre><pre> # get fastd peers<o:p></o:p></pre><pre> while json_select "$Index" > /dev/null<o:p></o:p></pre><pre>@@ -53,8 +56,8 @@ json_select ".." # back to root<o:p></o:p></pre><pre> <o:p></o:p></pre><pre> # main<o:p></o:p></pre><pre> <o:p></o:p></pre><pre>-# Only do something when file is here and greater 0 byte<o:p></o:p></pre><pre>-if [ -s "$hoodfiletmp" ]; then<o:p></o:p></pre><pre>+# Only do something if file is there and not empty; otherwise exit 1<o:p></o:p></pre><pre>+if [ -s "$hoodfile" ]; then<o:p></o:p></pre><pre>        # set some vars<o:p></o:p></pre><pre>        hostname=$(cat /proc/sys/kernel/hostname)<o:p></o:p></pre><pre>        mac=$(awk '{ mac=toupper($1); gsub(":", "", mac); print mac }' /sys/class/net/br-mesh/address 2>/dev/null)<o:p></o:p></pre><pre>@@ -84,4 +87,8 @@ if [ -s "$hoodfiletmp" ]; then<o:p></o:p></pre><pre>                        ([ -s "$pidfile" ] && [ -d "/proc/$(cat "$pidfile")" ]) && /etc/init.d/fastd stop<o:p></o:p></pre><pre>                fi<o:p></o:p></pre><pre>        fi<o:p></o:p></pre><pre>+       exit 0<o:p></o:p></pre><pre>+else<o:p></o:p></pre><pre>+       echo "vpn-select: Hood file not found or empty!"<o:p></o:p></pre><pre>+       exit 1<o:p></o:p></pre><pre> fi<o:p></o:p></pre></blockquote><p class=MsoNormal><o:p> </o:p></p></div></div></body></html>