Skip to content

Commit

Permalink
add --nofixcsum to disable all checksumming refs appneta#449
Browse files Browse the repository at this point in the history
will consider per-protocol configuration in 4.x
  • Loading branch information
synfinatic committed Nov 24, 2010
1 parent 42722b8 commit 0804ccf
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 7 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ AC_CONFIG_MACRO_DIR([m4])
dnl Set version info here!
MAJOR_VERSION=3
MINOR_VERSION=4
MICRO_VERSION=5beta2
MICRO_VERSION=5beta3
TCPREPLAY_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
PACKAGE_URL=http://tcpreplay.synfin.net/

Expand Down
5 changes: 5 additions & 0 deletions docs/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
$Id$

??/??/2010 Version 3.4.5
- Update URL's to point to new tcpreplay website (#430)
- Fix statistics to be more industry standard (#443)
- Add --nofixcsum (#449)

08/15/2010 Version 3.4.5beta1
- First pass at fixing 'make test' on many little-endian systems (#429)
- Warn users when processing LINUX_SLL frames w/o an Ethernet source MAC (#434)
Expand Down
7 changes: 5 additions & 2 deletions src/tcpedit/parse_args.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,11 @@ tcpedit_post_args(tcpedit_t **tcpedit_ex) {
tcpedit->cidrmap2 = tcpedit->cidrmap1;

/* --fixcsum */
if (HAVE_OPT(FIXCSUM))
tcpedit->fixcsum = 1;
if (HAVE_OPT(FIXCSUM)) {
tcpedit->fixcsum = TCPEDIT_FIXCSUM_ON;
} else if (HAVE_OPT(NOFIXCSUM)) {
tcpedit->fixcsum = TCPEDIT_FIXCSUM_DISABLE;
}

/* --efcs */
if (HAVE_OPT(EFCS))
Expand Down
3 changes: 2 additions & 1 deletion src/tcpedit/tcpedit-int.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,11 @@ struct tcpedit_s {
#define TCPEDIT_REWRITE_IP_OFF 0x0
#define TCPEDIT_REWRITE_IP_ON 0x1

/* fix IP/TCP/UDP checksums */
/* fix IP/TCP/UDP/ICMP checksums */
u_int8_t fixcsum;
#define TCPEDIT_FIXCSUM_OFF 0x0
#define TCPEDIT_FIXCSUM_ON 0x1
#define TCPEDIT_FIXCSUM_DISABLE 0xFF /* never fix via --nofixcsum */

/* remove ethernet FCS */
u_int8_t efcs;
Expand Down
9 changes: 7 additions & 2 deletions src/tcpedit/tcpedit.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,13 @@ tcpedit_packet(tcpedit_t *tcpedit, struct pcap_pkthdr **pkthdr,
}
}

/* do we need to fix checksums? -- must always do this last! */
if ((tcpedit->fixcsum || needtorecalc)) {
/* do we need to fix checksums? -- must always do this last!
* We recalc if:
* user specified --fixcsum
* packet was edited AND user did NOT specify --nofixcsum
*/
if ((tcpedit->fixcsum == TCPEDIT_FIXCSUM_ON ||
(needtorecalc && tcpedit->fixcsum != TCPEDIT_FIXCSUM_DISABLE))) {
if (ip_hdr != NULL) {
retval = fix_ipv4_checksums(tcpedit, *pkthdr, ip_hdr);
} else if (ip6_hdr != NULL) {
Expand Down
14 changes: 13 additions & 1 deletion src/tcpedit/tcpedit_opts.def
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,26 @@ EOText;
flag = {
name = fixcsum;
value = C;
descrip = "Force recalculation of IPv4/TCP/UDP header checksums";
descrip = "Force recalculation of IP/TCP/UDP/ICMP header checksums";
flags-cant = nofixcsum;
doc = <<- EOText
Causes each IPv4/v6 packet to have their checksums recalcualted and
fixed. Automatically enabled for packets modified with @samp{--seed},
@samp{--pnat}, @samp{--endpoints} or @samp{--fixlen}.
EOText;
};

flag = {
name = nofixcsum;
descrip = "Disable recalcuation of IP/TCP/UDP/ICMP header checksums";
flags-cant = fixcsum;
doc = <<- EOText
Normally, checksums will be automatically re-calcuated and fixed as necessary
when editing packets. However, if you wish to disable fixing of checksums
then specify this option.
EOText;
};

flag = {
name = mtu;
value = m;
Expand Down

0 comments on commit 0804ccf

Please sign in to comment.