gluon-l3roamd: add package containing basic l3roamd configuration (#1042)
This commit is contained in:
parent
12780715e9
commit
b994ad4fdc
33
package/gluon-l3roamd/Makefile
Normal file
33
package/gluon-l3roamd/Makefile
Normal file
@ -0,0 +1,33 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=gluon-l3roamd
|
||||
PKG_VERSION:=1
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include ../gluon.mk
|
||||
|
||||
define Package/gluon-l3roamd
|
||||
SECTION:=gluon
|
||||
CATEGORY:=Gluon
|
||||
TITLE:=Configure l3roamd for babel
|
||||
DEPENDS:=+gluon-core +gluon-mesh-babel +l3roamd
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
|
||||
endef
|
||||
|
||||
define Package/gluon-l3roamd/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,gluon-l3roamd))
|
27
package/gluon-l3roamd/files/etc/init.d/gluon-l3roamd
Executable file
27
package/gluon-l3roamd/files/etc/init.d/gluon-l3roamd
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=55
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/l3roamd
|
||||
|
||||
start_service () {
|
||||
procd_open_instance
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_set_param respawn ${respawn_threshold:-3660} ${respawn_timeout:-5} ${respawn_retry:-0}
|
||||
interfaces=$(for dev in $( ubus call network.interface dump | jsonfilter -e "@.interface[@.proto='gluon_mesh' && @.up=true].device");do echo " -m $dev"; done;
|
||||
[ "$(ifstatus client | jsonfilter -e "@.up")" = "true" ] && echo " -i local-node")
|
||||
procd_set_param command "$PROG" -p $(lua -e 'print(require("gluon.site_config").prefix6)') $interfaces -t 11 -a $(uci get network.loopback.ip6addr | cut -d/ -f1) -4 0:0:0:0:0:ffff::/96
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
local script=$(readlink "$initscript")
|
||||
local name=$(basename "${script:-$initscript}")
|
||||
|
||||
procd_open_trigger
|
||||
procd_add_raw_trigger "interface.*" 0 "/etc/init.d/$name" reload
|
||||
procd_close_trigger
|
||||
}
|
||||
|
20
package/gluon-l3roamd/luasrc/lib/gluon/upgrade/380-gluon-l3roamd-route
Executable file
20
package/gluon-l3roamd/luasrc/lib/gluon/upgrade/380-gluon-l3roamd-route
Executable file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local uci = require('simple-uci').cursor()
|
||||
local site = require 'gluon.site_config'
|
||||
|
||||
uci:delete('network', 'l3roam')
|
||||
uci:section('network', 'interface', 'l3roam', {
|
||||
ifname = 'l3roam0',
|
||||
proto = 'none',
|
||||
})
|
||||
|
||||
uci:delete('network', 'l3roamd_client')
|
||||
uci:section('network', 'route6', 'l3roamd_client', {
|
||||
interface = 'l3roam',
|
||||
target = site.prefix6,
|
||||
gateway = '::',
|
||||
table = '10',
|
||||
})
|
||||
|
||||
uci:save('network')
|
Loading…
Reference in New Issue
Block a user