[PATCH v2 0/5] ubus: extend the service object with a restart method

Florian Eckert fe at dev.tdt.de
Thu Dec 17 04:35:32 EST 2020


This patchset adds the new method "restart" to the ubus service object.
This method is called on a service restart, if it is managed by procd.

I have noticed that during a firewall restart the mwan3 rules have all
disappeared and I have to restart my service as well. I did not expected
this. So that I don't have to do this extra step, an event should be
generated during a service restart, so other service could subscribe to
this event.

All services that want to react to this event can create a
callback script. The same applies to a config change.

As an example I used the firewall here, because I came across the
problem here. So if the firewall gets restart, then a event es
generated.

Full discussion hat taken place at this URL.
https://github.com/openwrt/packages/pull/13931

A pull request is already staged to use this new funcionality.
https://github.com/openwrt/packages/pull/14215

v2:
- As requested by John Chrispin, I wrapped the new
  `_procd_add_service_trigger` with the function
  `_procd_add_restart_service_trigger` to make it a one-liner to use this
  functionality.

Florian Eckert (5):
  procd: add restart ubus call
  base-files: add restart function wrapper
  firewall: fix whitespace
  firewall: use new restart_service callback
  procd: add api wrapper

 package/base-files/files/etc/rc.common        | 13 ++++
 .../config/firewall/files/firewall.init       |  4 +-
 package/system/procd/files/procd.sh           | 33 ++++++++++
 .../patches/0010-add-restart-event.patch      | 64 +++++++++++++++++++
 4 files changed, 112 insertions(+), 2 deletions(-)
 create mode 100644 package/system/procd/patches/0010-add-restart-event.patch

-- 
2.20.1




More information about the openwrt-devel mailing list