Skip to content

Commit

Permalink
fix typos and remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
fklassen committed Nov 2, 2015
1 parent c5e13c0 commit 6a0aaf2
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/common/cidr.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ cidr2cidr(char *cidr)
/* we only get here on error parsing input */
error:
memset(ebuf, '\0', EBUF_SIZE);
strcpy(ebuf, "Unable to parse as a vaild CIDR: ");
strcpy(ebuf, "Unable to parse as a valid CIDR: ");
strlcat(ebuf, cidr, EBUF_SIZE);
errx(-1, "%s", ebuf);
return NULL;
Expand Down
11 changes: 1 addition & 10 deletions src/send_packets.c
Original file line number Diff line number Diff line change
Expand Up @@ -682,15 +682,14 @@ send_dual_packets(tcpreplay_t *ctx, pcap_t *pcap1, int cache_file_idx1, pcap_t *
COUNTER packetnum = 0;
int limit_send = options->limit_send;
int cache_file_idx;
pcap_t *pcap;
struct pcap_pkthdr pkthdr1, pkthdr2;
u_char *pktdata1 = NULL, *pktdata2 = NULL, *pktdata = NULL;
sendpacket_t *sp = ctx->intf1;
uint32_t pktlen;
uint32_t iteration = ctx->iteration;
bool unique_ip = options->unique_ip;
packet_cache_t *cached_packet1 = NULL, *cached_packet2 = NULL;
packet_cache_t **prev_packet1 = NULL, **prev_packet2 = NULL, **prev_packet = NULL;
packet_cache_t **prev_packet1 = NULL, **prev_packet2 = NULL;
struct pcap_pkthdr *pkthdr_ptr;
int datalink = options->file_cache[cache_file_idx1].dlt;
COUNTER start_us;
Expand Down Expand Up @@ -755,36 +754,28 @@ send_dual_packets(tcpreplay_t *ctx, pcap_t *pcap1, int cache_file_idx1, pcap_t *
/* file 2 is next */
sp = ctx->intf2;
datalink = options->file_cache[cache_file_idx2].dlt;
pcap = pcap2;
pkthdr_ptr = &pkthdr2;
prev_packet = prev_packet2;
cache_file_idx = cache_file_idx2;
pktdata = pktdata2;
} else if (pktdata2 == NULL) {
/* file 1 is next */
sp = ctx->intf1;
datalink = options->file_cache[cache_file_idx1].dlt;
pcap = pcap1;
pkthdr_ptr = &pkthdr1;
prev_packet = prev_packet1;
cache_file_idx = cache_file_idx1;
pktdata = pktdata1;
} else if (timercmp(&pkthdr1.ts, &pkthdr2.ts, <=)) {
/* file 1 is next */
sp = ctx->intf1;
datalink = options->file_cache[cache_file_idx1].dlt;
pcap = pcap1;
pkthdr_ptr = &pkthdr1;
prev_packet = prev_packet1;
cache_file_idx = cache_file_idx1;
pktdata = pktdata1;
} else {
/* file 2 is next */
sp = ctx->intf2;
datalink = options->file_cache[cache_file_idx2].dlt;
pcap = pcap2;
pkthdr_ptr = &pkthdr2;
prev_packet = prev_packet2;
cache_file_idx = cache_file_idx2;
pktdata = pktdata2;
}
Expand Down
2 changes: 0 additions & 2 deletions src/tcpedit/edit_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ extract_data(tcpedit_t *tcpedit, const u_char *pktdata, int caplen,
int datalen = 0; /* amount of data beyond ip header */
ipv4_hdr_t *ip_hdr = NULL;
tcp_hdr_t *tcp_hdr = NULL;
udp_hdr_t *udp_hdr = NULL;
u_char ipbuff[MAXPACKET];
u_char *dataptr = NULL;

Expand Down Expand Up @@ -365,7 +364,6 @@ extract_data(tcpedit_t *tcpedit, const u_char *pktdata, int caplen,

/* UDP ? */
else if (ip_hdr->ip_p == IPPROTO_UDP) {
udp_hdr = (udp_hdr_t *) get_layer4_v4(ip_hdr, datalen);
datalen -= TCPR_UDP_H;
if (datalen <= 0)
goto nodata;
Expand Down
8 changes: 0 additions & 8 deletions src/tcpprep.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,14 +334,6 @@ process_raw_packets(pcap_t * pcap)
tcpr_dir_t direction = TCPR_DIR_ERROR;
tcpprep_opt_t *options = tcpprep->options;

#ifdef ENABLE_VERBOSE
struct pollfd poller[1];

poller[0].fd = tcpprep->tcpdump.outfd;
poller[0].events = POLLIN;
poller[0].revents = 0;
#endif

assert(pcap);

while ((pktdata = pcap_next(pcap, &pkthdr)) != NULL) {
Expand Down
6 changes: 3 additions & 3 deletions src/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ tree_buildcidr(tcpr_data_tree_t *treeroot, tcpr_buildcidr_t * bcdata)

RB_FOREACH(node, tcpr_data_tree_s, treeroot) {

/* we only check types that are vaild */
/* we only check types that are valid */
if (bcdata->type != DIR_ANY) /* don't check if we're adding ANY */
if (bcdata->type != node->type) /* no match, exit early */
return;
Expand Down Expand Up @@ -140,7 +140,7 @@ tree_checkincidr(tcpr_data_tree_t *treeroot, tcpr_buildcidr_t * bcdata)

RB_FOREACH(node, tcpr_data_tree_s, treeroot) {

/* we only check types that are vaild */
/* we only check types that are valid */
if (bcdata->type != DIR_ANY) /* don't check if we're adding ANY */
if (bcdata->type != node->type) /* no match, exit early */
return 0;
Expand Down Expand Up @@ -203,7 +203,7 @@ process_tree(void)
}

safe_free(bcdata);
/* we failed to find a vaild cidr list */
/* we failed to find a valid cidr list */
notice("Unable to determine any IP addresses as a clients.");
notice("Perhaps you should change the --ratio, --minmask/maxmask settings, or try another mode?");
return (0);
Expand Down

0 comments on commit 6a0aaf2

Please sign in to comment.