|
|
ce5013 |
From 8a60760db57f496c2f893486f245b40560653ccd Mon Sep 17 00:00:00 2001
|
|
|
8d0d63 |
From: rpm-build <rpm-build>
|
|
|
8d0d63 |
Date: Mon, 20 Feb 2017 11:01:19 +0100
|
|
|
ce5013 |
Subject: [PATCH 08/13] Change -P to -Q and print warning
|
|
|
8d0d63 |
|
|
|
8d0d63 |
Guy Harris points that -P is already taken by MacOS derived work and
|
|
|
8d0d63 |
that the only remaining single-letter option is -Q (see GH #252). Fix
|
|
|
8d0d63 |
some formatting while at it.
|
|
|
8d0d63 |
---
|
|
|
8d0d63 |
tcpdump.1.in | 4 ++--
|
|
|
8d0d63 |
tcpdump.c | 23 +++++++++++++----------
|
|
|
8d0d63 |
2 files changed, 15 insertions(+), 12 deletions(-)
|
|
|
8d0d63 |
|
|
|
8d0d63 |
diff --git a/tcpdump.1.in b/tcpdump.1.in
|
|
|
ce5013 |
index f233934..88b1266 100644
|
|
|
8d0d63 |
--- a/tcpdump.1.in
|
|
|
8d0d63 |
+++ b/tcpdump.1.in
|
|
|
8d0d63 |
@@ -74,7 +74,7 @@ tcpdump \- dump traffic on a network
|
|
|
8d0d63 |
.B \-\-number
|
|
|
8d0d63 |
]
|
|
|
8d0d63 |
[
|
|
|
8d0d63 |
-.B \-Q
|
|
|
8d0d63 |
+.B \-Q|\-P
|
|
|
8d0d63 |
.I in|out|inout
|
|
|
8d0d63 |
]
|
|
|
8d0d63 |
.ti +8
|
|
|
ce5013 |
@@ -583,7 +583,7 @@ Note that the interface might be in promiscuous
|
|
|
8d0d63 |
mode for some other reason; hence, `-p' cannot be used as an abbreviation for
|
|
|
8d0d63 |
`ether host {local-hw-addr} or ether broadcast'.
|
|
|
8d0d63 |
.TP
|
|
|
8d0d63 |
-.BI \-Q " direction"
|
|
|
8d0d63 |
+.BI \-Q|\-P " direction"
|
|
|
8d0d63 |
.PD 0
|
|
|
8d0d63 |
.TP
|
|
|
8d0d63 |
.BI \-\-direction= direction
|
|
|
8d0d63 |
diff --git a/tcpdump.c b/tcpdump.c
|
|
|
ce5013 |
index e4e0d89..d7b094b 100644
|
|
|
8d0d63 |
--- a/tcpdump.c
|
|
|
8d0d63 |
+++ b/tcpdump.c
|
|
|
8d0d63 |
@@ -157,7 +157,7 @@ static int Jflag; /* list available time stamp types */
|
|
|
8d0d63 |
static int jflag = -1; /* packet time stamp source */
|
|
|
8d0d63 |
static int pflag; /* don't go promiscuous */
|
|
|
8d0d63 |
#ifdef HAVE_PCAP_SETDIRECTION
|
|
|
8d0d63 |
-static int Qflag = -1; /* restrict captured packet by send/receive direction */
|
|
|
8d0d63 |
+static int PQflag = -1; /* restrict captured packet by send/receive direction */
|
|
|
8d0d63 |
#endif
|
|
|
8d0d63 |
static int Uflag; /* "unbuffered" output of dump files */
|
|
|
8d0d63 |
static int Wflag; /* recycle output files after this number of files */
|
|
|
ce5013 |
@@ -509,12 +509,12 @@ show_devices_and_exit (void)
|
|
|
8d0d63 |
#endif
|
|
|
8d0d63 |
|
|
|
8d0d63 |
#ifdef HAVE_PCAP_SETDIRECTION
|
|
|
8d0d63 |
-#define Q_FLAG "Q:"
|
|
|
8d0d63 |
+#define PQ_FLAG "P:Q:"
|
|
|
8d0d63 |
#else
|
|
|
8d0d63 |
-#define Q_FLAG
|
|
|
8d0d63 |
+#define PQ_FLAG
|
|
|
8d0d63 |
#endif
|
|
|
8d0d63 |
|
|
|
8d0d63 |
-#define SHORTOPTS "aAb" B_FLAG "c:C:d" D_FLAG "eE:fF:G:hHi:" I_FLAG j_FLAG J_FLAG "KlLm:M:nNOpq" Q_FLAG "r:s:StT:u" U_FLAG "vV:w:W:xXy:Yz:Z:#"
|
|
|
8d0d63 |
+#define SHORTOPTS "aAb" B_FLAG "c:C:d" D_FLAG "eE:fF:G:hHi:" I_FLAG j_FLAG J_FLAG "KlLm:M:nNOpq" PQ_FLAG "r:s:StT:u" U_FLAG "vV:w:W:xXy:Yz:Z:#"
|
|
|
8d0d63 |
|
|
|
8d0d63 |
/*
|
|
|
8d0d63 |
* Long options.
|
|
|
ce5013 |
@@ -1059,8 +1059,8 @@ open_interface(const char *device, netdissect_options *ndo, char *ebuf)
|
|
|
8d0d63 |
pcap_statustostr(status));
|
|
|
8d0d63 |
}
|
|
|
8d0d63 |
#ifdef HAVE_PCAP_SETDIRECTION
|
|
|
8d0d63 |
- if (Qflag != -1) {
|
|
|
8d0d63 |
- status = pcap_setdirection(pc, Qflag);
|
|
|
8d0d63 |
+ if (PQflag != -1) {
|
|
|
8d0d63 |
+ status = pcap_setdirection(pc, PQflag);
|
|
|
8d0d63 |
if (status != 0)
|
|
|
8d0d63 |
error("%s: pcap_setdirection() failed: %s",
|
|
|
8d0d63 |
device, pcap_geterr(pc));
|
|
|
ce5013 |
@@ -1343,13 +1343,16 @@ main(int argc, char **argv)
|
|
|
8d0d63 |
break;
|
|
|
8d0d63 |
|
|
|
8d0d63 |
#ifdef HAVE_PCAP_SETDIRECTION
|
|
|
8d0d63 |
+ case 'P':
|
|
|
8d0d63 |
+ fprintf(stderr, "Warning: -P switch is not compatible with the upstream version. You should use -Q instead.\n");
|
|
|
8d0d63 |
+ /* Intentional fall through */
|
|
|
8d0d63 |
case 'Q':
|
|
|
8d0d63 |
if (ascii_strcasecmp(optarg, "in") == 0)
|
|
|
8d0d63 |
- Qflag = PCAP_D_IN;
|
|
|
8d0d63 |
+ PQflag = PCAP_D_IN;
|
|
|
8d0d63 |
else if (ascii_strcasecmp(optarg, "out") == 0)
|
|
|
8d0d63 |
- Qflag = PCAP_D_OUT;
|
|
|
8d0d63 |
+ PQflag = PCAP_D_OUT;
|
|
|
8d0d63 |
else if (ascii_strcasecmp(optarg, "inout") == 0)
|
|
|
8d0d63 |
- Qflag = PCAP_D_INOUT;
|
|
|
8d0d63 |
+ PQflag = PCAP_D_INOUT;
|
|
|
8d0d63 |
else
|
|
|
8d0d63 |
error("unknown capture direction `%s'", optarg);
|
|
|
8d0d63 |
break;
|
|
|
ce5013 |
@@ -2613,7 +2616,7 @@ print_usage(void)
|
|
|
8d0d63 |
"\t\t[ -i interface ]" j_FLAG_USAGE " [ -M secret ] [ --number ]\n");
|
|
|
8d0d63 |
#ifdef HAVE_PCAP_SETDIRECTION
|
|
|
8d0d63 |
(void)fprintf(stderr,
|
|
|
8d0d63 |
-"\t\t[ -Q in|out|inout ]\n");
|
|
|
8d0d63 |
+"\t\t[ -Q|-P in|out|inout ]\n");
|
|
|
8d0d63 |
#endif
|
|
|
8d0d63 |
(void)fprintf(stderr,
|
|
|
8d0d63 |
"\t\t[ -r file ] [ -s snaplen ] ");
|
|
|
8d0d63 |
--
|
|
|
ce5013 |
2.13.5
|
|
|
8d0d63 |
|