-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a dump of the former core package gluon-mesh-vpn-tunneldigger: https://github.com/freifunk-gluon/gluon/tree/c2dc338abfbebb34dcf62124dc09be85fa88f8ef/package/gluon-mesh-vpn-tunneldigger Only neccesary changes have been made.
- Loading branch information
Showing
10 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
include $(TOPDIR)/rules.mk | ||
|
||
PKG_NAME:=ff-mesh-vpn-tunneldigger | ||
PKG_VERSION:=0.0.1 | ||
PKG_RELEASE:=1 | ||
|
||
PKG_LICENSE:=BSD-2-Clause | ||
|
||
include $(TOPDIR)/../package/gluon.mk | ||
|
||
define Package/$(PKG_NAME) | ||
TITLE:=Support for connecting meshes via tunneldigger/L2TPv3 pseudowire | ||
DEPENDS:=+gluon-core +gluon-mesh-vpn-core +tunneldigger +simple-tc | ||
endef | ||
|
||
$(eval $(call BuildPackageGluon,$(PKG_NAME))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# ff-mesh-vpn-tunneldigger | ||
|
||
This package is based on the former core gluon package [gluon-mesh-vpn-tunneldigger](https://github.com/freifunk-gluon/gluon/tree/c2dc338abfbebb34dcf62124dc09be85fa88f8ef/package/gluon-mesh-vpn-tunneldigger). | ||
|
||
It you want to keep using tunneldigger you need to take the following steps: | ||
|
||
- `modules`: add this repo as descriped in the [README.md](../README.md#using-this-repository) | ||
- `image-customization.lua`: remove the `mesh-vpn-tunneldigger` feature | ||
- `image-customization.lua`: add the `config-mode-mesh-vpn` feature: | ||
`features({'config-mode-mesh-vpn'})` | ||
Not needed if you don't use the config mode or don't want to enable configuration of VPN Settings via the Config Mode. | ||
- `image-customization.lua`: add the `ff-mesh-vpn-tunneldigger` package: | ||
`packages({'ff-mesh-vpn-tunneldigger'})` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
need_string_array(in_domain({'mesh_vpn', 'tunneldigger', 'brokers'})) | ||
need_number({'mesh_vpn', 'tunneldigger', 'mtu'}) |
Empty file.
2 changes: 2 additions & 0 deletions
2
ff-mesh-vpn-tunneldigger/files/lib/gluon/reload.d/310-tunneldigger-stop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
/etc/init.d/tunneldigger stop |
2 changes: 2 additions & 0 deletions
2
ff-mesh-vpn-tunneldigger/files/lib/gluon/reload.d/790-tunneldigger-start
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
/etc/init.d/tunneldigger start |
1 change: 1 addition & 0 deletions
1
ff-mesh-vpn-tunneldigger/files/usr/lib/micron.d/tunneldigger-watchdog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*/5 * * * * /usr/bin/tunneldigger-watchdog |
19 changes: 19 additions & 0 deletions
19
ff-mesh-vpn-tunneldigger/luasrc/lib/gluon/upgrade/400-mesh-vpn-tunneldigger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/lua | ||
|
||
local site = require 'gluon.site' | ||
local util = require 'gluon.util' | ||
local vpn_core = require 'gluon.mesh-vpn' | ||
|
||
local uci = require('simple-uci').cursor() | ||
|
||
|
||
uci:section('tunneldigger', 'broker', 'mesh_vpn', { | ||
uuid = util.node_id(), | ||
interface = vpn_core.get_interface(), | ||
bind_interface = 'br-wan', | ||
group = 'gluon-mesh-vpn', | ||
broker_selection = 'usage', | ||
address = site.mesh_vpn.tunneldigger.brokers(), | ||
}) | ||
|
||
uci:save('tunneldigger') |
31 changes: 31 additions & 0 deletions
31
ff-mesh-vpn-tunneldigger/luasrc/usr/bin/tunneldigger-watchdog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/lua | ||
|
||
local uci = require('simple-uci').cursor() | ||
|
||
local function restart_tunneldigger() | ||
os.execute('logger -t tunneldigger-watchdog "Restarting Tunneldigger."') | ||
os.execute('/etc/init.d/tunneldigger restart') | ||
end | ||
|
||
local function has_mesh_vpn_neighbours() | ||
local handle = io.popen('batctl o', 'r') | ||
if not handle then | ||
return false | ||
end | ||
for line in handle:lines() do | ||
if line:find('mesh%-vpn') then | ||
handle:close() | ||
return true | ||
end | ||
end | ||
handle:close() | ||
return false | ||
end | ||
|
||
if uci:get_bool('tunneldigger', 'mesh_vpn', 'enabled') then | ||
if not has_mesh_vpn_neighbours() then | ||
os.execute('logger -t tunneldigger-watchdog "No vpn-mesh neighbours found."') | ||
restart_tunneldigger() | ||
return | ||
end | ||
end |
46 changes: 46 additions & 0 deletions
46
ff-mesh-vpn-tunneldigger/luasrc/usr/lib/lua/gluon/mesh-vpn/provider/tunneldigger.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
local uci = require('simple-uci').cursor() | ||
|
||
local site = require 'gluon.site' | ||
local vpn_core = require 'gluon.mesh-vpn' | ||
|
||
local M = {} | ||
|
||
function M.public_key() | ||
return nil | ||
end | ||
|
||
function M.enable(val) | ||
uci:set('tunneldigger', 'mesh_vpn', 'enabled', val) | ||
uci:save('tunneldigger') | ||
end | ||
|
||
function M.active() | ||
return site.mesh_vpn.tunneldigger() ~= nil | ||
end | ||
|
||
function M.set_limit(ingress_limit, egress_limit) | ||
if ingress_limit ~= nil then | ||
uci:set('tunneldigger', 'mesh_vpn', 'limit_bw_down', ingress_limit) | ||
else | ||
uci:delete('tunneldigger', 'mesh_vpn', 'limit_bw_down') | ||
end | ||
|
||
if egress_limit ~= nil then | ||
uci:section('simple-tc', 'interface', 'mesh_vpn', { | ||
ifname = vpn_core.get_interface(), | ||
enabled = true, | ||
limit_egress = egress_limit, | ||
}) | ||
else | ||
uci:delete('simple-tc', 'mesh_vpn') | ||
end | ||
|
||
uci:save('tunneldigger') | ||
uci:save('simple-tc') | ||
end | ||
|
||
function M.mtu() | ||
return site.mesh_vpn.tunneldigger.mtu() | ||
end | ||
|
||
return M |