forked from osmocom/wireshark
Correctly implement what was my intent when removing the HAVE_LIBPCAP
stuff - arrange that the interface summary list is set, if we've read a capture file that has interface information, *regardless* of whether we have libpcap/WinPcap or not. That means that summary_fill_in() should fill in the interface information for the summary if there's interface information from the capture file, and summary_fill_in_capture() - which is called only if HAVE_LIBPCAP is defined, and can exist only if HAVE_LIBPCAP is defined (as it takes an argument of a type that's defined only if HAVE_LIBPCAP is defined) - just fills in interface information from the capture options and does so only if there's none from the file. svn path=/trunk/; revision=42873
This commit is contained in:
parent
e954e00926
commit
88fb10b8a3
71
summary.c
71
summary.c
|
@ -107,10 +107,14 @@ tally_frame_data(frame_data *cur_frame, summary_tally *sum_tally)
|
|||
void
|
||||
summary_fill_in(capture_file *cf, summary_tally *st)
|
||||
{
|
||||
|
||||
frame_data *first_frame, *cur_frame;
|
||||
guint32 framenum;
|
||||
wtapng_section_t* shb_inf;
|
||||
iface_options iface;
|
||||
guint i;
|
||||
wtapng_iface_descriptions_t* idb_info;
|
||||
wtapng_if_descr_t wtapng_if_descr;
|
||||
wtapng_if_stats_t *if_stats;
|
||||
|
||||
st->packet_count_ts = 0;
|
||||
st->start_time = 0;
|
||||
|
@ -170,43 +174,6 @@ summary_fill_in(capture_file *cf, summary_tally *st)
|
|||
}
|
||||
|
||||
st->ifaces = g_array_new(FALSE, FALSE, sizeof(iface_options));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
summary_fill_in_capture(capture_file *cf,capture_options *capture_opts, summary_tally *st)
|
||||
{
|
||||
iface_options iface;
|
||||
interface_t device;
|
||||
guint i;
|
||||
wtapng_iface_descriptions_t* idb_info;
|
||||
wtapng_if_descr_t wtapng_if_descr;
|
||||
wtapng_if_stats_t *if_stats;
|
||||
|
||||
while (st->ifaces->len > 0) {
|
||||
iface = g_array_index(st->ifaces, iface_options, 0);
|
||||
st->ifaces = g_array_remove_index(st->ifaces, 0);
|
||||
g_free(iface.name);
|
||||
g_free(iface.descr);
|
||||
g_free(iface.cfilter);
|
||||
}
|
||||
if (st->is_tempfile) {
|
||||
for (i = 0; i < capture_opts->all_ifaces->len; i++) {
|
||||
device = g_array_index(capture_opts->all_ifaces, interface_t, i);
|
||||
if (!device.selected) {
|
||||
continue;
|
||||
}
|
||||
iface.cfilter = g_strdup(device.cfilter);
|
||||
iface.name = g_strdup(device.name);
|
||||
iface.descr = g_strdup(device.display_name);
|
||||
iface.drops_known = cf->drops_known;
|
||||
iface.drops = cf->drops;
|
||||
iface.has_snap = device.has_snaplen;
|
||||
iface.snap = device.snaplen;
|
||||
iface.encap_type = wtap_pcap_encap_to_wtap_encap(device.active_dlt);
|
||||
g_array_append_val(st->ifaces, iface);
|
||||
}
|
||||
} else {
|
||||
idb_info = wtap_file_get_idb_info(cf->wth);
|
||||
for (i = 0; i < idb_info->number_of_interfaces; i++) {
|
||||
wtapng_if_descr = g_array_index(idb_info->interface_data, wtapng_if_descr_t, i);
|
||||
|
@ -228,5 +195,33 @@ summary_fill_in_capture(capture_file *cf,capture_options *capture_opts, summary_
|
|||
g_array_append_val(st->ifaces, iface);
|
||||
}
|
||||
g_free(idb_info);
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_LIBPCAP
|
||||
void
|
||||
summary_fill_in_capture(capture_file *cf,capture_options *capture_opts, summary_tally *st)
|
||||
{
|
||||
iface_options iface;
|
||||
interface_t device;
|
||||
guint i;
|
||||
|
||||
if (st->ifaces->len == 0) {
|
||||
for (i = 0; i < capture_opts->all_ifaces->len; i++) {
|
||||
device = g_array_index(capture_opts->all_ifaces, interface_t, i);
|
||||
if (!device.selected) {
|
||||
continue;
|
||||
}
|
||||
iface.cfilter = g_strdup(device.cfilter);
|
||||
iface.name = g_strdup(device.name);
|
||||
iface.descr = g_strdup(device.display_name);
|
||||
iface.drops_known = cf->drops_known;
|
||||
iface.drops = cf->drops;
|
||||
iface.has_snap = device.has_snaplen;
|
||||
iface.snap = device.snaplen;
|
||||
iface.encap_type = wtap_pcap_encap_to_wtap_encap(device.active_dlt);
|
||||
g_array_append_val(st->ifaces, iface);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue