[PATCH 2/6] alfred: update stored interface list on interface change
Sven Eckelmann <[email protected]> Fri, 31 Jul 2026 13:44:51 +0200
| Newsgroups | org.open-mesh.lists.batman |
|---|---|
| Message-ID | <[email protected]> |
The interface list received via ALFRED_CHANGE_INTERFACE was passed to
netsock_set_interfaces() but globals->net_iface kept the value from the
daemon start. But the stale string is used by unix_sock_add_data() to
decide whether interface operations are disabled ('none'). And for the none
interface, it is required to be in primary mode and to prefill the
data->source address.
Store a copy of the new interface list in globals->net_iface to dynamically
switch between the disabled/not disabled mode.
Fixes: 94b3c4b5744f ("alfred: receive data with valid source on unix sock without active interface")
Signed-off-by: Sven Eckelmann <[email protected]>
---
unix_sock.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/unix_sock.c b/unix_sock.c
index e6b44da..64fde70 100644
--- a/unix_sock.c
+++ b/unix_sock.c
@@ -365,6 +365,7 @@ unix_sock_change_iface(struct globals *globals,
struct alfred_change_interface_v0 *change_iface,
int client_sock)
{
+ char *net_iface;
int ret = -1;
int len;
@@ -383,6 +384,13 @@ unix_sock_change_iface(struct globals *globals,
}
}
+ net_iface = strdup(change_iface->ifaces);
+ if (!net_iface)
+ goto err;
+
+ free(globals->net_iface);
+ globals->net_iface = net_iface;
+
netsock_set_interfaces(globals, change_iface->ifaces);
ret = 0;
--
2.47.3