aboutsummaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2004-03-12 17:23:56 +0000
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2004-03-12 17:23:56 +0000
commita544ec106bf2c583e2bd7e3143c46fb2bad6bd5d (patch)
tree3e313e781b0e8380832d3b362590daf5a1faca3e /util.c
parent22265aecebba1af5193254f8fb27da3b18dc4c21 (diff)
Don't automatically set a capture filter if DISPLAY or REMOTEHOST are
"localhost" or "127.0.0.1". git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@10365 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'util.c')
-rw-r--r--util.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/util.c b/util.c
index e4eb7c263d..45b15df886 100644
--- a/util.c
+++ b/util.c
@@ -1,7 +1,7 @@
/* util.c
* Utility routines
*
- * $Id: util.c,v 1.77 2004/02/07 04:25:16 guy Exp $
+ * $Id: util.c,v 1.78 2004/03/12 17:23:56 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -401,7 +401,7 @@ size_t base64_decode(char *s)
/* Try to figure out if we're remotely connected, e.g. via ssh or
Terminal Server, and create a capture filter that matches aspects of the
connection. We match the following environment variables:
-
+
SSH_CONNECTION (ssh): <remote IP> <remote port> <local IP> <local port>
SSH_CLIENT (ssh): <remote IP> <remote port> <local port>
REMOTEHOST (tcsh, others?): <remote name>
@@ -412,7 +412,7 @@ size_t base64_decode(char *s)
gchar *get_conn_cfilter(void) {
static GString *filter_str = NULL;
gchar *env, **tokens;
-
+
if (filter_str == NULL) {
filter_str = g_string_new("");
}
@@ -430,12 +430,19 @@ gchar *get_conn_cfilter(void) {
"and tcp port %s)", tokens[1], tokens[0], tokens[2]);
return filter_str->str;
} else if ((env = getenv("REMOTEHOST")) != NULL) {
+ if (strcasecmp(env, "localhost") == 0 || strcmp(env, "127.0.0.1") == 0) {
+ return "";
+ }
g_string_sprintf(filter_str, "not ip host %s", env);
return filter_str->str;
} else if ((env = getenv("DISPLAY")) != NULL) {
tokens = g_strsplit(env, ":", 2);
if (tokens[0] && tokens[0][0] != 0) {
- g_string_sprintf(filter_str, "not ip host %s",
+ if (strcasecmp(tokens[0], "localhost") == 0 ||
+ strcmp(tokens[0], "127.0.0.1") == 0) {
+ return "";
+ }
+ g_string_sprintf(filter_str, "not ip host %s",
tokens[0]);
return filter_str->str;
}
@@ -446,4 +453,4 @@ gchar *get_conn_cfilter(void) {
}
}
return "";
-}
+}