From 25dfa20780085ec3851470fea76833e0c023e70c Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Tue, 28 Jul 2020 19:23:12 +0300 Subject: [PATCH] nlbwmon: add hotplug script to reload after interface ifup Add a hotplug script to reload nlbwmon's config after interface ifup actions. That should improve the detection of the IPv6 LAN address that can get enabled a bit later in the boot process. Signed-off-by: Hannu Nyman --- net/nlbwmon/Makefile | 6 ++++-- net/nlbwmon/files/nlbwmon.hotplug | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 net/nlbwmon/files/nlbwmon.hotplug diff --git a/net/nlbwmon/Makefile b/net/nlbwmon/Makefile index 6c5606344a..9e3a8ba75e 100644 --- a/net/nlbwmon/Makefile +++ b/net/nlbwmon/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nlbwmon -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/jow-/nlbwmon.git @@ -25,7 +25,7 @@ define Package/nlbwmon SECTION:=net CATEGORY:=Network DEPENDS:=+libubox +libnl-tiny +zlib +kmod-nf-conntrack-netlink - TITLE:=LEDE Traffic Usage Monitor + TITLE:=OpenWrt Traffic Usage Monitor endef define Package/nlbwmon/install @@ -38,6 +38,8 @@ define Package/nlbwmon/install $(INSTALL_BIN) ./files/nlbwmon.init $(1)/etc/init.d/nlbwmon $(INSTALL_DIR) $(1)/etc/config $(INSTALL_CONF) ./files/nlbwmon.config $(1)/etc/config/nlbwmon + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_BIN) ./files/nlbwmon.hotplug $(1)/etc/hotplug.d/iface/30-nlbwmon endef define Package/nlbwmon/conffiles diff --git a/net/nlbwmon/files/nlbwmon.hotplug b/net/nlbwmon/files/nlbwmon.hotplug new file mode 100644 index 0000000000..bd486820fa --- /dev/null +++ b/net/nlbwmon/files/nlbwmon.hotplug @@ -0,0 +1,9 @@ +#!/bin/sh + +[ -n "$DEVICE" ] || exit 0 + +[ "$ACTION" = ifup ] && /etc/init.d/nlbwmon enabled && { + /etc/init.d/nlbwmon reload + logger -t nlbwmon "Reloading nlbwmon due to $ACTION of $INTERFACE ($DEVICE)" +} +