forked from freifunk-franken/firmware
fff-vpn-select: remove tunneldigger
Signed-off-by: Robert Langhammer <rlanghammer@web.de> Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> [Rebased, updated PKG_RELEASE] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Reviewed-by: Fabian Bläse <fabian@blaese.de>
This commit is contained in:
parent
9290d11699
commit
4941d6eff5
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-vpn-select
|
||||
PKG_RELEASE:=3
|
||||
PKG_RELEASE:=4
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
|
@ -12,15 +12,12 @@ define Package/$(PKG_NAME)
|
|||
CATEGORY:=Freifunk
|
||||
TITLE:= Freifunk-Franken vpn-select
|
||||
URL:=http://www.freifunk-franken.de
|
||||
DEPENDS:=+@BUSYBOX_CONFIG_WGET \
|
||||
+@BUSYBOX_CONFIG_FEATURE_WGET_TIMEOUT \
|
||||
+fff-tunneldigger \
|
||||
+fff-fastd
|
||||
DEPENDS:=+fff-fastd
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
This package selects and starts the VPN
|
||||
In this version fastd and l2tp via tunneldigger
|
||||
(currently only via fastd)
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
|
|
|
@ -8,9 +8,7 @@ hoodfile="$1"
|
|||
|
||||
make_config() {
|
||||
# remove old config
|
||||
>/etc/config/tunneldigger
|
||||
rm /tmp/fastd_fff_peers/*
|
||||
count=0
|
||||
Index=1
|
||||
json_load "$(cat "$hoodfile")"
|
||||
json_select vpn
|
||||
|
@ -29,24 +27,6 @@ do
|
|||
echo "remote \"${address}\" port ${port};" >> "$filename"
|
||||
echo "" >> "$filename"
|
||||
echo "float yes;" >> "$filename"
|
||||
|
||||
# ask for Broker and select the tunnel
|
||||
if [ "l2tp" = "$(wget -T10 "${address}/vpn.txt" -O - 2>/dev/null)" ]; then
|
||||
# Gateway offers l2tp
|
||||
L2PORT=$((port + 10000))
|
||||
UUID=$hostname
|
||||
|
||||
uci set tunneldigger.$count=broker
|
||||
uci set tunneldigger.$count.address="${address}:$L2PORT"
|
||||
uci set tunneldigger.$count.uuid="$UUID"
|
||||
uci set tunneldigger.$count.interface="l2tp$count"
|
||||
uci set tunneldigger.$count.enabled="1"
|
||||
uci set tunneldigger.$count.hook_script='/etc/tunneldigger/tunneldigger.hook'
|
||||
uci -c /tmp commit tunneldigger
|
||||
count=$((count + 1))
|
||||
# remove this fastd-peer
|
||||
rm "$filename"
|
||||
fi
|
||||
fi
|
||||
json_select ".." # back to vpn
|
||||
Index=$(( Index + 1 ))
|
||||
|
@ -58,25 +38,14 @@ json_select ".." # back to root
|
|||
|
||||
# Only do something if file is there and not empty; otherwise exit 1
|
||||
if [ -s "$hoodfile" ]; then
|
||||
# set some vars
|
||||
hostname=$(cat /proc/sys/kernel/hostname)
|
||||
mac=$(awk '{ mac=toupper($1); gsub(":", "", mac); print mac }' /sys/class/net/br-mesh/address 2>/dev/null)
|
||||
[ "$hostname" = "LEDE" ] && hostname=""
|
||||
[ "$hostname" = "" ] && hostname="$mac"
|
||||
|
||||
if [ ! -d /tmp/fastd_fff_peers ]; then
|
||||
# first run after reboot
|
||||
mkdir /tmp/fastd_fff_peers
|
||||
make_config
|
||||
# start fastd only if there are some peers left
|
||||
# start fastd only if there are some peers
|
||||
[ "$(ls /etc/fastd/fff/peers/* 2>/dev/null)" ] && /etc/init.d/fastd start
|
||||
/etc/init.d/tunneldigger start
|
||||
else
|
||||
# check if new tunneldigger conf is different
|
||||
sumold=$(sha256sum /etc/config/tunneldigger)
|
||||
make_config
|
||||
sumnew=$(sha256sum /etc/config/tunneldigger)
|
||||
[ "$sumnew" != "$sumold" ] && /etc/init.d/tunneldigger restart
|
||||
/etc/init.d/fastd reload
|
||||
|
||||
# fastd start/stop for various situations
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
>/etc/config/tunneldigger
|
||||
rm /tmp/fastd_fff_peers/*
|
||||
/etc/init.d/fastd stop
|
||||
/etc/init.d/tunneldigger stop
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user