[RFC PATCH v2 5/7] Added VPN Connectivity to previous added Hood-Management
Robert Langhammer
rlanghammer at web.de
Di Jun 7 15:31:37 CEST 2016
Hi,
hier habe ich mal ne Frage. s. unten
Am 06.06.2016 um 10:59 schrieb Jan Kraus:
> Signed-off-by: Jan Kraus <mayosemmel at gmail.com>
> ---
> bsp/default/root_file_system/etc/rc.local.tpl | 1 +
> .../fff/fff-fastd/files/usr/sbin/fastdstart | 36 +++++++++++++++++-----
> src/packages/fff/fff-hoods/Makefile | 2 +-
> .../fff/fff-hoods/files/usr/sbin/configurehood | 5 +--
> 4 files changed, 33 insertions(+), 11 deletions(-)
>
> diff --git a/bsp/default/root_file_system/etc/rc.local.tpl b/bsp/default/root_file_system/etc/rc.local.tpl
> index 7dbc95f..1aafc1b 100755
> --- a/bsp/default/root_file_system/etc/rc.local.tpl
> +++ b/bsp/default/root_file_system/etc/rc.local.tpl
> @@ -69,5 +69,6 @@ touch /tmp/started
>
> /usr/sbin/configurehood
> /usr/sbin/configurenetwork
> +/usr/sbin/fastdstart
>
> exit 0
> diff --git a/src/packages/fff/fff-fastd/files/usr/sbin/fastdstart b/src/packages/fff/fff-fastd/files/usr/sbin/fastdstart
> index 611a3f8..8e494ff 100755
> --- 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
Wird das in Zukunft noch benötigt oder ersetzt der dezentrale den
zentralen keyserver?
Robert
> -
> - 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)"
> + json_select vpn
> + local Index="1"
> + while json_select $Index > /dev/null
> + do
> + json_get_var protocol protocol
> + if [ "$protocol" == "fastd" ]
> + then
> + 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 f401a94..ae69a3b 100755
> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> @@ -86,9 +86,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
Mehr Informationen über die Mailingliste franken-dev