eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit f1dd6b1084530810f84d94acfe163d60fc17a156
parent fd1a267313d3c15974dcf456414b17e5a1cc7a98
Author: Tim Kourt <tim.a.kourt@linux.intel.com>
Date:   Wed, 17 Jul 2019 16:36:53 -0700

client: Fix network name completion after restart of iwd

Previously, on service disappeared event the list of the known
proxy objects was cleared, but pointers to the default entity
per command family wasn’t reset. Reset default entities for
the command families to remove the dead pointers to the deleted
proxy objects.

==1325== Invalid read of size 8
==1325==    at 0x4055D4: proxy_interface_is_same (dbus-proxy.c:439)
==1325==    by 0x407C28: match_by_partial_name (network.c:220)
==1325==    by 0x40547C: proxy_interface_find_all (dbus-proxy.c:424)
==1325==    by 0x405592: proxy_property_str_completion (dbus-proxy.c:153)
==1325==    by 0x407DA9: network_name_completion (network.c:241)
==1325==    by 0x4E596D5: rl_completion_matches (in /usr/lib64/libreadline.so.7.0)

Diffstat:
Mclient/command.c | 15+++++++++++++++
Mclient/command.h | 2++
Mclient/dbus-proxy.c | 2++
Mclient/device.c | 6++++++
4 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/client/command.c b/client/command.c @@ -555,6 +555,21 @@ int command_get_exit_status(void) return exit_status; } +void command_reset_default_entities(void) +{ + const struct l_queue_entry *entry; + + for (entry = l_queue_get_entries(command_families); entry; + entry = entry->next) { + struct command_family *family = entry->data; + + if (!family->reset_default_entity) + continue; + + family->reset_default_entity(); + } +} + void command_family_register(const struct command_family *family) { l_queue_push_tail(command_families, (void *) family); diff --git a/client/command.h b/client/command.h @@ -49,6 +49,7 @@ struct command_family { command_completion_func_t family_arg_completion; command_completion_func_t entity_arg_completion; void (*set_default_entity)(const char *entity); + void (*reset_default_entity)(void); }; bool command_line_find_token(const char *token, uint8_t num_to_inspect); @@ -62,6 +63,7 @@ void command_noninteractive_trigger(void); bool command_is_interactive_mode(void); int command_get_exit_status(void); void command_set_exit_status(int status); +void command_reset_default_entities(void); void command_family_register(const struct command_family *family); void command_family_unregister(const struct command_family *family); diff --git a/client/dbus-proxy.c b/client/dbus-proxy.c @@ -734,6 +734,8 @@ static void service_disappeared_callback(struct l_dbus *dbus, l_queue_clear(proxy_interfaces, proxy_interface_destroy); + command_reset_default_entities(); + display_disable_cmd_prompt(); } diff --git a/client/device.c b/client/device.c @@ -306,6 +306,11 @@ static void device_set_default(const char *device_name) l_queue_destroy(match, NULL); } +static void device_reset_default(void) +{ + default_device = NULL; +} + const struct proxy_interface *device_get_default(void) { struct l_queue *match; @@ -483,6 +488,7 @@ static struct command_family device_command_family = { .family_arg_completion = family_arg_completion, .entity_arg_completion = entity_arg_completion, .set_default_entity = device_set_default, + .reset_default_entity = device_reset_default, }; static int device_command_family_init(void)