#endif
}
-
+/*
+ * If no interface was specified explicitly, pick a default.
+ */
int
-capture_opts_trim_iface(capture_options *capture_opts, const char *capture_device)
+capture_opts_default_iface_if_necessary(capture_options *capture_opts,
+ const char *capture_device)
{
int status;
extern void
capture_opts_trim_ring_num_files(capture_options *capture_opts);
-/* trim the interface entry */
+/* pick default interface if none was specified */
extern int
-capture_opts_trim_iface(capture_options *capture_opts, const char *capture_device);
+capture_opts_default_iface_if_necessary(capture_options *capture_opts,
+ const char *capture_device);
extern void
collect_ifaces(capture_options *capture_opts);
* "-L", "-d", and capturing act on a particular interface, so we have to
* have an interface; if none was specified, pick a default.
*/
- status = capture_opts_trim_iface(&global_capture_opts, NULL);
+ status = capture_opts_default_iface_if_necessary(&global_capture_opts, NULL);
if (status != 0) {
/* cmdarg_err() already called .... */
exit_main(status);
}
} else {
/* No capture file specified, so we're supposed to do a live capture
- (or get a list of link-layer types for a live capture device);
+ or get a list of link-layer types for a live capture device;
do we have support for live captures? */
#ifdef HAVE_LIBPCAP
- /* trim the interface name and exit if that failed */
- exit_status = capture_opts_trim_iface(&global_capture_opts,
+ /* if no interface was specified, pick a default */
+ exit_status = capture_opts_default_iface_if_necessary(&global_capture_opts,
((prefs_p->capture_device) && (*prefs_p->capture_device != '\0')) ? get_if_name(prefs_p->capture_device) : NULL);
if (exit_status != 0)
return exit_status;
}
if (start_capture || list_link_layer_types) {
- /* Did the user specify an interface to use? */
- status = capture_opts_trim_iface(&global_capture_opts,
+ /* We're supposed to do a live capture or get a list of link-layer
+ types for a live capture device; if the user didn't specify an
+ interface to use, pick a default. */
+ status = capture_opts_default_iface_if_necessary(&global_capture_opts,
((prefs_p->capture_device) && (*prefs_p->capture_device != '\0')) ? get_if_name(prefs_p->capture_device) : NULL);
if (status != 0) {
exit(status);
// }
// if (start_capture || list_link_layer_types) {
-// /* Did the user specify an interface to use? */
-// status = capture_opts_trim_iface(&global_capture_opts,
+// /* We're supposed to do a live capture or get a list of link-layer
+// types for a live capture device; if the user didn't specify an
+// interface to use, pick a default. */
+// status = capture_opts_default_iface_if_necessary(&global_capture_opts,
// (prefs_p->capture_device) ? get_if_name(prefs_p->capture_device) : NULL);
// if (status != 0) {
// exit(status);