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 <mail@david-bauer.net>
This commit is contained in:
@@ -447,7 +447,7 @@ usteer_register_node(struct ubus_context *ctx, const char *name, uint32_t id)
|
|||||||
ln = usteer_get_node(ctx, name);
|
ln = usteer_get_node(ctx, name);
|
||||||
ln->obj_id = id;
|
ln->obj_id = id;
|
||||||
ln->iface = usteer_node_name(&ln->node) + offset;
|
ln->iface = usteer_node_name(&ln->node) + offset;
|
||||||
ln->ifindex = if_nametoindex(iface);
|
ln->ifindex = if_nametoindex(ln->iface);
|
||||||
|
|
||||||
blob_buf_init(&b, 0);
|
blob_buf_init(&b, 0);
|
||||||
blobmsg_add_u32(&b, "notify_response", 1);
|
blobmsg_add_u32(&b, "notify_response", 1);
|
||||||
|
Reference in New Issue
Block a user