From 830ba03c8a52c5a158e94cba463a3ccaf0e6b62f Mon Sep 17 00:00:00 2001 From: Vadim Kochan Date: Tue, 27 Oct 2015 02:00:48 +0200 Subject: flowtop: Add command-line option to disable hostname lookup Add option -n,--no-dns which allows to disable hostname lookup. Signed-off-by: Vadim Kochan [tk: Minor wording tweaks] Signed-off-by: Tobias Klauser --- flowtop.8 | 4 ++++ flowtop.c | 28 ++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/flowtop.8 b/flowtop.8 index faa1da1..7259e1d 100644 --- a/flowtop.8 +++ b/flowtop.8 @@ -103,6 +103,10 @@ Display ICMP version 4 and version 6 flows. .SS -S, --sctp Display SCTP flows. .PP +.SS -n, --no-dns +Don't perform hostname lookup. Only numeric addresses will be shown for flow +endpoints. +.PP .SS -s, --show-src Also show source information of the flow, not only destination information. .PP diff --git a/flowtop.c b/flowtop.c index 9eda68c..d27f752 100644 --- a/flowtop.c +++ b/flowtop.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "die.h" #include "xmalloc.h" @@ -110,8 +111,9 @@ static struct flow_list flow_list; static struct sysctl_params_ctx sysctl = { -1, -1 }; static unsigned int interval = 1; +static bool resolve_dns = true; -static const char *short_options = "vhTUsDIS46ut:"; +static const char *short_options = "vhTUsDIS46ut:n"; static const struct option long_options[] = { {"ipv4", no_argument, NULL, '4'}, {"ipv6", no_argument, NULL, '6'}, @@ -120,6 +122,7 @@ static const struct option long_options[] = { {"dccp", no_argument, NULL, 'D'}, {"icmp", no_argument, NULL, 'I'}, {"sctp", no_argument, NULL, 'S'}, + {"no-dns", no_argument, NULL, 'n'}, {"show-src", no_argument, NULL, 's'}, {"update", no_argument, NULL, 'u'}, {"interval", required_argument, NULL, 't'}, @@ -253,6 +256,7 @@ static void help(void) " -D|--dccp Show only DCCP flows\n" " -I|--icmp Show only ICMP/ICMPv6 flows\n" " -S|--sctp Show only SCTP flows\n" + " -n|--no-dns Don't perform hostname lookup\n" " -s|--show-src Also show source, not only dest\n" " -u|--update Update GeoIP databases\n" " -t|--interval