diff options
Diffstat (limited to 'package/network/services/dnsmasq/files')
4 files changed, 45 insertions, 37 deletions
diff --git a/package/network/services/dnsmasq/files/dhcp-script.sh b/package/network/services/dnsmasq/files/dhcp-script.sh index 86032694c1..470097bf6b 100755 --- a/package/network/services/dnsmasq/files/dhcp-script.sh +++ b/package/network/services/dnsmasq/files/dhcp-script.sh @@ -2,45 +2,52 @@ [ -f "$USER_DHCPSCRIPT" ] && . "$USER_DHCPSCRIPT" "$@" +. /usr/share/libubox/jshn.sh + +json_init +json_add_array env +hotplugobj="" + +case "$1" in + add | del | old | arp-add | arp-del) + json_add_string "" "MACADDR=$2" + json_add_string "" "IPADDR=$3" + ;; +esac + case "$1" in add) - export ACTION="add" - export MACADDR="$2" - export IPADDR="$3" - export HOSTNAME="$4" - exec /sbin/hotplug-call dhcp + json_add_string "" "ACTION=add" + json_add_string "" "HOSTNAME=$4" + hotplugobj="dhcp" ;; del) - export ACTION="remove" - export MACADDR="$2" - export IPADDR="$3" - export HOSTNAME="$4" - exec /sbin/hotplug-call dhcp + json_add_string "" "ACTION=remove" + json_add_string "" "HOSTNAME=$4" + hotplugobj="dhcp" ;; old) - export ACTION="update" - export MACADDR="$2" - export IPADDR="$3" - export HOSTNAME="$4" - exec /sbin/hotplug-call dhcp + json_add_string "" "ACTION=update" + json_add_string "" "HOSTNAME=$4" + hotplugobj="dhcp" ;; arp-add) - export ACTION="add" - export MACADDR="$2" - export IPADDR="$3" - exec /sbin/hotplug-call neigh + json_add_string "" "ACTION=add" + hotplugobj="neigh" ;; arp-del) - export ACTION="remove" - export MACADDR="$2" - export IPADDR="$3" - exec /sbin/hotplug-call neigh + json_add_string "" "ACTION=remove" + hotplugobj="neigh" ;; tftp) - export ACTION="add" - export TFTP_SIZE="$2" - export TFTP_ADDR="$3" - export TFTP_PATH="$4" - exec /sbin/hotplug-call tftp + json_add_string "" "ACTION=add" + json_add_string "" "TFTP_SIZE=$2" + json_add_string "" "TFTP_ADDR=$3" + json_add_string "" "TFTP_PATH=$4" + hotplugobj="tftp" ;; esac + +json_close_array env + +[ -n "$hotplugobj" ] && ubus call hotplug.${hotplugobj} call "$(json_dump)" diff --git a/package/network/services/dnsmasq/files/dnsmasq_acl.json b/package/network/services/dnsmasq/files/dnsmasq_acl.json index 00ec7d0f03..47d7c29302 100644 --- a/package/network/services/dnsmasq/files/dnsmasq_acl.json +++ b/package/network/services/dnsmasq/files/dnsmasq_acl.json @@ -1,4 +1,12 @@ { "user": "dnsmasq", - "publish": [ "dnsmasq" ] + "publish": [ "dnsmasq" ], + "access": { + "hotplug.dhcp": { + "methods": [ "call" ] + }, + "hotplug.neigh": { + "methods": [ "call" ] + } + } } diff --git a/package/network/services/dnsmasq/files/dnsmasqsec.hotplug b/package/network/services/dnsmasq/files/dnsmasqsec.hotplug index 71f5e68b2d..a59148600b 100644 --- a/package/network/services/dnsmasq/files/dnsmasqsec.hotplug +++ b/package/network/services/dnsmasq/files/dnsmasqsec.hotplug @@ -5,6 +5,7 @@ TIMEVALIDFILE="/var/state/dnsmasqsec" [ -f "$TIMEVALIDFILE" ] || { echo "ntpd says time is valid" >$TIMEVALIDFILE /etc/init.d/dnsmasq enabled && { + initscript=dnsmasq . /lib/functions/procd.sh procd_send_signal dnsmasq '*' INT } diff --git a/package/network/services/dnsmasq/files/dnsmasqsec_hotplug_acl.json b/package/network/services/dnsmasq/files/dnsmasqsec_hotplug_acl.json deleted file mode 100644 index 861ecbe034..0000000000 --- a/package/network/services/dnsmasq/files/dnsmasqsec_hotplug_acl.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "user": "ntp", - "access": { - "service": { - "methods": [ "signal" ] - } - } -} |