Skip to content

Commit

Permalink
add -F/fixchecksums to fix IP, TCP & UDP checksums
Browse files Browse the repository at this point in the history
  • Loading branch information
synfinatic committed May 8, 2003
1 parent 5988b45 commit 8c9daf9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
7 changes: 6 additions & 1 deletion man/tcpreplay.8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.\" $Id: tcpreplay.8,v 1.4 2003/05/07 22:32:35 aturner Exp $
.\" $Id: tcpreplay.8,v 1.5 2003/05/08 03:30:52 aturner Exp $
.TH TCPREPLAY 8
.SH NAME
tcpreplay \- replay packets from capture files
Expand All @@ -14,6 +14,8 @@ tcpreplay \- replay packets from capture files
.B \-f
.I config file
] [
.B \-F
] [
.B \-I
.I intf mac
] [
Expand Down Expand Up @@ -95,6 +97,9 @@ Option tokens are listed below next to the corresponding command-line flag.
.B \-c or "cachefile"
Specify the \fItcpprep cache\fR to use to process packets.
.TP
.B \-F or "fixchecksums"
Fixes IP and TCP/UDP checksums in packets. Auto-forced with -s or -u
.TP
.B \-h
Prints help/usage
.TP
Expand Down
15 changes: 12 additions & 3 deletions tcpreplay.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: tcpreplay.c,v 1.53 2003/05/07 17:45:38 aturner Exp $ */
/* $Id: tcpreplay.c,v 1.54 2003/05/08 03:30:51 aturner Exp $ */

#include "config.h"

Expand Down Expand Up @@ -77,10 +77,10 @@ main(int argc, char *argv[])

#ifdef DEBUG
while ((ch =
getopt(argc, argv, "d:c:C:f:hi:I:j:J:l:m:Mp:Pr:Rs:u:Vvx:X:?2:")) != -1)
getopt(argc, argv, "d:c:C:f:Fhi:I:j:J:l:m:Mp:Pr:Rs:u:Vvx:X:?2:")) != -1)
#else
while ((ch =
getopt(argc, argv, "c:C:f:hi:I:j:J:l:m:Mp:Pr:Rs:u:Vvx:X:?2:")) != -1)
getopt(argc, argv, "c:C:f:Fhi:I:j:J:l:m:Mp:Pr:Rs:u:Vvx:X:?2:")) != -1)
#endif
switch (ch) {
case 'c': /* cache file */
Expand All @@ -100,6 +100,9 @@ main(int argc, char *argv[])
case 'f': /* config file */
configfile(optarg);
break;
case 'F': /* force fixing checksums */
options.fixchecksums = 1;
break;
case 'i': /* interface */
intf = optarg;
break;
Expand Down Expand Up @@ -155,6 +158,7 @@ main(int argc, char *argv[])
break;
case 's':
options.seed = atoi(optarg);
options.fixchecksums = 0; /* untruncating already does this */
break;
case 'v': /* verbose */
options.verbose++;
Expand All @@ -169,6 +173,7 @@ main(int argc, char *argv[])
else {
errx(1, "Invalid untruncate option: %s", optarg);
}
options.fixchecksums = 0; /* untruncating already does this */
break;
case 'V':
version();
Expand Down Expand Up @@ -512,6 +517,9 @@ configfile(char *file)
else if (ARGS("no_martians", 1)) {
options.no_martians = 1;
}
else if (ARGS("fixchecksums", 1)) {
options.fixchecksums = 1;
}
else if (ARGS("rate", 2)) {
options.rate = atof(argv[1]);
if (options.rate <= 0)
Expand Down Expand Up @@ -605,6 +613,7 @@ usage()
fprintf(stderr, "-d <level>\t\tEnable debug output to STDERR\n");
#endif
fprintf(stderr, "-f <configfile>\t\tSpecify configuration file\n"
"-F\t\t\tFix IP, TCP and UDP checksums\n"
"-h\t\t\tHelp\n"
"-i <nic>\t\tPrimary interface to send traffic out of\n"
"-I <mac>\t\tRewrite dest MAC on primary interface\n"
Expand Down
3 changes: 2 additions & 1 deletion tcpreplay.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: tcpreplay.h,v 1.31 2003/05/07 22:33:30 aturner Exp $ */
/* $Id: tcpreplay.h,v 1.32 2003/05/08 03:30:51 aturner Exp $ */

#ifndef _TCPREPLAY_H_
#define _TCPREPLAY_H_
Expand Down Expand Up @@ -40,6 +40,7 @@ struct options {
int verbose;
int no_martians;
int topspeed;
int fixchecksums;
int cidr;
int trunc;
long int seed;
Expand Down

0 comments on commit 8c9daf9

Please sign in to comment.