diff options
| author | David Bauer | 2021-09-21 16:51:57 +0000 |
|---|---|---|
| committer | David Bauer | 2021-09-21 17:46:05 +0000 |
| commit | 8c35c8e6a00d8d4fc5e78987e7aa61f93a110e89 (patch) | |
| tree | 9ea8254cabfcc2c391400d7953c2c5a1f2b3b25b | |
| parent | e4ea2045ebaac63e663765b29178241932322406 (diff) | |
| download | usteer-8c35c8e6a00d8d4fc5e78987e7aa61f93a110e89.tar.gz | |
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>
| -rw-r--r-- | local_node.c | 2 |
1 files changed, 1 insertions, 1 deletions
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); |