nixos/zigbee2mqtt: allow using mDNS for adapters

Without this option, the 'mdns://' functionality for zigbee2mqtt
does not work at all and fails with the following error message:

- SystemError: A system error occurred: uv_interface_addresses returned Unknown system error 97 (Unknown system error 97)

Locally I've solved this with an override in my NixOS configuration,
and then it seems to work fine.

Just using tcp:// addresses was working fine, but using mDNS discovery
makes the configuration a bit more flexible. With network changes I
don't need to change this anymore.

Reading the SystemError, the uv_interfaces_addresses call seems to fail.
System error 97 translates to EAFNOSUPPORT, meaning 'Address Family not
supported'. This points towards some address family not being supported
and/or allowed.

libuv seems to be calling getifaddrs, which is likely the reason that an
AF_NETLINK socket is required here.
See also https://github.com/libuv/libuv/blob/d7dda9edfec189f9087d13f970525188db06464d/src/unix/linux.c#L1967

Concluding; mDNS sockets require interface enumeration, requiring
getifaddrs to be called. getifaddrs requires an AF_NETLINK socket.
This commit is contained in:
Rick van Schijndel
2025-12-05 22:42:58 +01:00
parent 38560a0624
commit 0879e5e23f
@@ -114,6 +114,7 @@ in
RestrictAddressFamilies = [
"AF_INET"
"AF_INET6"
"AF_NETLINK"
];
RestrictNamespaces = true;
RestrictRealtime = true;