From: David Bauer Date: Tue, 21 Sep 2021 16:51:57 +0000 (+0200) Subject: local-node: don't read pointer after clear X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=8c35c8e6a00d8d4fc5e78987e7aa61f93a110e89;p=project%2Fusteer.git local-node: don't read pointer after clear The name pointer provided by ubus get's cleared after the first call to ubus_register_subscriber in usteer_get_node. The leads to an incorrect ifindex returned by if_nametoindex due to the 0 characters long string. Work around this issue by reusing the interface name already stored in the local node struct. Fixes querying the wrong interface with netlink, resulting in incorrect SSIDs used for the nodes. Signed-off-by: David Bauer --- diff --git a/local_node.c b/local_node.c index 985b37b..8064bd7 100644 --- a/local_node.c +++ b/local_node.c @@ -447,7 +447,7 @@ usteer_register_node(struct ubus_context *ctx, const char *name, uint32_t id) ln = usteer_get_node(ctx, name); ln->obj_id = id; ln->iface = usteer_node_name(&ln->node) + offset; - ln->ifindex = if_nametoindex(iface); + ln->ifindex = if_nametoindex(ln->iface); blob_buf_init(&b, 0); blobmsg_add_u32(&b, "notify_response", 1);