[PATCH 2/4] Add package fff-vpn

Christian Dresel fff at chrisi01.de
Di Mai 3 23:22:04 CEST 2016


hi

Danke erstmal für die Arbeit, es freut mich zu sehen das es weiter geht.

ich guck mal ein wenig drüber, ob ich demnächst zum testen und bauen 
komme weiß ich aktuell nicht, hab soviel anderes noch um die Ohren...
Kommentare in der Mail:

Am 03.05.2016 um 21:24 schrieb Robert Langhammer:
> Signed-off-by: Robert Langhammer <rlanghammer at web.de>
> ---
>   src/packages/fff/fff-vpn/Makefile               | 39 +++++++++++++++++++
>   src/packages/fff/fff-vpn/files/usr/sbin/fff-vpn | 50 +++++++++++++++++++++++++
>   src/packages/fff/fff/Makefile                   |  6 ++-
>   3 files changed, 93 insertions(+), 2 deletions(-)
>   create mode 100644 src/packages/fff/fff-vpn/Makefile
>   create mode 100644 src/packages/fff/fff-vpn/files/usr/sbin/fff-vpn
>
> diff --git a/src/packages/fff/fff-vpn/Makefile b/src/packages/fff/fff-vpn/Makefile
> new file mode 100644
> index 0000000..976375a
> --- /dev/null
> +++ b/src/packages/fff/fff-vpn/Makefile
> @@ -0,0 +1,39 @@
> +include $(TOPDIR)/rules.mk
> +
> +PKG_NAME:=fff-vpn
> +PKG_VERSION:=1
> +PKG_RELEASE:=1
> +
> +PKG_BUILD_DIR:=$(BUILD_DIR)/fff-vpn
> +
> +include $(INCLUDE_DIR)/package.mk
> +
> +define Package/fff-vpn
> +    SECTION:=base
> +    CATEGORY:=Freifunk
> +    TITLE:= Freifunk-Franken vpn
> +    URL:=http://www.freifunk-franken.de
> +endef
> +
> +define Package/fff-vpn/description
> +    This selects the vpn-tunnel for the Freifunk Franken Firmware
> +    When a Gateway announces a Broker, l2tp is preferred
> +endef
> +
> +define Build/Prepare
> +	echo "all: " > $(PKG_BUILD_DIR)/Makefile
> +endef
> +
> +define Build/Configure
> +	# nothing
> +endef
> +
> +define Build/Compile
> +	# nothing
> +endef
> +
> +define Package/fff-vpn/install
> +	$(CP) ./files/* $(1)/
> +endef
> +
> +$(eval $(call BuildPackage,fff-vpn))
> diff --git a/src/packages/fff/fff-vpn/files/usr/sbin/fff-vpn b/src/packages/fff/fff-vpn/files/usr/sbin/fff-vpn
> new file mode 100644
> index 0000000..8ac62d1
> --- /dev/null
> +++ b/src/packages/fff/fff-vpn/files/usr/sbin/fff-vpn
> @@ -0,0 +1,50 @@
> +# sourced by faststart
> +/etc/init.d/tunneldigger disable && sed -i '/tunneldigger disable/d' $0
> +broker=no
> +fastd=no
> +count=0
> +conf="/etc/config/tunneldigger"
> +conftmp="/tmp/tunneldigger.conf.tmp"
> +>$conftmp
> +peers=$(ls /etc/fastd/fff/peers)
fff in dieser Verzeichnissstruktur ist meines wissens die Community, da 
gibts irgendeine Variable dafür. Es müsste VPN_PROJECT aus 
/etc/community.cfg sein. Sollte man wohl so wie hier lösen:

https://github.com/FreifunkFranken/firmware/blob/master/src/packages/fff/fff-fastd/files/usr/sbin/fastdstart
> +
> +for peer in $peers; do
> +	ip=$(grep ipv4 /etc/fastd/fff/peers/$peer | cut -f2 -d "\"")
das gleiche hier
> +	# ask gateway
> +	vpn=$(wget http://$ip/vpn.txt -O - 2>/dev/null)
> +	if [ "$vpn" = "l2tp" ]; then
> +		broker=yes
> +		#write l2tp config
> +		fdport=$(greo ipv4 /etc/fastd/fff/peers/$peer | cut -f5 -d " " | tr -d \;)
hier ebenfalls, dazu soll das wohl grep anstatt greo sein oder?
> +		brport=$((fdport + 10000))
> +		echo "config broker
> +	list address '$ip:$brport'
> +	option uuid '_$hostname'
> +	option interface 'l2tp$count'
> +	option enabled '1'
> +	option hook_script '/etc/tunneldigger.hook'
> +		" >> $conftmp
> +		count=$((count + 1))
> +		#remove peer
> +		rm /etc/fastd/fff/peers/$peer
auch hier
> +	else
> +		fastd=yes
> +	fi
> +done
> +
> +if [ "$broker" = "yes" ]; then
> +	if  !(diff $conftmp $conf &>/dev/null) ; then
> +		#broker changed
> +		/etc/init.d/tunneldigger stop
> +		# remove pid-files
> +		rm /var/run/tunneldigger* 2>/dev/null
> +		#copy new config
> +		cp $conftmp $conf
> +	fi
> +	/etc/init.d/tunneldigger start
> +fi
> +
> +if [ "$fastd" = "no" ]; then
> +	kill -TERM $(cat /var/run/fastd.$project.pid)
> +	etxit
> +fi
> diff --git a/src/packages/fff/fff/Makefile b/src/packages/fff/fff/Makefile
> index e709987..662b6d2 100644
> --- a/src/packages/fff/fff/Makefile
> +++ b/src/packages/fff/fff/Makefile
> @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
>   
>   PKG_NAME:=fff
>   PKG_VERSION:=0.0.2
> -PKG_RELEASE:=1
> +PKG_RELEASE:=2
>   
>   PKG_BUILD_DIR:=$(BUILD_DIR)/fff
>   
> @@ -20,7 +20,9 @@ define Package/fff-base
>                +fff-uradvd \
>                +fff-batman-adv-legacy \
>                +fff-fastd \
> -             +fff-firewall
> +             +fff-firewall \
> +             +fff-tunneldigger \
> +             +fff-vpn
>   endef
>   
>   define Package/fff-base/description




Mehr Informationen über die Mailingliste franken-dev