dnsmasq: mark global ubus context as closed after fork
authorSven Eckelmann <sven@narfation.org>
Sat, 18 Nov 2023 15:29:09 +0000 (16:29 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 26 Nov 2023 18:58:35 +0000 (19:58 +0100)
If the dnsmasq process forks to handle TCP connections, it closes the ubus
context. But instead of changing the daemon wide pointer to NULL, only the
local variable was adjusted - and this portion of the code was even dropped
(dead store) by some optimizing compilers.

It makes more sense to change the daemon->ubus pointer because various
functions are already checking it for NULL. It is also the behavior which
ubus_destroy() implements.

Fixes: d8b33dad0bb7 ("dnsmasq: add support for monitoring and modifying dns lookup results via ubus")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
package/network/services/dnsmasq/patches/200-ubus_dns.patch

index 8a70bb8bdf19bbbb68bd5c1a40a5faa50ccae732..ccbe70ab9c3cef7fb527e5662668db9d1f6e2821 100644 (file)
 +    return;
 +
 +  ubus_free(ubus);
-+  ubus = NULL;
++  daemon->ubus = NULL;
 +}
 +
  static int ubus_handle_metrics(struct ubus_context *ctx, struct ubus_object *obj,