aboutsummaryrefslogtreecommitdiffstats
path: root/text2pcap.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-04-13 18:36:24 +0000
committerGuy Harris <guy@alum.mit.edu>2002-04-13 18:36:24 +0000
commitc3b66ffa9c91b61fc8c2593c4552c1f6377bde0e (patch)
tree90b08bf26b370299bc2cb9ff54dae13529d40c91 /text2pcap.c
parent4fc2cbb88841d6b1a9801365a905b42a8c91b7a3 (diff)
From Michael Tuexen:
The -S option has been changed such that the payload protocol identifier can be specified instead of the verification tag. The error messages for -s -S have been corrected. Update the text2pcap man page to reflect the "-S" change. svn path=/trunk/; revision=5150
Diffstat (limited to 'text2pcap.c')
-rw-r--r--text2pcap.c52
1 files changed, 44 insertions, 8 deletions
diff --git a/text2pcap.c b/text2pcap.c
index 92f7fcf540..a09f8d1caa 100644
--- a/text2pcap.c
+++ b/text2pcap.c
@@ -6,7 +6,7 @@
*
* (c) Copyright 2001 Ashok Narayanan <ashokn@cisco.com>
*
- * $Id: text2pcap.c,v 1.14 2002/01/30 10:19:43 guy Exp $
+ * $Id: text2pcap.c,v 1.15 2002/04/13 18:36:23 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -941,7 +941,9 @@ help (char *progname)
" verification tag (in DECIMAL).\n"
" Automatically prepends Ethernet and IP headers as well\n"
" Example: -s 30,40,34\n"
- " -S srcp,dstp,tag: Same as -s srcp,dstp,tag but also prepends a DATA chunk header.\n"
+ " -S srcp,dstp,ppi: Prepend dummy SCTP header with specified dest/source ports and\n"
+ " verification tag 0. It also prepends a dummy SCTP DATA chunk header\n"
+ " with payload protocol identifier ppi.\n"
" Example: -S 30,40,34\n"
" -t timefmt : Treats the text before the packet as a date/time code; the\n"
" specified argument is a format string of the sort supported\n"
@@ -999,11 +1001,9 @@ parse_options (int argc, char *argv[])
hdr_ethernet_proto = 0x800;
break;
- case 'S':
- hdr_data_chunk = TRUE;
case 's':
- hdr_sctp = TRUE;
- hdr_sctp_src = strtol(optarg, &p, 10);
+ hdr_sctp = TRUE;
+ hdr_sctp_src = strtol(optarg, &p, 10);
if (p == optarg || (*p != ',' && *p != '\0')) {
fprintf(stderr, "Bad src port for '-%c'\n", c);
help(argv[0]);
@@ -1018,8 +1018,9 @@ parse_options (int argc, char *argv[])
if (p == optarg || (*p != ',' && *p != '\0')) {
fprintf(stderr, "Bad dest port for '-s'\n");
help(argv[0]);
- } if (*p == '\0') {
- fprintf(stderr, "No dest port specified for '-%c'\n", c);
+ }
+ if (*p == '\0') {
+ fprintf(stderr, "No tag specified for '-%c'\n", c);
help(argv[0]);
}
p++;
@@ -1035,6 +1036,41 @@ parse_options (int argc, char *argv[])
hdr_ethernet = TRUE;
hdr_ethernet_proto = 0x800;
break;
+ case 'S':
+ hdr_sctp = TRUE;
+ hdr_data_chunk = TRUE;
+ hdr_sctp_src = strtol(optarg, &p, 10);
+ if (p == optarg || (*p != ',' && *p != '\0')) {
+ fprintf(stderr, "Bad src port for '-%c'\n", c);
+ help(argv[0]);
+ }
+ if (*p == '\0') {
+ fprintf(stderr, "No dest port specified for '-%c'\n", c);
+ help(argv[0]);
+ }
+ p++;
+ optarg = p;
+ hdr_sctp_dest = strtol(optarg, &p, 10);
+ if (p == optarg || (*p != ',' && *p != '\0')) {
+ fprintf(stderr, "Bad dest port for '-s'\n");
+ help(argv[0]);
+ } if (*p == '\0') {
+ fprintf(stderr, "No ppi specified for '-%c'\n", c);
+ help(argv[0]);
+ }
+ p++;
+ optarg = p;
+ hdr_data_chunk_ppid = strtol(optarg, &p, 10);
+ if (p == optarg || *p != '\0') {
+ fprintf(stderr, "Bad ppi for '-%c'\n", c);
+ help(argv[0]);
+ }
+
+ hdr_ip = TRUE;
+ hdr_ip_proto = 132;
+ hdr_ethernet = TRUE;
+ hdr_ethernet_proto = 0x800;
+ break;
case 't':
ts_fmt = optarg;