aboutsummaryrefslogtreecommitdiffstats
path: root/extcap.c
diff options
context:
space:
mode:
authorJohn Thacker <johnthacker@gmail.com>2023-12-12 06:09:14 -0500
committerJohn Thacker <johnthacker@gmail.com>2023-12-15 21:55:02 -0500
commit636f0a989a20fd155322004674fe788875c0a679 (patch)
tree778ea155d569cfa556219db4bf0131cc7b954420 /extcap.c
parentc655b8e103f84a9ae6d613b9304d64b92e03a62e (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.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/extcap.c b/extcap.c
index c6d8e9eb07..0e29b095a6 100644
--- a/extcap.c
+++ b/extcap.c
@@ -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);