[RFC PATCH 8/8] Added VPN Connectivity to previous created Hood-Management

mayosemmel mayosemmel at googlemail.com
So Mai 8 21:53:55 CEST 2016


Hi

Am Samstag, den 07.05.2016, 23:29 +0200 schrieb Tim Niemeyer:
> Hi
> 
> Ich fänd es gut,wenn die Entscheidung, ob fastd genommen wird oder nicht außerhalb von fastdstart passiert.
> 
Ich wollte das erstmal auf die Schnelle funktionsfähig kriegen. Man
sollte das in der Tat an anderer Stelle konfigurieren.
Ich werd mal schauen ob wir das mit dem originalen Init Script
hinkriegen.

Grüße Jan
> 
> Am 3. Mai 2016 23:20:57 MESZ, schrieb Jan Kraus <mayosemmel at googlemail.com>:
> >Signed-off-by: Jan Kraus <mayosemmel at gmail.com>
> >---
> > bsp/default/root_file_system/etc/rc.local.tpl      |  4 +--
> >.../fff/fff-fastd/files/usr/sbin/fastdstart        | 36
> >+++++++++++++++++-----
> > src/packages/fff/fff-hoods/Makefile                |  2 +-
> > .../fff/fff-hoods/files/usr/sbin/configurehood     | 11 ++++---
> > .../fff-network/files/usr/sbin/configurenetwork    |  4 +--
> > 5 files changed, 39 insertions(+), 18 deletions(-)
> >mode change 100755 => 100644
> >src/packages/fff/fff-fastd/files/usr/sbin/fastdstart
> >
> >diff --git a/bsp/default/root_file_system/etc/rc.local.tpl
> >b/bsp/default/root_file_system/etc/rc.local.tpl
> >index c76bb79..a0238d2 100755
> >--- a/bsp/default/root_file_system/etc/rc.local.tpl
> >+++ b/bsp/default/root_file_system/etc/rc.local.tpl
> >@@ -56,8 +56,6 @@ if ! uci get board.model.name; then
> >     uci set board.model.name=$BOARD
> > fi
> >
> >-. /usr/sbin/configurehood
> >-
> ># Starting NTP-Client Daemon after 30s to ensure that the interface is
> >up
> > ( sleep 30 ; ntpd -p ${NTPD_IP} ) &
> >
> >@@ -66,4 +64,6 @@ fi
> >
> > touch /tmp/started
> >
> >+. /usr/sbin/configurehood
> >+
> > exit 0
> >diff --git a/src/packages/fff/fff-fastd/files/usr/sbin/fastdstart
> >b/src/packages/fff/fff-fastd/files/usr/sbin/fastdstart
> >old mode 100755
> >new mode 100644
> >index 611a3f8..8e494ff
> >--- a/src/packages/fff/fff-fastd/files/usr/sbin/fastdstart
> >+++ b/src/packages/fff/fff-fastd/files/usr/sbin/fastdstart
> >@@ -4,6 +4,7 @@ SERVER="no"
> > #SERVERNAME="--servername--"
> >
> > . /etc/community.cfg
> >+. /usr/share/libubox/jshn.sh
> >
> > project="$VPN_PROJECT"
> >
> >@@ -77,14 +78,33 @@ if ping -w5 -c3 "$test_ipv4_host1" &>/dev/null ||
> >		fastd -c /etc/fastd/$project/$project.conf -d --pid-file
> >/var/run/fastd.$project.pid
> > 	fi
> >
> >-#	register
> >-	wget -T15
> >"http://keyserver.freifunk-franken.de/${project}/geo.php?mac=$mac&name=$hostname&port=$port&key=$pubkey&lat=$lat&long=$long"
> >-O /tmp/fastd_${project}_output
> >-
> >-	filenames=$(awk '/^####/ { gsub(/^####/, "", $0); gsub(/.conf/, "",
> >$0); print $0; }' /tmp/fastd_${project}_output)
> >-	for file in $filenames; do
> >-		awk "{ if(a) print }; /^####$file.conf$/{a=1}; /^$/{a=0};"
> >/tmp/fastd_${project}_output | sed 's/ float;/;/g' >
> >/etc/fastd/$project/peers/$file
> >-		echo 'float yes;' >> /etc/fastd/$project/peers/$file
> >-	done
> >+#   configure
> >+    rm -f /etc/fastd/$project/peers/*
> >+    hood="$(uci get system. at system[0].hood)"
> >+    json_load "$(cat /etc/hoods/$hood.hood)"
> 
> Könnte man die fastd Parameter nicht bereits in configurehood setzen? Vielleicht könnte man da sogar fastd so konfigurieren, dass man das openwrt init script verwenden kann?
> 
> >+    json_select vpn
> >+    local Index="1"
> >+    while json_select $Index > /dev/null
> >+    do
> >+        json_get_var protocol protocol
> >+        if [ "$protocol" == "fastd" ]
> >+        then
> 
> Diese Entscheidung sollte in configurehood sein.
> 
> Tim
> 
> >+            json_get_var servername name
> >+            echo "#name \"$servername\";" >
> >/etc/fastd/$project/peers/$servername
> >+            json_get_var key key
> >+            echo "key \"$key\";" >>
> >/etc/fastd/$project/peers/$servername
> >+            json_get_var address address
> >+            json_get_var port port
> >+            echo "remote ipv4 \"$address\" port $port;" >>
> >/etc/fastd/$project/peers/$servername
> >+            echo "float yes;" >> /etc/fastd/$project/peers/$servername
> >+        else
> >+            echo "protocol $protocol is not supported by this script"
> >+            json_select ".."
> >+            continue
> >+        fi
> >+        json_select ".."
> >+        Index=$((Index+1))
> >+    done
> >
> > 	#reload
> > 	kill -HUP $(cat /var/run/fastd.$project.pid)
> >diff --git a/src/packages/fff/fff-hoods/Makefile
> >b/src/packages/fff/fff-hoods/Makefile
> >index ac48760..b182485 100644
> >--- a/src/packages/fff/fff-hoods/Makefile
> >+++ b/src/packages/fff/fff-hoods/Makefile
> >@@ -13,7 +13,7 @@ define Package/fff-hoods
> >     CATEGORY:=Freifunk
> >     TITLE:= Freifunk-Franken hoods
> >     URL:=http://www.freifunk-franken.de
> >-    DEPENDS:=+mdns +fff-network
> >+    DEPENDS:=+mdns +fff-network +fff-fastd
> > endef
> >
> > define Package/fff-hoods/description
> >diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> >b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> >index 0fa20fd..5626fa4 100755
> >--- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> >+++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> >@@ -84,9 +84,10 @@ echo "Setting channel 2.4 Ghz: $channel2"
> > echo "Setting mode 2.4 GHz: $mode2"
> > echo "Setting mesh 2.4 GHz type: $type2"
> >
> >-echo "Shutting down wifi"
> >-wifi down
> >+#echo "Shutting down wifi"
> >+#wifi down
> >
> >+uci set system. at system[0].hood=$hood
> > uci set wireless.radio0=wifi-device
> > uci set wireless.radio0.type=mac80211
> > uci set wireless.radio0.channel=$channel2
> >@@ -133,7 +134,7 @@ EOF
> >
> > . /usr/sbin/configurenetwork
> >
> >-# ==TODO==
> >-#echo "Finding fastd Gateways, if online. Configure fastd."
> >-# =======
> >+echo "Finding fastd Gateways, if online. Configure fastd."
> >+. /usr/sbin/fastdstart
> >+
> > echo "Done"
> >diff --git
> >a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
> >b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
> >index aadef59..cfd66d7 100644
> >--- a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
> >+++ b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
> >@@ -126,7 +126,6 @@ then
> >         ip -6 addr del $ip dev br-mesh
> >     done
> >
> >-    prefix="fdff:0::/64"
> >     # Set $prefix::MAC as IP
> >suffix=$(awk -F: '{ print $1$2":"$3$4":"$5$6 }'
> >/sys/class/net/br-mesh/address)
> >     addr=$(echo $prefix | sed -e 's/\//'$suffix'\//')
> >@@ -152,7 +151,8 @@ then
> >
> >     uci -q commit network
> >
> >-    /etc/init.d/fff-uradvd restart
> >+    killall uradvd
> >+    /etc/init.d/fff-uradvd start
> > else
> >     echo "IPv6 Prefix is not set"
> > fi

-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigröße  : 473 bytes
Beschreibung: This is a digitally signed message part
URL         : <http://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20160508/151ac0bb/attachment-0002.sig>


Mehr Informationen über die Mailingliste franken-dev