Addition of new services to OpenWrt

My intention is to add new option to WebUI and run a newly added services on openWRT.

I am trying to figure out how the calls from the Web UI are propagated to the system via UCI commands through the UBUS and back to the Web UI. Any insights would be highly appreciated and it will help me get stated

I was trying to figure out the flow using the DNS options by selecting the option and then trying to trace the call. Understood that /etc/config/dhcp gets updated with the new value. It also gets updated in the /var/etc/dnsmasq.conf.cfg01411c .

I am facing issues in understanding who is issuing the trigger to save the new values in the DNS service configuration file [ /var/etc/dnsmasq.conf.cfg01411c ].

Reason i ask this is - I have tried to set the same using UCI set command followed by UCI commit. When I do it manually, new value gets updated in the /etc/config/dhcp , but not in the /var/etc/dnsmasq.conf.cfg01411c

Hence, i would like to understand the complete flow of events when any options is set from web UI and data flow back to the webUI. once I get this flow, I will go ahead to add my custom services in the same fashion as that of OpenWRT using UCI & Ubus.

https://openwrt.org/docs/guide-developer/rpcd

  • Did you commit the config?
  • Did you restart dnsmasq by /etc/init.d/dnsmasq restart

uci commit on the cli will not trigger service reloads, you'll have to manually call /sbin/reload_config afterwards.

LuCI uses the ubus uci namespace (ubus call uci commit ...) which will emit change events for any committed /etc/config/xxx file which are then in turn processed by services having a reload trigger installed (grep -r procd_add_reload_trigger /etc/init.d/)

2 Likes

Yes. I did and also restarted the dnsmasq service as well..

That was helpful. Also looked into the dependent scripts in the/etc/config/ucitrack.

Right, the /etc/config/ucitrack is a legacy/transitional mechanism that predates procd. Nowaday its a simple shim that installs service stubs in procd to setup reload dependencies.

Normal procd enabled init scripts do not need the ucitrack mechanism at all anymore.