ASR_BASE
Change-Id: Icf3719cc0afe3eeb3edc7fa80a2eb5199ca9dda1
diff --git a/external/subpack/net/etherwake-nfqueue/files/etherwake-nfqueue.config b/external/subpack/net/etherwake-nfqueue/files/etherwake-nfqueue.config
new file mode 100644
index 0000000..541bbe2
--- /dev/null
+++ b/external/subpack/net/etherwake-nfqueue/files/etherwake-nfqueue.config
@@ -0,0 +1,21 @@
+config etherwake-nfqueue 'setup'
+ option sudo 'off'
+ option debug 'off'
+
+# You can add targets with uci:
+# # uci add etherwake-nfqueue target
+# Set a name for the target
+# # uci set etherwake-nfqueue.@target[-1].name=example
+# Set MAC address of the host to wake up
+# # uci set etherwake-nfqueue.@target[-1].mac=00:22:44:66:88:aa
+# Set the nfqueue num used for receiving filtered packets, defaults to 0
+# # uci set etherwake-nfqueue.@target[-1].nfqueue_num=0
+# Set the interface used for sending the magic packet, defaults to 'eth0'
+# # uci set etherwake-nfqueue.@target[-1].interface=eth0
+# Configure if it should be sent to broadcast address, defaults to off
+# # uci set etherwake-nfqueue.@target[-1].broadcast=off
+# Optionally provide a password (required by some adapters)
+# e.g. 00:22:44:66:88:aa or 192.168.1.1
+# # uci set etherwake-nfqueue.@target[-1].password=00:22:44:66:88:aa
+# Optionally disable the target, by default it is enabled
+# # uci set etherwake-nfqueue.@target[-1].enabled=false
diff --git a/external/subpack/net/etherwake-nfqueue/files/etherwake-nfqueue.init b/external/subpack/net/etherwake-nfqueue/files/etherwake-nfqueue.init
new file mode 100644
index 0000000..0be740d
--- /dev/null
+++ b/external/subpack/net/etherwake-nfqueue/files/etherwake-nfqueue.init
@@ -0,0 +1,69 @@
+#!/bin/sh /etc/rc.common
+#
+# Copyright (C) 2019 Mister Benjamin <144dbspl@gmail.com>
+
+NAME='etherwake-nfqueue'
+
+START=60
+USE_PROCD=1
+
+PROGRAM=${NAME}
+
+start_service()
+{
+ local value
+
+ config_load ${NAME}
+
+ config_get_bool value setup sudo 0
+ [ "${value}" -ne 0 ] && PROGRAM="sudo ${PROGRAM}"
+
+ config_get_bool value setup debug 0
+ if [ "${value}" -ne 0 ]; then
+ PROCD_DEBUG=1
+ append PROGRAM '-D'
+ fi
+
+ config_foreach start_instance target
+}
+
+start_instance()
+{
+ local section="$1"
+ local value name mac
+
+ config_get_bool value "${section}" enabled 1
+ [ "${value}" -ne 1 ] && return 0
+
+ config_get value "${section}" name
+ [ -z "${value}" ] && value="{section}"
+ name=${value}
+
+ config_get mac "${section}" mac
+ [ -z "${mac}" ] && {
+ echo "${initscript}: Target ${name} has no MAC address"
+ return 1
+ }
+
+ procd_open_instance ${name}
+ procd_set_param command ${PROGRAM}
+ procd_set_param respawn
+ procd_set_param stdout 1
+ procd_set_param stderr 1
+
+ config_get_bool value "${section}" broadcast 0
+ [ "${value}" -ne 0 ] && procd_append_param command -b
+
+ config_get value "${section}" interface
+ [ -n "${value}" ] && procd_append_param command -i "${value}"
+
+ config_get value "${section}" password
+ [ -n "${value}" ] && procd_append_param command -p "${value}"
+
+ config_get value "${section}" nfqueue_num 0
+ procd_append_param command -q "${value}"
+
+ procd_append_param command "${mac}"
+
+ procd_close_instance
+}