From 16d4d4be6eb008f0ab37506d651fe6e50cb6d96a Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Fri, 27 Dec 2013 14:07:02 -0800 Subject: [PATCH 01/20] Increment release number --- configure | 2 +- configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index d89e482ad..47a86490d 100755 --- a/configure +++ b/configure @@ -2920,7 +2920,7 @@ MAINTAINER_AUTOGEN_VERSION=5.16.2 MAJOR_VERSION=4 MINOR_VERSION=0 -MICRO_VERSION=0beta2 +MICRO_VERSION=0beta3 TCPREPLAY_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION PACKAGE_URL=http://tcpreplay.synfin.net/ diff --git a/configure.ac b/configure.ac index 00f0a3a83..cd24ff55f 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ AC_CONFIG_MACRO_DIR([m4]) dnl Set version info here! MAJOR_VERSION=4 MINOR_VERSION=0 -MICRO_VERSION=0beta2 +MICRO_VERSION=0beta3 TCPREPLAY_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION PACKAGE_URL=http://tcpreplay.synfin.net/ From 5c01269e5589cd52fd4534f2f66da31745cf4551 Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Sat, 28 Dec 2013 17:47:40 -0800 Subject: [PATCH 02/20] Add missing API calls #40 --- src/tcpreplay_api.c | 43 +++++++++++++++++++++++++++++++++++++++++++ src/tcpreplay_api.h | 4 ++++ 2 files changed, 47 insertions(+) diff --git a/src/tcpreplay_api.c b/src/tcpreplay_api.c index 2864153d7..bf211fb6c 100644 --- a/src/tcpreplay_api.c +++ b/src/tcpreplay_api.c @@ -1173,3 +1173,46 @@ tcpreplay_get_current_source(tcpreplay_t *ctx) /* vim: set tabstop=8 expandtab shiftwidth=4 softtabstop=4: */ + +/** + * \brief Sets printing of flow statistics + */ +int tcpreplay_set_flow_stats(tcpreplay_t *ctx, bool value) +{ + assert(ctx); + + ctx->options->flow_stats = value; + return 0; +} + +/** + * \brief Sets the flow expiry in seconds + */ +int tcpreplay_set_flow_expiry(tcpreplay_t *ctx, int value) +{ + assert(ctx); + + ctx->options->flow_expiry = value; + return 0; +} + +/** + * \brief Get whether to printof flow statistics + */ +bool tcpreplay_get_flow_stats(tcpreplay_t *ctx) +{ + assert(ctx); + + return ctx->options->flow_stats; + return 0; +} + +/** + * \brief Gets the flow expiry in seconds + */ +int tcpreplay_get_flow_expiry(tcpreplay_t *ctx) +{ + assert(ctx); + + return ctx->options->flow_expiry; +} diff --git a/src/tcpreplay_api.h b/src/tcpreplay_api.h index d25bb4b25..7add6a811 100644 --- a/src/tcpreplay_api.h +++ b/src/tcpreplay_api.h @@ -237,6 +237,10 @@ int tcpreplay_set_preload_pcap(tcpreplay_t *, bool); /* information */ int tcpreplay_get_source_count(tcpreplay_t *); int tcpreplay_get_current_source(tcpreplay_t *); +int tcpreplay_set_flow_stats(tcpreplay_t *, bool); +int tcpreplay_set_flow_expiry(tcpreplay_t *,int); +bool tcpreplay_get_flow_stats(tcpreplay_t *); +int tcpreplay_get_flow_expiry(tcpreplay_t *); /* functions controlling execution */ int tcpreplay_prepare(tcpreplay_t *); From 3b00bbe919868bd8920f24ac28328e9d8756bff1 Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Sat, 28 Dec 2013 19:31:14 -0800 Subject: [PATCH 03/20] Add per-interface flow stats and collect flow stats more aggressively - #40 --- src/common/sendpacket.c | 17 +++++++++++++++-- src/common/sendpacket.h | 5 +++++ src/send_packets.c | 36 +++++++++++++++++++++++++----------- src/tcpreplay.c | 12 ++++++------ src/tcpreplay_opts.def | 6 ++++-- 5 files changed, 55 insertions(+), 21 deletions(-) diff --git a/src/common/sendpacket.c b/src/common/sendpacket.c index fe784c606..ffe59ec2a 100644 --- a/src/common/sendpacket.c +++ b/src/common/sendpacket.c @@ -568,12 +568,13 @@ sendpacket_open(const char *device, char *errbuf, tcpr_dir_t direction, char * sendpacket_getstat(sendpacket_t *sp) { - static char buf[1024]; + char buf[1024]; + int offset; assert(sp); memset(buf, 0, sizeof(buf)); - sprintf(buf, "Statistics for network device: %s\n" + offset = sprintf(buf, "Statistics for network device: %s\n" "\tAttempted packets: " COUNTER_SPEC "\n" "\tSuccessful packets: " COUNTER_SPEC "\n" "\tFailed packets: " COUNTER_SPEC "\n" @@ -582,6 +583,18 @@ sendpacket_getstat(sendpacket_t *sp) "\tRetried packets (EAGAIN): " COUNTER_SPEC "\n", sp->device, sp->attempt, sp->sent, sp->failed, sp->trunc_packets, sp->retry_enobufs, sp->retry_eagain); + + if (sp->flow_packets && offset > 0) { + sprintf(&buf[offset], + "\tFlows: " COUNTER_SPEC "\n" + "\tFlows expired: " COUNTER_SPEC "\n" + "\tFlow packets: " COUNTER_SPEC "\n" + "\tNon-flow packets: " COUNTER_SPEC "\n" + "\tInvalid flow packets: " COUNTER_SPEC "\n", + sp->flows, sp->flows_expired, sp->flow_packets, + sp->flow_non_flow_packets, sp->flows_invalid_packets); + } + return(buf); } diff --git a/src/common/sendpacket.h b/src/common/sendpacket.h index 2d13d7cdc..04f515879 100644 --- a/src/common/sendpacket.h +++ b/src/common/sendpacket.h @@ -98,6 +98,11 @@ struct sendpacket_s { COUNTER sent; COUNTER bytes_sent; COUNTER attempt; + COUNTER flow_non_flow_packets; + COUNTER flows; + COUNTER flow_packets; + COUNTER flows_expired; + COUNTER flows_invalid_packets; sendpacket_type_t handle_type; union sendpacket_handle handle; struct tcpr_ether_addr ether; diff --git a/src/send_packets.c b/src/send_packets.c index 1d0bc41be..cb27531ef 100644 --- a/src/send_packets.c +++ b/src/send_packets.c @@ -290,8 +290,8 @@ fast_edit_packet(struct pcap_pkthdr *pkthdr, u_char **pktdata, * * Finds out if flow is unique and updates stats. */ -static inline void update_flow_stats(tcpreplay_t *ctx, const struct pcap_pkthdr *pkthdr, - const u_char *pktdata, int datalink) +static inline void update_flow_stats(tcpreplay_t *ctx, sendpacket_t *sp, + const struct pcap_pkthdr *pkthdr, const u_char *pktdata, int datalink) { flow_entry_type_t res = flow_decode(ctx->flow_hash_table, pkthdr, pktdata, datalink, ctx->options->flow_expiry); @@ -300,32 +300,46 @@ static inline void update_flow_stats(tcpreplay_t *ctx, const struct pcap_pkthdr case FLOW_ENTRY_NEW: ++ctx->stats.flows; ++ctx->stats.flow_packets; + if (sp) { + ++sp->flows; + ++sp->flow_packets; + } break; case FLOW_ENTRY_EXISTING: ++ctx->stats.flow_packets; + if (sp) + ++sp->flow_packets; break; case FLOW_ENTRY_EXPIRED: ++ctx->stats.flows_expired; ++ctx->stats.flows; ++ctx->stats.flow_packets; + if (sp) { + ++sp->flows_expired; + ++sp->flows; + ++sp->flow_packets; + } break; case FLOW_ENTRY_NON_IP: ++ctx->stats.flow_non_flow_packets; + if (sp) + ++sp->flow_non_flow_packets; break; case FLOW_ENTRY_INVALID: ++ctx->stats.flows_invalid_packets; + if (sp) + ++sp->flows_invalid_packets; break; } } /** * \brief Preloads the memory cache for the given pcap file_idx * - * Preloading can be used with or without --loop and implies using - * --enable-file-cache + * Preloading can be used with or without --loop */ void preload_pcap_file(tcpreplay_t *ctx, int idx) @@ -354,7 +368,7 @@ preload_pcap_file(tcpreplay_t *ctx, int idx) while ((pktdata = get_next_packet(ctx, pcap, &pkthdr, idx, prev_packet)) != NULL) { packetnum++; if (options->flow_stats) - update_flow_stats(ctx, &pkthdr, pktdata, dlt); + update_flow_stats(ctx, NULL, &pkthdr, pktdata, dlt); } /* mark this file as cached */ @@ -454,9 +468,9 @@ send_packets(tcpreplay_t *ctx, pcap_t *pcap, int idx) fast_edit_packet(&pkthdr, &pktdata, iteration, file_cached, datalink); - /* update flow stats for the first iteration only */ - if (options->flow_stats && !file_cached && !iteration) - update_flow_stats(ctx, &pkthdr, pktdata, datalink); + /* update flow stats if not caching */ + if (options->flow_stats && !file_cached) + update_flow_stats(ctx, NULL, &pkthdr, pktdata, datalink); /* * we have to cast the ts, since OpenBSD sucks @@ -663,9 +677,9 @@ send_dual_packets(tcpreplay_t *ctx, pcap_t *pcap1, int cache_file_idx1, pcap_t * fast_edit_packet(pkthdr_ptr, &pktdata, ctx->iteration, options->file_cache[cache_file_idx].cached, datalink); - /* update flow stats for the first iteration only */ - if (options->flow_stats && !options->file_cache[cache_file_idx].cached && !iteration) - update_flow_stats(ctx, pkthdr_ptr, pktdata, datalink); + /* update flow stats */ + if (options->flow_stats && !options->file_cache[cache_file_idx].cached) + update_flow_stats(ctx, sp, pkthdr_ptr, pktdata, datalink); /* * we have to cast the ts, since OpenBSD sucks diff --git a/src/tcpreplay.c b/src/tcpreplay.c index 00347fdb4..dfe550eb5 100644 --- a/src/tcpreplay.c +++ b/src/tcpreplay.c @@ -219,13 +219,13 @@ flow_stats(const tcpreplay_t *ctx, bool unique_ip) return; /* - * Flows are only counted in first iteration or - * when they are read into cache. If flows are - * unique from one loop iteration to the next - * then multiply by the number of successful - * iterations. + * When packets are read into cache, flows + * are only counted in first iteration + * If flows are unique from one loop iteration + * to the next then multiply by the number of + * successful iterations. */ - if (unique_ip) { + if (unique_ip && ctx->options->preload_pcap) { flows *= ctx->iteration; flows_expired *= ctx->iteration; } diff --git a/src/tcpreplay_opts.def b/src/tcpreplay_opts.def index a051d96bd..7f603f3de 100644 --- a/src/tcpreplay_opts.def +++ b/src/tcpreplay_opts.def @@ -214,8 +214,10 @@ flag = { doc = <<- EOText This option loads the specified pcap(s) into RAM before starting to send in order to improve replay performance while introducing a startup performance hit. -Preloading can be used with or without @var{--loop} and implies -@var{--enable-file-cache}. +Preloading can be used with or without @var{--loop}. This option also suppresses +flow statistics collection for every iteration, which can significantly reduce +memory usage. Flow statistics are predicted based on options supplied and +statistics collected from the first loop iteration. EOText; }; From 213bcf10c2297a45ec4a8bf23a6a2ab1d52b9e9c Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Sat, 28 Dec 2013 21:07:07 -0800 Subject: [PATCH 04/20] prevent accessing unopend pcap files - closes #41 --- src/common/sendpacket.c | 6 ++++-- src/replay.c | 26 ++++++++++++-------------- src/tcpreplay_api.c | 4 ++++ 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/common/sendpacket.c b/src/common/sendpacket.c index ffe59ec2a..7778896a9 100644 --- a/src/common/sendpacket.c +++ b/src/common/sendpacket.c @@ -641,7 +641,8 @@ sendpacket_close(sendpacket_t *sp) case SP_TYPE_NETMAP: #ifdef HAVE_NETMAP - fprintf(stderr, "Switching network driver to normal mode... "); + fprintf(stderr, "Switching network driver for %s to normal mode... ", + sp->device); fflush(NULL); /* flush any remaining packets */ ioctl (sp->handle.fd, NIOCTXSYNC, NULL); @@ -969,7 +970,8 @@ sendpacket_open_netmap(const char *device, char *errbuf) * * Cards take a long time to reset the PHY. */ - fprintf(stderr, "Switching network driver to netmap bypass mode... "); + fprintf(stderr, "Switching network driver for %s to netmap bypass mode... ", + device); fflush(NULL); bzero (&nmr, sizeof(nmr)); diff --git a/src/replay.c b/src/replay.c index f5da212ab..27355375d 100644 --- a/src/replay.c +++ b/src/replay.c @@ -245,23 +245,21 @@ replay_two_files(tcpreplay_t *ctx, int idx1, int idx2) } } } -#ifdef HAVE_PCAP_SNAPSHOT - if (pcap_snapshot(pcap1) < 65535) { - tcpreplay_setwarn(ctx, "%s was captured using a snaplen of %d bytes. This may mean you have truncated packets.", - path1, pcap_snapshot(pcap1)); - rcode = -2; - } - if (pcap_snapshot(pcap2) < 65535) { - tcpreplay_setwarn(ctx, "%s was captured using a snaplen of %d bytes. This may mean you have truncated packets.", - path2, pcap_snapshot(pcap2)); - rcode = -2; - } + if (pcap1 != NULL) { +#ifdef HAVE_PCAP_SNAPSHOT + if (pcap_snapshot(pcap1) < 65535) { + tcpreplay_setwarn(ctx, "%s was captured using a snaplen of %d bytes. This may mean you have truncated packets.", + path1, pcap_snapshot(pcap1)); + rcode = -2; + } + if (pcap_snapshot(pcap2) < 65535) { + tcpreplay_setwarn(ctx, "%s was captured using a snaplen of %d bytes. This may mean you have truncated packets.", + path2, pcap_snapshot(pcap2)); + rcode = -2; + } #endif - - - if (pcap1 != NULL) { if (ctx->intf1dlt == -1) ctx->intf1dlt = sendpacket_get_dlt(ctx->intf1); if ((ctx->intf1dlt >= 0) && (ctx->intf1dlt != pcap_datalink(pcap1))) { diff --git a/src/tcpreplay_api.c b/src/tcpreplay_api.c index bf211fb6c..b5c74d2c4 100644 --- a/src/tcpreplay_api.c +++ b/src/tcpreplay_api.c @@ -307,6 +307,10 @@ tcpreplay_post_args(tcpreplay_t *ctx, int argc) ctx->intf1dlt = sendpacket_get_dlt(ctx->intf1); if (HAVE_OPT(INTF2)) { + if (!HAVE_OPT(CACHEFILE) && !HAVE_OPT(DUALFILE)) { + tcpreplay_seterr(ctx, "--intf2=%s requires either --cachefile or --dualfile", OPT_ARG(INTF2)); + return -1; + } if ((intname = get_interface(ctx->intlist, OPT_ARG(INTF2))) == NULL) { tcpreplay_seterr(ctx, "Invalid interface name/alias: %s", OPT_ARG(INTF2)); return -1; From a337192403725e634686cf077acf346a668ed2d8 Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Sun, 29 Dec 2013 12:57:10 -0800 Subject: [PATCH 05/20] per-interface flow stats for cache-file option #41 --- src/send_packets.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/send_packets.c b/src/send_packets.c index cb27531ef..4f3440c04 100644 --- a/src/send_packets.c +++ b/src/send_packets.c @@ -401,7 +401,7 @@ send_packets(tcpreplay_t *ctx, pcap_t *pcap, int idx) COUNTER start_us; uint32_t iteration = ctx->iteration; bool unique_ip = options->unique_ip; - bool file_cached = options->file_cache[idx].cached; + bool preload = options->file_cache[idx].cached; bool do_not_timestamp = options->speed.mode == speed_topspeed || (options->speed.mode == speed_mbpsrate && !options->speed.speed); @@ -466,11 +466,12 @@ send_packets(tcpreplay_t *ctx, pcap_t *pcap, int idx) if (unique_ip && iteration) /* edit packet to ensure every pass is unique */ fast_edit_packet(&pkthdr, &pktdata, iteration, - file_cached, datalink); + preload, datalink); - /* update flow stats if not caching */ - if (options->flow_stats && !file_cached) - update_flow_stats(ctx, NULL, &pkthdr, pktdata, datalink); + /* update flow stats */ + if (options->flow_stats && !preload) + update_flow_stats(ctx, + options->cache_packets ? sp : NULL, &pkthdr, pktdata, datalink); /* * we have to cast the ts, since OpenBSD sucks From a5a89ed7245760be70e127c296ebf1da56033306 Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Sun, 29 Dec 2013 13:26:48 -0800 Subject: [PATCH 06/20] Update README docs for #40 --- README | 221 ++++++++++++++++++++++++++++++++++++++++++++++-------- README.md | 160 +++++++++++++++++++++++++++++---------- 2 files changed, 311 insertions(+), 70 deletions(-) diff --git a/README b/README index 7c28b8e65..7e9898e93 100644 --- a/README +++ b/README @@ -1,31 +1,133 @@ -[Please note that licensing, compiling, usage and other documentation can be -found in the docs subdirectory.] +Tcpreplay is a suite of GPLv3 licensed utilities for UNIX (and Win32 under +Cygwin) operating systems for editing and replaying network traffic which +was previously captured by tools like tcpdump and Ethereal/Wireshark. +It allows you to classify traffic as client or server, rewrite Layer 2, 3 and 4 +packets and finally replay the traffic back onto the network and through other +devices such as switches, routers, firewalls, NIDS and IPS's. Tcpreplay supports +both single and dual NIC modes for testing both sniffing and in-line devices. -If you have a question or think you are experiancing a bug, it is important -that you provide enough information for us to help you. Failure to provide -enough information will likely cause your email to be ignored or get an -annoyed reply from the author. +Tcpreplay is used by numerous firewall, IDS, IPS, NetFlow and other networking +vendors, enterprises, universities, labs and open source projects. If your +organization uses Tcpreplay, please let us know who you are and what you use +it for so that I can continue to add features which are useful. + +Tcpreplay is designed to work with network hardware and normally does not +penetrate deeper than Layer 2. Yazan Siam with sponsorship from [Cisco] developed +*tcpliveplay* to replay TCP pcap files directly to servers. Use this utility +if you want to test the entire network stack and into the application. + +As of version 4.0, Tcpreplay has been enhanced to address the complexities of +testing and tuning IP Flow/NetFlow hardware. Enhancements include: + +* Support for [netmap] modified network drivers for 10GigE wire-speed performance +* Increased accuracy for playback speed +* Increased accuracy of results reporting +* Flow statistics including Flows Per Second (fps) +* Flow analysis for analysis and fine tuning of flow expiry timeouts +* Hundreds of thousands of flows per second (dependent flow sizes in pcap file) + +Version 4.0 is the first version delivered by Fred Klassen and sponsored by +AppNeta Inc. Many thanks to the author of Tcpreplay, Aaron Turner who has supplied +the world with a a solid and full-featured test product thus far. The new author +strives to take Tcprelay performance to levels normally only seen in commercial +network test equipment. + +Products +======== +The Tcpreplay suite includes the following tools: + +Network playback products: +-------------------------- +* tcpreplay - replays pcap files at arbitrary speeds onto the network with an +option to replay with random IP addresses + +* tcpreplay-edit - replays pcap files at arbitrary speeds onto the network with +numerous options to modify packets packets on the fly + +* tcpliveplay - replays TCP network traffic stored in a pcap file on live +networks in a manner that a remote server will respond to + +Pcap file editors and utilities: +-------------------------------- +* tcpprep - multi-pass pcap file pre-processor which determines packets as +client or server and splits them into creates output files for use by tcpreplay and tcprewrite + +* tcprewrite - pcap file editor which rewrites TCP/IP and Layer 2 packet headers + +* tcpbridge - bridge two network segments with the power of tcprewrite + +* tcpcapinfo - raw pcap file decoder and debugger + + +Install package +=============== +Please visit our wiki at http://tcpreplay.appneta.com for product information and detailed +installation instructions. + + +Simple directions for Unix users: +--------------------------------- + + ./configure + make + sudo make install + +Build netmap feature +-------------------- +This feature will detect netmap (http://info.iet.unipi.it/~luigi/netmap/) +capable network drivers on Linux and BSD +systems. If detected, the network driver is bypassed for the execution +duration of tcpreplay and tcpreplay-edit, and network buffers will be +written to directly. This will allow you to achieve full line rates on +commodity network adapters, similar to rates achieved by commercial network +traffic generators. + +**Note** that bypassing the network driver will disrupt other applications connected +through the test interface. Don't test on the same interface you ssh'ed into. + +Download latest and install netmap from +If you extracted netmap into **/usr/src/** or **/usr/local/src** you can build normally. Otherwise you +will have to specify the netmap source directory, for example: + + ./configure --with-netmap=/home/fklassen/git/netmap + make + sudo make install + +Detailed installation instructions are available in the INSTALL document in the tar ball. + +Install from source code +------------------------ +Download the tar ball (https://github.com/appneta/tcpreplay/tarball/master) or +zip (https://github.com/appneta/tcpreplay/zipball/master) file. Optionally clone the git +repository: + + + git clone git@github.com:appneta/tcpreplay.git + +Support +======= +If you have a question or think you are experiencing a bug, submit them +here (https://github.com/appneta/tcpreplay/issues). It is important +that you provide enough information for us to help you. If your problem has to do with COMPILING tcpreplay: -- Version of tcpreplay you are trying to compile -- Platform (Red Hat Linux 9 on x86, Solaris 7 on SPARC, OS X on PPC, etc) -- ./configure arguments -- Contents of config.log -- Output from 'make' -- Any additional information you think that would be useful. +* Version of tcpreplay you are trying to compile +* Platform (Red Hat Linux 9 on x86, Solaris 7 on SPARC, OS X on PPC, etc) +* Contents of config.status +* Output from **configure** and **make** +* Any additional information you think that would be useful. If your problem has to do with RUNNING tcpreplay or one of the sub-tools: -- Version information (output of -V) -- Command line used (options and arguments) -- Platform (Red Hat Linux 9 on Intel, Solaris 7 on SPARC, etc) -- Make & model of the network card(s) and driver(s) version -- Error message (if available) and/or description of problem -- If possible, attach the pcap file used (compressed with bzip2 or gzip - preferred) -- The core dump or backtrace if available -- Detailed description of your problem or what you are trying to accomplish - -Note: The author of tcpreplay primarily uses OS X; hence, if you're reporting +* Version information (output of -V) +* Command line used (options and arguments) +* Platform (Red Hat Linux 9 on Intel, Solaris 7 on SPARC, etc) +* Make & model of the network card(s) and driver(s) version +* Error message (if available) and/or description of problem +* If possible, attach the pcap file used (compressed with bzip2 or gzip preferred) +* The core dump or backtrace if available +* Detailed description of your problem or what you are trying to accomplish + +Note: The author of tcpreplay primarily uses OS X and Linux; hence, if you're reporting an issue on another platform, it is important that you give very detailed information as I may not be able to reproduce your issue. @@ -35,14 +137,71 @@ tcpreplay-users email list: http://lists.sourceforge.net/lists/listinfo/tcpreplay-users -Lastly, please don't email the author or maintainer directly with your questions. -Doing so prevents others from potentially helping you and your question/answer -from showing up in the list archives. +If you have a bug to report you can submit it here: -Thanks, -Aaron (tcpreplay author) -Fred Klassen - AppNeta Inc. (tcpreplay maintainer) +https://github.com/appneta/tcpreplay/issues -PS: -This product includes software developed by the University of +If you want to help with development, visit our developers wiki: + +https://github.com/appneta/tcpreplay/wiki + +Lastly, please don't email the authors directly with your questions. Doing so +prevents others from potentially helping you and your question/answer from +showing up in the list archives. + +License +======= +Tcpreplay 3.5 is GPLv3 and includes software developed by the University of California, Berkeley, Lawrence Berkeley Laboratory and its contributors. + +Authors and Contributors +======================== +Tcpreplay is authored by Aaron Turner. In 2013 Fred Klassen, Founder and VP Network Technology, +AppNeta Inc. (http://appneta.com) added performance features and enhancements, +and ultimately took over the maintenance of Tcpreplay. + +The source code repository has moved to GitHub. You can get a working copy of the repository +by installing [git] and executing: + +``` +git clone git@github.com:appneta/tcpreplay.git +``` + +How To Contribute +================= +It's easy. Basically you... + +* Set up git - https://help.github.com/articles/set-up-git +* Fork - https://help.github.com/articles/fork-a-repo +* Edit (we that you create a branch per issue) +* Send a PR - https://help.github.com/articles/using-pull-requests + + +Details: +-------- +You will find that you will not be able to contribute to the Tcpreplay project directly if you +use clone the appneta/tcpreplay repo. If you believe that you may someday contribute to the +repository, GitHub provides an innovative approach. Forking the @appneta/tcpreplay repository +allows you to work on your own copy of the repository and submit code changes without first +asking permission from the authors. Forking is also considered to be a compliment so fork away: + +* if you haven't already done so, get yourself a free GitHub(https://github.com) ID and visit @appneta/tcpreplay +* click the **Fork** button to get your own private copy of the repository +* on your build system clone your private repository: + + git clone git@github.com:/tcpreplay.git + +* we like to keep the **master** branch available for projection ready code so we recommend that you make a +branch for each feature or bug fix +* when you are happy with your work, push it to your GitHub repository +* on your GitHub repository select your new branch and submit a **Pull Request** to **master** +* optionally monitor the status of your submission here (https://github.com/appneta/tcpreplay/network) + +We will review and possibly discuss the changes with you through GitHub services. +If we accept the submission, it will instantly be applied to the production **master** branch. + +Additional Information +====================== +Please visit our wiki (http://tcpreplay.appneta.com). + +or visit our developers wiki (https://github.com/appneta/tcpreplay/wiki) diff --git a/README.md b/README.md index b68147408..b31e2d518 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,74 @@ -Tcpreplay is a suite of [GPLv3](http://www.gnu.org/licenses/gpl-3.0.html) licensed tools for UNIX (and Win32 under Cygwin) operating systems which gives you the ability to use previously captured traffic in libpcap format to test a variety of network devices. It allows you to classify traffic as client or server, rewrite Layer 2, 3 and 4 headers and finally replay the traffic back onto the network and through other devices such as switches, routers, firewalls, NIDS and IPS's. Tcpreplay supports both single and dual NIC modes for testing both sniffing and in-line devices. - -Tcpreplay is used by numerous firewall, IDS, IPS, NetFlow and other networking vendors, enterprises, universities, labs and open source projects. If your organization uses Tcpreplay, please let me know who you are and what you use it for so that I can continue to add features which are useful. - -Version 4.0.0 is the first version delivered by Fred Klassen of AppNeta Inc. Many thanks to the author of Tcpreplay, -Aaron Turner who has supplied the world with a a solid and full-featured test product thus far. The new author -strives to take Tcprelay performance to levels normally only seen in commercial network test equipment. For -example, using commodity hardware with stock Intel 10GigE adapters with [netmap](http://info.iet.unipi.it/~luigi/netmap/) modified network drivers you can generate full wire rate pcap file playback. With new [NetFlow](http://www.cisco.com/go/netflow) features you can generate up to 18 -million flows per second. - -## Products +Tcpreplay is a suite of [GPLv3] licensed utilities for UNIX (and Win32 under +[Cygwin]) operating systems for editing and replaying network traffic which +was previously captured by tools like [tcpdump] and [Ethereal]/[Wireshark]. +It allows you to classify traffic as client or server, rewrite Layer 2, 3 and 4 +packets and finally replay the traffic back onto the network and through other +devices such as switches, routers, firewalls, NIDS and IPS's. Tcpreplay supports +both single and dual NIC modes for testing both sniffing and in-line devices. + +Tcpreplay is used by numerous firewall, IDS, IPS, NetFlow and other networking +vendors, enterprises, universities, labs and open source projects. If your +organization uses Tcpreplay, please let us know who you are and what you use +it for so that I can continue to add features which are useful. + +Tcpreplay is designed to work with network hardware and normally does not +penetrate deeper than Layer 2. Yazan Siam with sponsorship from [Cisco] developed +*tcpliveplay* to replay TCP pcap files directly to servers. Use this utility +if you want to test the entire network stack and into the application. + +As of version 4.0, Tcpreplay has been enhanced to address the complexities of +testing and tuning [IP Flow][flow]/[NetFlow] hardware. Enhancements include: + +* Support for [netmap] modified network drivers for 10GigE wire-speed performance +* Increased accuracy for playback speed +* Increased accuracy of results reporting +* Flow statistics including Flows Per Second (fps) +* Flow analysis for analysis and fine tuning of flow expiry timeouts +* Hundreds of thousands of flows per second (dependent flow sizes in pcap file) + +Version 4.0 is the first version delivered by Fred Klassen and sponsored by +[AppNeta]. Many thanks to the author of Tcpreplay, Aaron Turner who has supplied +the world with a a solid and full-featured test product thus far. The new author +strives to take Tcprelay performance to levels normally only seen in commercial +network test equipment. + +Products +======== The Tcpreplay suite includes the following tools: -### Network playback products: -* **tcpreplay** - replays pcap files at arbitrary speeds onto the network with an option to replay with random IP addresses -* **tcpreplay-edit** - replays pcap files at arbitrary speeds onto the network with numerous options to modify packets packets on the fly -* **tcpliveplay** - replays TCP network traffic stored in a pcap file on live networks in a manner that a remote server will respond to - -### Pcap file editors: -* **tcpprep** - multi-pass pcap file pre-processor which determines packets as client or server and splits them into creates output files for use by tcpreplay and tcprewrite +Network playback products: +-------------------------- +* **tcpreplay** - replays pcap files at arbitrary speeds onto the network with an +option to replay with random IP addresses +* **tcpreplay-edit** - replays pcap files at arbitrary speeds onto the network with +numerous options to modify packets packets on the fly +* **tcpliveplay** - replays TCP network traffic stored in a pcap file on live +networks in a manner that a remote server will respond to + +Pcap file editors and utilities: +-------------------------------- +* **tcpprep** - multi-pass pcap file pre-processor which determines packets as +client or server and splits them into creates output files for use by tcpreplay and tcprewrite * **tcprewrite** - pcap file editor which rewrites TCP/IP and Layer 2 packet headers - -### Utilities: * **tcpbridge** - bridge two network segments with the power of tcprewrite * **tcpcapinfo** - raw pcap file decoder and debugger -## Install package -Please visit our [wiki](http://tcpreplay.appneta.com) for product information and detailed installation instructions. +Install package +=============== +Please visit our [wiki](http://tcpreplay.appneta.com) for product information and detailed +installation instructions. -## Install from source code -Select the [TAR](https://github.com/appneta/tcpreplay/tarball/master) or [ZIP](https://github.com/appneta/tcpreplay/zipball/master) to download. Detailed installation instructions are available in the INSTALL document in the tar ball. -### Simple directions for Unix users: +Simple directions for Unix users: +--------------------------------- ``` ./configure make sudo make install ``` -### Build netmap feature + +Build netmap feature +-------------------- This feature will detect [netmap](http://info.iet.unipi.it/~luigi/netmap/) capable network drivers on Linux and BSD systems. If detected, the network driver is bypassed for the execution @@ -57,8 +89,22 @@ make sudo make install ``` -## Support -If you have a question or think you are experiencing a bug, submit them [here](https://github.com/appneta/tcpreplay/issues). It is important +Detailed installation instructions are available in the INSTALL document in the tar ball. + +Install from source code +------------------------ +Download the [tar ball](https://github.com/appneta/tcpreplay/tarball/master) or +[zip](https://github.com/appneta/tcpreplay/zipball/master) file. Optionally clone the git +repository: + +``` +git clone git@github.com:appneta/tcpreplay.git +``` + +Support +======= +If you have a question or think you are experiencing a bug, submit them +[here](https://github.com/appneta/tcpreplay/issues). It is important that you provide enough information for us to help you. If your problem has to do with COMPILING tcpreplay: @@ -100,24 +146,43 @@ Lastly, please don't email the authors directly with your questions. Doing so prevents others from potentially helping you and your question/answer from showing up in the list archives. -## License +License +======= Tcpreplay 3.5 is GPLv3 and includes software developed by the University of California, Berkeley, Lawrence Berkeley Laboratory and its contributors. -## Authors and Contributors +Authors and Contributors +======================== Tcpreplay is authored by Aaron Turner. In 2013 Fred Klassen, Founder and VP Network Technology, [AppNeta Inc.](http://appneta.com) added performance features and enhancements, and ultimately took over the maintenance of Tcpreplay. -The source code repository has moved to GitHub. You can get a working copy of the repository by installing **git** and executing: +The source code repository has moved to GitHub. You can get a working copy of the repository +by installing [git] and executing: + ``` git clone git@github.com:appneta/tcpreplay.git ``` -However you will find that you will not be able to contribute to the Tcpreplay project directly if you -use this method. If you believe that you may someday contribute to the repository, GitHub provides -an innovative approach. Forking the @appneta/tcpreplay repository allows you to work -on your own copy of the repository and submit code changes without first asking permission -from the authors. Forking is also considered to be a compliment so fork away: + +How To Contribute +================= +It's easy. Basically you... + +* [Set up git][git] +* [Fork] +* Edit (we that you create a branch per issue) +* [Send a PR][pr] + +
+ +Details: +-------- +You will find that you will not be able to contribute to the Tcpreplay project directly if you +use clone the appneta/tcpreplay repo. If you believe that you may someday contribute to the +repository, GitHub provides an innovative approach. Forking the @appneta/tcpreplay repository +allows you to work on your own copy of the repository and submit code changes without first +asking permission from the authors. Forking is also considered to be a compliment so fork away: + * if you haven't already done so, get yourself a free [GitHub](https://github.com) ID and visit @appneta/tcpreplay * click the **Fork** button to get your own private copy of the repository * on your build system clone your private repository: @@ -125,15 +190,32 @@ from the authors. Forking is also considered to be a compliment so fork away: ``` git clone git@github.com:/tcpreplay.git ``` -* we like to keep the **master** branch available for projection ready code so we recommend that you make a branch fore each feature or bug fix + +* we like to keep the **master** branch available for projection ready code so we recommend that you make a +branch for each feature or bug fix * when you are happy with your work, push it to your GitHub repository * on your GitHub repository select your new branch and submit a **Pull Request** to **master** * optionally monitor the status of your submission [here](https://github.com/appneta/tcpreplay/network) -We will review and possibly discuss the changes with you through GitHub services. If we accept the submission, it will instantly be applied to the production **master** branch. +We will review and possibly discuss the changes with you through GitHub services. +If we accept the submission, it will instantly be applied to the production **master** branch. -## Additional information +Additional Information +====================== Please visit our [wiki](http://tcpreplay.appneta.com). or visit our [developers wiki](https://github.com/appneta/tcpreplay/wiki) +[GPLv3]: http://www.gnu.org/licenses/gpl-3.0.html +[netmap]: http://info.iet.unipi.it/~luigi/netmap/ +[flow]: http://en.wikipedia.org/wiki/Traffic_flow_%28computer_networking%29 +[NetFlow]: http://www.cisco.com/go/netflow +[Cygwin]: http://www.cygwin.com/ +[Wireshark]: http://www.wireshark.org +[tcpdump]: http://www.tcpdump.org +[Ethereal]: http://www.ethreal.com +[Cisco]: http://www.cisco.com +[AppNeta]: http://www.appneta.com +[git]: https://help.github.com/articles/set-up-git +[Fork]: https://help.github.com/articles/fork-a-repo +[pr]: https://help.github.com/articles/using-pull-requests From 8df0dbd379053832891fdc1f75485bc223af4e02 Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Tue, 31 Dec 2013 15:47:56 -0800 Subject: [PATCH 07/20] Merged Juniper Encapsulated Ethernet DLT from synfinatic/tcpreplay master - for #42 --- src/tcpedit/Makefile.in | 54 ++- src/tcpedit/plugins/Makefile.am | 2 + .../plugins/dlt_jnpr_ether/Makefile.am | 28 ++ .../plugins/dlt_jnpr_ether/jnpr_ether.c | 430 ++++++++++++++++++ .../plugins/dlt_jnpr_ether/jnpr_ether.h | 59 +++ .../plugins/dlt_jnpr_ether/jnpr_ether_api.c | 48 ++ .../plugins/dlt_jnpr_ether/jnpr_ether_api.h | 38 ++ .../dlt_jnpr_ether/jnpr_ether_opts.def | 1 + .../plugins/dlt_jnpr_ether/jnpr_ether_types.h | 51 +++ src/tcpedit/plugins/dlt_opts.def | 2 + src/tcpedit/plugins/dlt_plugins.c | 2 + src/tcpedit/plugins/dlt_stub.def | 1 + src/tcpedit/plugins/dlt_template.sh | 24 +- .../plugins/dlt_template/plugin.c.tmpl | 1 + 14 files changed, 726 insertions(+), 15 deletions(-) create mode 100644 src/tcpedit/plugins/dlt_jnpr_ether/Makefile.am create mode 100644 src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c create mode 100644 src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.h create mode 100644 src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_api.c create mode 100644 src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_api.h create mode 100644 src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_opts.def create mode 100644 src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_types.h diff --git a/src/tcpedit/Makefile.in b/src/tcpedit/Makefile.in index 69df31afc..8a88c46a5 100644 --- a/src/tcpedit/Makefile.in +++ b/src/tcpedit/Makefile.in @@ -92,6 +92,14 @@ # add any other files (like documentation, notes, etc) to EXTRA_DIST # add your dependancy information (see comment below) +# $Id:$ +# START OF: dlt_jnpr_ether +# Note, if you add any files to your plugin, you will need to edit dlt_jnpr_ether/Makefile.am +# add your .c files to libtcpedit_a_SOURCES +# add your .h files to noinst_HEADERS +# add any other files (like documentation, notes, etc) to EXTRA_DIST +# add your dependancy information (see comment below) + VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ @@ -118,6 +126,7 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/plugins/dlt_en10mb/Makefile.am \ $(srcdir)/plugins/dlt_hdlc/Makefile.am \ $(srcdir)/plugins/dlt_ieee80211/Makefile.am \ + $(srcdir)/plugins/dlt_jnpr_ether/Makefile.am \ $(srcdir)/plugins/dlt_linuxsll/Makefile.am \ $(srcdir)/plugins/dlt_loop/Makefile.am \ $(srcdir)/plugins/dlt_null/Makefile.am \ @@ -145,7 +154,8 @@ am_libtcpedit_a_OBJECTS = tcpedit.$(OBJEXT) parse_args.$(OBJEXT) \ en10mb_api.$(OBJEXT) hdlc.$(OBJEXT) hdlc_api.$(OBJEXT) \ user.$(OBJEXT) user_api.$(OBJEXT) raw.$(OBJEXT) null.$(OBJEXT) \ loop.$(OBJEXT) linuxsll.$(OBJEXT) ieee80211.$(OBJEXT) \ - ieee80211_hdr.$(OBJEXT) radiotap.$(OBJEXT) + ieee80211_hdr.$(OBJEXT) radiotap.$(OBJEXT) \ + jnpr_ether.$(OBJEXT) libtcpedit_a_OBJECTS = $(am_libtcpedit_a_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/config/depcomp @@ -333,7 +343,8 @@ libtcpedit_a_SOURCES = tcpedit.c parse_args.c edit_packet.c portmap.c \ $(srcdir)/plugins/dlt_linuxsll/linuxsll.c \ $(srcdir)/plugins/dlt_ieee80211/ieee80211.c \ $(srcdir)/plugins/dlt_ieee80211/ieee80211_hdr.c \ - $(srcdir)/plugins/dlt_radiotap/radiotap.c + $(srcdir)/plugins/dlt_radiotap/radiotap.c \ + $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c AM_CFLAGS = -I.. -I../common -I../.. @LDNETINC@ $(LIBOPTS_CFLAGS) \ $(LNAV_CFLAGS) -I. -I$(srcdir)/plugins -I$(srcdir)/../common \ $(LIBOPTS_CFLAGS) @@ -359,7 +370,8 @@ noinst_HEADERS = tcpedit.h edit_packet.h portmap.h tcpedit_stub.h \ $(srcdir)/plugins/dlt_ieee80211/ieee80211.h \ $(srcdir)/plugins/dlt_ieee80211/ieee80211_hdr.h \ $(srcdir)/plugins/dlt_ieee80211/ieee80211_types.h \ - $(srcdir)/plugins/dlt_radiotap/radiotap.h + $(srcdir)/plugins/dlt_radiotap/radiotap.h \ + $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.h # Note: # You probably don't want to touch anything below this line until the end of the plugin @@ -372,7 +384,8 @@ MOSTLYCLEANFILES = *~ $(srcdir)/plugins/*~ \ $(srcdir)/plugins/dlt_null/*~ $(srcdir)/plugins/dlt_loop/*~ \ $(srcdir)/plugins/dlt_linuxsll/*~ \ $(srcdir)/plugins/dlt_ieee80211/*~ \ - $(srcdir)/plugins/dlt_radiotap/*~ + $(srcdir)/plugins/dlt_radiotap/*~ \ + $(srcdir)/plugins/dlt_jnpr_ether/*~ MAINTAINERCLEANFILES = Makefile.in tcpedit_stub.h tcpedit.1 \ Makefile.in EXTRA_DIST = tcpedit_stub.def tcpedit_opts.def \ @@ -385,7 +398,10 @@ EXTRA_DIST = tcpedit_stub.def tcpedit_opts.def \ $(srcdir)/plugins/dlt_loop/loop_opts.def \ $(srcdir)/plugins/dlt_linuxsll/linuxsll_opts.def \ $(srcdir)/plugins/dlt_ieee80211/ieee80211_opts.def \ - $(srcdir)/plugins/dlt_radiotap/radiotap_opts.def + $(srcdir)/plugins/dlt_radiotap/radiotap_opts.def \ + $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether_opts.def + +# You probably don't want to touch anything below this line until the end of the plugin # You probably don't want to touch anything below this line until the end of the plugin @@ -407,13 +423,14 @@ DLT_STUB_DEPS = $(srcdir)/plugins/dlt_opts.def \ $(srcdir)/plugins/dlt_loop/loop_opts.def \ $(srcdir)/plugins/dlt_linuxsll/linuxsll_opts.def \ $(srcdir)/plugins/dlt_ieee80211/ieee80211_opts.def \ - $(srcdir)/plugins/dlt_radiotap/radiotap_opts.def + $(srcdir)/plugins/dlt_radiotap/radiotap_opts.def \ + $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether_opts.def all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/plugins/Makefile.am $(srcdir)/plugins/dlt_en10mb/Makefile.am $(srcdir)/plugins/dlt_hdlc/Makefile.am $(srcdir)/plugins/dlt_user/Makefile.am $(srcdir)/plugins/dlt_raw/Makefile.am $(srcdir)/plugins/dlt_null/Makefile.am $(srcdir)/plugins/dlt_loop/Makefile.am $(srcdir)/plugins/dlt_linuxsll/Makefile.am $(srcdir)/plugins/dlt_ieee80211/Makefile.am $(srcdir)/plugins/dlt_radiotap/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/plugins/Makefile.am $(srcdir)/plugins/dlt_en10mb/Makefile.am $(srcdir)/plugins/dlt_hdlc/Makefile.am $(srcdir)/plugins/dlt_user/Makefile.am $(srcdir)/plugins/dlt_raw/Makefile.am $(srcdir)/plugins/dlt_null/Makefile.am $(srcdir)/plugins/dlt_loop/Makefile.am $(srcdir)/plugins/dlt_linuxsll/Makefile.am $(srcdir)/plugins/dlt_ieee80211/Makefile.am $(srcdir)/plugins/dlt_radiotap/Makefile.am $(srcdir)/plugins/dlt_jnpr_ether/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -469,6 +486,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hdlc_api.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ieee80211.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ieee80211_hdr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jnpr_ether.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linuxsll.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loop.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/null.Po@am__quote@ @@ -726,6 +744,20 @@ radiotap.obj: $(srcdir)/plugins/dlt_radiotap/radiotap.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o radiotap.obj `if test -f '$(srcdir)/plugins/dlt_radiotap/radiotap.c'; then $(CYGPATH_W) '$(srcdir)/plugins/dlt_radiotap/radiotap.c'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/plugins/dlt_radiotap/radiotap.c'; fi` +jnpr_ether.o: $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT jnpr_ether.o -MD -MP -MF $(DEPDIR)/jnpr_ether.Tpo -c -o jnpr_ether.o `test -f '$(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c' || echo '$(srcdir)/'`$(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/jnpr_ether.Tpo $(DEPDIR)/jnpr_ether.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c' object='jnpr_ether.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o jnpr_ether.o `test -f '$(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c' || echo '$(srcdir)/'`$(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c + +jnpr_ether.obj: $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT jnpr_ether.obj -MD -MP -MF $(DEPDIR)/jnpr_ether.Tpo -c -o jnpr_ether.obj `if test -f '$(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c'; then $(CYGPATH_W) '$(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/jnpr_ether.Tpo $(DEPDIR)/jnpr_ether.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c' object='jnpr_ether.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o jnpr_ether.obj `if test -f '$(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c'; then $(CYGPATH_W) '$(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c'; fi` + mostlyclean-libtool: -rm -f *.lo @@ -1024,6 +1056,14 @@ $(srcdir)/plugins/dlt_radiotap/radiotap.c: $(srcdir)/tcpedit_stub.h $(srcdir)/p # END OF: dlt_radiotap +# dependancies for your plugin source code. Edit as necessary +$(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c: $(srcdir)/tcpedit_stub.h $(srcdir)/plugins/dlt_utils.h \ + $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.h $(srcdir)/tcpedit_stub.h $(srcdir)/plugins/dlt_utils.h \ + $(srcdir)/plugins.h $(srcdir)/plugins_api.h $(srcdir)/plugins_types.h \ + $(srcdir)/tcpedit_api.h + +# END OF: dlt_jnpr_ether + ######################################################## # Add your plugin Makefile.am's below this line ######################################################## diff --git a/src/tcpedit/plugins/Makefile.am b/src/tcpedit/plugins/Makefile.am index e26054299..1885d3c81 100644 --- a/src/tcpedit/plugins/Makefile.am +++ b/src/tcpedit/plugins/Makefile.am @@ -31,3 +31,5 @@ include $(srcdir)/plugins/dlt_loop/Makefile.am include $(srcdir)/plugins/dlt_linuxsll/Makefile.am include $(srcdir)/plugins/dlt_ieee80211/Makefile.am include $(srcdir)/plugins/dlt_radiotap/Makefile.am +include $(srcdir)/plugins/dlt_jnpr_ether/Makefile.am + diff --git a/src/tcpedit/plugins/dlt_jnpr_ether/Makefile.am b/src/tcpedit/plugins/dlt_jnpr_ether/Makefile.am new file mode 100644 index 000000000..dc4b0cc79 --- /dev/null +++ b/src/tcpedit/plugins/dlt_jnpr_ether/Makefile.am @@ -0,0 +1,28 @@ +# $Id:$ +# START OF: dlt_jnpr_ether +# Note, if you add any files to your plugin, you will need to edit dlt_jnpr_ether/Makefile.am +# add your .c files to libtcpedit_a_SOURCES +# add your .h files to noinst_HEADERS +# add any other files (like documentation, notes, etc) to EXTRA_DIST +# add your dependancy information (see comment below) + +libtcpedit_a_SOURCES += $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c + +noinst_HEADERS += $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.h + +EXTRA_DIST += $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether_opts.def + +# dependancies for your plugin source code. Edit as necessary +$(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c: $(srcdir)/tcpedit_stub.h $(srcdir)/plugins/dlt_utils.h \ + $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.h $(srcdir)/tcpedit_stub.h $(srcdir)/plugins/dlt_utils.h \ + $(srcdir)/plugins.h $(srcdir)/plugins_api.h $(srcdir)/plugins_types.h \ + $(srcdir)/tcpedit_api.h + + +# You probably don't want to touch anything below this line until the end of the plugin + +DLT_STUB_DEPS += $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether_opts.def + +MOSTLYCLEANFILES += $(srcdir)/plugins/dlt_jnpr_ether/*~ + +# END OF: dlt_jnpr_ether diff --git a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c new file mode 100644 index 000000000..3e4060e25 --- /dev/null +++ b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c @@ -0,0 +1,430 @@ +/* $Id$ */ + +/* + * Copyright (c) 2006-2007 Aaron Turner. + * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the names of the copyright owners nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +#include "defines.h" +#include "common.h" +#include "tcpr.h" +#include "tcpedit.h" +#include "dlt_utils.h" +#include "tcpedit_stub.h" +#include "jnpr_ether.h" +#include "jnpr_ether_types.h" +#include "../ethernet.h" +#include "../dlt_en10mb/en10mb.h" + +static char dlt_name[] = "jnpr_eth"; +static char dlt_prefix[] = "jnpr_ether"; +static uint16_t dlt_value = DLT_JUNIPER_ETHER; + +/* + * Function to register ourselves. This function is always called, regardless + * of what DLT types are being used, so it shouldn't be allocating extra buffers + * or anything like that (use the dlt_jnpr_ether_init() function below for that). + * Tasks: + * - Create a new plugin struct + * - Fill out the provides/requires bit masks. Note: Only specify which fields are + * actually in the header. + * - Add the plugin to the context's plugin chain + * Returns: TCPEDIT_ERROR | TCPEDIT_OK | TCPEDIT_WARN + */ +int +dlt_jnpr_ether_register(tcpeditdlt_t *ctx) +{ + tcpeditdlt_plugin_t *plugin; + assert(ctx); + + /* create a new plugin structure */ + plugin = tcpedit_dlt_newplugin(); + + plugin->provides += PLUGIN_MASK_PROTO + PLUGIN_MASK_SRCADDR + PLUGIN_MASK_DSTADDR; + plugin->requires = 0; + + /* what is our DLT value? */ + plugin->dlt = dlt_value; + + /* set the prefix name of our plugin. This is also used as the prefix for our options */ + plugin->name = safe_strdup(dlt_name); + + /* + * Point to our functions, note, you need a function for EVERY method. + * Even if it is only an empty stub returning success. + */ + plugin->plugin_init = dlt_jnpr_ether_init; + plugin->plugin_post_init = dlt_jnpr_ether_post_init; + plugin->plugin_cleanup = dlt_jnpr_ether_cleanup; + plugin->plugin_parse_opts = dlt_jnpr_ether_parse_opts; + plugin->plugin_decode = dlt_jnpr_ether_decode; + plugin->plugin_encode = dlt_jnpr_ether_encode; + plugin->plugin_proto = dlt_jnpr_ether_proto; + plugin->plugin_l2addr_type = dlt_jnpr_ether_l2addr_type; + plugin->plugin_l2len = dlt_jnpr_ether_l2len; + plugin->plugin_get_layer3 = dlt_jnpr_ether_get_layer3; + plugin->plugin_merge_layer3 = dlt_jnpr_ether_merge_layer3; + plugin->plugin_get_mac = dlt_jnpr_ether_get_mac; + + /* add it to the available plugin list */ + return tcpedit_dlt_addplugin(ctx, plugin); +} + + +/* + * Initializer function. This function is called only once, if and only iif + * this plugin will be utilized. Remember, if you need to keep track of any state, + * store it in your plugin->config, not a global! + * Returns: TCPEDIT_ERROR | TCPEDIT_OK | TCPEDIT_WARN + */ +int +dlt_jnpr_ether_init(tcpeditdlt_t *ctx) +{ + tcpeditdlt_plugin_t *plugin; + jnpr_ether_config_t *config; + assert(ctx); + + if ((plugin = tcpedit_dlt_getplugin(ctx, dlt_value)) == NULL) { + tcpedit_seterr(ctx->tcpedit, "Unable to initalize unregistered plugin %s", dlt_name); + return TCPEDIT_ERROR; + } + + /* allocate memory for our deocde extra data */ + if (sizeof(jnpr_ether_extra_t) > 0) + ctx->decoded_extra = safe_malloc(sizeof(jnpr_ether_extra_t)); + + /* allocate memory for our config data */ + if (sizeof(jnpr_ether_config_t) > 0) + plugin->config = safe_malloc(sizeof(jnpr_ether_config_t)); + + config = (jnpr_ether_config_t *)plugin->config; + + return TCPEDIT_OK; /* success */ +} + +/** + * Post init function. This function is called only once after init() and parse_opts() + * It basically allows decoders to properly initialize sub-plugins. + */ +int +dlt_jnpr_ether_post_init(tcpeditdlt_t *ctx) +{ + jnpr_ether_config_t *config; + + /* do nothing if we're not the decoder */ + if (ctx->decoder->dlt != dlt_value) + return TCPEDIT_OK; + + /* init our subcontext & decoder of en10mb */ + config = (jnpr_ether_config_t *)ctx->encoder->config; + config->subctx = tcpedit_dlt_init(ctx->tcpedit, DLT_EN10MB); + + return TCPEDIT_OK; +} + +/* + * Since this is used in a library, we should manually clean up after ourselves + * Unless you allocated some memory in dlt_jnpr_ether_init(), this is just an stub. + * Returns: TCPEDIT_ERROR | TCPEDIT_OK | TCPEDIT_WARN + */ +int +dlt_jnpr_ether_cleanup(tcpeditdlt_t *ctx) +{ + tcpeditdlt_plugin_t *plugin; + jnpr_ether_config_t *config; + + assert(ctx); + + if ((plugin = tcpedit_dlt_getplugin(ctx, dlt_value)) == NULL) { + tcpedit_seterr(ctx->tcpedit, "Unable to cleanup unregistered plugin %s", dlt_name); + return TCPEDIT_ERROR; + } + + if (ctx->decoded_extra != NULL) { + safe_free(ctx->decoded_extra); + ctx->decoded_extra = NULL; + } + + if (plugin->config != NULL) { + /* clean up the en10mb plugin */ + config = (jnpr_ether_config_t *)ctx->encoder->config; + tcpedit_dlt_cleanup(config->subctx); + plugin->config = NULL; + } + + return TCPEDIT_OK; /* success */ +} + +/* + * This is where you should define all your AutoGen AutoOpts option parsing. + * Any user specified option should have it's bit turned on in the 'provides' + * bit mask. + * Returns: TCPEDIT_ERROR | TCPEDIT_OK | TCPEDIT_WARN + */ +int +dlt_jnpr_ether_parse_opts(tcpeditdlt_t *ctx) +{ + assert(ctx); + + return TCPEDIT_OK; /* success */ +} + +/* + * Function to decode the layer 2 header in the packet. + * You need to fill out: + * - ctx->l2len + * - ctx->srcaddr + * - ctx->dstaddr + * - ctx->proto + * - ctx->decoded_extra + * Returns: TCPEDIT_ERROR | TCPEDIT_OK | TCPEDIT_WARN + */ +int +dlt_jnpr_ether_decode(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen) +{ + int jnpr_header_len = 0; + const u_char *ethernet = NULL; + jnpr_ether_config_t *config; + + + assert(ctx); + assert(packet); + assert(pktlen > JUNIPER_ETHER_HEADER_LEN); /* MAGIC + Static fields + Extension Length */ + + config = (jnpr_ether_config_t *)ctx->encoder->config; + + + /* first, verify magic */ + if (memcmp(packet, JUNIPER_ETHER_MAGIC, JUNIPER_ETHER_MAGIC_LEN) != 0) { + tcpedit_seterr(ctx->tcpedit, "Invalid magic 0x%02X%02X%02X", + packet[0], packet[1], packet[2]); + return TCPEDIT_ERROR; + } + + /* next make sure the L2 header is present */ + if ((packet[JUNIPER_ETHER_OPTIONS_OFFSET] & JUNIPER_ETHER_L2PRESENT) + != JUNIPER_ETHER_L2PRESENT) { + tcpedit_seterr(ctx->tcpedit, "Frame is missing L2 Header: %x", + packet[JUNIPER_ETHER_OPTIONS_OFFSET]); + return TCPEDIT_ERROR; + } + + /* then get the Juniper header length */ + memcpy(&jnpr_header_len, &packet[JUNIPER_ETHER_EXTLEN_OFFSET], 2); + + jnpr_header_len = ntohs(jnpr_header_len) + JUNIPER_ETHER_HEADER_LEN; + + dbgx(1, "jnpr header len: %d", jnpr_header_len); + /* make sure the packet is big enough to find the Ethernet Header */ + + if (pktlen < jnpr_header_len + TCPR_ETH_H) { + tcpedit_seterr(ctx->tcpedit, "Frame is too short! %d < %d", + pktlen, (jnpr_header_len + TCPR_ETH_H)); + return TCPEDIT_ERROR; + } + + ctx->l2len = jnpr_header_len; + + /* jump to the appropriate offset */ + ethernet = packet + jnpr_header_len; + + /* let the en10mb plugin decode the rest */ + if (tcpedit_dlt_decode(config->subctx, ethernet, (pktlen - jnpr_header_len)) == TCPEDIT_ERROR) + return TCPEDIT_ERROR; + + /* copy the subdecoder state to our encoder state */ + if (tcpedit_dlt_copy_decoder_state(ctx, config->subctx) == TCPEDIT_ERROR) + return TCPEDIT_ERROR; + + return TCPEDIT_OK; +} + +/* + * Function to encode the layer 2 header back into the packet. + * Returns: total packet len or TCPEDIT_ERROR + */ +int +dlt_jnpr_ether_encode(tcpeditdlt_t *ctx, u_char *packet, int pktlen, _U_ tcpr_dir_t dir) +{ + assert(ctx); + assert(pktlen > JUNIPER_ETHER_HEADER_LEN); /* MAGIC + Static fields + Extension Length */ + assert(packet); + + tcpedit_seterr(ctx->tcpedit, "%s", "DLT_JUNIPER_ETHER plugin does not support packet encoding"); + return TCPEDIT_ERROR; +} + +/* + * Function returns the Layer 3 protocol type of the given packet, or TCPEDIT_ERROR on error + * Make sure you return this value in NETWORK byte order! + */ +int +dlt_jnpr_ether_proto(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen) +{ + int jnpr_hdr_len; + const u_char *ethernet; + jnpr_ether_config_t *config; + + assert(ctx); + assert(packet); + assert(pktlen > JUNIPER_ETHER_HEADER_LEN); /* MAGIC + Static fields + Extension Length */ + + config = (jnpr_ether_config_t *)ctx->encoder->config; + + + /* next make sure the L2 header is present */ + if ((packet[JUNIPER_ETHER_OPTIONS_OFFSET] & JUNIPER_ETHER_L2PRESENT) + != JUNIPER_ETHER_L2PRESENT) { + tcpedit_seterr(ctx->tcpedit, "Frame is missing L2 Header: %x", + packet[JUNIPER_ETHER_OPTIONS_OFFSET]); + return TCPEDIT_ERROR; + } + + /* then get the Juniper header length */ + memcpy(&jnpr_hdr_len, &packet[JUNIPER_ETHER_EXTLEN_OFFSET], 2); + + jnpr_hdr_len = ntohs(jnpr_hdr_len) + JUNIPER_ETHER_HEADER_LEN; + ethernet = packet + jnpr_hdr_len; + + /* let the en10mb plugin do the rest of the work */ + return tcpedit_dlt_proto(config->subctx, DLT_EN10MB, ethernet, (pktlen - jnpr_hdr_len)); +} + +/* + * Function returns a pointer to the layer 3 protocol header or NULL on error + */ +u_char * +dlt_jnpr_ether_get_layer3(tcpeditdlt_t *ctx, u_char *packet, const int pktlen) +{ + int l2len; + assert(ctx); + assert(packet); + + /* next make sure the L2 header is present */ + if ((packet[JUNIPER_ETHER_OPTIONS_OFFSET] & JUNIPER_ETHER_L2PRESENT) + != JUNIPER_ETHER_L2PRESENT) { + tcpedit_seterr(ctx->tcpedit, "Frame is missing L2 Header: %x", + packet[JUNIPER_ETHER_OPTIONS_OFFSET]); + return NULL; + } + + l2len = dlt_jnpr_ether_l2len(ctx, packet, pktlen); + + assert(pktlen >= l2len); + + return tcpedit_dlt_l3data_copy(ctx, packet, pktlen, l2len); +} + +/* + * function merges the packet (containing L2 and old L3) with the l3data buffer + * containing the new l3 data. Note, if L2 % 4 == 0, then they're pointing to the + * same buffer, otherwise there was a memcpy involved on strictly aligned architectures + * like SPARC + */ +u_char * +dlt_jnpr_ether_merge_layer3(tcpeditdlt_t *ctx, u_char *packet, const int pktlen, u_char *l3data) +{ + int l2len; + assert(ctx); + assert(packet); + assert(l3data); + + l2len = dlt_jnpr_ether_l2len(ctx, packet, pktlen); + + assert(pktlen >= l2len); + + return tcpedit_dlt_l3data_merge(ctx, packet, pktlen, l3data, l2len); +} + +/* + * return a static pointer to the source/destination MAC address + * return NULL on error/address doesn't exist + */ +u_char * +dlt_jnpr_ether_get_mac(tcpeditdlt_t *ctx, tcpeditdlt_mac_type_t mac, const u_char *packet, const int pktlen) +{ + const u_char *ethernet = NULL; + jnpr_ether_config_t *config; + int jnpr_hdr_len = 0; + + assert(ctx); + assert(packet); + assert(pktlen); + + config = (jnpr_ether_config_t *)ctx->encoder->config; + + /* first get the Juniper header length */ + memcpy(&jnpr_hdr_len, &packet[JUNIPER_ETHER_EXTLEN_OFFSET], 2); + + jnpr_hdr_len = ntohs(jnpr_hdr_len) + JUNIPER_ETHER_HEADER_LEN; + ethernet = packet + jnpr_hdr_len; + + return dlt_en10mb_get_mac(config->subctx, mac, ethernet, (pktlen - jnpr_hdr_len)); +} + + +/* + * return the length of the L2 header of the current packet + */ +int +dlt_jnpr_ether_l2len(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen) +{ + uint16_t len; + jnpr_ether_config_t *config; + + assert(ctx); + assert(packet); + assert(pktlen); + + config = (jnpr_ether_config_t *)ctx->encoder->config; + + /* first get the Juniper header length */ + memcpy(&len, &packet[JUNIPER_ETHER_EXTLEN_OFFSET], 2); + + len = ntohs(len) + JUNIPER_ETHER_HEADER_LEN; + dbgx(3, "juniper header len: %u", len); + + /* add the 802.3 length */ + len += tcpedit_dlt_l2len(config->subctx, DLT_EN10MB, (packet + len), (pktlen - len)); + dbgx(3, "total l2len: %u", len); + + /* and return that */ + return len; +} + + +tcpeditdlt_l2addr_type_t +dlt_jnpr_ether_l2addr_type(void) +{ + return ETHERNET; +} + diff --git a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.h b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.h new file mode 100644 index 000000000..b362effeb --- /dev/null +++ b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.h @@ -0,0 +1,59 @@ +/* $Id$ */ + +/* + * Copyright (c) 2001-2010 Aaron Turner + * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * + * The Tcpreplay Suite of tools is free software: you can redistribute it + * and/or modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or with the authors permission any later version. + * + * The Tcpreplay Suite is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with the Tcpreplay Suite. If not, see . + */ + +#ifndef _DLT_jnpr_ether_H_ +#define _DLT_jnpr_ether_H_ + +#include "jnpr_ether_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define JUNIPER_ETHER_HEADER_LEN 6 +#define JUNIPER_ETHER_MAGIC_LEN 3 +#define JUNIPER_ETHER_MAGIC "\x4d\x47\x43" +#define JUNIPER_ETHER_OPTIONS_OFFSET 3 +#define JUNIPER_ETHER_L2PRESENT 0x80 +#define JUNIPER_ETHER_DIRECTION 0x01 +#define JUNIPER_ETHER_EXTLEN_OFFSET 4 + + +int dlt_jnpr_ether_register(tcpeditdlt_t *ctx); +int dlt_jnpr_ether_init(tcpeditdlt_t *ctx); +int dlt_jnpr_ether_post_init(tcpeditdlt_t *ctx); +int dlt_jnpr_ether_cleanup(tcpeditdlt_t *ctx); +int dlt_jnpr_ether_parse_opts(tcpeditdlt_t *ctx); +int dlt_jnpr_ether_decode(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen); +int dlt_jnpr_ether_encode(tcpeditdlt_t *ctx, u_char *packet, int pktlen, tcpr_dir_t dir); +int dlt_jnpr_ether_proto(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen); +u_char *dlt_jnpr_ether_get_layer3(tcpeditdlt_t *ctx, u_char *packet, const int pktlen); +u_char *dlt_jnpr_ether_merge_layer3(tcpeditdlt_t *ctx, u_char *packet, const int pktlen, u_char *l3data); +tcpeditdlt_l2addr_type_t dlt_jnpr_ether_l2addr_type(void); +int dlt_jnpr_ether_l2len(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen); +u_char *dlt_jnpr_ether_get_mac(tcpeditdlt_t *ctx, tcpeditdlt_mac_type_t mac, const u_char *packet, const int pktlen); + + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_api.c b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_api.c new file mode 100644 index 000000000..9d5253f6e --- /dev/null +++ b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_api.c @@ -0,0 +1,48 @@ +/* $Id$ */ + +/* + * Copyright (c) 2009 Aaron Turner. + * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the names of the copyright owners nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +/* + * FIXME: If you are creating an encoder plugin with any options + * then you need to create API calls for each option so that the + * GUI or other programs using libtcpedit can set those values. + * + * Just uncomment the following headers, declare your methods in + * jnpr_ether_api.h and write them here... + +#include "common.h" +#include "tcpr.h" +#include "tcpedit.h" +#include "jnpr_ether_types.h" + +*/ \ No newline at end of file diff --git a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_api.h b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_api.h new file mode 100644 index 000000000..f1018b794 --- /dev/null +++ b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_api.h @@ -0,0 +1,38 @@ +/* $Id$ */ + +/* + * Copyright (c) 2001-2010 Aaron Turner + * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * + * The Tcpreplay Suite of tools is free software: you can redistribute it + * and/or modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or with the authors permission any later version. + * + * The Tcpreplay Suite is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with the Tcpreplay Suite. If not, see . + */ + +#ifndef _DLT_jnpr_ether_API_H_ +#define _DLT_jnpr_ether_API_H_ + +#include "tcpedit_types.h" +#include "plugins_types.h" +#include "jnpr_ether_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_opts.def b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_opts.def new file mode 100644 index 000000000..ffbc19c2f --- /dev/null +++ b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_opts.def @@ -0,0 +1 @@ +/* Add the flag definitions for your plugin here */ \ No newline at end of file diff --git a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_types.h b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_types.h new file mode 100644 index 000000000..dba0fd8e0 --- /dev/null +++ b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_types.h @@ -0,0 +1,51 @@ +/* $Id$ */ + +/* + * Copyright (c) 2001-2010 Aaron Turner + * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * + * The Tcpreplay Suite of tools is free software: you can redistribute it + * and/or modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or with the authors permission any later version. + * + * The Tcpreplay Suite is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with the Tcpreplay Suite. If not, see . + */ + +#ifndef _DLT_jnpr_ether_TYPES_H_ +#define _DLT_jnpr_ether_TYPES_H_ + +#include "jnpr_ether_api.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * structure to hold any data parsed from the packet by the decoder. + */ +typedef struct jnpr_ether_extra_s { + ; +} jnpr_ether_extra_t; + + +/* we have no user config data */ +typedef struct jnpr_ether_config_s { + /* sub-plugin context for the en10mb plugin */ + tcpeditdlt_t *subctx; +} jnpr_ether_config_t; + + + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/src/tcpedit/plugins/dlt_opts.def b/src/tcpedit/plugins/dlt_opts.def index 74fa7578c..6ddc106d7 100644 --- a/src/tcpedit/plugins/dlt_opts.def +++ b/src/tcpedit/plugins/dlt_opts.def @@ -34,6 +34,8 @@ Ethernet aka DLT_EN10MB @item @var{hdlc} Cisco HDLC aka DLT_C_HDLC +@var{jnpr_ether} +Juniper Ethernet DLT_C_JNPR_ETHER @item @var{user} User specified Layer 2 header and DLT type diff --git a/src/tcpedit/plugins/dlt_plugins.c b/src/tcpedit/plugins/dlt_plugins.c index 2611ebb84..0eeb95098 100644 --- a/src/tcpedit/plugins/dlt_plugins.c +++ b/src/tcpedit/plugins/dlt_plugins.c @@ -40,6 +40,7 @@ #include "dlt_linuxsll/linuxsll.h" #include "dlt_ieee80211/ieee80211.h" #include "dlt_radiotap/radiotap.h" +#include "dlt_jnpr_ether/jnpr_ether.h" /** @@ -61,6 +62,7 @@ tcpedit_dlt_register(tcpeditdlt_t *ctx) retcode += dlt_linuxsll_register(ctx); retcode += dlt_ieee80211_register(ctx); retcode += dlt_radiotap_register(ctx); + retcode += dlt_jnpr_ether_register(ctx); if (retcode < 0) return TCPEDIT_ERROR; diff --git a/src/tcpedit/plugins/dlt_stub.def b/src/tcpedit/plugins/dlt_stub.def index cb3636911..9562cacb0 100644 --- a/src/tcpedit/plugins/dlt_stub.def +++ b/src/tcpedit/plugins/dlt_stub.def @@ -10,3 +10,4 @@ #include dlt_linuxsll/linuxsll_opts.def #include dlt_ieee80211/ieee80211_opts.def #include dlt_radiotap/radiotap_opts.def +#include dlt_jnpr_ether/jnpr_ether_opts.def diff --git a/src/tcpedit/plugins/dlt_template.sh b/src/tcpedit/plugins/dlt_template.sh index 2d08fe687..41ce79916 100755 --- a/src/tcpedit/plugins/dlt_template.sh +++ b/src/tcpedit/plugins/dlt_template.sh @@ -28,6 +28,16 @@ if [ ! -d $PLUGINDIR ]; then try mkdir $PLUGINDIR fi + +# Files to not change their name +for i in Makefile.am ; do + if [ -f ${PLUGINDIR}/$i ]; then + echo "Skipping ${PLUGINDIR}/$i" + continue; + fi + try sed -e "s/%{plugin}/$PLUGIN/g" dlt_template/$i >${PLUGINDIR}/$i +done + # Files to have their name changed for i in plugin.c.tmpl plugin.h plugin_opts.def plugin_api.c.tmpl plugin_api.h plugin_types.h ; do OUTFILE=`echo $i | sed -E "s/plugin/${PLUGIN}/"` @@ -38,21 +48,19 @@ for i in plugin.c.tmpl plugin.h plugin_opts.def plugin_api.c.tmpl plugin_api.h p continue; fi - try sed -E "s/%{plugin}/${PLUGIN}/g" dlt_template/$i >$OUTFILE + try sed -e "s/%{plugin}/${PLUGIN}/g" dlt_template/$i >$OUTFILE done # tell the user what to do now echo "Plugin template created in: $PLUGINDIR" echo "" +echo "Pleased be sure to modify ./Makefile.am and add the line to the END OF THE FILE:" +echo "include \$(srcdir)/plugins/${PLUGINDIR}/Makefile.am" +echo "" echo "You must also modify ./dlt_stub.def and add the line:" echo "#include ${PLUGINDIR}/${PLUGIN}_opts.def" echo "" -echo "Next, put any configuration parsing functions in ${PLUGINDIR}/${PLUGIN}_api.[ch]" -echo "" echo "Next, you must make the appropriate modifications to ./dlt_plugin.c" -echo "You'll want to use your configuration parsing functions from above in your" -echo "tcpedit_${PLUGIN}_parse_opts() function" -echo "" -echo "Lastly, re-run 'cmake' from the root source directory" -echo "and run 'make' to build your new plugin" +echo "Lastly, re-run automake from the root source directory" +echo "and run ./configure to build your new plugin" exit 0 diff --git a/src/tcpedit/plugins/dlt_template/plugin.c.tmpl b/src/tcpedit/plugins/dlt_template/plugin.c.tmpl index e0a3822d4..a0b820d74 100644 --- a/src/tcpedit/plugins/dlt_template/plugin.c.tmpl +++ b/src/tcpedit/plugins/dlt_template/plugin.c.tmpl @@ -2,6 +2,7 @@ /* * Copyright (c) 2006-2007 Aaron Turner. + * Copyright (c) 2013 Fred Klassen - AppNeta Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without From 9e83a0adc039ff1ffd7d37f43e21a68d53323604 Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Tue, 31 Dec 2013 15:52:26 -0800 Subject: [PATCH 08/20] Updateed README for #40 --- README | 4 +++- README.md | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README b/README index 7e9898e93..f3f2474d1 100644 --- a/README +++ b/README @@ -93,9 +93,11 @@ will have to specify the netmap source directory, for example: make sudo make install +You can also find netmap source here (http://code.google.com/p/netmap/). + Detailed installation instructions are available in the INSTALL document in the tar ball. -Install from source code +Install Tcpreplay from source code ------------------------ Download the tar ball (https://github.com/appneta/tcpreplay/tarball/master) or zip (https://github.com/appneta/tcpreplay/zipball/master) file. Optionally clone the git diff --git a/README.md b/README.md index b31e2d518..e8b3b8c0b 100644 --- a/README.md +++ b/README.md @@ -89,9 +89,11 @@ make sudo make install ``` +You can also find netmap source [here](http://code.google.com/p/netmap/). + Detailed installation instructions are available in the INSTALL document in the tar ball. -Install from source code +Install Tcpreplay from source code ------------------------ Download the [tar ball](https://github.com/appneta/tcpreplay/tarball/master) or [zip](https://github.com/appneta/tcpreplay/zipball/master) file. Optionally clone the git From aa46e21ebc44dfa5dbd3dc04dc1d002ef483064c Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Tue, 31 Dec 2013 16:19:41 -0800 Subject: [PATCH 09/20] Updated Copyright statement to include 2014 --- lib/strlcpy.h | 2 +- src/bridge.c | 2 +- src/bridge.h | 2 +- src/common.h | 2 +- src/common/cache.c | 2 +- src/common/cache.h | 2 +- src/common/cidr.c | 2 +- src/common/cidr.h | 2 +- src/common/err.c | 2 +- src/common/err.h | 2 +- src/common/fakepcap.c | 2 +- src/common/fakepcap.h | 2 +- src/common/fakepcapnav.c | 2 +- src/common/fakepcapnav.h | 2 +- src/common/flows.c | 2 +- src/common/flows.h | 2 +- src/common/get.c | 2 +- src/common/get.h | 2 +- src/common/interface.c | 2 +- src/common/interface.h | 2 +- src/common/list.c | 2 +- src/common/list.h | 2 +- src/common/mac.c | 2 +- src/common/mac.h | 2 +- src/common/pcap_dlt.h | 2 +- src/common/sendpacket.c | 2 +- src/common/sendpacket.h | 2 +- src/common/services.c | 2 +- src/common/services.h | 2 +- src/common/tcpdump.c | 2 +- src/common/tcpdump.h | 2 +- src/common/timer.c | 2 +- src/common/timer.h | 2 +- src/common/utils.c | 2 +- src/common/utils.h | 2 +- src/common/xX.c | 2 +- src/common/xX.h | 2 +- src/fragroute/LICENSE | 2 +- src/fragroute/fragroute.c | 2 +- src/fragroute/fragroute.h | 2 +- src/replay.c | 2 +- src/replay.h | 2 +- src/send_packets.c | 2 +- src/send_packets.h | 2 +- src/signal_handler.c | 2 +- src/signal_handler.h | 2 +- src/sleep.c | 2 +- src/sleep.h | 2 +- src/tcpbridge.c | 2 +- src/tcpbridge.h | 2 +- src/tcpbridge_opts.def | 2 +- src/tcpcapinfo.c | 2 +- src/tcpcapinfo_opts.def | 2 +- src/tcpedit/checksum.c | 2 +- src/tcpedit/checksum.h | 2 +- src/tcpedit/dlt.c | 2 +- src/tcpedit/dlt.h | 2 +- src/tcpedit/edit_packet.c | 2 +- src/tcpedit/edit_packet.h | 2 +- src/tcpedit/parse_args.c | 2 +- src/tcpedit/parse_args.h | 2 +- src/tcpedit/plugins.h | 2 +- src/tcpedit/plugins/dlt_en10mb/en10mb.c | 2 +- src/tcpedit/plugins/dlt_en10mb/en10mb.h | 2 +- src/tcpedit/plugins/dlt_en10mb/en10mb_api.c | 2 +- src/tcpedit/plugins/dlt_en10mb/en10mb_api.h | 2 +- src/tcpedit/plugins/dlt_en10mb/en10mb_types.h | 2 +- src/tcpedit/plugins/dlt_hdlc/hdlc.c | 2 +- src/tcpedit/plugins/dlt_hdlc/hdlc.h | 2 +- src/tcpedit/plugins/dlt_hdlc/hdlc_api.c | 2 +- src/tcpedit/plugins/dlt_hdlc/hdlc_api.h | 2 +- src/tcpedit/plugins/dlt_hdlc/hdlc_types.h | 2 +- src/tcpedit/plugins/dlt_ieee80211/ieee80211.c | 2 +- src/tcpedit/plugins/dlt_ieee80211/ieee80211.h | 2 +- src/tcpedit/plugins/dlt_ieee80211/ieee80211_hdr.c | 2 +- src/tcpedit/plugins/dlt_ieee80211/ieee80211_hdr.h | 2 +- src/tcpedit/plugins/dlt_ieee80211/ieee80211_types.h | 2 +- src/tcpedit/plugins/dlt_linuxsll/linuxsll.c | 2 +- src/tcpedit/plugins/dlt_linuxsll/linuxsll.h | 2 +- src/tcpedit/plugins/dlt_loop/loop.c | 2 +- src/tcpedit/plugins/dlt_loop/loop.h | 2 +- src/tcpedit/plugins/dlt_null/null.c | 2 +- src/tcpedit/plugins/dlt_null/null.h | 2 +- src/tcpedit/plugins/dlt_plugins.c | 2 +- src/tcpedit/plugins/dlt_radiotap/radiotap.c | 2 +- src/tcpedit/plugins/dlt_radiotap/radiotap.h | 2 +- src/tcpedit/plugins/dlt_raw/raw.c | 2 +- src/tcpedit/plugins/dlt_raw/raw.h | 2 +- src/tcpedit/plugins/dlt_template/plugin.c.tmpl | 1 + src/tcpedit/plugins/dlt_template/plugin.h | 2 +- src/tcpedit/plugins/dlt_template/plugin_api.c.tmpl | 2 +- src/tcpedit/plugins/dlt_template/plugin_api.h | 2 +- src/tcpedit/plugins/dlt_template/plugin_types.h | 2 +- src/tcpedit/plugins/dlt_user/user.c | 2 +- src/tcpedit/plugins/dlt_user/user.h | 2 +- src/tcpedit/plugins/dlt_user/user_api.c | 2 +- src/tcpedit/plugins/dlt_user/user_api.h | 2 +- src/tcpedit/plugins/dlt_utils.c | 2 +- src/tcpedit/plugins/dlt_utils.h | 2 +- src/tcpedit/plugins/ethernet.c | 2 +- src/tcpedit/plugins/ethernet.h | 2 +- src/tcpedit/plugins_api.h | 2 +- src/tcpedit/plugins_types.h | 2 +- src/tcpedit/portmap.c | 2 +- src/tcpedit/portmap.h | 2 +- src/tcpedit/tcpedit.c | 2 +- src/tcpedit/tcpedit.h | 2 +- src/tcpedit/tcpedit_api.c | 2 +- src/tcpedit/tcpedit_api.h | 2 +- src/tcpedit/tcpedit_opts.def | 2 +- src/tcpedit/tcpedit_stub.def | 2 +- src/tcpedit/tcpedit_types.h | 2 +- src/tcpprep.c | 2 +- src/tcpprep.h | 2 +- src/tcpprep_api.c | 2 +- src/tcpprep_api.h | 2 +- src/tcpprep_opts.def | 2 +- src/tcpr.h | 2 +- src/tcpreplay.c | 2 +- src/tcpreplay.h | 2 +- src/tcpreplay_api.c | 2 +- src/tcpreplay_api.h | 2 +- src/tcpreplay_opts.def | 2 +- src/tcprewrite.c | 2 +- src/tcprewrite.h | 2 +- src/tcprewrite_opts.def | 2 +- src/timestamp_trace.h | 2 +- src/tree.c | 2 +- src/tree.h | 2 +- 129 files changed, 129 insertions(+), 128 deletions(-) diff --git a/lib/strlcpy.h b/lib/strlcpy.h index d69fe9ac0..b6e44729b 100644 --- a/lib/strlcpy.h +++ b/lib/strlcpy.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/bridge.c b/src/bridge.c index ee3f51258..3e7a5e77d 100644 --- a/src/bridge.c +++ b/src/bridge.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/bridge.h b/src/bridge.h index fa8000941..66e66141c 100644 --- a/src/bridge.h +++ b/src/bridge.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common.h b/src/common.h index 006bc3f0f..c3ca356d1 100644 --- a/src/common.h +++ b/src/common.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/cache.c b/src/common/cache.c index 5741e51d2..93195cf70 100644 --- a/src/common/cache.c +++ b/src/common/cache.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/cache.h b/src/common/cache.h index 74b74c2be..ac3ce1d02 100644 --- a/src/common/cache.h +++ b/src/common/cache.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/cidr.c b/src/common/cidr.c index d6eed6112..38abc6936 100644 --- a/src/common/cidr.c +++ b/src/common/cidr.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/cidr.h b/src/common/cidr.h index dec4f5caa..8db5d7e84 100644 --- a/src/common/cidr.h +++ b/src/common/cidr.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/err.c b/src/common/err.c index 3b735457e..36558630c 100644 --- a/src/common/err.c +++ b/src/common/err.c @@ -7,7 +7,7 @@ * * Copyright (c) 2001-2010 Aaron Turner. * - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * Copyright (c) 2000 Dug Song * diff --git a/src/common/err.h b/src/common/err.h index ea4fc447f..a9316f67b 100644 --- a/src/common/err.h +++ b/src/common/err.h @@ -7,7 +7,7 @@ * * Copyright (c) 2001-2010 Aaron Turner. * - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * Copyright (c) 2000 Dug Song * diff --git a/src/common/fakepcap.c b/src/common/fakepcap.c index eb80b8105..15eabfd5d 100644 --- a/src/common/fakepcap.c +++ b/src/common/fakepcap.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/fakepcap.h b/src/common/fakepcap.h index b5e47fc09..c0d47c67c 100644 --- a/src/common/fakepcap.h +++ b/src/common/fakepcap.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/fakepcapnav.c b/src/common/fakepcapnav.c index 3a83e434b..585baafa3 100644 --- a/src/common/fakepcapnav.c +++ b/src/common/fakepcapnav.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/fakepcapnav.h b/src/common/fakepcapnav.h index 3a5a51965..9f5503987 100644 --- a/src/common/fakepcapnav.h +++ b/src/common/fakepcapnav.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/flows.c b/src/common/flows.c index e6eae7d94..f42c897c8 100644 --- a/src/common/flows.c +++ b/src/common/flows.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/flows.h b/src/common/flows.h index 8c5d4243b..de034a9da 100644 --- a/src/common/flows.h +++ b/src/common/flows.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/get.c b/src/common/get.c index befa799ac..c7e20ae07 100644 --- a/src/common/get.c +++ b/src/common/get.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/get.h b/src/common/get.h index 7257fd7e5..9d9c1ec17 100644 --- a/src/common/get.h +++ b/src/common/get.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/interface.c b/src/common/interface.c index cc894adff..d252cd742 100644 --- a/src/common/interface.c +++ b/src/common/interface.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/interface.h b/src/common/interface.h index 249bc986a..fe83c45c1 100644 --- a/src/common/interface.h +++ b/src/common/interface.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/list.c b/src/common/list.c index ffcd499e6..c60b4ff51 100644 --- a/src/common/list.c +++ b/src/common/list.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/list.h b/src/common/list.h index 8a65e85d7..f279e9485 100644 --- a/src/common/list.h +++ b/src/common/list.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/mac.c b/src/common/mac.c index ca6ca919f..4cf5c62fb 100644 --- a/src/common/mac.c +++ b/src/common/mac.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/mac.h b/src/common/mac.h index 392c5e655..fda9513bd 100644 --- a/src/common/mac.h +++ b/src/common/mac.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/pcap_dlt.h b/src/common/pcap_dlt.h index 37c9fc593..06fd26333 100644 --- a/src/common/pcap_dlt.h +++ b/src/common/pcap_dlt.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/sendpacket.c b/src/common/sendpacket.c index 7778896a9..503dbe5dd 100644 --- a/src/common/sendpacket.c +++ b/src/common/sendpacket.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/sendpacket.h b/src/common/sendpacket.h index 04f515879..97869d6a9 100644 --- a/src/common/sendpacket.h +++ b/src/common/sendpacket.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/services.c b/src/common/services.c index bde4e97eb..e7ef3545e 100644 --- a/src/common/services.c +++ b/src/common/services.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/services.h b/src/common/services.h index a0f106a5b..1a3469339 100644 --- a/src/common/services.h +++ b/src/common/services.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/tcpdump.c b/src/common/tcpdump.c index c61fd8a08..f05b70fc6 100644 --- a/src/common/tcpdump.c +++ b/src/common/tcpdump.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/tcpdump.h b/src/common/tcpdump.h index fc846dbd6..afcb499b2 100644 --- a/src/common/tcpdump.h +++ b/src/common/tcpdump.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/timer.c b/src/common/timer.c index 8861726d9..edc642332 100755 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/timer.h b/src/common/timer.h index 4866c5f20..b5071b5b1 100755 --- a/src/common/timer.h +++ b/src/common/timer.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/utils.c b/src/common/utils.c index 5d4ef584a..9dc7ce5d9 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/utils.h b/src/common/utils.h index 5e6d75d03..876aa8114 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/xX.c b/src/common/xX.c index 93c537cd9..874e060b4 100644 --- a/src/common/xX.c +++ b/src/common/xX.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/common/xX.h b/src/common/xX.h index e35705452..130e95882 100644 --- a/src/common/xX.h +++ b/src/common/xX.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/fragroute/LICENSE b/src/fragroute/LICENSE index 4540d570f..7c9247018 100644 --- a/src/fragroute/LICENSE +++ b/src/fragroute/LICENSE @@ -1,7 +1,7 @@ Copyright (c) 2001, 2002 Dug Song Copyright (c) 2008 Aaron Turner - Copyright (c) 2013 Fred Klassen - AppNeta Inc. + Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. All rights reserved, all wrongs reversed. Redistribution and use in source and binary forms, with or without diff --git a/src/fragroute/fragroute.c b/src/fragroute/fragroute.c index cd89e3d0c..0c75522f2 100644 --- a/src/fragroute/fragroute.c +++ b/src/fragroute/fragroute.c @@ -3,7 +3,7 @@ * * Copyright (c) 2001 Dug Song * Copyright (c) 2007-2008 Aaron Turner. - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * $Id$ */ diff --git a/src/fragroute/fragroute.h b/src/fragroute/fragroute.h index d4dfd8214..4bb126a22 100644 --- a/src/fragroute/fragroute.h +++ b/src/fragroute/fragroute.h @@ -3,7 +3,7 @@ /* * Copyright (c) 2001 Dug Song * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/replay.c b/src/replay.c index 27355375d..bca01f316 100644 --- a/src/replay.c +++ b/src/replay.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/replay.h b/src/replay.h index 8874adc67..cfbf15445 100644 --- a/src/replay.h +++ b/src/replay.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/send_packets.c b/src/send_packets.c index 4f3440c04..d0ade0330 100644 --- a/src/send_packets.c +++ b/src/send_packets.c @@ -3,7 +3,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/send_packets.h b/src/send_packets.h index d535cd600..135b59c87 100644 --- a/src/send_packets.h +++ b/src/send_packets.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/signal_handler.c b/src/signal_handler.c index bf0911d7a..6ae908ac2 100644 --- a/src/signal_handler.c +++ b/src/signal_handler.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/signal_handler.h b/src/signal_handler.h index 1eb83015e..191c68b84 100644 --- a/src/signal_handler.h +++ b/src/signal_handler.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/sleep.c b/src/sleep.c index 31d432229..a5e1747b9 100644 --- a/src/sleep.c +++ b/src/sleep.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/sleep.h b/src/sleep.h index a61018087..091ada7da 100644 --- a/src/sleep.h +++ b/src/sleep.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpbridge.c b/src/tcpbridge.c index 54a440fa1..a2acb239f 100644 --- a/src/tcpbridge.c +++ b/src/tcpbridge.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpbridge.h b/src/tcpbridge.h index bec6efce7..9c1bde111 100644 --- a/src/tcpbridge.h +++ b/src/tcpbridge.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpbridge_opts.def b/src/tcpbridge_opts.def index a89eb9780..791d8e1b3 100644 --- a/src/tcpbridge_opts.def +++ b/src/tcpbridge_opts.def @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpcapinfo.c b/src/tcpcapinfo.c index 88e755cb7..7e1a4f7d1 100644 --- a/src/tcpcapinfo.c +++ b/src/tcpcapinfo.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2012 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpcapinfo_opts.def b/src/tcpcapinfo_opts.def index 75d85d696..1ce38b8b5 100644 --- a/src/tcpcapinfo_opts.def +++ b/src/tcpcapinfo_opts.def @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/checksum.c b/src/tcpedit/checksum.c index 1af3d22cf..fa86ad620 100644 --- a/src/tcpedit/checksum.c +++ b/src/tcpedit/checksum.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/checksum.h b/src/tcpedit/checksum.h index fa649ff30..cb62df466 100644 --- a/src/tcpedit/checksum.h +++ b/src/tcpedit/checksum.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/dlt.c b/src/tcpedit/dlt.c index 727cbb119..ed10e913f 100644 --- a/src/tcpedit/dlt.c +++ b/src/tcpedit/dlt.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/dlt.h b/src/tcpedit/dlt.h index 3cb0da6f4..862aec603 100644 --- a/src/tcpedit/dlt.h +++ b/src/tcpedit/dlt.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/edit_packet.c b/src/tcpedit/edit_packet.c index a4a064b2b..9a3925fbe 100644 --- a/src/tcpedit/edit_packet.c +++ b/src/tcpedit/edit_packet.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/edit_packet.h b/src/tcpedit/edit_packet.h index 61e3ec2af..6d1c6f643 100644 --- a/src/tcpedit/edit_packet.h +++ b/src/tcpedit/edit_packet.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/parse_args.c b/src/tcpedit/parse_args.c index 639f1ee38..1c1977a8d 100644 --- a/src/tcpedit/parse_args.c +++ b/src/tcpedit/parse_args.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/parse_args.h b/src/tcpedit/parse_args.h index f6ab936f8..3b27a6fc6 100644 --- a/src/tcpedit/parse_args.h +++ b/src/tcpedit/parse_args.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins.h b/src/tcpedit/plugins.h index 52caa8187..aed9de847 100644 --- a/src/tcpedit/plugins.h +++ b/src/tcpedit/plugins.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_en10mb/en10mb.c b/src/tcpedit/plugins/dlt_en10mb/en10mb.c index 6efbd85ae..274611dbc 100644 --- a/src/tcpedit/plugins/dlt_en10mb/en10mb.c +++ b/src/tcpedit/plugins/dlt_en10mb/en10mb.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_en10mb/en10mb.h b/src/tcpedit/plugins/dlt_en10mb/en10mb.h index a6d06695d..25b90e9dd 100644 --- a/src/tcpedit/plugins/dlt_en10mb/en10mb.h +++ b/src/tcpedit/plugins/dlt_en10mb/en10mb.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_en10mb/en10mb_api.c b/src/tcpedit/plugins/dlt_en10mb/en10mb_api.c index 0ec0eac3e..65a0072bd 100644 --- a/src/tcpedit/plugins/dlt_en10mb/en10mb_api.c +++ b/src/tcpedit/plugins/dlt_en10mb/en10mb_api.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_en10mb/en10mb_api.h b/src/tcpedit/plugins/dlt_en10mb/en10mb_api.h index 1b389b65c..6ada5f507 100644 --- a/src/tcpedit/plugins/dlt_en10mb/en10mb_api.h +++ b/src/tcpedit/plugins/dlt_en10mb/en10mb_api.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_en10mb/en10mb_types.h b/src/tcpedit/plugins/dlt_en10mb/en10mb_types.h index dc7fe0506..278255e12 100644 --- a/src/tcpedit/plugins/dlt_en10mb/en10mb_types.h +++ b/src/tcpedit/plugins/dlt_en10mb/en10mb_types.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_hdlc/hdlc.c b/src/tcpedit/plugins/dlt_hdlc/hdlc.c index 2122ea7e7..843a3ecee 100644 --- a/src/tcpedit/plugins/dlt_hdlc/hdlc.c +++ b/src/tcpedit/plugins/dlt_hdlc/hdlc.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_hdlc/hdlc.h b/src/tcpedit/plugins/dlt_hdlc/hdlc.h index 8dfb42d14..9e785956d 100644 --- a/src/tcpedit/plugins/dlt_hdlc/hdlc.h +++ b/src/tcpedit/plugins/dlt_hdlc/hdlc.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_hdlc/hdlc_api.c b/src/tcpedit/plugins/dlt_hdlc/hdlc_api.c index 29fc9187c..f9f6c40e3 100644 --- a/src/tcpedit/plugins/dlt_hdlc/hdlc_api.c +++ b/src/tcpedit/plugins/dlt_hdlc/hdlc_api.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_hdlc/hdlc_api.h b/src/tcpedit/plugins/dlt_hdlc/hdlc_api.h index 8cdafcea0..158024b4b 100644 --- a/src/tcpedit/plugins/dlt_hdlc/hdlc_api.h +++ b/src/tcpedit/plugins/dlt_hdlc/hdlc_api.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_hdlc/hdlc_types.h b/src/tcpedit/plugins/dlt_hdlc/hdlc_types.h index 4e4e84d35..7201473d2 100644 --- a/src/tcpedit/plugins/dlt_hdlc/hdlc_types.h +++ b/src/tcpedit/plugins/dlt_hdlc/hdlc_types.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_ieee80211/ieee80211.c b/src/tcpedit/plugins/dlt_ieee80211/ieee80211.c index c3832f92f..a61bcbe8c 100644 --- a/src/tcpedit/plugins/dlt_ieee80211/ieee80211.c +++ b/src/tcpedit/plugins/dlt_ieee80211/ieee80211.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_ieee80211/ieee80211.h b/src/tcpedit/plugins/dlt_ieee80211/ieee80211.h index bb1683b42..c399c76ec 100644 --- a/src/tcpedit/plugins/dlt_ieee80211/ieee80211.h +++ b/src/tcpedit/plugins/dlt_ieee80211/ieee80211.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_ieee80211/ieee80211_hdr.c b/src/tcpedit/plugins/dlt_ieee80211/ieee80211_hdr.c index e5870ff46..0956cbd02 100644 --- a/src/tcpedit/plugins/dlt_ieee80211/ieee80211_hdr.c +++ b/src/tcpedit/plugins/dlt_ieee80211/ieee80211_hdr.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_ieee80211/ieee80211_hdr.h b/src/tcpedit/plugins/dlt_ieee80211/ieee80211_hdr.h index cd1ea30b6..6aeff2ab9 100644 --- a/src/tcpedit/plugins/dlt_ieee80211/ieee80211_hdr.h +++ b/src/tcpedit/plugins/dlt_ieee80211/ieee80211_hdr.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_ieee80211/ieee80211_types.h b/src/tcpedit/plugins/dlt_ieee80211/ieee80211_types.h index c7da0ac6c..e5728516e 100644 --- a/src/tcpedit/plugins/dlt_ieee80211/ieee80211_types.h +++ b/src/tcpedit/plugins/dlt_ieee80211/ieee80211_types.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_linuxsll/linuxsll.c b/src/tcpedit/plugins/dlt_linuxsll/linuxsll.c index c4f4da596..33d126be6 100644 --- a/src/tcpedit/plugins/dlt_linuxsll/linuxsll.c +++ b/src/tcpedit/plugins/dlt_linuxsll/linuxsll.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_linuxsll/linuxsll.h b/src/tcpedit/plugins/dlt_linuxsll/linuxsll.h index 685a949e7..f4ffd3ce3 100644 --- a/src/tcpedit/plugins/dlt_linuxsll/linuxsll.h +++ b/src/tcpedit/plugins/dlt_linuxsll/linuxsll.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_loop/loop.c b/src/tcpedit/plugins/dlt_loop/loop.c index f69ad6b56..2eebce03b 100644 --- a/src/tcpedit/plugins/dlt_loop/loop.c +++ b/src/tcpedit/plugins/dlt_loop/loop.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_loop/loop.h b/src/tcpedit/plugins/dlt_loop/loop.h index dcc57ab52..eaf2b17ab 100644 --- a/src/tcpedit/plugins/dlt_loop/loop.h +++ b/src/tcpedit/plugins/dlt_loop/loop.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_null/null.c b/src/tcpedit/plugins/dlt_null/null.c index cdd7d5506..cca60cef0 100644 --- a/src/tcpedit/plugins/dlt_null/null.c +++ b/src/tcpedit/plugins/dlt_null/null.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_null/null.h b/src/tcpedit/plugins/dlt_null/null.h index a548489ff..a217ce1e5 100644 --- a/src/tcpedit/plugins/dlt_null/null.h +++ b/src/tcpedit/plugins/dlt_null/null.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_plugins.c b/src/tcpedit/plugins/dlt_plugins.c index 2611ebb84..662989a7e 100644 --- a/src/tcpedit/plugins/dlt_plugins.c +++ b/src/tcpedit/plugins/dlt_plugins.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_radiotap/radiotap.c b/src/tcpedit/plugins/dlt_radiotap/radiotap.c index c325c81e7..e0d2a10dc 100644 --- a/src/tcpedit/plugins/dlt_radiotap/radiotap.c +++ b/src/tcpedit/plugins/dlt_radiotap/radiotap.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_radiotap/radiotap.h b/src/tcpedit/plugins/dlt_radiotap/radiotap.h index 5abb1ac55..e57cff1db 100644 --- a/src/tcpedit/plugins/dlt_radiotap/radiotap.h +++ b/src/tcpedit/plugins/dlt_radiotap/radiotap.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_raw/raw.c b/src/tcpedit/plugins/dlt_raw/raw.c index 527bb959f..f9f4a7ed4 100644 --- a/src/tcpedit/plugins/dlt_raw/raw.c +++ b/src/tcpedit/plugins/dlt_raw/raw.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_raw/raw.h b/src/tcpedit/plugins/dlt_raw/raw.h index 4d2ef1f64..1a44eab88 100644 --- a/src/tcpedit/plugins/dlt_raw/raw.h +++ b/src/tcpedit/plugins/dlt_raw/raw.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_template/plugin.c.tmpl b/src/tcpedit/plugins/dlt_template/plugin.c.tmpl index e0a3822d4..7541d65f6 100644 --- a/src/tcpedit/plugins/dlt_template/plugin.c.tmpl +++ b/src/tcpedit/plugins/dlt_template/plugin.c.tmpl @@ -2,6 +2,7 @@ /* * Copyright (c) 2006-2007 Aaron Turner. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/tcpedit/plugins/dlt_template/plugin.h b/src/tcpedit/plugins/dlt_template/plugin.h index 55b08479b..6d98900b8 100644 --- a/src/tcpedit/plugins/dlt_template/plugin.h +++ b/src/tcpedit/plugins/dlt_template/plugin.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_template/plugin_api.c.tmpl b/src/tcpedit/plugins/dlt_template/plugin_api.c.tmpl index 64472aa76..77bc73639 100644 --- a/src/tcpedit/plugins/dlt_template/plugin_api.c.tmpl +++ b/src/tcpedit/plugins/dlt_template/plugin_api.c.tmpl @@ -2,7 +2,7 @@ /* * Copyright (c) 2009 Aaron Turner. - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/tcpedit/plugins/dlt_template/plugin_api.h b/src/tcpedit/plugins/dlt_template/plugin_api.h index 75005e24a..68dabe482 100644 --- a/src/tcpedit/plugins/dlt_template/plugin_api.h +++ b/src/tcpedit/plugins/dlt_template/plugin_api.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_template/plugin_types.h b/src/tcpedit/plugins/dlt_template/plugin_types.h index 7f344e16c..0ed36825a 100644 --- a/src/tcpedit/plugins/dlt_template/plugin_types.h +++ b/src/tcpedit/plugins/dlt_template/plugin_types.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_user/user.c b/src/tcpedit/plugins/dlt_user/user.c index 910fdc02a..2805bbc0b 100644 --- a/src/tcpedit/plugins/dlt_user/user.c +++ b/src/tcpedit/plugins/dlt_user/user.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_user/user.h b/src/tcpedit/plugins/dlt_user/user.h index 705b0fb73..4608b8b52 100644 --- a/src/tcpedit/plugins/dlt_user/user.h +++ b/src/tcpedit/plugins/dlt_user/user.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_user/user_api.c b/src/tcpedit/plugins/dlt_user/user_api.c index 4e9110cf3..b041b6bda 100644 --- a/src/tcpedit/plugins/dlt_user/user_api.c +++ b/src/tcpedit/plugins/dlt_user/user_api.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_user/user_api.h b/src/tcpedit/plugins/dlt_user/user_api.h index ca7337f24..f0d27d83c 100644 --- a/src/tcpedit/plugins/dlt_user/user_api.h +++ b/src/tcpedit/plugins/dlt_user/user_api.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_utils.c b/src/tcpedit/plugins/dlt_utils.c index c6a9f7365..b473c55e9 100644 --- a/src/tcpedit/plugins/dlt_utils.c +++ b/src/tcpedit/plugins/dlt_utils.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_utils.h b/src/tcpedit/plugins/dlt_utils.h index 16ebef85e..ce38af2da 100644 --- a/src/tcpedit/plugins/dlt_utils.h +++ b/src/tcpedit/plugins/dlt_utils.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/ethernet.c b/src/tcpedit/plugins/ethernet.c index e893f5402..6530192c3 100644 --- a/src/tcpedit/plugins/ethernet.c +++ b/src/tcpedit/plugins/ethernet.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/ethernet.h b/src/tcpedit/plugins/ethernet.h index 783b16448..a8daadcde 100644 --- a/src/tcpedit/plugins/ethernet.h +++ b/src/tcpedit/plugins/ethernet.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins_api.h b/src/tcpedit/plugins_api.h index b6884e482..bd41e77ad 100644 --- a/src/tcpedit/plugins_api.h +++ b/src/tcpedit/plugins_api.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins_types.h b/src/tcpedit/plugins_types.h index cbd0bf2d8..cb173682b 100644 --- a/src/tcpedit/plugins_types.h +++ b/src/tcpedit/plugins_types.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/portmap.c b/src/tcpedit/portmap.c index 001d97095..791dba63a 100644 --- a/src/tcpedit/portmap.c +++ b/src/tcpedit/portmap.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/portmap.h b/src/tcpedit/portmap.h index e4fdf39f9..4569c0da9 100644 --- a/src/tcpedit/portmap.h +++ b/src/tcpedit/portmap.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/tcpedit.c b/src/tcpedit/tcpedit.c index 40f8d909f..13c1359c6 100644 --- a/src/tcpedit/tcpedit.c +++ b/src/tcpedit/tcpedit.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/tcpedit.h b/src/tcpedit/tcpedit.h index 96a27e5f6..2faedac95 100644 --- a/src/tcpedit/tcpedit.h +++ b/src/tcpedit/tcpedit.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/tcpedit_api.c b/src/tcpedit/tcpedit_api.c index b9f6110ce..4f8b7ceb0 100644 --- a/src/tcpedit/tcpedit_api.c +++ b/src/tcpedit/tcpedit_api.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/tcpedit_api.h b/src/tcpedit/tcpedit_api.h index df344f2eb..a3ebf865c 100644 --- a/src/tcpedit/tcpedit_api.h +++ b/src/tcpedit/tcpedit_api.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/tcpedit_opts.def b/src/tcpedit/tcpedit_opts.def index 6d8dcf5a9..5bba3661d 100644 --- a/src/tcpedit/tcpedit_opts.def +++ b/src/tcpedit/tcpedit_opts.def @@ -1,6 +1,6 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/tcpedit_stub.def b/src/tcpedit/tcpedit_stub.def index 18e8ec165..642ebc904 100644 --- a/src/tcpedit/tcpedit_stub.def +++ b/src/tcpedit/tcpedit_stub.def @@ -1,6 +1,6 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/tcpedit_types.h b/src/tcpedit/tcpedit_types.h index 15f0150a4..68bd35c90 100644 --- a/src/tcpedit/tcpedit_types.h +++ b/src/tcpedit/tcpedit_types.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpprep.c b/src/tcpprep.c index f67e21239..0be9bf5ff 100644 --- a/src/tcpprep.c +++ b/src/tcpprep.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpprep.h b/src/tcpprep.h index 8545df67b..8bf39663c 100644 --- a/src/tcpprep.h +++ b/src/tcpprep.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpprep_api.c b/src/tcpprep_api.c index e6518da5e..fd4b66faf 100644 --- a/src/tcpprep_api.c +++ b/src/tcpprep_api.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpprep_api.h b/src/tcpprep_api.h index 30204bdc3..cc6a91dae 100644 --- a/src/tcpprep_api.h +++ b/src/tcpprep_api.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpprep_opts.def b/src/tcpprep_opts.def index 374ff0d0e..f91ee7f0a 100644 --- a/src/tcpprep_opts.def +++ b/src/tcpprep_opts.def @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpr.h b/src/tcpr.h index 76a4289e7..7082112eb 100644 --- a/src/tcpr.h +++ b/src/tcpr.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpreplay.c b/src/tcpreplay.c index dfe550eb5..6ddbe5fac 100644 --- a/src/tcpreplay.c +++ b/src/tcpreplay.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpreplay.h b/src/tcpreplay.h index 39e3868ad..cce4de263 100644 --- a/src/tcpreplay.h +++ b/src/tcpreplay.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpreplay_api.c b/src/tcpreplay_api.c index b5c74d2c4..68f84cc5f 100644 --- a/src/tcpreplay_api.c +++ b/src/tcpreplay_api.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpreplay_api.h b/src/tcpreplay_api.h index 7add6a811..c0173daaa 100644 --- a/src/tcpreplay_api.h +++ b/src/tcpreplay_api.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpreplay_opts.def b/src/tcpreplay_opts.def index 7f603f3de..ee7661b25 100644 --- a/src/tcpreplay_opts.def +++ b/src/tcpreplay_opts.def @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcprewrite.c b/src/tcprewrite.c index 3f2e2a21a..ac9c6b734 100644 --- a/src/tcprewrite.c +++ b/src/tcprewrite.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcprewrite.h b/src/tcprewrite.h index cc476ec20..2e5b9e991 100644 --- a/src/tcprewrite.h +++ b/src/tcprewrite.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcprewrite_opts.def b/src/tcprewrite_opts.def index c0b34451d..bcefda127 100644 --- a/src/tcprewrite_opts.def +++ b/src/tcprewrite_opts.def @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/timestamp_trace.h b/src/timestamp_trace.h index fc7b23ba7..f243d1cf9 100644 --- a/src/timestamp_trace.h +++ b/src/timestamp_trace.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tree.c b/src/tree.c index a45c47702..2ff138e52 100644 --- a/src/tree.c +++ b/src/tree.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tree.h b/src/tree.h index 1f9e70c4e..b049e8dd7 100644 --- a/src/tree.h +++ b/src/tree.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as From cf26d9b0a4231bfe7ca572133724941a6e6c2ba3 Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Tue, 31 Dec 2013 17:11:38 -0800 Subject: [PATCH 10/20] Add PPP serial DLT for #40 --- src/Makefile.am | 29 +- src/Makefile.in | 29 +- src/tcpedit/Makefile.in | 53 ++- src/tcpedit/plugins/Makefile.am | 1 + src/tcpedit/plugins/dlt_opts.def | 4 +- src/tcpedit/plugins/dlt_plugins.c | 2 + src/tcpedit/plugins/dlt_pppserial/Makefile.am | 28 ++ src/tcpedit/plugins/dlt_pppserial/pppserial.c | 376 ++++++++++++++++++ src/tcpedit/plugins/dlt_pppserial/pppserial.h | 41 ++ .../plugins/dlt_pppserial/pppserial_api.c | 48 +++ .../plugins/dlt_pppserial/pppserial_api.h | 39 ++ .../plugins/dlt_pppserial/pppserial_opts.def | 1 + .../plugins/dlt_pppserial/pppserial_types.h | 40 ++ src/tcpedit/plugins/dlt_stub.def | 1 + src/tcpedit/plugins/dlt_template.sh | 19 +- 15 files changed, 670 insertions(+), 41 deletions(-) create mode 100644 src/tcpedit/plugins/dlt_pppserial/Makefile.am create mode 100644 src/tcpedit/plugins/dlt_pppserial/pppserial.c create mode 100644 src/tcpedit/plugins/dlt_pppserial/pppserial.h create mode 100644 src/tcpedit/plugins/dlt_pppserial/pppserial_api.c create mode 100644 src/tcpedit/plugins/dlt_pppserial/pppserial_api.h create mode 100644 src/tcpedit/plugins/dlt_pppserial/pppserial_opts.def create mode 100644 src/tcpedit/plugins/dlt_pppserial/pppserial_types.h diff --git a/src/Makefile.am b/src/Makefile.am index c70eb0fd9..e1a8c5444 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -25,25 +25,25 @@ autoopts: tcpreplay_opts.c tcprewrite_opts.c tcpbridge_opts.c tcpliveplay_opts.c opts_list=-L tcpedit tcpprep.1: tcpprep_opts.def - @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpprep_opts.def || true + @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpprep_opts.def tcprewrite.1: tcprewrite_opts.def tcpedit/tcpedit_opts.def - @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcprewrite_opts.def || true + @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcprewrite_opts.def tcpreplay-edit.1: tcpreplay_opts.def - @AUTOGEN@ -T agman-cmd.tpl $(opts_list) -DTCPREPLAY_EDIT -DTCPREPLAY_EDIT_MAN tcpreplay_opts.def || true + @AUTOGEN@ -T agman-cmd.tpl $(opts_list) -DTCPREPLAY_EDIT -DTCPREPLAY_EDIT_MAN tcpreplay_opts.def tcpreplay.1: tcpreplay_opts.def - @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpreplay_opts.def || true + @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpreplay_opts.def tcpbridge.1: tcpbridge_opts.def tcpedit/tcpedit_opts.def - @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpbridge_opts.def || true + @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpbridge_opts.def tcpliveplay.1: tcpliveplay_opts.def - @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpliveplay_opts.def || true + @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpliveplay_opts.def tcpcapinfo.1: tcpcapinfo_opts.def - @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpcapinfo_opts.def || true + @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpcapinfo_opts.def man_MANS = tcpreplay.1 tcpprep.1 tcprewrite.1 tcpreplay-edit.1 tcpcapinfo.1 EXTRA_DIST = tcpreplay.1 tcpprep.1 tcprewrite.1 tcpbridge.1 tcpreplay-edit.1 \ @@ -67,8 +67,7 @@ tcpreplay_edit_OBJECTS: tcpreplay_opts.h tcpreplay_edit_opts.h: tcpreplay_edit_opts.c tcpreplay_edit_opts.c: tcpreplay_opts.def - @AUTOGEN@ $(opts_list) @NETMAPFLAGS@ -DTCPREPLAY_EDIT -b tcpreplay_edit_opts \ - tcpreplay_opts.def || true + @AUTOGEN@ $(opts_list) @NETMAPFLAGS@ -DTCPREPLAY_EDIT -b tcpreplay_edit_opts tcpreplay_opts.def tcpreplay_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPREPLAY tcpreplay_SOURCES = tcpreplay_opts.c send_packets.c signal_handler.c tcpreplay.c sleep.c tcpreplay_api.c replay.c @@ -77,7 +76,7 @@ tcpreplay_OBJECTS: tcpreplay_opts.h tcpreplay_opts.h: tcpreplay_opts.c tcpreplay_opts.c: tcpreplay_opts.def - @AUTOGEN@ $(opts_list) @NETMAPFLAGS@ tcpreplay_opts.def || true + @AUTOGEN@ $(opts_list) @NETMAPFLAGS@ tcpreplay_opts.def if ENABLE_OSX_FRAMEWORKS tcpreplay_LDFLAGS = -framework CoreServices -framework Carbon @@ -91,7 +90,7 @@ tcpliveplay_OBJECTS: tcpliveplay_opts.h tcpliveplay_opts.h: tcpliveplay_opts.c tcpliveplay_opts.c: tcpliveplay_opts.def - @AUTOGEN@ $(opts_list) tcpliveplay_opts.def || true + @AUTOGEN@ $(opts_list) tcpliveplay_opts.def tcprewrite_CFLAGS = $(LIBOPTS_CFLAGS) -I.. -Itcpedit @LDNETINC@ $(LNAV_CFLAGS) -DTCPREWRITE -DHAVE_CACHEFILE_SUPPORT @@ -102,7 +101,7 @@ tcprewrite_SOURCES = tcprewrite_opts.c tcprewrite.c tcprewrite_OBJECTS: tcprewrite_opts.h tcprewrite_opts.h: tcprewrite_opts.c tcprewrite_opts.c: tcprewrite_opts.def tcpedit/tcpedit_opts.def - @AUTOGEN@ $(opts_list) tcprewrite_opts.def || true + @AUTOGEN@ $(opts_list) tcprewrite_opts.def tcpcapinfo_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPCAPINFO tcpcapinfo_LDADD = ./common/libcommon.a \ @@ -111,7 +110,7 @@ tcpcapinfo_SOURCES = tcpcapinfo_opts.c tcpcapinfo.c tcpcapinfo_OBJECTS: tcpcapinfo_opts.h tcpcapinfo_opts.h: tcpcapinfo_opts.c tcpcapinfo_opts.c: tcpcapinfo_opts.def - @AUTOGEN@ $(opts_list) tcpcapinfo_opts.def || true + @AUTOGEN@ $(opts_list) tcpcapinfo_opts.def tcpprep_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPPREP tcpprep_LDADD = ./common/libcommon.a \ @@ -120,7 +119,7 @@ tcpprep_SOURCES = tcpprep_opts.c tcpprep.c tree.c tcpprep_api.c tcpprep_OBJECTS: tcpprep_opts.h tcpprep_opts.h: tcpprep_opts.c tcpprep_opts.c: tcpprep_opts.def - @AUTOGEN@ tcpprep_opts.def || true + @AUTOGEN@ tcpprep_opts.def tcpbridge_CFLAGS = $(LIBOPTS_CFLAGS) -I.. -Itcpedit $(LNAV_CFLAGS) @LDNETINC@ -DTCPBRIDGE tcpbridge_LDADD = ./tcpedit/libtcpedit.a ./common/libcommon.a \ @@ -132,7 +131,7 @@ tcpbridge_SOURCES = tcpbridge_opts.c tcpbridge.c bridge.c sleep.c tcpbridge_OBJECTS: tcpbridge_opts.h tcpbridge_opts.h: tcpbridge_opts.c tcpbridge_opts.c: tcpbridge_opts.def tcpedit/tcpedit_opts.def - @AUTOGEN@ $(opts_list) tcpbridge_opts.def || true + @AUTOGEN@ $(opts_list) tcpbridge_opts.def noinst_HEADERS = tcpreplay.h tcpprep.h bridge.h defines.h tree.h tcpliveplay.h \ send_packets.h signal_handler.h common.h tcpreplay_opts.h tcpliveplay_opts.h \ diff --git a/src/Makefile.in b/src/Makefile.in index 180b92bcb..75ab38520 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1385,57 +1385,56 @@ autoopts: tcpreplay_opts.c tcprewrite_opts.c tcpbridge_opts.c tcpliveplay_opts.c manpages tcpreplay_edit_opts.c tcpprep.1: tcpprep_opts.def - @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpprep_opts.def || true + @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpprep_opts.def tcprewrite.1: tcprewrite_opts.def tcpedit/tcpedit_opts.def - @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcprewrite_opts.def || true + @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcprewrite_opts.def tcpreplay-edit.1: tcpreplay_opts.def - @AUTOGEN@ -T agman-cmd.tpl $(opts_list) -DTCPREPLAY_EDIT -DTCPREPLAY_EDIT_MAN tcpreplay_opts.def || true + @AUTOGEN@ -T agman-cmd.tpl $(opts_list) -DTCPREPLAY_EDIT -DTCPREPLAY_EDIT_MAN tcpreplay_opts.def tcpreplay.1: tcpreplay_opts.def - @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpreplay_opts.def || true + @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpreplay_opts.def tcpbridge.1: tcpbridge_opts.def tcpedit/tcpedit_opts.def - @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpbridge_opts.def || true + @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpbridge_opts.def tcpliveplay.1: tcpliveplay_opts.def - @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpliveplay_opts.def || true + @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpliveplay_opts.def tcpcapinfo.1: tcpcapinfo_opts.def - @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpcapinfo_opts.def || true + @AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpcapinfo_opts.def tcpreplay_edit_OBJECTS: tcpreplay_opts.h tcpreplay_edit_opts.h: tcpreplay_edit_opts.c tcpreplay_edit_opts.c: tcpreplay_opts.def - @AUTOGEN@ $(opts_list) @NETMAPFLAGS@ -DTCPREPLAY_EDIT -b tcpreplay_edit_opts \ - tcpreplay_opts.def || true + @AUTOGEN@ $(opts_list) @NETMAPFLAGS@ -DTCPREPLAY_EDIT -b tcpreplay_edit_opts tcpreplay_opts.def tcpreplay_OBJECTS: tcpreplay_opts.h tcpreplay_opts.h: tcpreplay_opts.c tcpreplay_opts.c: tcpreplay_opts.def - @AUTOGEN@ $(opts_list) @NETMAPFLAGS@ tcpreplay_opts.def || true + @AUTOGEN@ $(opts_list) @NETMAPFLAGS@ tcpreplay_opts.def tcpliveplay_OBJECTS: tcpliveplay_opts.h tcpliveplay_opts.h: tcpliveplay_opts.c tcpliveplay_opts.c: tcpliveplay_opts.def - @AUTOGEN@ $(opts_list) tcpliveplay_opts.def || true + @AUTOGEN@ $(opts_list) tcpliveplay_opts.def tcprewrite_OBJECTS: tcprewrite_opts.h tcprewrite_opts.h: tcprewrite_opts.c tcprewrite_opts.c: tcprewrite_opts.def tcpedit/tcpedit_opts.def - @AUTOGEN@ $(opts_list) tcprewrite_opts.def || true + @AUTOGEN@ $(opts_list) tcprewrite_opts.def tcpcapinfo_OBJECTS: tcpcapinfo_opts.h tcpcapinfo_opts.h: tcpcapinfo_opts.c tcpcapinfo_opts.c: tcpcapinfo_opts.def - @AUTOGEN@ $(opts_list) tcpcapinfo_opts.def || true + @AUTOGEN@ $(opts_list) tcpcapinfo_opts.def tcpprep_OBJECTS: tcpprep_opts.h tcpprep_opts.h: tcpprep_opts.c tcpprep_opts.c: tcpprep_opts.def - @AUTOGEN@ tcpprep_opts.def || true + @AUTOGEN@ tcpprep_opts.def tcpbridge_OBJECTS: tcpbridge_opts.h tcpbridge_opts.h: tcpbridge_opts.c tcpbridge_opts.c: tcpbridge_opts.def tcpedit/tcpedit_opts.def - @AUTOGEN@ $(opts_list) tcpbridge_opts.def || true + @AUTOGEN@ $(opts_list) tcpbridge_opts.def # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/src/tcpedit/Makefile.in b/src/tcpedit/Makefile.in index 69df31afc..8f9526ff7 100644 --- a/src/tcpedit/Makefile.in +++ b/src/tcpedit/Makefile.in @@ -92,6 +92,14 @@ # add any other files (like documentation, notes, etc) to EXTRA_DIST # add your dependancy information (see comment below) +# $Id:$ +# START OF: dlt_pppserial +# Note, if you add any files to your plugin, you will need to edit dlt_pppserial/Makefile.am +# add your .c files to libtcpedit_a_SOURCES +# add your .h files to noinst_HEADERS +# add any other files (like documentation, notes, etc) to EXTRA_DIST +# add your dependancy information (see comment below) + VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ @@ -121,6 +129,7 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/plugins/dlt_linuxsll/Makefile.am \ $(srcdir)/plugins/dlt_loop/Makefile.am \ $(srcdir)/plugins/dlt_null/Makefile.am \ + $(srcdir)/plugins/dlt_pppserial/Makefile.am \ $(srcdir)/plugins/dlt_radiotap/Makefile.am \ $(srcdir)/plugins/dlt_raw/Makefile.am \ $(srcdir)/plugins/dlt_user/Makefile.am @@ -145,7 +154,7 @@ am_libtcpedit_a_OBJECTS = tcpedit.$(OBJEXT) parse_args.$(OBJEXT) \ en10mb_api.$(OBJEXT) hdlc.$(OBJEXT) hdlc_api.$(OBJEXT) \ user.$(OBJEXT) user_api.$(OBJEXT) raw.$(OBJEXT) null.$(OBJEXT) \ loop.$(OBJEXT) linuxsll.$(OBJEXT) ieee80211.$(OBJEXT) \ - ieee80211_hdr.$(OBJEXT) radiotap.$(OBJEXT) + ieee80211_hdr.$(OBJEXT) radiotap.$(OBJEXT) pppserial.$(OBJEXT) libtcpedit_a_OBJECTS = $(am_libtcpedit_a_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/config/depcomp @@ -333,7 +342,8 @@ libtcpedit_a_SOURCES = tcpedit.c parse_args.c edit_packet.c portmap.c \ $(srcdir)/plugins/dlt_linuxsll/linuxsll.c \ $(srcdir)/plugins/dlt_ieee80211/ieee80211.c \ $(srcdir)/plugins/dlt_ieee80211/ieee80211_hdr.c \ - $(srcdir)/plugins/dlt_radiotap/radiotap.c + $(srcdir)/plugins/dlt_radiotap/radiotap.c \ + $(srcdir)/plugins/dlt_pppserial/pppserial.c AM_CFLAGS = -I.. -I../common -I../.. @LDNETINC@ $(LIBOPTS_CFLAGS) \ $(LNAV_CFLAGS) -I. -I$(srcdir)/plugins -I$(srcdir)/../common \ $(LIBOPTS_CFLAGS) @@ -359,7 +369,8 @@ noinst_HEADERS = tcpedit.h edit_packet.h portmap.h tcpedit_stub.h \ $(srcdir)/plugins/dlt_ieee80211/ieee80211.h \ $(srcdir)/plugins/dlt_ieee80211/ieee80211_hdr.h \ $(srcdir)/plugins/dlt_ieee80211/ieee80211_types.h \ - $(srcdir)/plugins/dlt_radiotap/radiotap.h + $(srcdir)/plugins/dlt_radiotap/radiotap.h \ + $(srcdir)/plugins/dlt_pppserial/pppserial.h # Note: # You probably don't want to touch anything below this line until the end of the plugin @@ -372,7 +383,8 @@ MOSTLYCLEANFILES = *~ $(srcdir)/plugins/*~ \ $(srcdir)/plugins/dlt_null/*~ $(srcdir)/plugins/dlt_loop/*~ \ $(srcdir)/plugins/dlt_linuxsll/*~ \ $(srcdir)/plugins/dlt_ieee80211/*~ \ - $(srcdir)/plugins/dlt_radiotap/*~ + $(srcdir)/plugins/dlt_radiotap/*~ \ + $(srcdir)/plugins/dlt_pppserial/*~ MAINTAINERCLEANFILES = Makefile.in tcpedit_stub.h tcpedit.1 \ Makefile.in EXTRA_DIST = tcpedit_stub.def tcpedit_opts.def \ @@ -385,7 +397,10 @@ EXTRA_DIST = tcpedit_stub.def tcpedit_opts.def \ $(srcdir)/plugins/dlt_loop/loop_opts.def \ $(srcdir)/plugins/dlt_linuxsll/linuxsll_opts.def \ $(srcdir)/plugins/dlt_ieee80211/ieee80211_opts.def \ - $(srcdir)/plugins/dlt_radiotap/radiotap_opts.def + $(srcdir)/plugins/dlt_radiotap/radiotap_opts.def \ + $(srcdir)/plugins/dlt_pppserial/pppserial_opts.def + +# You probably don't want to touch anything below this line until the end of the plugin # You probably don't want to touch anything below this line until the end of the plugin @@ -407,13 +422,14 @@ DLT_STUB_DEPS = $(srcdir)/plugins/dlt_opts.def \ $(srcdir)/plugins/dlt_loop/loop_opts.def \ $(srcdir)/plugins/dlt_linuxsll/linuxsll_opts.def \ $(srcdir)/plugins/dlt_ieee80211/ieee80211_opts.def \ - $(srcdir)/plugins/dlt_radiotap/radiotap_opts.def + $(srcdir)/plugins/dlt_radiotap/radiotap_opts.def \ + $(srcdir)/plugins/dlt_pppserial/pppserial_opts.def all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/plugins/Makefile.am $(srcdir)/plugins/dlt_en10mb/Makefile.am $(srcdir)/plugins/dlt_hdlc/Makefile.am $(srcdir)/plugins/dlt_user/Makefile.am $(srcdir)/plugins/dlt_raw/Makefile.am $(srcdir)/plugins/dlt_null/Makefile.am $(srcdir)/plugins/dlt_loop/Makefile.am $(srcdir)/plugins/dlt_linuxsll/Makefile.am $(srcdir)/plugins/dlt_ieee80211/Makefile.am $(srcdir)/plugins/dlt_radiotap/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/plugins/Makefile.am $(srcdir)/plugins/dlt_en10mb/Makefile.am $(srcdir)/plugins/dlt_hdlc/Makefile.am $(srcdir)/plugins/dlt_user/Makefile.am $(srcdir)/plugins/dlt_raw/Makefile.am $(srcdir)/plugins/dlt_null/Makefile.am $(srcdir)/plugins/dlt_loop/Makefile.am $(srcdir)/plugins/dlt_linuxsll/Makefile.am $(srcdir)/plugins/dlt_ieee80211/Makefile.am $(srcdir)/plugins/dlt_radiotap/Makefile.am $(srcdir)/plugins/dlt_pppserial/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -474,6 +490,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/null.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse_args.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/portmap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pppserial.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/radiotap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raw.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpedit.Po@am__quote@ @@ -726,6 +743,20 @@ radiotap.obj: $(srcdir)/plugins/dlt_radiotap/radiotap.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o radiotap.obj `if test -f '$(srcdir)/plugins/dlt_radiotap/radiotap.c'; then $(CYGPATH_W) '$(srcdir)/plugins/dlt_radiotap/radiotap.c'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/plugins/dlt_radiotap/radiotap.c'; fi` +pppserial.o: $(srcdir)/plugins/dlt_pppserial/pppserial.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pppserial.o -MD -MP -MF $(DEPDIR)/pppserial.Tpo -c -o pppserial.o `test -f '$(srcdir)/plugins/dlt_pppserial/pppserial.c' || echo '$(srcdir)/'`$(srcdir)/plugins/dlt_pppserial/pppserial.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pppserial.Tpo $(DEPDIR)/pppserial.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/plugins/dlt_pppserial/pppserial.c' object='pppserial.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pppserial.o `test -f '$(srcdir)/plugins/dlt_pppserial/pppserial.c' || echo '$(srcdir)/'`$(srcdir)/plugins/dlt_pppserial/pppserial.c + +pppserial.obj: $(srcdir)/plugins/dlt_pppserial/pppserial.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pppserial.obj -MD -MP -MF $(DEPDIR)/pppserial.Tpo -c -o pppserial.obj `if test -f '$(srcdir)/plugins/dlt_pppserial/pppserial.c'; then $(CYGPATH_W) '$(srcdir)/plugins/dlt_pppserial/pppserial.c'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/plugins/dlt_pppserial/pppserial.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pppserial.Tpo $(DEPDIR)/pppserial.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/plugins/dlt_pppserial/pppserial.c' object='pppserial.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pppserial.obj `if test -f '$(srcdir)/plugins/dlt_pppserial/pppserial.c'; then $(CYGPATH_W) '$(srcdir)/plugins/dlt_pppserial/pppserial.c'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/plugins/dlt_pppserial/pppserial.c'; fi` + mostlyclean-libtool: -rm -f *.lo @@ -1024,6 +1055,14 @@ $(srcdir)/plugins/dlt_radiotap/radiotap.c: $(srcdir)/tcpedit_stub.h $(srcdir)/p # END OF: dlt_radiotap +# dependancies for your plugin source code. Edit as necessary +$(srcdir)/plugins/dlt_pppserial/pppserial.c: $(srcdir)/tcpedit_stub.h $(srcdir)/plugins/dlt_utils.h \ + $(srcdir)/plugins/dlt_pppserial/pppserial.h $(srcdir)/tcpedit_stub.h $(srcdir)/plugins/dlt_utils.h \ + $(srcdir)/plugins.h $(srcdir)/plugins_api.h $(srcdir)/plugins_types.h \ + $(srcdir)/tcpedit_api.h + +# END OF: dlt_pppserial + ######################################################## # Add your plugin Makefile.am's below this line ######################################################## diff --git a/src/tcpedit/plugins/Makefile.am b/src/tcpedit/plugins/Makefile.am index e26054299..06ed7aac7 100644 --- a/src/tcpedit/plugins/Makefile.am +++ b/src/tcpedit/plugins/Makefile.am @@ -31,3 +31,4 @@ include $(srcdir)/plugins/dlt_loop/Makefile.am include $(srcdir)/plugins/dlt_linuxsll/Makefile.am include $(srcdir)/plugins/dlt_ieee80211/Makefile.am include $(srcdir)/plugins/dlt_radiotap/Makefile.am +include $(srcdir)/plugins/dlt_pppserial/Makefile.am diff --git a/src/tcpedit/plugins/dlt_opts.def b/src/tcpedit/plugins/dlt_opts.def index 74fa7578c..c609f8cd5 100644 --- a/src/tcpedit/plugins/dlt_opts.def +++ b/src/tcpedit/plugins/dlt_opts.def @@ -33,7 +33,9 @@ To change the DLT type of the output pcap, select one of the following values: Ethernet aka DLT_EN10MB @item @var{hdlc} -Cisco HDLC aka DLT_C_HDLC +@item +@var{pppserial} +PPP Serial aka DLT_PPPSERIAL @item @var{user} User specified Layer 2 header and DLT type diff --git a/src/tcpedit/plugins/dlt_plugins.c b/src/tcpedit/plugins/dlt_plugins.c index 662989a7e..47332ee40 100644 --- a/src/tcpedit/plugins/dlt_plugins.c +++ b/src/tcpedit/plugins/dlt_plugins.c @@ -40,6 +40,7 @@ #include "dlt_linuxsll/linuxsll.h" #include "dlt_ieee80211/ieee80211.h" #include "dlt_radiotap/radiotap.h" +#include "dlt_pppserial/pppserial.h" /** @@ -61,6 +62,7 @@ tcpedit_dlt_register(tcpeditdlt_t *ctx) retcode += dlt_linuxsll_register(ctx); retcode += dlt_ieee80211_register(ctx); retcode += dlt_radiotap_register(ctx); + retcode += dlt_pppserial_register(ctx); if (retcode < 0) return TCPEDIT_ERROR; diff --git a/src/tcpedit/plugins/dlt_pppserial/Makefile.am b/src/tcpedit/plugins/dlt_pppserial/Makefile.am new file mode 100644 index 000000000..1f69285da --- /dev/null +++ b/src/tcpedit/plugins/dlt_pppserial/Makefile.am @@ -0,0 +1,28 @@ +# $Id:$ +# START OF: dlt_pppserial +# Note, if you add any files to your plugin, you will need to edit dlt_pppserial/Makefile.am +# add your .c files to libtcpedit_a_SOURCES +# add your .h files to noinst_HEADERS +# add any other files (like documentation, notes, etc) to EXTRA_DIST +# add your dependancy information (see comment below) + +libtcpedit_a_SOURCES += $(srcdir)/plugins/dlt_pppserial/pppserial.c + +noinst_HEADERS += $(srcdir)/plugins/dlt_pppserial/pppserial.h + +EXTRA_DIST += $(srcdir)/plugins/dlt_pppserial/pppserial_opts.def + +# dependancies for your plugin source code. Edit as necessary +$(srcdir)/plugins/dlt_pppserial/pppserial.c: $(srcdir)/tcpedit_stub.h $(srcdir)/plugins/dlt_utils.h \ + $(srcdir)/plugins/dlt_pppserial/pppserial.h $(srcdir)/tcpedit_stub.h $(srcdir)/plugins/dlt_utils.h \ + $(srcdir)/plugins.h $(srcdir)/plugins_api.h $(srcdir)/plugins_types.h \ + $(srcdir)/tcpedit_api.h + + +# You probably don't want to touch anything below this line until the end of the plugin + +DLT_STUB_DEPS += $(srcdir)/plugins/dlt_pppserial/pppserial_opts.def + +MOSTLYCLEANFILES += $(srcdir)/plugins/dlt_pppserial/*~ + +# END OF: dlt_pppserial diff --git a/src/tcpedit/plugins/dlt_pppserial/pppserial.c b/src/tcpedit/plugins/dlt_pppserial/pppserial.c new file mode 100644 index 000000000..148646851 --- /dev/null +++ b/src/tcpedit/plugins/dlt_pppserial/pppserial.c @@ -0,0 +1,376 @@ +/* $Id$ */ + +/* + * Copyright (c) 2006-2007 Aaron Turner. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the names of the copyright owners nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#include +#include + +#include "tcpedit.h" +#include "common.h" +#include "tcpr.h" +#include "dlt_utils.h" +#include "tcpedit_stub.h" +#include "pppserial.h" +#include "pppserial_types.h" + +static char dlt_name[] = "pppserial"; +static char dlt_prefix[] = "pppserial"; +static u_int16_t dlt_value = 0x0032; + +/* + * Function to register ourselves. This function is always called, regardless + * of what DLT types are being used, so it shouldn't be allocating extra buffers + * or anything like that (use the dlt_pppserial_init() function below for that). + * Tasks: + * - Create a new plugin struct + * - Fill out the provides/requires bit masks. Note: Only specify which fields are + * actually in the header. + * - Add the plugin to the context's plugin chain + * Returns: TCPEDIT_ERROR | TCPEDIT_OK | TCPEDIT_WARN + */ +int +dlt_pppserial_register(tcpeditdlt_t *ctx) +{ + tcpeditdlt_plugin_t *plugin; + assert(ctx); + + /* create a new plugin structure */ + plugin = tcpedit_dlt_newplugin(); + + /* set what we provide & require */ + plugin->provides += PLUGIN_MASK_PROTO; + /* plugin->requires += PLUGIN_MASK_PROTO + PLUGIN_MASK_SRCADDR + PLUGIN_MASK_DSTADDR; */ + + /* what is our DLT value? */ + plugin->dlt = dlt_value; + + /* set the prefix name of our plugin. This is also used as the prefix for our options */ + plugin->name = safe_strdup(dlt_name); + + /* + * Point to our functions, note, you need a function for EVERY method. + * Even if it is only an empty stub returning success. + */ + plugin->plugin_init = dlt_pppserial_init; + plugin->plugin_post_init = dlt_pppserial_init; + plugin->plugin_cleanup = dlt_pppserial_cleanup; + plugin->plugin_parse_opts = dlt_pppserial_parse_opts; + plugin->plugin_decode = dlt_pppserial_decode; + plugin->plugin_encode = dlt_pppserial_encode; + plugin->plugin_proto = dlt_pppserial_proto; + plugin->plugin_l2addr_type = dlt_pppserial_l2addr_type; + plugin->plugin_l2len = dlt_pppserial_l2len; + plugin->plugin_get_layer3 = dlt_pppserial_get_layer3; + plugin->plugin_merge_layer3 = dlt_pppserial_merge_layer3; + plugin->plugin_get_mac = dlt_pppserial_get_mac; + + /* add it to the available plugin list */ + return tcpedit_dlt_addplugin(ctx, plugin); +} + + +/* + * Initializer function. This function is called only once, if and only iif + * this plugin will be utilized. Remember, if you need to keep track of any state, + * store it in your plugin->config, not a global! + * Returns: TCPEDIT_ERROR | TCPEDIT_OK | TCPEDIT_WARN + */ +int +dlt_pppserial_init(tcpeditdlt_t *ctx) +{ + tcpeditdlt_plugin_t *plugin; + pppserial_config_t *config; + assert(ctx); + + if ((plugin = tcpedit_dlt_getplugin(ctx, dlt_value)) == NULL) { + tcpedit_seterr(ctx->tcpedit, "Unable to initalize unregistered plugin %s", dlt_name); + return TCPEDIT_ERROR; + } + + /* allocate memory for our deocde extra data */ + if (sizeof(pppserial_extra_t) > 0) + ctx->decoded_extra = safe_malloc(sizeof(pppserial_extra_t)); + + /* allocate memory for our config data */ + if (sizeof(pppserial_config_t) > 0) + plugin->config = safe_malloc(sizeof(pppserial_config_t)); + + config = (pppserial_config_t *)plugin->config; + + /* FIXME: set default config values here */ + + return TCPEDIT_OK; /* success */ +} + +/** + * Post init function. This function is called only once after init() and parse_opts() + * It basically allows decoders to properly initialize sub-plugins. + */ +int +dlt_pppserial_post_init(tcpeditdlt_t *ctx) +{ + assert(ctx); +/* FIXME: Only needs to do something if we're using a sub-plugin + * See the jnpr_ether_plugin for an example of this + + pppserial_config_t *config; + + // do nothing if we're not the decoder + if (ctx->decoder->dlt != dlt_value) + return TCPEDIT_OK; + + // init our subcontext & decoder + config = (pppserial_config_t *)ctx->encoder->config; + config->subctx = tcpedit_dlt_init(ctx->tcpedit, SUB_PLUGIN_DLT_TYPE); +*/ + return TCPEDIT_OK; +} + +/* + * Since this is used in a library, we should manually clean up after ourselves + * Unless you allocated some memory in dlt_pppserial_init(), this is just an stub. + * Returns: TCPEDIT_ERROR | TCPEDIT_OK | TCPEDIT_WARN + */ +int +dlt_pppserial_cleanup(tcpeditdlt_t *ctx) +{ + tcpeditdlt_plugin_t *plugin; + assert(ctx); + + if ((plugin = tcpedit_dlt_getplugin(ctx, dlt_value)) == NULL) { + tcpedit_seterr(ctx->tcpedit, "Unable to cleanup unregistered plugin %s", dlt_name); + return TCPEDIT_ERROR; + } + + /* FIXME: make this function do something if necessary */ + if (ctx->decoded_extra != NULL) { + safe_free(ctx->decoded_extra); + ctx->decoded_extra = NULL; + } + + if (plugin->config != NULL) { + safe_free(plugin->config); + plugin->config = NULL; + } + + return TCPEDIT_OK; /* success */ +} + +/* + * This is where you should define all your AutoGen AutoOpts option parsing. + * Any user specified option should have it's bit turned on in the 'provides' + * bit mask. + * Returns: TCPEDIT_ERROR | TCPEDIT_OK | TCPEDIT_WARN + */ +int +dlt_pppserial_parse_opts(tcpeditdlt_t *ctx) +{ + assert(ctx); + + /* no options! nothing to do here :) */ + + return TCPEDIT_OK; /* success */ +} + +/* + * Function to decode the layer 2 header in the packet. + * You need to fill out: + * - ctx->l2len + * - ctx->srcaddr + * - ctx->dstaddr + * - ctx->proto + * - ctx->decoded_extra + * Returns: TCPEDIT_ERROR | TCPEDIT_OK | TCPEDIT_WARN + */ +int +dlt_pppserial_decode(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen) +{ + tcpeditdlt_plugin_t *plugin = NULL; + struct tcpr_pppserial_hdr *ppp = NULL; + + assert(ctx); + assert(packet); + assert(pktlen > 4); + + /* + * PPP has three fields: address, control and protocol + * address should always be 0xff, and control seems pretty meaningless. + * protocol field informs you of the following header, but alas does not + * use standard IEEE 802.11 values (IPv4 is not 0x0800, but is 0x0021) + */ + plugin = tcpedit_dlt_getplugin(ctx, dlt_value); + ppp = (struct tcpr_pppserial_hdr *)packet; + switch (ntohs(ppp->protocol)) { + case 0x0021: /* IPv4 */ + ctx->proto = htons(ETHERTYPE_IP); + ctx->l2len = 4; + break; + + default: + /* + * PPP Seems to be using different protocol values then IEEE/802.x + * but Wireshark seems to know how to decode them, so rather then + * returning TCPEDIT_SOFT_ERROR and skipping rewrite completely, + * I just copy the packet payload over and let Wireshark figure it out + */ + ctx->l2len = 4; + ctx->proto = ppp->protocol; + } + + return TCPEDIT_OK; /* success */ +} + +/* + * Function to encode the layer 2 header back into the packet. + * Returns: total packet len or TCPEDIT_ERROR + */ +int +dlt_pppserial_encode(tcpeditdlt_t *ctx, u_char *packet, int pktlen, _U_ tcpr_dir_t dir) +{ + assert(ctx); + assert(pktlen > 4); + assert(packet); + + /* FIXME: make this function work */ + + + return pktlen; /* success */ +} + +/* + * Function returns the Layer 3 protocol type of the given packet, or TCPEDIT_ERROR on error + * Make sure you return this value in NETWORK byte order! + */ +int +dlt_pppserial_proto(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen) +{ + tcpeditdlt_plugin_t *plugin = NULL; + struct tcpr_pppserial_hdr *ppp = NULL; + int protocol = 0; + + assert(ctx); + assert(packet); + assert(pktlen > 4); + + plugin = tcpedit_dlt_getplugin(ctx, dlt_value); + ppp = (struct tcpr_pppserial_hdr *)packet; + switch (ntohs(ppp->protocol)) { + case 0x0021: /* IPv4 */ + protocol = ETHERTYPE_IP; + break; + + default: + tcpedit_seterr(ctx->tcpedit, "Packet " COUNTER_SPEC + " isn't IP. Skipping packet", + ctx->tcpedit->runtime.packetnum); + return TCPEDIT_SOFT_ERROR; + } + + return protocol; +} + +/* + * Function returns a pointer to the layer 3 protocol header or NULL on error + */ +u_char * +dlt_pppserial_get_layer3(tcpeditdlt_t *ctx, u_char *packet, const int pktlen) +{ + int l2len; + assert(ctx); + assert(packet); + + /* FIXME: Is there anything else we need to do?? */ + l2len = dlt_pppserial_l2len(ctx, packet, pktlen); + + assert(pktlen >= l2len); + + return tcpedit_dlt_l3data_copy(ctx, packet, pktlen, l2len); +} + +/* + * function merges the packet (containing L2 and old L3) with the l3data buffer + * containing the new l3 data. Note, if L2 % 4 == 0, then they're pointing to the + * same buffer, otherwise there was a memcpy involved on strictly aligned architectures + * like SPARC + */ +u_char * +dlt_pppserial_merge_layer3(tcpeditdlt_t *ctx, u_char *packet, const int pktlen, u_char *l3data) +{ + int l2len; + assert(ctx); + assert(packet); + assert(l3data); + + /* FIXME: Is there anything else we need to do?? */ + l2len = dlt_pppserial_l2len(ctx, packet, pktlen); + + assert(pktlen >= l2len); + + return tcpedit_dlt_l3data_merge(ctx, packet, pktlen, l3data, l2len); +} + +/* + * return a static pointer to the source/destination MAC address + * return NULL on error/address doesn't exist + */ +u_char * +dlt_pppserial_get_mac(tcpeditdlt_t *ctx, tcpeditdlt_mac_type_t mac, const u_char *packet, const int pktlen) +{ + assert(ctx); + assert(packet); + assert(pktlen); + + return NULL; +} + + +/* + * return the length of the L2 header of the current packet + */ +int +dlt_pppserial_l2len(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen) +{ + assert(ctx); + assert(packet); + assert(pktlen); + + return 4; +} + + +tcpeditdlt_l2addr_type_t +dlt_pppserial_l2addr_type(void) +{ + return NONE; +} + diff --git a/src/tcpedit/plugins/dlt_pppserial/pppserial.h b/src/tcpedit/plugins/dlt_pppserial/pppserial.h new file mode 100644 index 000000000..89a2b9f4d --- /dev/null +++ b/src/tcpedit/plugins/dlt_pppserial/pppserial.h @@ -0,0 +1,41 @@ +/* $Id$ */ + +/* + * Copyright (c) 2001-2010 Aaron Turner + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. + * + * The Tcpreplay Suite of tools is free software: you can redistribute it + * and/or modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or with the authors permission any later version. + * + * The Tcpreplay Suite is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with the Tcpreplay Suite. If not, see . + */ + +#ifndef _DLT_pppserial_H_ +#define _DLT_pppserial_H_ + +#include "pppserial_types.h" + +int dlt_pppserial_register(tcpeditdlt_t *ctx); +int dlt_pppserial_init(tcpeditdlt_t *ctx); +int dlt_pppserial_post_init(tcpeditdlt_t *ctx); +int dlt_pppserial_cleanup(tcpeditdlt_t *ctx); +int dlt_pppserial_parse_opts(tcpeditdlt_t *ctx); +int dlt_pppserial_decode(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen); +int dlt_pppserial_encode(tcpeditdlt_t *ctx, u_char *packet, int pktlen, tcpr_dir_t dir); +int dlt_pppserial_proto(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen); +u_char *dlt_pppserial_get_layer3(tcpeditdlt_t *ctx, u_char *packet, const int pktlen); +u_char *dlt_pppserial_merge_layer3(tcpeditdlt_t *ctx, u_char *packet, const int pktlen, u_char *l3data); +tcpeditdlt_l2addr_type_t dlt_pppserial_l2addr_type(void); +int dlt_pppserial_l2len(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen); +u_char *dlt_pppserial_get_mac(tcpeditdlt_t *ctx, tcpeditdlt_mac_type_t mac, const u_char *packet, const int pktlen); + +#endif + diff --git a/src/tcpedit/plugins/dlt_pppserial/pppserial_api.c b/src/tcpedit/plugins/dlt_pppserial/pppserial_api.c new file mode 100644 index 000000000..8c7accdbe --- /dev/null +++ b/src/tcpedit/plugins/dlt_pppserial/pppserial_api.c @@ -0,0 +1,48 @@ +/* $Id$ */ + +/* + * Copyright (c) 2009 Aaron Turner. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the names of the copyright owners nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +/* + * FIXME: If you are creating an encoder plugin with any options + * then you need to create API calls for each option so that the + * GUI or other programs using libtcpedit can set those values. + * + * Just uncomment the following headers, declare your methods in + * pppserial_api.h and write them here... + +#include "common.h" +#include "tcpr.h" +#include "tcpedit.h" +#include "pppserial_types.h" + +*/ \ No newline at end of file diff --git a/src/tcpedit/plugins/dlt_pppserial/pppserial_api.h b/src/tcpedit/plugins/dlt_pppserial/pppserial_api.h new file mode 100644 index 000000000..3183a74a0 --- /dev/null +++ b/src/tcpedit/plugins/dlt_pppserial/pppserial_api.h @@ -0,0 +1,39 @@ +/* $Id$ */ + +/* + * Copyright (c) 2001-2010 Aaron Turner + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. + * + * The Tcpreplay Suite of tools is free software: you can redistribute it + * and/or modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or with the authors permission any later version. + * + * The Tcpreplay Suite is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with the Tcpreplay Suite. If not, see . + */ + +#ifndef _DLT_pppserial_API_H_ +#define _DLT_pppserial_API_H_ + +#include "tcpedit_types.h" +#include "plugins_types.h" +#include "pppserial_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* your methods go here */ + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/src/tcpedit/plugins/dlt_pppserial/pppserial_opts.def b/src/tcpedit/plugins/dlt_pppserial/pppserial_opts.def new file mode 100644 index 000000000..ffbc19c2f --- /dev/null +++ b/src/tcpedit/plugins/dlt_pppserial/pppserial_opts.def @@ -0,0 +1 @@ +/* Add the flag definitions for your plugin here */ \ No newline at end of file diff --git a/src/tcpedit/plugins/dlt_pppserial/pppserial_types.h b/src/tcpedit/plugins/dlt_pppserial/pppserial_types.h new file mode 100644 index 000000000..0f8798dd2 --- /dev/null +++ b/src/tcpedit/plugins/dlt_pppserial/pppserial_types.h @@ -0,0 +1,40 @@ +/* $Id$ */ + +/* + * Copyright (c) 2001-2010 Aaron Turner + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. + * + * The Tcpreplay Suite of tools is free software: you can redistribute it + * and/or modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or with the authors permission any later version. + * + * The Tcpreplay Suite is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with the Tcpreplay Suite. If not, see . + */ + + +#ifndef _DLT_pppserial_TYPES_H_ +#define _DLT_pppserial_TYPES_H_ + +#include "plugins_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { } pppserial_config_t; + +typedef struct { } pppserial_extra_t; + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/src/tcpedit/plugins/dlt_stub.def b/src/tcpedit/plugins/dlt_stub.def index cb3636911..dbbcdb9ee 100644 --- a/src/tcpedit/plugins/dlt_stub.def +++ b/src/tcpedit/plugins/dlt_stub.def @@ -10,3 +10,4 @@ #include dlt_linuxsll/linuxsll_opts.def #include dlt_ieee80211/ieee80211_opts.def #include dlt_radiotap/radiotap_opts.def +#include dlt_pppserial/radiotap_opts.def diff --git a/src/tcpedit/plugins/dlt_template.sh b/src/tcpedit/plugins/dlt_template.sh index 2d08fe687..4c8d5adc3 100755 --- a/src/tcpedit/plugins/dlt_template.sh +++ b/src/tcpedit/plugins/dlt_template.sh @@ -28,6 +28,16 @@ if [ ! -d $PLUGINDIR ]; then try mkdir $PLUGINDIR fi + +# Files to not change their name +for i in Makefile.am ; do + if [ -f ${PLUGINDIR}/$i ]; then + echo "Skipping ${PLUGINDIR}/$i" + continue; + fi + try sed -e "s/%{plugin}/$PLUGIN/g" dlt_template/$i >${PLUGINDIR}/$i +done + # Files to have their name changed for i in plugin.c.tmpl plugin.h plugin_opts.def plugin_api.c.tmpl plugin_api.h plugin_types.h ; do OUTFILE=`echo $i | sed -E "s/plugin/${PLUGIN}/"` @@ -38,12 +48,15 @@ for i in plugin.c.tmpl plugin.h plugin_opts.def plugin_api.c.tmpl plugin_api.h p continue; fi - try sed -E "s/%{plugin}/${PLUGIN}/g" dlt_template/$i >$OUTFILE + try sed -e "s/%{plugin}/${PLUGIN}/g" dlt_template/$i >$OUTFILE done # tell the user what to do now echo "Plugin template created in: $PLUGINDIR" echo "" +echo "Pleased be sure to modify ./Makefile.am and add the line to the END OF THE FILE:" +echo "include \$(srcdir)/plugins/${PLUGINDIR}/Makefile.am" +echo "" echo "You must also modify ./dlt_stub.def and add the line:" echo "#include ${PLUGINDIR}/${PLUGIN}_opts.def" echo "" @@ -53,6 +66,6 @@ echo "Next, you must make the appropriate modifications to ./dlt_plugin.c" echo "You'll want to use your configuration parsing functions from above in your" echo "tcpedit_${PLUGIN}_parse_opts() function" echo "" -echo "Lastly, re-run 'cmake' from the root source directory" -echo "and run 'make' to build your new plugin" +echo "Lastly, re-run automake from the root source directory" +echo "and run ./configure to build your new plugin" exit 0 From 86be14e2482fdfe54bf262f1e44082086bd88003 Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Wed, 1 Jan 2014 12:37:49 -0800 Subject: [PATCH 11/20] Updates since getting a sample packet capture from Mike Komer - #42 --- src/common/flows.c | 29 ++++++++++++++-------- src/common/get.c | 38 +++++++++++++++++++++-------- src/tcpedit/dlt.c | 5 ++++ src/tcpedit/plugins/dlt_opts.def | 1 + src/tcpedit/plugins/dlt_template.sh | 2 ++ src/tcprewrite_opts.def | 2 ++ 6 files changed, 57 insertions(+), 20 deletions(-) diff --git a/src/common/flows.c b/src/common/flows.c index e6eae7d94..6bddbea40 100644 --- a/src/common/flows.c +++ b/src/common/flows.c @@ -164,7 +164,7 @@ flow_entry_type_t flow_decode(flow_hash_table_t *fht, const struct pcap_pkthdr * udp_hdr_t *udp_hdr; icmpv4_hdr_t *icmp_hdr; flow_entry_data_t entry; - int l2_len = 0; + uint16_t l2_len = 0; int ip_len; uint8_t protocol; uint32_t hash; @@ -192,16 +192,25 @@ flow_entry_type_t flow_decode(flow_hash_table_t *fht, const struct pcap_pkthdr * ether_type = ETHERTYPE_IP6; break; + case DLT_JUNIPER_ETHER: + if (memcmp(pktdata, "MGC", 3)) + warnx("No Magic Number found: %s (0x%x)", + pcap_datalink_val_to_description(datalink), datalink); + + if ((pktdata[3] & 0x80) == 0x80) { + l2_len = ntohs(*((uint16_t*)&pktdata[4])); + l2_len += 6; + } else + l2_len = 4; /* no header extensions */ + /* fall through */ case DLT_EN10MB: - ether_type = ntohs(((eth_hdr_t*)pktdata)->ether_type); - - if (ether_type == ETHERTYPE_VLAN) { - while (ether_type == ETHERTYPE_VLAN) { - vlan_hdr = (vlan_hdr_t *)(pktdata + l2_len); - entry.vlan = vlan_hdr->vlan_priority_c_vid & htons(0xfff); - ether_type = ntohs(vlan_hdr->vlan_len); - l2_len += 4; - } + ether_type = ntohs(((eth_hdr_t*)(pktdata + l2_len))->ether_type); + + while (ether_type == ETHERTYPE_VLAN) { + vlan_hdr = (vlan_hdr_t *)(pktdata + l2_len); + entry.vlan = vlan_hdr->vlan_priority_c_vid & htons(0xfff); + ether_type = ntohs(vlan_hdr->vlan_len); + l2_len += 4; } l2_len += sizeof(eth_hdr_t); diff --git a/src/common/get.c b/src/common/get.c index befa799ac..8c2e7ef01 100644 --- a/src/common/get.c +++ b/src/common/get.c @@ -83,6 +83,7 @@ get_l2protocol(const u_char *pktdata, const int datalen, const int datalink) hdlc_hdr_t *hdlc_hdr; sll_hdr_t *sll_hdr; uint16_t ether_type; + uint16_t eth_hdr_offset = 0; assert(pktdata); assert(datalen); @@ -92,8 +93,19 @@ get_l2protocol(const u_char *pktdata, const int datalen, const int datalink) return ETHERTYPE_IP; break; + case DLT_JUNIPER_ETHER: + if (memcmp(pktdata, "MGC", 3)) + warnx("No Magic Number found: %s (0x%x)", + pcap_datalink_val_to_description(datalink), datalink); + + if ((pktdata[3] & 0x80) == 0x80) { + eth_hdr_offset = ntohs(*((uint16_t*)&pktdata[4])); + eth_hdr_offset += 6; + } else + eth_hdr_offset = 4; /* no header extensions */ + /* fall through */ case DLT_EN10MB: - eth_hdr = (eth_hdr_t *)pktdata; + eth_hdr = (eth_hdr_t *)(pktdata + eth_hdr_offset); ether_type = ntohs(eth_hdr->ether_type); switch (ether_type) { case ETHERTYPE_VLAN: /* 802.1q */ @@ -130,7 +142,9 @@ get_l2protocol(const u_char *pktdata, const int datalen, const int datalink) int get_l2len(const u_char *pktdata, const int datalen, const int datalink) { - eth_hdr_t *eth_hdr; + uint16_t ether_type = 0; + vlan_hdr_t *vlan_hdr; + int l2_len = 0; assert(pktdata); assert(datalen); @@ -141,17 +155,21 @@ get_l2len(const u_char *pktdata, const int datalen, const int datalink) return 0; break; + case DLT_JUNIPER_ETHER: + l2_len = 24; + /* fall through */ case DLT_EN10MB: - eth_hdr = (struct tcpr_ethernet_hdr *)pktdata; - switch (ntohs(eth_hdr->ether_type)) { - case ETHERTYPE_VLAN: - return 18; - break; + ether_type = ntohs(((eth_hdr_t*)(pktdata + l2_len))->ether_type); - default: - return 14; - break; + while (ether_type == ETHERTYPE_VLAN) { + vlan_hdr = (vlan_hdr_t *)(pktdata + l2_len); + ether_type = ntohs(vlan_hdr->vlan_len); + l2_len += 4; } + + l2_len += sizeof(eth_hdr_t); + + return l2_len; break; case DLT_C_HDLC: diff --git a/src/tcpedit/dlt.c b/src/tcpedit/dlt.c index 727cbb119..96771b4ca 100644 --- a/src/tcpedit/dlt.c +++ b/src/tcpedit/dlt.c @@ -63,6 +63,10 @@ dlt2layer2len(tcpedit_t *tcpedit, int dlt) len = 4; break; + case DLT_JUNIPER_ETHER: + len = 36; + break; + default: tcpedit_seterr(tcpedit, "Invalid DLT Type: %d", dlt); len = -1; @@ -124,6 +128,7 @@ dlt2mtu(tcpedit_t *tcpedit, int dlt) case DLT_EN10MB: case DLT_RAW: case DLT_C_HDLC: + case DLT_JUNIPER_ETHER: mtu = 1500; break; diff --git a/src/tcpedit/plugins/dlt_opts.def b/src/tcpedit/plugins/dlt_opts.def index 6ddc106d7..e2b9fe325 100644 --- a/src/tcpedit/plugins/dlt_opts.def +++ b/src/tcpedit/plugins/dlt_opts.def @@ -34,6 +34,7 @@ Ethernet aka DLT_EN10MB @item @var{hdlc} Cisco HDLC aka DLT_C_HDLC +@item @var{jnpr_ether} Juniper Ethernet DLT_C_JNPR_ETHER @item diff --git a/src/tcpedit/plugins/dlt_template.sh b/src/tcpedit/plugins/dlt_template.sh index 41ce79916..a343f48f4 100755 --- a/src/tcpedit/plugins/dlt_template.sh +++ b/src/tcpedit/plugins/dlt_template.sh @@ -60,6 +60,8 @@ echo "" echo "You must also modify ./dlt_stub.def and add the line:" echo "#include ${PLUGINDIR}/${PLUGIN}_opts.def" echo "" +echo "You may also need to update dlt.c, flows.c, dlt_opts.def and tcprewrite_opts.def +echo "" echo "Next, you must make the appropriate modifications to ./dlt_plugin.c" echo "Lastly, re-run automake from the root source directory" echo "and run ./configure to build your new plugin" diff --git a/src/tcprewrite_opts.def b/src/tcprewrite_opts.def index c0b34451d..d220e5652 100644 --- a/src/tcprewrite_opts.def +++ b/src/tcprewrite_opts.def @@ -72,6 +72,8 @@ tcprewrite currently supports reading the following DLT types: @var{DLT_IEEE802_11} aka 802.11a/b/g @item @var{DLT_IEEE802_11_RADIO} aka 802.11a/b/g with Radiotap headers +@item +@var{DLT_JUNIPER_ETHER} aka Juniper Encapsulated Ethernet Please see the --dlt option for supported DLT types for writing. From 48b1b1f1568ff0d4b8c1459a32dd4bc70a4138b8 Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Wed, 1 Jan 2014 16:27:49 -0800 Subject: [PATCH 12/20] updates to DLT_PPP_SERIAL - #40 --- src/common/flows.c | 28 +++++++-- src/common/get.c | 14 ++++- src/send_packets.c | 90 +++++++++++++++++++++-------- src/tcpedit/dlt.c | 3 + src/tcpedit/plugins/dlt_opts.def | 2 +- src/tcpedit/plugins/dlt_template.sh | 6 +- src/tcpprep.c | 1 + src/tcprewrite_opts.def | 2 + 8 files changed, 111 insertions(+), 35 deletions(-) diff --git a/src/common/flows.c b/src/common/flows.c index f42c897c8..fbd5f9ffa 100644 --- a/src/common/flows.c +++ b/src/common/flows.c @@ -21,6 +21,7 @@ #include #include #include +#include "../../lib/sll.h" /* 5-tuple plus VLAN ID */ typedef struct flow_entry_data { @@ -163,6 +164,9 @@ flow_entry_type_t flow_decode(flow_hash_table_t *fht, const struct pcap_pkthdr * tcp_hdr_t *tcp_hdr; udp_hdr_t *udp_hdr; icmpv4_hdr_t *icmp_hdr; + hdlc_hdr_t *hdlc_hdr; + sll_hdr_t *sll_hdr; + struct tcpr_pppserial_hdr *ppp; flow_entry_data_t entry; int l2_len = 0; int ip_len; @@ -180,11 +184,26 @@ flow_entry_type_t flow_decode(flow_hash_table_t *fht, const struct pcap_pkthdr * switch (datalink) { case DLT_LINUX_SLL: - l2_len = 12; /* actually 16 */ - /* fall through */ + l2_len = 16; + sll_hdr = (sll_hdr_t *)pktdata; + ether_type = sll_hdr->sll_protocol; + break; + + case DLT_PPP_SERIAL: + l2_len = 4; + ppp = (struct tcpr_pppserial_hdr *)pktdata; + if (ntohs(ppp->protocol) == 0x0021) + ether_type = htonl(ETHERTYPE_IP); + else + ether_type = ppp->protocol; + break; + case DLT_C_HDLC: - l2_len += 4; - /* fall through */ + l2_len = 4; + hdlc_hdr = (hdlc_hdr_t *)pktdata; + ether_type = hdlc_hdr->protocol; + break; + case DLT_RAW: if ((pktdata[0] >> 4) == 4) ether_type = ETHERTYPE_IP; @@ -213,7 +232,6 @@ flow_entry_type_t flow_decode(flow_hash_table_t *fht, const struct pcap_pkthdr * return FLOW_ENTRY_INVALID; } - if (ether_type == ETHERTYPE_IP) { ip_hdr = (ipv4_hdr_t *)(pktdata + l2_len); diff --git a/src/common/get.c b/src/common/get.c index c7e20ae07..427d28989 100644 --- a/src/common/get.c +++ b/src/common/get.c @@ -83,13 +83,17 @@ get_l2protocol(const u_char *pktdata, const int datalen, const int datalink) hdlc_hdr_t *hdlc_hdr; sll_hdr_t *sll_hdr; uint16_t ether_type; + struct tcpr_pppserial_hdr *ppp; assert(pktdata); assert(datalen); switch (datalink) { case DLT_RAW: - return ETHERTYPE_IP; + if ((pktdata[0] >> 4) == 4) + return ETHERTYPE_IP; + else if ((pktdata[0] >> 4) == 6) + return ETHERTYPE_IP6; break; case DLT_EN10MB: @@ -104,6 +108,14 @@ get_l2protocol(const u_char *pktdata, const int datalen, const int datalink) } break; + case DLT_PPP_SERIAL: + ppp = (struct tcpr_pppserial_hdr *)pktdata; + if (ntohs(ppp->protocol) == 0x0021) + return htonl(ETHERTYPE_IP); + else + return ppp->protocol; + break; + case DLT_C_HDLC: hdlc_hdr = (hdlc_hdr_t *)pktdata; return hdlc_hdr->protocol; diff --git a/src/send_packets.c b/src/send_packets.c index d0ade0330..76622caf7 100644 --- a/src/send_packets.c +++ b/src/send_packets.c @@ -35,6 +35,7 @@ #include "tcpreplay_api.h" #include "timestamp_trace.h" +#include "../lib/sll.h" #ifdef TCPREPLAY @@ -83,9 +84,13 @@ fast_edit_packet_dl(struct pcap_pkthdr *pkthdr, u_char **pktdata, int l2_len = 0; ipv4_hdr_t *ip_hdr; ipv6_hdr_t *ip6_hdr; + hdlc_hdr_t *hdlc_hdr; + sll_hdr_t *sll_hdr; + struct tcpr_pppserial_hdr *ppp; uint32_t *src_ptr = NULL, *dst_ptr = NULL; uint32_t src_ip, dst_ip; uint32_t src_ip_orig, dst_ip_orig; + uint16_t ether_type; if (pkthdr->caplen < (bpf_u_int32)TCPR_IPV6_H) { dbgx(1, "Packet too short for Unique IP feature: %u", pkthdr->caplen); @@ -95,41 +100,78 @@ fast_edit_packet_dl(struct pcap_pkthdr *pkthdr, u_char **pktdata, switch (datalink) { case DLT_LINUX_SLL: - l2_len = 12; /* actually 16 */ - /* fall through */ + l2_len = 16; + sll_hdr = (sll_hdr_t *)*pktdata; + ether_type = sll_hdr->sll_protocol; + break; + + case DLT_PPP_SERIAL: + l2_len = 4; + ppp = (struct tcpr_pppserial_hdr *)*pktdata; + if (ntohs(ppp->protocol) == 0x0021) + ether_type = htonl(ETHERTYPE_IP); + else + ether_type = ppp->protocol; + break; + case DLT_C_HDLC: - l2_len += 4; - /* fall through */ + l2_len = 4; + hdlc_hdr = (hdlc_hdr_t *)*pktdata; + ether_type = hdlc_hdr->protocol; + break; + case DLT_RAW: - /* pktdata IS the ip header! */ - ip_hdr = (ipv4_hdr_t*)(packet + l2_len); + if ((*pktdata[0] >> 4) == 4) + ether_type = ETHERTYPE_IP; + else if ((*pktdata[0] >> 4) == 6) + ether_type = ETHERTYPE_IP6; + break; - switch (ip_hdr->ip_v) { - case 4: - src_ptr = (uint32_t*)&ip_hdr->ip_src; - dst_ptr = (uint32_t*)&ip_hdr->ip_dst; - break; + default: + warnx("Unable to process unsupported DLT type: %s (0x%x)", + pcap_datalink_val_to_description(datalink), datalink); + return; + } - case 6: - ip6_hdr = (ipv6_hdr_t*)ip_hdr; - src_ptr = (uint32_t*)&ip6_hdr->ip_src.__u6_addr.__u6_addr32[3]; - dst_ptr = (uint32_t*)&ip6_hdr->ip_dst.__u6_addr.__u6_addr32[3]; - break; + switch (ether_type) { + case ETHERTYPE_IP: + ip_hdr = (ipv4_hdr_t *)(*pktdata + l2_len); + + if (ip_hdr->ip_v != 4) { + dbgx(2, "expected IPv4 but got: %u", ip_hdr->ip_v); + return; + } - default: - /* non-IP packet */ + if (pkthdr->caplen < (bpf_u_int32)sizeof(*ip_hdr)) { + dbgx(2, "Packet too short for Unique IP feature: %u", pkthdr->caplen); return; } + + ip_hdr = (ipv4_hdr_t *)(*pktdata + l2_len); + src_ip_orig = src_ip = ntohl(ip_hdr->ip_src.s_addr); + dst_ip_orig = dst_ip = ntohl(ip_hdr->ip_dst.s_addr); break; - default: - warnx("Unable to process unsupported DLT type: %s (0x%x)", - pcap_datalink_val_to_description(datalink), datalink); + case ETHERTYPE_IP6: + + if ((*pktdata[0] >> 4) != 6) { + dbgx(2, "expected IPv6 but got: %u", *pktdata[0] >> 4); + return; + } + + if (pkthdr->caplen < (bpf_u_int32)TCPR_IPV6_H) { + dbgx(2, "Packet too short for Unique IPv6 feature: %u", pkthdr->caplen); + return; + } + + ip6_hdr = (ipv6_hdr_t *)(*pktdata + l2_len); + src_ip_orig = src_ip = ntohl(ip6_hdr->ip_src.__u6_addr.__u6_addr32[3]); + dst_ip_orig = dst_ip = ntohl(ip6_hdr->ip_dst.__u6_addr.__u6_addr32[3]); break; - } - src_ip_orig = src_ip = ntohl(*src_ptr); - dst_ip_orig = dst_ip = ntohl(*dst_ptr); + default: + return; /* non-IP */ + } /* swap src/dst IP's in a manner that does not affect CRC */ if ((!cached && dst_ip > src_ip) || diff --git a/src/tcpedit/dlt.c b/src/tcpedit/dlt.c index ed10e913f..5844caa3d 100644 --- a/src/tcpedit/dlt.c +++ b/src/tcpedit/dlt.c @@ -59,6 +59,7 @@ dlt2layer2len(tcpedit_t *tcpedit, int dlt) len = 16; break; + case DLT_PPP_SERIAL: case DLT_C_HDLC: len = 4; break; @@ -92,6 +93,7 @@ dltrequires(tcpedit_t *tcpedit, int dlt) case DLT_NULL: case DLT_RAW: case DLT_C_HDLC: + case DLT_PPP_SERIAL: req = TCPEDIT_DLT_SRC + TCPEDIT_DLT_DST; /* we just have the proto */ break; @@ -121,6 +123,7 @@ dlt2mtu(tcpedit_t *tcpedit, int dlt) switch (dlt) { /* case DLT_VLAN: case DLT_USER: */ + case DLT_PPP_SERIAL: case DLT_EN10MB: case DLT_RAW: case DLT_C_HDLC: diff --git a/src/tcpedit/plugins/dlt_opts.def b/src/tcpedit/plugins/dlt_opts.def index c609f8cd5..f3146f2ea 100644 --- a/src/tcpedit/plugins/dlt_opts.def +++ b/src/tcpedit/plugins/dlt_opts.def @@ -35,7 +35,7 @@ Ethernet aka DLT_EN10MB @var{hdlc} @item @var{pppserial} -PPP Serial aka DLT_PPPSERIAL +PPP Serial aka DLT_PPP_SERIAL @item @var{user} User specified Layer 2 header and DLT type diff --git a/src/tcpedit/plugins/dlt_template.sh b/src/tcpedit/plugins/dlt_template.sh index 4c8d5adc3..050517518 100755 --- a/src/tcpedit/plugins/dlt_template.sh +++ b/src/tcpedit/plugins/dlt_template.sh @@ -60,12 +60,10 @@ echo "" echo "You must also modify ./dlt_stub.def and add the line:" echo "#include ${PLUGINDIR}/${PLUGIN}_opts.def" echo "" -echo "Next, put any configuration parsing functions in ${PLUGINDIR}/${PLUGIN}_api.[ch]" +echo "You may also need to update dlt.c, get.c, tcpprep.c, +echo "flows.c, send_packets.c, dlt_opts.def and tcprewrite_opts.def echo "" echo "Next, you must make the appropriate modifications to ./dlt_plugin.c" -echo "You'll want to use your configuration parsing functions from above in your" -echo "tcpedit_${PLUGIN}_parse_opts() function" -echo "" echo "Lastly, re-run automake from the root source directory" echo "and run ./configure to build your new plugin" exit 0 diff --git a/src/tcpprep.c b/src/tcpprep.c index 0be9bf5ff..2e0898b80 100644 --- a/src/tcpprep.c +++ b/src/tcpprep.c @@ -119,6 +119,7 @@ main(int argc, char *argv[]) case DLT_LINUX_SLL: case DLT_RAW: case DLT_C_HDLC: + case DLT_PPP_SERIAL: break; /* do nothing because all is good */ default: errx(-1, "Unsupported pcap DLT type: 0x%x", pcap_datalink(options->pcap)); diff --git a/src/tcprewrite_opts.def b/src/tcprewrite_opts.def index bcefda127..ad4ebcd5b 100644 --- a/src/tcprewrite_opts.def +++ b/src/tcprewrite_opts.def @@ -72,6 +72,8 @@ tcprewrite currently supports reading the following DLT types: @var{DLT_IEEE802_11} aka 802.11a/b/g @item @var{DLT_IEEE802_11_RADIO} aka 802.11a/b/g with Radiotap headers +@item +@var{DLT_PPP_SERIAL} aka PPP over Serial Please see the --dlt option for supported DLT types for writing. From 89976c55ec48006cba2959f562107764c4027be4 Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Wed, 1 Jan 2014 19:43:06 -0800 Subject: [PATCH 13/20] DLT specific code now gets DLT from file, not interface #42 --- src/replay.c | 20 +++++++++++++++++--- src/send_packets.c | 38 ++++++++++++++++++++++++++------------ src/tcpprep.c | 3 ++- src/tcpreplay_api.h | 1 + 4 files changed, 46 insertions(+), 16 deletions(-) diff --git a/src/replay.c b/src/replay.c index 27355375d..d42499232 100644 --- a/src/replay.c +++ b/src/replay.c @@ -133,6 +133,8 @@ replay_file(tcpreplay_t *ctx, int idx) return -1; } + ctx->options->file_cache[idx].dlt = pcap_datalink(pcap); + #ifdef HAVE_PCAP_SNAPSHOT if (pcap_snapshot(pcap) < 65535) warnx("%s was captured using a snaplen of %d bytes. This may mean you have truncated packets.", @@ -140,11 +142,13 @@ replay_file(tcpreplay_t *ctx, int idx) #endif } else { - if (!ctx->options->file_cache[idx].cached) + if (!ctx->options->file_cache[idx].cached) { if ((pcap = pcap_open_offline(path, ebuf)) == NULL) { tcpreplay_seterr(ctx, "Error opening pcap file: %s", ebuf); return -1; } + ctx->options->file_cache[idx].dlt = pcap_datalink(pcap); + } } #if 0 @@ -161,6 +165,7 @@ replay_file(tcpreplay_t *ctx, int idx) return -1; } + ctx->options->file_cache[idx].dlt = pcap_datalink(pcap); /* init tcpdump */ tcpdump_open(ctx->options->tcpdump, pcap); } @@ -176,6 +181,10 @@ replay_file(tcpreplay_t *ctx, int idx) path, pcap_datalink_val_to_name(pcap_datalink(pcap)), ctx->options->intf1->device, pcap_datalink_val_to_name(ctx->intf1dlt)); #endif + if (ctx->intf1dlt != ctx->options->file_cache[idx].dlt) + tcpreplay_setwarn(ctx, "%s DLT (%s) does not match that of the outbound interface: %s (%s)", + path, pcap_datalink_val_to_name(pcap_datalink(pcap)), + ctx->intf1->device, pcap_datalink_val_to_name(ctx->intf1dlt)); } ctx->stats.active_pcap = ctx->options->sources[idx].filename; @@ -227,22 +236,26 @@ replay_two_files(tcpreplay_t *ctx, int idx1, int idx2) tcpreplay_seterr(ctx, "Error opening pcap file: %s", ebuf); return -1; } + ctx->options->file_cache[idx1].dlt = pcap_datalink(pcap1); if ((pcap2 = pcap_open_offline(path2, ebuf)) == NULL) { tcpreplay_seterr(ctx, "Error opening pcap file: %s", ebuf); return -1; } + ctx->options->file_cache[idx2].dlt = pcap_datalink(pcap2); } else { if (!ctx->options->file_cache[idx1].cached) { if ((pcap1 = pcap_open_offline(path1, ebuf)) == NULL) { tcpreplay_seterr(ctx, "Error opening pcap file: %s", ebuf); return -1; } + ctx->options->file_cache[idx1].dlt = pcap_datalink(pcap1); } if (!ctx->options->file_cache[idx2].cached) { if ((pcap2 = pcap_open_offline(path2, ebuf)) == NULL) { tcpreplay_seterr(ctx, "Error opening pcap file: %s", ebuf); return -1; } + ctx->options->file_cache[idx2].dlt = pcap_datalink(pcap2); } } @@ -289,12 +302,13 @@ replay_two_files(tcpreplay_t *ctx, int idx1, int idx2) if (ctx->options->verbose) { /* in cache mode, we may not have opened the file */ - if (pcap1 == NULL) + if (pcap1 == NULL) { if ((pcap1 = pcap_open_offline(path1, ebuf)) == NULL) { tcpreplay_seterr(ctx, "Error opening pcap file: %s", ebuf); return -1; } - + ctx->options->file_cache[idx1].dlt = pcap_datalink(pcap1); + } /* init tcpdump */ tcpdump_open(ctx->options->tcpdump, pcap1); } diff --git a/src/send_packets.c b/src/send_packets.c index 4f3440c04..ec3dc5e26 100644 --- a/src/send_packets.c +++ b/src/send_packets.c @@ -190,8 +190,9 @@ fast_edit_packet(struct pcap_pkthdr *pkthdr, u_char **pktdata, uint32_t src_ip, dst_ip; uint32_t src_ip_orig, dst_ip_orig; int l2_len; + u_char *packet = *pktdata; - if (datalink != DLT_EN10MB) + if (datalink != DLT_EN10MB && datalink != DLT_JUNIPER_ETHER) fast_edit_packet_dl(pkthdr, pktdata, iteration, cached, datalink); if (pkthdr->caplen < (bpf_u_int32)TCPR_IPV6_H) { @@ -199,11 +200,23 @@ fast_edit_packet(struct pcap_pkthdr *pkthdr, u_char **pktdata, return; } - /* assume Ethernet, IPv4 for now */ - ether_type = ntohs(((eth_hdr_t*)*pktdata)->ether_type); l2_len = 0; + if (datalink == DLT_JUNIPER_ETHER) { + if (memcmp(packet, "MGC", 3)) + warnx("No Magic Number found: %s (0x%x)", + pcap_datalink_val_to_description(datalink), datalink); + + if ((packet[3] & 0x80) == 0x80) { + l2_len = ntohs(*((uint16_t*)&packet[4])); + l2_len += 6; + } else + l2_len = 4; /* no header extensions */ + } + + /* assume Ethernet, IPv4 for now */ + ether_type = ntohs(((eth_hdr_t*)(packet + l2_len))->ether_type); while (ether_type == ETHERTYPE_VLAN) { - vlan_hdr = (vlan_hdr_t *)(*pktdata + l2_len); + vlan_hdr = (vlan_hdr_t *)(packet + l2_len); ether_type = ntohs(vlan_hdr->vlan_len); l2_len += 4; } @@ -211,13 +224,13 @@ fast_edit_packet(struct pcap_pkthdr *pkthdr, u_char **pktdata, switch (ether_type) { case ETHERTYPE_IP: - ip_hdr = (ipv4_hdr_t *)(*pktdata + l2_len); + ip_hdr = (ipv4_hdr_t *)(packet + l2_len); src_ip_orig = src_ip = ntohl(ip_hdr->ip_src.s_addr); dst_ip_orig = dst_ip = ntohl(ip_hdr->ip_dst.s_addr); break; case ETHERTYPE_IP6: - ip6_hdr = (ipv6_hdr_t *)(*pktdata + l2_len); + ip6_hdr = (ipv6_hdr_t *)(packet + l2_len); src_ip_orig = src_ip = ntohl(ip6_hdr->ip_src.__u6_addr.__u6_addr32[3]); dst_ip_orig = dst_ip = ntohl(ip6_hdr->ip_dst.__u6_addr.__u6_addr32[3]); break; @@ -373,6 +386,7 @@ preload_pcap_file(tcpreplay_t *ctx, int idx) /* mark this file as cached */ options->file_cache[idx].cached = TRUE; + options->file_cache[idx].dlt = dlt; pcap_close(pcap); } @@ -396,7 +410,7 @@ send_packets(tcpreplay_t *ctx, pcap_t *pcap, int idx) #if defined TCPREPLAY && defined TCPREPLAY_EDIT struct pcap_pkthdr *pkthdr_ptr; #endif - int datalink = ctx->intf1dlt; + int datalink = options->file_cache[idx].dlt; COUNTER skip_length = 0; COUNTER start_us; uint32_t iteration = ctx->iteration; @@ -569,7 +583,7 @@ send_dual_packets(tcpreplay_t *ctx, pcap_t *pcap1, int cache_file_idx1, pcap_t * packet_cache_t *cached_packet1 = NULL, *cached_packet2 = NULL; packet_cache_t **prev_packet1 = NULL, **prev_packet2 = NULL, **prev_packet = NULL; struct pcap_pkthdr *pkthdr_ptr; - int datalink = ctx->intf1dlt; + int datalink = options->file_cache[cache_file_idx1].dlt; COUNTER start_us; COUNTER skip_length = 0; bool do_not_timestamp = options->speed.mode == speed_topspeed || @@ -613,7 +627,7 @@ send_dual_packets(tcpreplay_t *ctx, pcap_t *pcap1, int cache_file_idx1, pcap_t * if (pktdata1 == NULL) { /* file 2 is next */ sp = ctx->intf2; - datalink = ctx->intf2dlt; + datalink = options->file_cache[cache_file_idx2].dlt; pcap = pcap2; pkthdr_ptr = &pkthdr2; prev_packet = prev_packet2; @@ -622,7 +636,7 @@ send_dual_packets(tcpreplay_t *ctx, pcap_t *pcap1, int cache_file_idx1, pcap_t * } else if (pktdata2 == NULL) { /* file 1 is next */ sp = ctx->intf1; - datalink = ctx->intf1dlt; + datalink = options->file_cache[cache_file_idx1].dlt; pcap = pcap1; pkthdr_ptr = &pkthdr1; prev_packet = prev_packet1; @@ -631,7 +645,7 @@ send_dual_packets(tcpreplay_t *ctx, pcap_t *pcap1, int cache_file_idx1, pcap_t * } else if (timercmp(&pkthdr1.ts, &pkthdr2.ts, <=)) { /* file 1 is next */ sp = ctx->intf1; - datalink = ctx->intf1dlt; + datalink = options->file_cache[cache_file_idx1].dlt; pcap = pcap1; pkthdr_ptr = &pkthdr1; prev_packet = prev_packet1; @@ -640,7 +654,7 @@ send_dual_packets(tcpreplay_t *ctx, pcap_t *pcap1, int cache_file_idx1, pcap_t * } else { /* file 2 is next */ sp = ctx->intf2; - datalink = ctx->intf2dlt; + datalink = options->file_cache[cache_file_idx2].dlt; pcap = pcap2; pkthdr_ptr = &pkthdr2; prev_packet = prev_packet2; diff --git a/src/tcpprep.c b/src/tcpprep.c index f67e21239..d033d8603 100644 --- a/src/tcpprep.c +++ b/src/tcpprep.c @@ -119,6 +119,7 @@ main(int argc, char *argv[]) case DLT_LINUX_SLL: case DLT_RAW: case DLT_C_HDLC: + case DLT_JUNIPER_ETHER: break; /* do nothing because all is good */ default: errx(-1, "Unsupported pcap DLT type: 0x%x", pcap_datalink(options->pcap)); @@ -228,7 +229,7 @@ check_dst_port(ipv4_hdr_t *ip_hdr, ipv6_hdr_t *ip6_hdr, int len) if ((l4 = get_layer4_v6(ip6_hdr, len)) == NULL) return 0; - dbgx(3, "Found proto %u at offset %p. base %p (%u)", proto, (void *)l4, (void *)ip6_hdr, (l4 - (u_char *)ip6_hdr)); + dbgx(3, "Found proto %u at offset %p. base %p (%p)", proto, (void *)l4, (void *)ip6_hdr, (void*)(l4 - (u_char *)ip6_hdr)); } else { assert(0); } diff --git a/src/tcpreplay_api.h b/src/tcpreplay_api.h index 7add6a811..a9f30e377 100644 --- a/src/tcpreplay_api.h +++ b/src/tcpreplay_api.h @@ -53,6 +53,7 @@ typedef struct packet_cache_s { typedef struct file_cache_s { int index; int cached; + int dlt; packet_cache_t *packet_cache; } file_cache_t; From 0bf4516c6c89090dcaee3c35b4afedd02338143d Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Thu, 2 Jan 2014 13:30:47 -0800 Subject: [PATCH 14/20] DLT comes from pcap, not interface #40 --- src/replay.c | 20 +++++++++++++++++--- src/send_packets.c | 24 +++++++++++++----------- src/tcpedit/plugins/dlt_opts.def | 1 + src/tcpedit/plugins/dlt_stub.def | 2 +- src/tcpedit/plugins/dlt_template.sh | 4 ++++ src/tcpreplay_api.h | 1 + 6 files changed, 37 insertions(+), 15 deletions(-) diff --git a/src/replay.c b/src/replay.c index bca01f316..eda1e54e9 100644 --- a/src/replay.c +++ b/src/replay.c @@ -133,6 +133,8 @@ replay_file(tcpreplay_t *ctx, int idx) return -1; } + ctx->options->file_cache[idx].dlt = pcap_datalink(pcap); + #ifdef HAVE_PCAP_SNAPSHOT if (pcap_snapshot(pcap) < 65535) warnx("%s was captured using a snaplen of %d bytes. This may mean you have truncated packets.", @@ -140,11 +142,13 @@ replay_file(tcpreplay_t *ctx, int idx) #endif } else { - if (!ctx->options->file_cache[idx].cached) + if (!ctx->options->file_cache[idx].cached) { if ((pcap = pcap_open_offline(path, ebuf)) == NULL) { tcpreplay_seterr(ctx, "Error opening pcap file: %s", ebuf); return -1; } + ctx->options->file_cache[idx].dlt = pcap_datalink(pcap); + } } #if 0 @@ -161,6 +165,7 @@ replay_file(tcpreplay_t *ctx, int idx) return -1; } + ctx->options->file_cache[idx].dlt = pcap_datalink(pcap); /* init tcpdump */ tcpdump_open(ctx->options->tcpdump, pcap); } @@ -176,6 +181,10 @@ replay_file(tcpreplay_t *ctx, int idx) path, pcap_datalink_val_to_name(pcap_datalink(pcap)), ctx->options->intf1->device, pcap_datalink_val_to_name(ctx->intf1dlt)); #endif + if (ctx->intf1dlt != ctx->options->file_cache[idx].dlt) + tcpreplay_setwarn(ctx, "%s DLT (%s) does not match that of the outbound interface: %s (%s)", + path, pcap_datalink_val_to_name(pcap_datalink(pcap)), + ctx->intf1->device, pcap_datalink_val_to_name(ctx->intf1dlt)); } ctx->stats.active_pcap = ctx->options->sources[idx].filename; @@ -227,22 +236,26 @@ replay_two_files(tcpreplay_t *ctx, int idx1, int idx2) tcpreplay_seterr(ctx, "Error opening pcap file: %s", ebuf); return -1; } + ctx->options->file_cache[idx1].dlt = pcap_datalink(pcap1); if ((pcap2 = pcap_open_offline(path2, ebuf)) == NULL) { tcpreplay_seterr(ctx, "Error opening pcap file: %s", ebuf); return -1; } + ctx->options->file_cache[idx2].dlt = pcap_datalink(pcap2); } else { if (!ctx->options->file_cache[idx1].cached) { if ((pcap1 = pcap_open_offline(path1, ebuf)) == NULL) { tcpreplay_seterr(ctx, "Error opening pcap file: %s", ebuf); return -1; } + ctx->options->file_cache[idx1].dlt = pcap_datalink(pcap1); } if (!ctx->options->file_cache[idx2].cached) { if ((pcap2 = pcap_open_offline(path2, ebuf)) == NULL) { tcpreplay_seterr(ctx, "Error opening pcap file: %s", ebuf); return -1; } + ctx->options->file_cache[idx2].dlt = pcap_datalink(pcap2); } } @@ -289,12 +302,13 @@ replay_two_files(tcpreplay_t *ctx, int idx1, int idx2) if (ctx->options->verbose) { /* in cache mode, we may not have opened the file */ - if (pcap1 == NULL) + if (pcap1 == NULL) { if ((pcap1 = pcap_open_offline(path1, ebuf)) == NULL) { tcpreplay_seterr(ctx, "Error opening pcap file: %s", ebuf); return -1; } - + ctx->options->file_cache[idx1].dlt = pcap_datalink(pcap1); + } /* init tcpdump */ tcpdump_open(ctx->options->tcpdump, pcap1); } diff --git a/src/send_packets.c b/src/send_packets.c index 76622caf7..a2dd5ebc0 100644 --- a/src/send_packets.c +++ b/src/send_packets.c @@ -232,6 +232,7 @@ fast_edit_packet(struct pcap_pkthdr *pkthdr, u_char **pktdata, uint32_t src_ip, dst_ip; uint32_t src_ip_orig, dst_ip_orig; int l2_len; + u_char *packet = *pktdata; if (datalink != DLT_EN10MB) fast_edit_packet_dl(pkthdr, pktdata, iteration, cached, datalink); @@ -241,11 +242,11 @@ fast_edit_packet(struct pcap_pkthdr *pkthdr, u_char **pktdata, return; } - /* assume Ethernet, IPv4 for now */ - ether_type = ntohs(((eth_hdr_t*)*pktdata)->ether_type); l2_len = 0; + /* assume Ethernet, IPv4 for now */ + ether_type = ntohs(((eth_hdr_t*)(packet + l2_len))->ether_type); while (ether_type == ETHERTYPE_VLAN) { - vlan_hdr = (vlan_hdr_t *)(*pktdata + l2_len); + vlan_hdr = (vlan_hdr_t *)(packet + l2_len); ether_type = ntohs(vlan_hdr->vlan_len); l2_len += 4; } @@ -253,13 +254,13 @@ fast_edit_packet(struct pcap_pkthdr *pkthdr, u_char **pktdata, switch (ether_type) { case ETHERTYPE_IP: - ip_hdr = (ipv4_hdr_t *)(*pktdata + l2_len); + ip_hdr = (ipv4_hdr_t *)(packet + l2_len); src_ip_orig = src_ip = ntohl(ip_hdr->ip_src.s_addr); dst_ip_orig = dst_ip = ntohl(ip_hdr->ip_dst.s_addr); break; case ETHERTYPE_IP6: - ip6_hdr = (ipv6_hdr_t *)(*pktdata + l2_len); + ip6_hdr = (ipv6_hdr_t *)(packet + l2_len); src_ip_orig = src_ip = ntohl(ip6_hdr->ip_src.__u6_addr.__u6_addr32[3]); dst_ip_orig = dst_ip = ntohl(ip6_hdr->ip_dst.__u6_addr.__u6_addr32[3]); break; @@ -415,6 +416,7 @@ preload_pcap_file(tcpreplay_t *ctx, int idx) /* mark this file as cached */ options->file_cache[idx].cached = TRUE; + options->file_cache[idx].dlt = dlt; pcap_close(pcap); } @@ -438,7 +440,7 @@ send_packets(tcpreplay_t *ctx, pcap_t *pcap, int idx) #if defined TCPREPLAY && defined TCPREPLAY_EDIT struct pcap_pkthdr *pkthdr_ptr; #endif - int datalink = ctx->intf1dlt; + int datalink = options->file_cache[idx].dlt; COUNTER skip_length = 0; COUNTER start_us; uint32_t iteration = ctx->iteration; @@ -611,7 +613,7 @@ send_dual_packets(tcpreplay_t *ctx, pcap_t *pcap1, int cache_file_idx1, pcap_t * packet_cache_t *cached_packet1 = NULL, *cached_packet2 = NULL; packet_cache_t **prev_packet1 = NULL, **prev_packet2 = NULL, **prev_packet = NULL; struct pcap_pkthdr *pkthdr_ptr; - int datalink = ctx->intf1dlt; + int datalink = options->file_cache[cache_file_idx1].dlt; COUNTER start_us; COUNTER skip_length = 0; bool do_not_timestamp = options->speed.mode == speed_topspeed || @@ -655,7 +657,7 @@ send_dual_packets(tcpreplay_t *ctx, pcap_t *pcap1, int cache_file_idx1, pcap_t * if (pktdata1 == NULL) { /* file 2 is next */ sp = ctx->intf2; - datalink = ctx->intf2dlt; + datalink = options->file_cache[cache_file_idx2].dlt; pcap = pcap2; pkthdr_ptr = &pkthdr2; prev_packet = prev_packet2; @@ -664,7 +666,7 @@ send_dual_packets(tcpreplay_t *ctx, pcap_t *pcap1, int cache_file_idx1, pcap_t * } else if (pktdata2 == NULL) { /* file 1 is next */ sp = ctx->intf1; - datalink = ctx->intf1dlt; + datalink = options->file_cache[cache_file_idx1].dlt; pcap = pcap1; pkthdr_ptr = &pkthdr1; prev_packet = prev_packet1; @@ -673,7 +675,7 @@ send_dual_packets(tcpreplay_t *ctx, pcap_t *pcap1, int cache_file_idx1, pcap_t * } else if (timercmp(&pkthdr1.ts, &pkthdr2.ts, <=)) { /* file 1 is next */ sp = ctx->intf1; - datalink = ctx->intf1dlt; + datalink = options->file_cache[cache_file_idx1].dlt; pcap = pcap1; pkthdr_ptr = &pkthdr1; prev_packet = prev_packet1; @@ -682,7 +684,7 @@ send_dual_packets(tcpreplay_t *ctx, pcap_t *pcap1, int cache_file_idx1, pcap_t * } else { /* file 2 is next */ sp = ctx->intf2; - datalink = ctx->intf2dlt; + datalink = options->file_cache[cache_file_idx2].dlt; pcap = pcap2; pkthdr_ptr = &pkthdr2; prev_packet = prev_packet2; diff --git a/src/tcpedit/plugins/dlt_opts.def b/src/tcpedit/plugins/dlt_opts.def index f3146f2ea..9f078bf54 100644 --- a/src/tcpedit/plugins/dlt_opts.def +++ b/src/tcpedit/plugins/dlt_opts.def @@ -33,6 +33,7 @@ To change the DLT type of the output pcap, select one of the following values: Ethernet aka DLT_EN10MB @item @var{hdlc} +Cisco HDLC aka DLT_C_HDLC @item @var{pppserial} PPP Serial aka DLT_PPP_SERIAL diff --git a/src/tcpedit/plugins/dlt_stub.def b/src/tcpedit/plugins/dlt_stub.def index dbbcdb9ee..470e314ee 100644 --- a/src/tcpedit/plugins/dlt_stub.def +++ b/src/tcpedit/plugins/dlt_stub.def @@ -10,4 +10,4 @@ #include dlt_linuxsll/linuxsll_opts.def #include dlt_ieee80211/ieee80211_opts.def #include dlt_radiotap/radiotap_opts.def -#include dlt_pppserial/radiotap_opts.def +#include dlt_pppserial/pppserial_opts.def diff --git a/src/tcpedit/plugins/dlt_template.sh b/src/tcpedit/plugins/dlt_template.sh index 050517518..7b418906e 100755 --- a/src/tcpedit/plugins/dlt_template.sh +++ b/src/tcpedit/plugins/dlt_template.sh @@ -64,6 +64,10 @@ echo "You may also need to update dlt.c, get.c, tcpprep.c, echo "flows.c, send_packets.c, dlt_opts.def and tcprewrite_opts.def echo "" echo "Next, you must make the appropriate modifications to ./dlt_plugin.c" +echo "" +echo "You'll want to use your configuration parsing functions from above in your" +echo "tcpedit_${PLUGIN}_parse_opts() function" +echo "" echo "Lastly, re-run automake from the root source directory" echo "and run ./configure to build your new plugin" exit 0 diff --git a/src/tcpreplay_api.h b/src/tcpreplay_api.h index c0173daaa..5474ec4ec 100644 --- a/src/tcpreplay_api.h +++ b/src/tcpreplay_api.h @@ -53,6 +53,7 @@ typedef struct packet_cache_s { typedef struct file_cache_s { int index; int cached; + int dlt; packet_cache_t *packet_cache; } file_cache_t; From 1a27a4a4d2f8e2ed70d26015dc74d09cdaa03152 Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Thu, 2 Jan 2014 15:46:55 -0800 Subject: [PATCH 15/20] Fix missing files in dist. Better git version info. #40 --- configure | 6 +++--- configure.ac | 4 ++-- src/common/Makefile.am | 2 +- src/common/Makefile.in | 2 +- src/tcpedit/Makefile.in | 13 +++++++++---- src/tcpedit/plugins/dlt_pppserial/Makefile.am | 13 ++++++++----- src/tcpedit/plugins/dlt_template/Makefile.am | 15 +++++++++------ 7 files changed, 33 insertions(+), 22 deletions(-) diff --git a/configure b/configure index 47a86490d..00b2559c0 100755 --- a/configure +++ b/configure @@ -15746,13 +15746,13 @@ fi AUTOGEN_VERSION="unknown - man pages will not be built" if test -n "${AUTOGEN}" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autogen version >= 5.9.x" >&5 -$as_echo_n "checking for autogen version >= 5.9.x... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autogen version >= 5.16.x" >&5 +$as_echo_n "checking for autogen version >= 5.16.x... " >&6; } ${AUTOGEN} -v >autogen.version AUTOGEN_VERSION=`cat autogen.version | ${SED} 's|.* \([0-9\.]\{5,\}\).*|\1|'` AUTOGEN_MAJOR=`echo ${AUTOGEN_VERSION} | ${CUT} -d '.' -f 1` AUTOGEN_MINOR=`echo ${AUTOGEN_VERSION} | ${CUT} -d '.' -f 2` - if ( test ${AUTOGEN_MAJOR} -eq 5 && test ${AUTOGEN_MINOR} -lt 9 ) || test ${AUTOGEN_MAJOR} -lt 5 ; then + if ( test ${AUTOGEN_MAJOR} -eq 5 && test ${AUTOGEN_MINOR} -lt 16 ) || test ${AUTOGEN_MAJOR} -lt 5 ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ${AUTOGEN} is too old (${AUTOGEN_VERSION}) for building from source code. Please upgrade to 5.16.2)" >&5 diff --git a/configure.ac b/configure.ac index cd24ff55f..fe0da7569 100644 --- a/configure.ac +++ b/configure.ac @@ -75,12 +75,12 @@ AC_PATH_PROG(GROFF, groff) dnl check autogen version AUTOGEN_VERSION="unknown - man pages will not be built" if test -n "${AUTOGEN}" ; then - AC_MSG_CHECKING(for autogen version >= 5.9.x) + AC_MSG_CHECKING(for autogen version >= 5.16.x) ${AUTOGEN} -v >autogen.version AUTOGEN_VERSION=`cat autogen.version | ${SED} 's|.* \([[0-9\.]]\{5,\}\).*|\1|'` AUTOGEN_MAJOR=`echo ${AUTOGEN_VERSION} | ${CUT} -d '.' -f 1` AUTOGEN_MINOR=`echo ${AUTOGEN_VERSION} | ${CUT} -d '.' -f 2` - if ( test ${AUTOGEN_MAJOR} -eq 5 && test ${AUTOGEN_MINOR} -lt 9 ) || test ${AUTOGEN_MAJOR} -lt 5 ; then + if ( test ${AUTOGEN_MAJOR} -eq 5 && test ${AUTOGEN_MINOR} -lt 16 ) || test ${AUTOGEN_MAJOR} -lt 5 ; then AC_MSG_RESULT(no) AC_MSG_WARN([${AUTOGEN} is too old (${AUTOGEN_VERSION}) for building from source code. Please upgrade to 5.16.2)]) else diff --git a/src/common/Makefile.am b/src/common/Makefile.am index 28d59ee0f..e4b94a6cb 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -5,7 +5,7 @@ BUILT_SOURCES = git_version.c git_version.c: $(ECHO) -n 'const char GIT_Version[] = "git:' > git_version.c - git describe --always --abbrev=0 | tr -d '\n' | tr -d '\r' >> git_version.c + git describe --always | tr -d '\n' | tr -d '\r' >> git_version.c $(ECHO) '";' >> git_version.c $(ECHO) 'const char *git_version(void) {' >> git_version.c $(ECHO) ' return GIT_Version;' >> git_version.c diff --git a/src/common/Makefile.in b/src/common/Makefile.in index 7224677a2..cc7b4c0cd 100644 --- a/src/common/Makefile.in +++ b/src/common/Makefile.in @@ -554,7 +554,7 @@ uninstall-am: git_version.c: $(ECHO) -n 'const char GIT_Version[] = "git:' > git_version.c - git describe --always --abbrev=0 | tr -d '\n' | tr -d '\r' >> git_version.c + git describe --always | tr -d '\n' | tr -d '\r' >> git_version.c $(ECHO) '";' >> git_version.c $(ECHO) 'const char *git_version(void) {' >> git_version.c $(ECHO) ' return GIT_Version;' >> git_version.c diff --git a/src/tcpedit/Makefile.in b/src/tcpedit/Makefile.in index 8f9526ff7..5b0f9e841 100644 --- a/src/tcpedit/Makefile.in +++ b/src/tcpedit/Makefile.in @@ -154,7 +154,8 @@ am_libtcpedit_a_OBJECTS = tcpedit.$(OBJEXT) parse_args.$(OBJEXT) \ en10mb_api.$(OBJEXT) hdlc.$(OBJEXT) hdlc_api.$(OBJEXT) \ user.$(OBJEXT) user_api.$(OBJEXT) raw.$(OBJEXT) null.$(OBJEXT) \ loop.$(OBJEXT) linuxsll.$(OBJEXT) ieee80211.$(OBJEXT) \ - ieee80211_hdr.$(OBJEXT) radiotap.$(OBJEXT) pppserial.$(OBJEXT) + ieee80211_hdr.$(OBJEXT) radiotap.$(OBJEXT) pppserial.$(OBJEXT) \ + pppserial.$(OBJEXT) libtcpedit_a_OBJECTS = $(am_libtcpedit_a_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/config/depcomp @@ -343,6 +344,7 @@ libtcpedit_a_SOURCES = tcpedit.c parse_args.c edit_packet.c portmap.c \ $(srcdir)/plugins/dlt_ieee80211/ieee80211.c \ $(srcdir)/plugins/dlt_ieee80211/ieee80211_hdr.c \ $(srcdir)/plugins/dlt_radiotap/radiotap.c \ + $(srcdir)/plugins/dlt_pppserial/pppserial.c \ $(srcdir)/plugins/dlt_pppserial/pppserial.c AM_CFLAGS = -I.. -I../common -I../.. @LDNETINC@ $(LIBOPTS_CFLAGS) \ $(LNAV_CFLAGS) -I. -I$(srcdir)/plugins -I$(srcdir)/../common \ @@ -370,7 +372,9 @@ noinst_HEADERS = tcpedit.h edit_packet.h portmap.h tcpedit_stub.h \ $(srcdir)/plugins/dlt_ieee80211/ieee80211_hdr.h \ $(srcdir)/plugins/dlt_ieee80211/ieee80211_types.h \ $(srcdir)/plugins/dlt_radiotap/radiotap.h \ - $(srcdir)/plugins/dlt_pppserial/pppserial.h + $(srcdir)/plugins/dlt_pppserial/pppserial.h \ + $(srcdir)/plugins/dlt_pppserial/pppserial_api.h \ + $(srcdir)/plugins/dlt_pppserial/pppserial_types.h # Note: # You probably don't want to touch anything below this line until the end of the plugin @@ -414,6 +418,7 @@ EXTRA_DIST = tcpedit_stub.def tcpedit_opts.def \ # You probably don't want to touch anything below this line until the end of the plugin +# Note: # You probably don't want to touch anything below this line until the end of the plugin DLT_STUB_DEPS = $(srcdir)/plugins/dlt_opts.def \ $(srcdir)/plugins/dlt_user/user_opts.def \ @@ -1057,9 +1062,9 @@ $(srcdir)/plugins/dlt_radiotap/radiotap.c: $(srcdir)/tcpedit_stub.h $(srcdir)/p # dependancies for your plugin source code. Edit as necessary $(srcdir)/plugins/dlt_pppserial/pppserial.c: $(srcdir)/tcpedit_stub.h $(srcdir)/plugins/dlt_utils.h \ - $(srcdir)/plugins/dlt_pppserial/pppserial.h $(srcdir)/tcpedit_stub.h $(srcdir)/plugins/dlt_utils.h \ $(srcdir)/plugins.h $(srcdir)/plugins_api.h $(srcdir)/plugins_types.h \ - $(srcdir)/tcpedit_api.h + $(srcdir)/tcpedit_api.h $(srcdir)/plugins/dlt_pppserial/pppserial.h $(srcdir)/plugins/dlt_pppserial/pppserial_api.h \ + $(srcdir)/plugins/dlt_pppserial/pppserial_types.h # END OF: dlt_pppserial diff --git a/src/tcpedit/plugins/dlt_pppserial/Makefile.am b/src/tcpedit/plugins/dlt_pppserial/Makefile.am index 1f69285da..76cead3e2 100644 --- a/src/tcpedit/plugins/dlt_pppserial/Makefile.am +++ b/src/tcpedit/plugins/dlt_pppserial/Makefile.am @@ -6,19 +6,22 @@ # add any other files (like documentation, notes, etc) to EXTRA_DIST # add your dependancy information (see comment below) -libtcpedit_a_SOURCES += $(srcdir)/plugins/dlt_pppserial/pppserial.c +libtcpedit_a_SOURCES += $(srcdir)/plugins/dlt_pppserial/pppserial.c \ + $(srcdir)/plugins/dlt_pppserial/pppserial.c -noinst_HEADERS += $(srcdir)/plugins/dlt_pppserial/pppserial.h +noinst_HEADERS += $(srcdir)/plugins/dlt_pppserial/pppserial.h \ + $(srcdir)/plugins/dlt_pppserial/pppserial_api.h \ + $(srcdir)/plugins/dlt_pppserial/pppserial_types.h EXTRA_DIST += $(srcdir)/plugins/dlt_pppserial/pppserial_opts.def # dependancies for your plugin source code. Edit as necessary $(srcdir)/plugins/dlt_pppserial/pppserial.c: $(srcdir)/tcpedit_stub.h $(srcdir)/plugins/dlt_utils.h \ - $(srcdir)/plugins/dlt_pppserial/pppserial.h $(srcdir)/tcpedit_stub.h $(srcdir)/plugins/dlt_utils.h \ $(srcdir)/plugins.h $(srcdir)/plugins_api.h $(srcdir)/plugins_types.h \ - $(srcdir)/tcpedit_api.h - + $(srcdir)/tcpedit_api.h $(srcdir)/plugins/dlt_pppserial/pppserial.h $(srcdir)/plugins/dlt_pppserial/pppserial_api.h \ + $(srcdir)/plugins/dlt_pppserial/pppserial_types.h +# Note: # You probably don't want to touch anything below this line until the end of the plugin DLT_STUB_DEPS += $(srcdir)/plugins/dlt_pppserial/pppserial_opts.def diff --git a/src/tcpedit/plugins/dlt_template/Makefile.am b/src/tcpedit/plugins/dlt_template/Makefile.am index 28335f632..b926f68aa 100644 --- a/src/tcpedit/plugins/dlt_template/Makefile.am +++ b/src/tcpedit/plugins/dlt_template/Makefile.am @@ -6,19 +6,22 @@ # add any other files (like documentation, notes, etc) to EXTRA_DIST # add your dependancy information (see comment below) -libtcpedit_a_SOURCES += $(srcdir)/plugins/dlt_%{plugin}/%{plugin}.c +libtcpedit_a_SOURCES += $(srcdir)/plugins/dlt_%{plugin}/%{plugin}.c \ + $(srcdir)/plugins/dlt_%{plugin}/%{plugin}.c -noinst_HEADERS += $(srcdir)/plugins/dlt_%{plugin}/%{plugin}.h +noinst_HEADERS += $(srcdir)/plugins/dlt_%{plugin}/%{plugin}.h \ + $(srcdir)/plugins/dlt_%{plugin}/%{plugin}_api.h \ + $(srcdir)/plugins/dlt_%{plugin}/%{plugin}_types.h EXTRA_DIST += $(srcdir)/plugins/dlt_%{plugin}/%{plugin}_opts.def # dependancies for your plugin source code. Edit as necessary $(srcdir)/plugins/dlt_%{plugin}/%{plugin}.c: $(srcdir)/tcpedit_stub.h $(srcdir)/plugins/dlt_utils.h \ - $(srcdir)/plugins/dlt_%{plugin}/%{plugin}.h $(srcdir)/tcpedit_stub.h $(srcdir)/plugins/dlt_utils.h \ $(srcdir)/plugins.h $(srcdir)/plugins_api.h $(srcdir)/plugins_types.h \ - $(srcdir)/tcpedit_api.h - - + $(srcdir)/tcpedit_api.h $(srcdir)/plugins/dlt_%{plugin}/%{plugin}.h $(srcdir)/plugins/dlt_%{plugin}/%{plugin}_api.h \ + $(srcdir)/plugins/dlt_%{plugin}/%{plugin}_types.h + +# Note: # You probably don't want to touch anything below this line until the end of the plugin DLT_STUB_DEPS += $(srcdir)/plugins/dlt_%{plugin}/%{plugin}_opts.def From dd31c5d9a98f11a13545a81e518656e7b7de9b04 Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Thu, 2 Jan 2014 15:53:28 -0800 Subject: [PATCH 16/20] Updated Makefile and copyright for dlt_jnpr_ether #42 --- src/tcpedit/plugins/dlt_jnpr_ether/Makefile.am | 15 +++++++++------ src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c | 2 +- src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.h | 2 +- .../plugins/dlt_jnpr_ether/jnpr_ether_api.c | 2 +- .../plugins/dlt_jnpr_ether/jnpr_ether_api.h | 2 +- .../plugins/dlt_jnpr_ether/jnpr_ether_types.h | 2 +- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/tcpedit/plugins/dlt_jnpr_ether/Makefile.am b/src/tcpedit/plugins/dlt_jnpr_ether/Makefile.am index dc4b0cc79..e2fb5f2bd 100644 --- a/src/tcpedit/plugins/dlt_jnpr_ether/Makefile.am +++ b/src/tcpedit/plugins/dlt_jnpr_ether/Makefile.am @@ -6,19 +6,22 @@ # add any other files (like documentation, notes, etc) to EXTRA_DIST # add your dependancy information (see comment below) -libtcpedit_a_SOURCES += $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c +libtcpedit_a_SOURCES += $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c \ + $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c -noinst_HEADERS += $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.h +noinst_HEADERS += $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.h \ + $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether_api.h \ + $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether_types.h EXTRA_DIST += $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether_opts.def # dependancies for your plugin source code. Edit as necessary $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.c: $(srcdir)/tcpedit_stub.h $(srcdir)/plugins/dlt_utils.h \ - $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.h $(srcdir)/tcpedit_stub.h $(srcdir)/plugins/dlt_utils.h \ $(srcdir)/plugins.h $(srcdir)/plugins_api.h $(srcdir)/plugins_types.h \ - $(srcdir)/tcpedit_api.h - - + $(srcdir)/tcpedit_api.h $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether.h $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether_api.h \ + $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether_types.h + +# Note: # You probably don't want to touch anything below this line until the end of the plugin DLT_STUB_DEPS += $(srcdir)/plugins/dlt_jnpr_ether/jnpr_ether_opts.def diff --git a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c index 3e4060e25..594497dfa 100644 --- a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c +++ b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2006-2007 Aaron Turner. - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.h b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.h index b362effeb..fd5e5ab58 100644 --- a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.h +++ b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_api.c b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_api.c index 9d5253f6e..478307f3f 100644 --- a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_api.c +++ b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_api.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2009 Aaron Turner. - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_api.h b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_api.h index f1018b794..6a5f01b32 100644 --- a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_api.h +++ b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_api.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as diff --git a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_types.h b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_types.h index dba0fd8e0..3c61dbe7d 100644 --- a/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_types.h +++ b/src/tcpedit/plugins/dlt_jnpr_ether/jnpr_ether_types.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2001-2010 Aaron Turner - * Copyright (c) 2013 Fred Klassen - AppNeta Inc. + * Copyright (c) 2013-2014 Fred Klassen - AppNeta Inc. * * The Tcpreplay Suite of tools is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License as From e3ca773293b4de2c7e2dc088aa24393774156ce9 Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Thu, 2 Jan 2014 15:57:18 -0800 Subject: [PATCH 17/20] Add missing template included #40 --- src/tcpedit/plugins/dlt_template/plugin.c.tmpl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tcpedit/plugins/dlt_template/plugin.c.tmpl b/src/tcpedit/plugins/dlt_template/plugin.c.tmpl index 7541d65f6..22a233324 100644 --- a/src/tcpedit/plugins/dlt_template/plugin.c.tmpl +++ b/src/tcpedit/plugins/dlt_template/plugin.c.tmpl @@ -34,9 +34,13 @@ #include #include +#include "defines.h" #include "common.h" #include "tcpr.h" #include "tcpedit.h" +#include "dlt_utils.h" +#include "tcpedit_stub.h" +#include "%{plugin}.h" #include "%{plugin}_types.h" /* FIXME: edit these variables to taste */ From 098b7424f870aab07433852502f73da1751541d1 Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Fri, 3 Jan 2014 15:55:32 -0800 Subject: [PATCH 18/20] Implemented unique flows counter and stats - closes #44 --- src/common/sendpacket.c | 5 +++-- src/common/sendpacket.h | 1 + src/common/utils.h | 1 + src/send_packets.c | 2 ++ src/tcpreplay.c | 16 +++++++++------- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/common/sendpacket.c b/src/common/sendpacket.c index 503dbe5dd..85af4fce5 100644 --- a/src/common/sendpacket.c +++ b/src/common/sendpacket.c @@ -586,12 +586,13 @@ sendpacket_getstat(sendpacket_t *sp) if (sp->flow_packets && offset > 0) { sprintf(&buf[offset], - "\tFlows: " COUNTER_SPEC "\n" + "\tFlows total: " COUNTER_SPEC "\n" + "\tFlows unique: " COUNTER_SPEC "\n" "\tFlows expired: " COUNTER_SPEC "\n" "\tFlow packets: " COUNTER_SPEC "\n" "\tNon-flow packets: " COUNTER_SPEC "\n" "\tInvalid flow packets: " COUNTER_SPEC "\n", - sp->flows, sp->flows_expired, sp->flow_packets, + sp->flows, sp->flows_expired, sp->flows_expired, sp->flow_packets, sp->flow_non_flow_packets, sp->flows_invalid_packets); } diff --git a/src/common/sendpacket.h b/src/common/sendpacket.h index 97869d6a9..048bf22aa 100644 --- a/src/common/sendpacket.h +++ b/src/common/sendpacket.h @@ -101,6 +101,7 @@ struct sendpacket_s { COUNTER flow_non_flow_packets; COUNTER flows; COUNTER flow_packets; + COUNTER flows_unique; COUNTER flows_expired; COUNTER flows_invalid_packets; sendpacket_type_t handle_type; diff --git a/src/common/utils.h b/src/common/utils.h index 876aa8114..c5f5fb687 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -37,6 +37,7 @@ typedef struct { struct timeval last_print; COUNTER flow_non_flow_packets; COUNTER flows; + COUNTER flows_unique; COUNTER flow_packets; COUNTER flows_expired; COUNTER flows_invalid_packets; diff --git a/src/send_packets.c b/src/send_packets.c index a2dd5ebc0..fa1988596 100644 --- a/src/send_packets.c +++ b/src/send_packets.c @@ -342,9 +342,11 @@ static inline void update_flow_stats(tcpreplay_t *ctx, sendpacket_t *sp, switch (res) { case FLOW_ENTRY_NEW: ++ctx->stats.flows; + ++ctx->stats.flows_unique; ++ctx->stats.flow_packets; if (sp) { ++sp->flows; + ++sp->flows_unique; ++sp->flow_packets; } break; diff --git a/src/tcpreplay.c b/src/tcpreplay.c index 6ddbe5fac..24316b2e9 100644 --- a/src/tcpreplay.c +++ b/src/tcpreplay.c @@ -205,7 +205,8 @@ flow_stats(const tcpreplay_t *ctx, bool unique_ip) struct timeval diff; COUNTER diff_us; const tcpreplay_stats_t *stats = &ctx->stats; - COUNTER flows = stats->flows; + COUNTER flows_total = stats->flows; + COUNTER flows_unique = stats->flows_unique; COUNTER flows_expired = stats->flows_expired; COUNTER flow_packets; COUNTER flow_non_flow_packets; @@ -215,7 +216,7 @@ flow_stats(const tcpreplay_t *ctx, bool unique_ip) timersub(&stats->end_time, &stats->start_time, &diff); diff_us = TIMEVAL_TO_MICROSEC(&diff); - if (!flows || !ctx->iteration) + if (!flows_total || !ctx->iteration) return; /* @@ -226,7 +227,8 @@ flow_stats(const tcpreplay_t *ctx, bool unique_ip) * successful iterations. */ if (unique_ip && ctx->options->preload_pcap) { - flows *= ctx->iteration; + flows_total *= ctx->iteration; + flows_unique *= ctx->iteration; flows_expired *= ctx->iteration; } @@ -236,18 +238,18 @@ flow_stats(const tcpreplay_t *ctx, bool unique_ip) if (diff_us) { COUNTER flows_sec_X100; - flows_sec_X100 = (flows * 100 * 1000 * 1000) / diff_us; + flows_sec_X100 = (flows_total * 100 * 1000 * 1000) / diff_us; flows_sec = flows_sec_X100 / 100; flows_sec_100ths = flows_sec_X100 % 100; } if (ctx->options->flow_expiry) - printf("Flows: " COUNTER_SPEC " flows, " COUNTER_SPEC " expired, %llu.%02u fps, " COUNTER_SPEC " flow packets, " COUNTER_SPEC " non-flow\n", - flows, flows_expired, flows_sec, flows_sec_100ths, flow_packets, + printf("Flows: " COUNTER_SPEC " flows, " COUNTER_SPEC " unique, "COUNTER_SPEC " expired, %llu.%02u fps, " COUNTER_SPEC " flow packets, " COUNTER_SPEC " non-flow\n", + flows_total, flows_unique, flows_expired, flows_sec, flows_sec_100ths, flow_packets, flow_non_flow_packets); else printf("Flows: " COUNTER_SPEC " flows, %llu.%02u fps, " COUNTER_SPEC " flow packets, " COUNTER_SPEC " non-flow\n", - flows, flows_sec, flows_sec_100ths, flow_packets, + flows_total, flows_sec, flows_sec_100ths, flow_packets, flow_non_flow_packets); } From df049ae0203203e6b1c0cd0e261634a69453a7af Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Sun, 5 Jan 2014 00:46:16 -0800 Subject: [PATCH 19/20] Back out psuedo-crc calc - this closes #45 --- src/tcpedit/checksum.c | 49 ------------------------- src/tcpedit/checksum.h | 2 -- src/tcpedit/edit_packet.c | 76 ++------------------------------------- src/tcpedit/edit_packet.h | 2 -- src/tcpedit/parse_args.c | 1 + src/tcpedit/tcpedit_api.c | 1 - 6 files changed, 4 insertions(+), 127 deletions(-) diff --git a/src/tcpedit/checksum.c b/src/tcpedit/checksum.c index fa86ad620..aca4f517b 100644 --- a/src/tcpedit/checksum.c +++ b/src/tcpedit/checksum.c @@ -29,55 +29,6 @@ static int do_checksum_math(uint16_t *, int); -/* - * Fold a partial checksum - * - * shamelessly stolen from Linux kernel and modified - * to run in user land - */ -static inline u_int16_t csum_fold(u_int32_t csum) -{ - u_int32_t sum = csum; - sum = (sum & 0xffff) + (sum >> 16); - sum = (sum & 0xffff) + (sum >> 16); - return (u_int16_t)~sum; -} - -static inline u_int32_t csum_partial(void *buff, int len, u_int32_t wsum) -{ - unsigned int sum = (unsigned int)wsum; - unsigned int result = do_checksum_math(buff, len); - - /* add in old sum, and carry.. */ - result += sum; - if (sum > result) - result += 1; - return (u_int32_t)result; -} - -static inline void __chksum_replace4(u_int16_t *sum, u_int32_t from, u_int32_t to) -{ - u_int32_t diff[] = { ~from, to }; - *sum = csum_fold(csum_partial(diff, sizeof(diff), ~((u_int32_t)(*sum)))); -} - -/** - * Apply modifications to an existing checksum based on - * 32-bit before and after values - */ -void chksum_replace4(u_int16_t *sum, u_int32_t from, u_int32_t to) -{ - __chksum_replace4(sum, from, to); -} - -/** - * Apply modifications to an existing checksum based on - * 32-bit before and after values - */ -void chksum_replace2(u_int16_t *sum, u_int16_t from, u_int16_t to) -{ - __chksum_replace4(sum, (u_int32_t)from, (u_int32_t)to); -} /** * Returns -1 on error and 0 on success, 1 on warn diff --git a/src/tcpedit/checksum.h b/src/tcpedit/checksum.h index cb62df466..1721c539b 100644 --- a/src/tcpedit/checksum.h +++ b/src/tcpedit/checksum.h @@ -25,7 +25,5 @@ (x = (x >> 16) + (x & 0xffff), (~(x + (x >> 16)) & 0xffff)) int do_checksum(tcpedit_t *, u_int8_t *, int, int); -void chksum_replace4(u_int16_t *sum, u_int32_t from, u_int32_t to); -void ckksum_replace2(u_int16_t *sum, u_int16_t from, u_int16_t to); #endif diff --git a/src/tcpedit/edit_packet.c b/src/tcpedit/edit_packet.c index 9a3925fbe..1d00d8e36 100644 --- a/src/tcpedit/edit_packet.c +++ b/src/tcpedit/edit_packet.c @@ -105,70 +105,6 @@ fix_ipv6_checksums(tcpedit_t *tcpedit, struct pcap_pkthdr *pkthdr, ipv6_hdr_t *i return TCPEDIT_OK; } -#define IP_DF 0x4000 /* Flag: "Don't Fragment" */ -#define IP_MF 0x2000 /* Flag: "More Fragments" */ -#define IP_OFFSET 0x1FFF /* "Fragment Offset" part */ -int chksum_replace_ipv4(tcpedit_t *tcpedit, ipv4_hdr_t *ip_hdr, u_int32_t from, u_int32_t to) -{ - if (tcpedit->fixcsum) - return 1; - - chksum_replace4(&ip_hdr->ip_sum, from, to); - return 0; -} - -static int transport_pseudo_chksum_ipv4(tcpedit_t *tcpedit, ipv4_hdr_t *ip_hdr, - u_int32_t from, u_int32_t to) -{ - int ihl; - u_char *transport; - u_int8_t protocol; - - if (tcpedit->fixcsum) - return 1; - - ihl = ip_hdr->ip_hl * 4; - transport = ((u_char *)ip_hdr) + ihl; - protocol = ip_hdr->ip_p; - - chksum_replace4(&ip_hdr->ip_sum, from, to); - - /* reject IP fragments */ - if (ip_hdr->ip_off & htons(IP_OFFSET)) - return 1; - - switch (protocol) { - case IPPROTO_TCP: - { - struct tcpr_tcp_hdr *tcph; - - tcph = (struct tcpr_tcp_hdr *)transport; - chksum_replace4(&tcph->th_sum, from, to); - break; - } - case IPPROTO_UDP: - { - struct tcpr_udp_hdr *udph; - - udph = (struct tcpr_udp_hdr *)transport; - if (udph->uh_sum) { - chksum_replace4(&udph->uh_sum, from, to); - if (!udph->uh_sum) - udph->uh_sum = 0xffff; /* mangled checksum */ - } - break; - } - - case IPPROTO_ICMP: - break; - - default: - return 1; - } - - return 0; -} - /** * returns a new 32bit integer which is the randomized IP * based upon the user specified seed @@ -222,8 +158,6 @@ randomize_ipv4(tcpedit_t *tcpedit, struct pcap_pkthdr *pkthdr, #ifdef DEBUG char srcip[16], dstip[16]; #endif - int needtorecalc = 0; - assert(tcpedit); assert(pkthdr); assert(pktdata); @@ -239,17 +173,13 @@ randomize_ipv4(tcpedit_t *tcpedit, struct pcap_pkthdr *pkthdr, /* don't rewrite broadcast addresses */ if ((tcpedit->skip_broadcast && is_unicast_ipv4(tcpedit, (u_int32_t)ip_hdr->ip_dst.s_addr)) - || !tcpedit->skip_broadcast) { - in_addr_t old_dst_ip = ip_hdr->ip_dst.s_addr; + || !tcpedit->skip_broadcast) { ip_hdr->ip_dst.s_addr = randomize_ipv4_addr(tcpedit, ip_hdr->ip_dst.s_addr); - needtorecalc += transport_pseudo_chksum_ipv4(tcpedit, ip_hdr, old_dst_ip, ip_hdr->ip_dst.s_addr); } if ((tcpedit->skip_broadcast && is_unicast_ipv4(tcpedit, (u_int32_t)ip_hdr->ip_src.s_addr)) - || !tcpedit->skip_broadcast) { - in_addr_t old_src_ip = ip_hdr->ip_src.s_addr; + || !tcpedit->skip_broadcast) { ip_hdr->ip_src.s_addr = randomize_ipv4_addr(tcpedit, ip_hdr->ip_src.s_addr); - needtorecalc += transport_pseudo_chksum_ipv4(tcpedit, ip_hdr, old_src_ip, ip_hdr->ip_src.s_addr); } #ifdef DEBUG @@ -259,7 +189,7 @@ randomize_ipv4(tcpedit_t *tcpedit, struct pcap_pkthdr *pkthdr, dbgx(1, "New Src IP: %s\tNew Dst IP: %s\n", srcip, dstip); - return(needtorecalc); + return(1); } int diff --git a/src/tcpedit/edit_packet.h b/src/tcpedit/edit_packet.h index 6d1c6f643..590122f8a 100644 --- a/src/tcpedit/edit_packet.h +++ b/src/tcpedit/edit_packet.h @@ -55,8 +55,6 @@ int rewrite_ipv4_ttl(tcpedit_t *tcpedit, ipv4_hdr_t *ip_hdr); int rewrite_ipv6_hlim(tcpedit_t *tcpedit, ipv6_hdr_t *ip6_hdr); -int chksum_replace_ipv4(tcpedit_t *tcpedit, ipv4_hdr_t *ip_hdr, u_int32_t from, u_int32_t to); - #define BROADCAST_IP 4294967295 #endif diff --git a/src/tcpedit/parse_args.c b/src/tcpedit/parse_args.c index 1c1977a8d..1135b3ec8 100644 --- a/src/tcpedit/parse_args.c +++ b/src/tcpedit/parse_args.c @@ -207,6 +207,7 @@ tcpedit_post_args(tcpedit_t *tcpedit) { tcpedit->rewrite_ip = true; srandom(OPT_VALUE_SEED); tcpedit->seed = random() + random() + random() + random() + random(); + printf("seed=0x%x\n", tcpedit->seed); } if (HAVE_OPT(ENDPOINTS)) { diff --git a/src/tcpedit/tcpedit_api.c b/src/tcpedit/tcpedit_api.c index 4f8b7ceb0..77ed58bad 100644 --- a/src/tcpedit/tcpedit_api.c +++ b/src/tcpedit/tcpedit_api.c @@ -215,7 +215,6 @@ tcpedit_set_seed(tcpedit_t *tcpedit, int value) assert(tcpedit); tcpedit->rewrite_ip = true; - srandom(value); tcpedit->seed = random() + random() + random() + random() + random(); return TCPEDIT_OK; From 52a53f0e7c61f09ffcf11d1179f64b4f53fd34eb Mon Sep 17 00:00:00 2001 From: Fred Klassen Date: Sun, 5 Jan 2014 00:49:51 -0800 Subject: [PATCH 20/20] Removed unnecessary printf statement - #45 --- src/tcpedit/parse_args.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tcpedit/parse_args.c b/src/tcpedit/parse_args.c index 1135b3ec8..1c1977a8d 100644 --- a/src/tcpedit/parse_args.c +++ b/src/tcpedit/parse_args.c @@ -207,7 +207,6 @@ tcpedit_post_args(tcpedit_t *tcpedit) { tcpedit->rewrite_ip = true; srandom(OPT_VALUE_SEED); tcpedit->seed = random() + random() + random() + random() + random(); - printf("seed=0x%x\n", tcpedit->seed); } if (HAVE_OPT(ENDPOINTS)) {