aboutsummaryrefslogtreecommitdiffstats
path: root/capchild
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2018-12-27 11:34:09 -0500
committerAnders Broman <a.broman58@gmail.com>2018-12-29 08:16:01 +0000
commit785621dcca96d3e735c4a6dc2da31c44238e1eb9 (patch)
treedef08e8b30753bf281ce049582bfc4409e3095ed /capchild
parentd68a8a36054a26e520647a9402e9e405efd8cf3e (diff)
Add interface name when outputting packets dropped.
Add interface name (colon delimited) to SP_DROPS ('D') message so when dropped packets are outputted, they include the interface name for clarity. Bug: 13498 Change-Id: I68cdde4f20a574580f089dc5096d815cde5d3357 Reviewed-on: https://code.wireshark.org/review/31218 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'capchild')
-rw-r--r--capchild/capture_sync.c27
-rw-r--r--capchild/capture_sync.h2
2 files changed, 19 insertions, 10 deletions
diff --git a/capchild/capture_sync.c b/capchild/capture_sync.c
index 6da5f63f4b..c3bd19cc5e 100644
--- a/capchild/capture_sync.c
+++ b/capchild/capture_sync.c
@@ -1703,21 +1703,30 @@ sync_pipe_input_cb(gint source, gpointer user_data)
/* (an error message doesn't mean we have to stop capturing) */
break;
case SP_BAD_FILTER: {
- char *ch=NULL;
- int indx=0;
+ const char *message=NULL;
+ guint32 indx = 0;
+ const gchar* end;
- ch = strtok(buffer, ":");
- if (ch) {
- indx = (int)strtol(ch, NULL, 10);
- ch = strtok(NULL, ":");
+ if (ws_strtou32(buffer, &end, &indx) && end[0] == ':') {
+ message = end + 1;
}
- capture_input_cfilter_error_message(cap_session, indx, ch);
+
+ capture_input_cfilter_error_message(cap_session, indx, (char*)message);
/* the capture child will close the sync_pipe, nothing to do for now */
break;
}
- case SP_DROPS:
- capture_input_drops(cap_session, (guint32)strtoul(buffer, NULL, 10));
+ case SP_DROPS: {
+ const char *name = NULL;
+ const gchar* end;
+ guint32 num = 0;
+
+ if (ws_strtou32(buffer, &end, &num) && end[0] == ':') {
+ name = end + 1;
+ }
+
+ capture_input_drops(cap_session, num, (char*)name);
break;
+ }
default:
g_assert_not_reached();
}
diff --git a/capchild/capture_sync.h b/capchild/capture_sync.h
index 2da20e4864..c0fdc1d72f 100644
--- a/capchild/capture_sync.h
+++ b/capchild/capture_sync.h
@@ -121,7 +121,7 @@ capture_input_new_packets(capture_session *cap_session, int to_read);
* Capture child told us how many dropped packets it counted.
*/
extern void
-capture_input_drops(capture_session *cap_session, guint32 dropped);
+capture_input_drops(capture_session *cap_session, guint32 dropped, char* interface_name);
/**
* Capture child told us that an error has occurred while starting the capture.