diff options
author | John Thacker <johnthacker@gmail.com> | 2023-12-12 06:09:14 -0500 |
---|---|---|
committer | John Thacker <johnthacker@gmail.com> | 2023-12-15 21:55:02 -0500 |
commit | 636f0a989a20fd155322004674fe788875c0a679 (patch) | |
tree | 778ea155d569cfa556219db4bf0131cc7b954420 /extcap.c | |
parent | c655b8e103f84a9ae6d613b9304d64b92e03a62e (diff) |
capture: Add return messages to the if_capabilities_t struct
Add the return messages to the if_capabilities_t struct. We
are already serializing them in the JSON. This is necessary
if we want to query the capabilities of multiple interfaces
at once and determine which interfaces had failures and what
each reason was.
Keep the behavior of capture_get_if_capabilities, which
retrieves a single interface, the same; it still returns NULL
on failure and the messages separately.
Related to #15082
Diffstat (limited to 'extcap.c')
-rw-r--r-- | extcap.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -543,7 +543,7 @@ static gboolean cb_dlt(extcap_callback_info_t cb_info) /* * Allocate the interface capabilities structure. */ - caps = (if_capabilities_t *) g_malloc(sizeof * caps); + caps = (if_capabilities_t *) g_malloc0(sizeof * caps); caps->can_set_rfmon = FALSE; caps->timestamp_types = NULL; @@ -569,17 +569,17 @@ static gboolean cb_dlt(extcap_callback_info_t cb_info) if (linktype_list != NULL && cb_info.data != NULL) { caps->data_link_types = linktype_list; - *(if_capabilities_t **) cb_info.data = caps; } else { + caps->primary_msg = g_strdup("Extcap returned no DLTs"); if (cb_info.err_str) { ws_debug(" returned no DLTs"); - *(cb_info.err_str) = g_strdup("Extcap returned no DLTs"); + *(cb_info.err_str) = g_strdup(caps->primary_msg); } - g_free(caps); } + *(if_capabilities_t **) cb_info.data = caps; extcap_free_dlts(temp); |