Message ID | 20210320123228.3697143-1-hauke@hauke-m.de |
---|---|
State | Superseded |
Delegated to: | Hauke Mehrtens |
Headers | show |
Series | [1/2] uhttpd: Reload config after uhttpd-mod-ubus was added | expand |
On 3/20/21 1:32 PM, Hauke Mehrtens wrote: > 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@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 > I will also increase the PKG_RELEASE. Hauke
Hi Hauke, thanks for looking into it! I have a couple of remarks... > [...] > [ "$(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 That might reload other, unrelated changes. It likely isn't that much of a problem in practise for most users but could interfere with other provisioning setups or custom logic. I think it is better if we simply perform a selective /etc/init.d/uhttpd reload call here. > } > > exit 0 >
On 3/20/21 2:05 PM, Jo-Philipp Wich wrote: > Hi Hauke, > > thanks for looking into it! > > I have a couple of remarks... > >> [...] >> [ "$(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 > > That might reload other, unrelated changes. It likely isn't that much of > a problem in practise for most users but could interfere with other > provisioning setups or custom logic. > > I think it is better if we simply perform a selective /etc/init.d/uhttpd > reload call here. thanks for the hint, I updated the code. Hauke
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
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@hauke-m.de> --- package/network/services/uhttpd/files/ubus.default | 2 ++ 1 file changed, 2 insertions(+)