dnsmasq: switch to ubus-based hotplug call
Use new ubus-based hotplug call in dhcp-script.sh As sysntpd now makes use of the new ubus-based hotplug calls, dnsmasq no longer needs to ship ACL to cover ntpd-hotplug. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
parent
29a6a71d52
commit
aed95c4cb8
|
@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
|
||||||
PKG_NAME:=dnsmasq
|
PKG_NAME:=dnsmasq
|
||||||
PKG_UPSTREAM_VERSION:=2.84test3
|
PKG_UPSTREAM_VERSION:=2.84test3
|
||||||
PKG_VERSION:=$(subst test,~~test,$(subst rc,~rc,$(PKG_UPSTREAM_VERSION)))
|
PKG_VERSION:=$(subst test,~~test,$(subst rc,~rc,$(PKG_UPSTREAM_VERSION)))
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=$(AUTORELEASE)
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_UPSTREAM_VERSION).tar.xz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_UPSTREAM_VERSION).tar.xz
|
||||||
PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/test-releases
|
PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/test-releases
|
||||||
|
@ -180,7 +180,6 @@ define Package/dnsmasq/install
|
||||||
$(INSTALL_BIN) ./files/dhcp-script.sh $(1)/usr/lib/dnsmasq/dhcp-script.sh
|
$(INSTALL_BIN) ./files/dhcp-script.sh $(1)/usr/lib/dnsmasq/dhcp-script.sh
|
||||||
$(INSTALL_DIR) $(1)/usr/share/acl.d
|
$(INSTALL_DIR) $(1)/usr/share/acl.d
|
||||||
$(INSTALL_DATA) ./files/dnsmasq_acl.json $(1)/usr/share/acl.d/
|
$(INSTALL_DATA) ./files/dnsmasq_acl.json $(1)/usr/share/acl.d/
|
||||||
$(INSTALL_DATA) ./files/dnsmasqsec_hotplug_acl.json $(1)/usr/share/acl.d/
|
|
||||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||||
$(INSTALL_BIN) ./files/50-dnsmasq-migrate-resolv-conf-auto.sh $(1)/etc/uci-defaults
|
$(INSTALL_BIN) ./files/50-dnsmasq-migrate-resolv-conf-auto.sh $(1)/etc/uci-defaults
|
||||||
endef
|
endef
|
||||||
|
|
|
@ -2,45 +2,52 @@
|
||||||
|
|
||||||
[ -f "$USER_DHCPSCRIPT" ] && . "$USER_DHCPSCRIPT" "$@"
|
[ -f "$USER_DHCPSCRIPT" ] && . "$USER_DHCPSCRIPT" "$@"
|
||||||
|
|
||||||
|
. /usr/share/libubox/jshn.sh
|
||||||
|
|
||||||
|
json_init
|
||||||
|
json_add_array env
|
||||||
|
hotplugobj=""
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
add)
|
add | del | old | arp-add | arp-del)
|
||||||
export ACTION="add"
|
json_add_string "" "MACADDR=$2"
|
||||||
export MACADDR="$2"
|
json_add_string "" "IPADDR=$3"
|
||||||
export IPADDR="$3"
|
|
||||||
export HOSTNAME="$4"
|
|
||||||
exec /sbin/hotplug-call dhcp
|
|
||||||
;;
|
|
||||||
del)
|
|
||||||
export ACTION="remove"
|
|
||||||
export MACADDR="$2"
|
|
||||||
export IPADDR="$3"
|
|
||||||
export HOSTNAME="$4"
|
|
||||||
exec /sbin/hotplug-call dhcp
|
|
||||||
;;
|
|
||||||
old)
|
|
||||||
export ACTION="update"
|
|
||||||
export MACADDR="$2"
|
|
||||||
export IPADDR="$3"
|
|
||||||
export HOSTNAME="$4"
|
|
||||||
exec /sbin/hotplug-call dhcp
|
|
||||||
;;
|
|
||||||
arp-add)
|
|
||||||
export ACTION="add"
|
|
||||||
export MACADDR="$2"
|
|
||||||
export IPADDR="$3"
|
|
||||||
exec /sbin/hotplug-call neigh
|
|
||||||
;;
|
|
||||||
arp-del)
|
|
||||||
export ACTION="remove"
|
|
||||||
export MACADDR="$2"
|
|
||||||
export IPADDR="$3"
|
|
||||||
exec /sbin/hotplug-call neigh
|
|
||||||
;;
|
|
||||||
tftp)
|
|
||||||
export ACTION="add"
|
|
||||||
export TFTP_SIZE="$2"
|
|
||||||
export TFTP_ADDR="$3"
|
|
||||||
export TFTP_PATH="$4"
|
|
||||||
exec /sbin/hotplug-call tftp
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
add)
|
||||||
|
json_add_string "" "ACTION=add"
|
||||||
|
json_add_string "" "HOSTNAME=$4"
|
||||||
|
hotplugobj="dhcp"
|
||||||
|
;;
|
||||||
|
del)
|
||||||
|
json_add_string "" "ACTION=remove"
|
||||||
|
json_add_string "" "HOSTNAME=$4"
|
||||||
|
hotplugobj="dhcp"
|
||||||
|
;;
|
||||||
|
old)
|
||||||
|
json_add_string "" "ACTION=update"
|
||||||
|
json_add_string "" "HOSTNAME=$4"
|
||||||
|
hotplugobj="dhcp"
|
||||||
|
;;
|
||||||
|
arp-add)
|
||||||
|
json_add_string "" "ACTION=add"
|
||||||
|
hotplugobj="neigh"
|
||||||
|
;;
|
||||||
|
arp-del)
|
||||||
|
json_add_string "" "ACTION=remove"
|
||||||
|
hotplugobj="neigh"
|
||||||
|
;;
|
||||||
|
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)"
|
||||||
|
|
|
@ -1,4 +1,12 @@
|
||||||
{
|
{
|
||||||
"user": "dnsmasq",
|
"user": "dnsmasq",
|
||||||
"publish": [ "dnsmasq" ]
|
"publish": [ "dnsmasq" ],
|
||||||
|
"access": {
|
||||||
|
"hotplug.dhcp": {
|
||||||
|
"methods": [ "call" ]
|
||||||
|
},
|
||||||
|
"hotplug.neigh": {
|
||||||
|
"methods": [ "call" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ TIMEVALIDFILE="/var/state/dnsmasqsec"
|
||||||
[ -f "$TIMEVALIDFILE" ] || {
|
[ -f "$TIMEVALIDFILE" ] || {
|
||||||
echo "ntpd says time is valid" >$TIMEVALIDFILE
|
echo "ntpd says time is valid" >$TIMEVALIDFILE
|
||||||
/etc/init.d/dnsmasq enabled && {
|
/etc/init.d/dnsmasq enabled && {
|
||||||
|
initscript=dnsmasq
|
||||||
. /lib/functions/procd.sh
|
. /lib/functions/procd.sh
|
||||||
procd_send_signal dnsmasq '*' INT
|
procd_send_signal dnsmasq '*' INT
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"user": "ntp",
|
|
||||||
"access": {
|
|
||||||
"service": {
|
|
||||||
"methods": [ "signal" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue