[PATCH 1/2] uhttpd: Reload config after uhttpd-mod-ubus was added

Hauke Mehrtens hauke at hauke-m.de
Sat Mar 20 12:32:27 GMT 2021


Without this change the config is only committed, but the uhttpd daemon
is not reloaded. This reload is needed to apply the config. Without the
reload of uhttpd, the ubus server is not available over http and returns
a Error 404.

This caused problems when installing luci on the snapshots and
accessing it without reloading uhttpd.

There is another bug in uhttpd that it does not discard the request data
when it returned a http error 404 for a post request and interpret it as
part of the next request on the same TCP connection.

Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 package/network/services/uhttpd/files/ubus.default | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/package/network/services/uhttpd/files/ubus.default b/package/network/services/uhttpd/files/ubus.default
index ca9e72a3150a..35724ba57e03 100644
--- a/package/network/services/uhttpd/files/ubus.default
+++ b/package/network/services/uhttpd/files/ubus.default
@@ -3,11 +3,13 @@
 if [ -z "$(uci -q get uhttpd.main.ubus_prefix)" ]; then
 	uci set uhttpd.main.ubus_prefix=/ubus
 	uci commit uhttpd
+	reload_config
 fi
 
 [ "$(uci -q get uhttpd.main.ubus_socket)" = "/var/run/ubus.sock" ] && {
 	uci set uhttpd.main.ubus_socket='/var/run/ubus/ubus.sock'
 	uci commit uhttpd
+	reload_config
 }
 
 exit 0
-- 
2.30.2




More information about the openwrt-devel mailing list