1
0
mirror of https://git.openwrt.org/feed/packages.git synced 2024-06-16 20:33:58 +02:00
openwrt-packages/net/dawn/files/dawn.init
Nick Hainke 89a093a1f0 dawn: bump to latest version
Includes:
- dawn_uci: fix crashing when uci config is received
- tcpsocket: add option to add server ip

A new config option allows to add a server ip
	option server_ip '10.0.0.2'

However, this server does not send anything back. Therefore it is not
possible to change the node configuration. This will probably be added
soon. The main goal of this commit is to allow monitoring of all nodes
in a network with DAWN, e.g. clients, channel utilization, ...

Also a network option (3) has been added which allows to use TCP but
not to announce your daemon in the broadcast domain. This allows you to
create a monitor-only node that holds only the local information and
forwards it to the central server.

A monitor-only node could be configured like
	option server_ip '10.0.0.1'
	option tcp_port '1026'
	option network_option '3'

Another possible config is
        option server_ip '10.0.0.1'
        option tcp_port '1026'
        option network_option '2'
Here, the node shares information with a central server, which can be
located outside the broadcast domain. Nevertheless, it also shares
information within its broadcast domain and can therefore perform
client steering.

Signed-off-by: Nick Hainke <vincent@systemli.org>
2020-08-22 00:45:19 +02:00

65 lines
1.1 KiB
Bash
Executable File

#!/bin/sh /etc/rc.common
USE_PROCD=1
START=81
STOP=81
PROG=/usr/sbin/dawn
NAME=dawn
wait_for_network()
{
ubus -t 15 wait_for network.interface.$1 2>/dev/null
}
boot()
{
ubus -t 5 wait_for umdns 2>/dev/null
config_load network
config_foreach wait_for_network interface
rc_procd start_service
}
reload_service()
{
if service_running; then
ubus call dawn reload_config
else
start
fi
}
service_triggers()
{
procd_add_reload_trigger "dawn"
}
start_service()
{
local _tcp_buffer
local _network_option
config_load dawn
load_tcp_config() {
config_get _tcp_buffer "$1" tcp_port
config_get _network_option "$1" network_option
}
config_foreach load_tcp_config network
touch /tmp/dawn_mac_list
echo "Starting Service..."
procd_open_instance
procd_set_param command $PROG
procd_set_param stdout 0 # here it is possible to remove the debug output...
procd_set_param stderr 1
if [ ${_network_option} -eq 2 ]; then
procd_add_mdns "dawn" "tcp" "${_tcp_buffer}"
echo "UMDNS with port ${_tcp_buffer}"
fi
procd_close_instance
echo "Dawn instance started!"
}