Added gluon-mesh-vpn-tunneldigger
This commit is contained in:
parent
119ac32540
commit
ff2ca88374
40
package/gluon-mesh-vpn-tunneldigger/Makefile
Normal file
40
package/gluon-mesh-vpn-tunneldigger/Makefile
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=gluon-mesh-vpn-tunneldigger
|
||||||
|
PKG_VERSION:=3
|
||||||
|
|
||||||
|
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||||
|
|
||||||
|
include $(GLUONDIR)/include/package.mk
|
||||||
|
|
||||||
|
define Package/gluon-mesh-vpn-tunneldigger
|
||||||
|
SECTION:=gluon
|
||||||
|
CATEGORY:=Gluon
|
||||||
|
TITLE:=Support for connecting batman-adv meshes via tunneltigger/l2tpv3 pseudowire
|
||||||
|
DEPENDS:=+gluon-core gluon-mesh-batman-adv +gluon-wan-dnsmasq +tunneldigger +iptables-mod-extra
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/gluon-mesh-vpn-tunneldigger/description
|
||||||
|
Gluon community wifi mesh firmware framework: tunneldigger support
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Prepare
|
||||||
|
mkdir -p $(PKG_BUILD_DIR)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Configure
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Compile
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/gluon-mesh-vpn-tunneldigger/install
|
||||||
|
$(CP) ./files/* $(1)/
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/gluon-mesh-vpn-tunneldigger/postinst
|
||||||
|
#!/bin/sh
|
||||||
|
$(call GluonCheckSite,check_site.lua)
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,gluon-mesh-vpn-tunneldigger))
|
3
package/gluon-mesh-vpn-tunneldigger/check_site.lua
Normal file
3
package/gluon-mesh-vpn-tunneldigger/check_site.lua
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
need_number('tunneldigger_mesh_vpn.mtu')
|
||||||
|
need_boolean('tunneldigger_mesh_vpn.enabled', false)
|
||||||
|
need_string_array('tunneldigger_mesh_vpn.brokers'))
|
@ -0,0 +1,3 @@
|
|||||||
|
return {
|
||||||
|
enabled = uci:get_bool('tunneldigger', 'broker', 'enabled'),
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
local json = require 'luci.json'
|
||||||
|
local ltn12 = require 'luci.ltn12'
|
||||||
|
local nixio = require 'nixio'
|
||||||
|
local site = require 'gluon.site_config'
|
||||||
|
local uci = require('luci.model.uci').cursor()
|
||||||
|
|
||||||
|
return nil
|
@ -0,0 +1,3 @@
|
|||||||
|
*nat
|
||||||
|
-I OUTPUT -m owner --gid-owner gluon-tunneldigger -o lo -d 127.0.0.1 -p udp --dport 53 -j DNAT --to-destination :54
|
||||||
|
COMMIT
|
@ -0,0 +1,62 @@
|
|||||||
|
#!/usr/bin/lua
|
||||||
|
|
||||||
|
local site = require 'gluon.site_config'
|
||||||
|
local users = require 'gluon.users'
|
||||||
|
local util = require 'gluon.util'
|
||||||
|
|
||||||
|
local uci = require('luci.model.uci').cursor()
|
||||||
|
local lutil = require 'luci.util'
|
||||||
|
|
||||||
|
-- Group for iptables rule
|
||||||
|
users.add_group('gluon-tunneldigger', 900)
|
||||||
|
|
||||||
|
local enabled = uci:get('tunneldigger', 'broker', 'enabled')
|
||||||
|
if not enabled then
|
||||||
|
enabled = site.tunneldigger_mesh_vpn.enabled and 1 or 0
|
||||||
|
end
|
||||||
|
|
||||||
|
uci:section('tunneldigger', 'broker',
|
||||||
|
{
|
||||||
|
enabled = enabled,
|
||||||
|
uuid = util.node_id(),
|
||||||
|
interface = 'mesh-vpn',
|
||||||
|
bind_interface = 'br-wan',
|
||||||
|
group = 'gluon-tunneldigger',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
uci:set("tunneldigger", "broker", "address", site.mesh_vpn_tunneldigger.brokers)
|
||||||
|
|
||||||
|
uci:save('tunneldigger')
|
||||||
|
uci:commit('tunneldigger')
|
||||||
|
|
||||||
|
uci:section('network', 'interface', 'mesh_vpn',
|
||||||
|
{
|
||||||
|
ifname = 'mesh-vpn',
|
||||||
|
proto = 'batadv',
|
||||||
|
mesh = 'bat0',
|
||||||
|
mesh_no_rebroadcast = 1,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
uci:section('network', 'device', 'mesh_vpn_dev',
|
||||||
|
{
|
||||||
|
ifname = 'mesh-vpn',
|
||||||
|
mtu = site.mesh_vpn_tunneldigger.mtu,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
uci:save('network')
|
||||||
|
uci:commit('network')
|
||||||
|
|
||||||
|
|
||||||
|
uci:section('firewall', 'include', 'mesh_vpn_dns',
|
||||||
|
{
|
||||||
|
type = 'restore',
|
||||||
|
path = '/lib/gluon/mesh-vpn-tunneldigger/iptables.rules',
|
||||||
|
family = 'ipv4',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
uci:save('firewall')
|
||||||
|
uci:commit('firewall')
|
Loading…
Reference in New Issue
Block a user