aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/commandline.c41
-rw-r--r--ui/dissect_opts.c45
-rw-r--r--ui/dissect_opts.h2
3 files changed, 51 insertions, 37 deletions
diff --git a/ui/commandline.c b/ui/commandline.c
index 85f8375442..e12d9fe3d4 100644
--- a/ui/commandline.c
+++ b/ui/commandline.c
@@ -43,7 +43,6 @@
#include <wsutil/filesystem.h>
#include <epan/ex-opt.h>
-#include <epan/addr_resolv.h>
#include <epan/packet.h>
#include <epan/proto.h>
#include <epan/prefs.h>
@@ -57,11 +56,6 @@
#include "recent.h"
#include "decode_as_utils.h"
-#if defined(HAVE_HEIMDAL_KERBEROS) || defined(HAVE_MIT_KERBEROS)
-#include <epan/asn1.h>
-#include <epan/dissectors/packet-kerberos.h>
-#endif
-
#include "../file.h"
#include "ui/dissect_opts.h"
@@ -195,7 +189,7 @@ commandline_print_usage(gboolean for_help_option) {
*/
#define LONGOPT_FULL_SCREEN 65536
-#define OPTSTRING OPTSTRING_CAPTURE_COMMON OPTSTRING_DISSECT_COMMON "C:g:Hh" "jJ:kK:lm:nN:o:P:r:R:Su:vw:X:Y:z:"
+#define OPTSTRING OPTSTRING_CAPTURE_COMMON OPTSTRING_DISSECT_COMMON "C:g:Hh" "jJ:klm:o:P:r:R:Svw:X:Y:z:"
static const struct option long_options[] = {
{"help", no_argument, NULL, 'h'},
{"read-file", required_argument, NULL, 'r' },
@@ -357,7 +351,6 @@ void commandline_other_options(int argc, char *argv[], gboolean opt_reset)
#else
gboolean capture_option_specified;
#endif
- char badopt;
/*
* To reset the options parser, set optreset to 1 on platforms that
@@ -445,12 +438,6 @@ void commandline_other_options(int argc, char *argv[], gboolean opt_reset)
#endif
break;
-#if defined(HAVE_HEIMDAL_KERBEROS) || defined(HAVE_MIT_KERBEROS)
- case 'K': /* Kerberos keytab file */
- read_keytab_file(optarg);
- break;
-#endif
-
/*** all non capture option specific ***/
case 'C':
/* Configuration profile settings were already processed just ignore them this time*/
@@ -480,17 +467,6 @@ void commandline_other_options(int argc, char *argv[], gboolean opt_reset)
arg_error = TRUE;
#endif
break;
- case 'n': /* No name resolution */
- disable_name_resolution();
- break;
- case 'N': /* Select what types of addresses/port #s to resolve */
- badopt = string_to_name_resolve(optarg, &gbl_resolv_flags);
- if (badopt != '\0') {
- cmdarg_err("-N specifies unknown resolving option '%c'; valid options are 'd', m', 'n', 'N', and 't'",
- badopt);
- exit(1);
- }
- break;
case 'o': /* Override preference from command line */
switch (prefs_set_pref(optarg)) {
case PREFS_SET_OK:
@@ -540,17 +516,6 @@ void commandline_other_options(int argc, char *argv[], gboolean opt_reset)
case 'R': /* Read file filter */
global_commandline_info.rfilter = optarg;
break;
- case 'u': /* Seconds type */
- if (strcmp(optarg, "s") == 0)
- timestamp_set_seconds_type(TS_SECONDS_DEFAULT);
- else if (strcmp(optarg, "hms") == 0)
- timestamp_set_seconds_type(TS_SECONDS_HOUR_MIN_SEC);
- else {
- cmdarg_err("Invalid seconds type \"%s\"", optarg);
- cmdarg_err_cont("It must be \"s\" for seconds or \"hms\" for hours, minutes and seconds.");
- exit(1);
- }
- break;
case 'X':
/* ext ops were already processed just ignore them this time*/
break;
@@ -576,7 +541,11 @@ void commandline_other_options(int argc, char *argv[], gboolean opt_reset)
}
break;
case 'd': /* Decode as rule */
+ case 'K': /* Kerberos keytab file */
+ case 'n': /* No name resolution */
+ case 'N': /* Select what types of addresses/port #s to resolve */
case 't': /* time stamp type */
+ case 'u': /* Seconds type */
case LONGOPT_DISABLE_PROTOCOL: /* disable dissection of protocol */
case LONGOPT_ENABLE_HEURISTIC: /* enable heuristic dissection of protocol */
case LONGOPT_DISABLE_HEURISTIC: /* disable heuristic dissection of protocol */
diff --git a/ui/dissect_opts.c b/ui/dissect_opts.c
index 471f0467fd..267b363669 100644
--- a/ui/dissect_opts.c
+++ b/ui/dissect_opts.c
@@ -31,10 +31,16 @@
#include <glib.h>
+#include <epan/prefs.h>
#include <epan/timestamp.h>
+#include <epan/addr_resolv.h>
#include "ui/decode_as_utils.h"
+#if defined(HAVE_HEIMDAL_KERBEROS) || defined(HAVE_MIT_KERBEROS)
+#include <epan/dissectors/read_keytab_file.h>
+#endif
+
#include <wsutil/clopts_common.h>
#include <wsutil/cmdarg_err.h>
#include <wsutil/file_util.h>
@@ -55,11 +61,38 @@ dissect_opts_init(void)
gboolean
dissect_opts_handle_opt(int opt, char *optarg_str_p)
{
+ char badopt;
+
switch(opt) {
case 'd': /* Decode as rule */
if (!decode_as_command_option(optarg_str_p))
return FALSE;
break;
+ case 'K': /* Kerberos keytab file */
+#if defined(HAVE_HEIMDAL_KERBEROS) || defined(HAVE_MIT_KERBEROS)
+ read_keytab_file(optarg_str_p);
+#else
+ cmdarg_err("-K specified, but Kerberos keytab file support isn't present");
+ return FALSE;
+#endif
+ break;
+ case 'n': /* No name resolution */
+ disable_name_resolution();
+ break;
+ case 'N': /* Select what types of addresses/port #s to resolve */
+ badopt = string_to_name_resolve(optarg_str_p, &gbl_resolv_flags);
+ if (badopt != '\0') {
+ cmdarg_err("-N specifies unknown resolving option '%c'; valid options are:",
+ badopt);
+ cmdarg_err_cont("\t'd' to enable address resolution from captured DNS packets\n"
+ "\t'm' to enable MAC address resolution\n"
+ "\t'n' to enable network address resolution\n"
+ "\t'N' to enable using external resolvers (e.g., DNS)\n"
+ "\t for network address resolution\n"
+ "\t't' to enable transport-layer port number resolution");
+ return FALSE;
+ }
+ break;
case 't': /* Time stamp type */
if (strcmp(optarg_str_p, "r") == 0)
global_dissect_options.time_format = TS_RELATIVE;
@@ -96,6 +129,18 @@ dissect_opts_handle_opt(int opt, char *optarg_str_p)
return FALSE;
}
break;
+ case 'u': /* Seconds type */
+ if (strcmp(optarg_str_p, "s") == 0)
+ timestamp_set_seconds_type(TS_SECONDS_DEFAULT);
+ else if (strcmp(optarg_str_p, "hms") == 0)
+ timestamp_set_seconds_type(TS_SECONDS_HOUR_MIN_SEC);
+ else {
+ cmdarg_err("Invalid seconds type \"%s\"; it must be one of:", optarg_str_p);
+ cmdarg_err_cont("\t\"s\" for seconds\n"
+ "\t\"hms\" for hours, minutes and seconds");
+ return FALSE;
+ }
+ break;
case LONGOPT_DISABLE_PROTOCOL: /* disable dissection of protocol */
global_dissect_options.disable_protocol_slist = g_slist_append(global_dissect_options.disable_protocol_slist, optarg_str_p);
break;
diff --git a/ui/dissect_opts.h b/ui/dissect_opts.h
index 629136e131..9dd06e1a40 100644
--- a/ui/dissect_opts.h
+++ b/ui/dissect_opts.h
@@ -66,7 +66,7 @@ extern "C" {
{"disable-heuristic", required_argument, NULL, LONGOPT_DISABLE_HEURISTIC }, \
#define OPTSTRING_DISSECT_COMMON \
- "d:t:"
+ "d:K:nN:t:u:"
/** Capture options coming from user interface */
typedef struct dissect_options_tag {