Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Korsgaard <jacmet@uclibc.org>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/1] Fixed tcpreplay auto build errors
Date: Wed, 22 Jan 2014 09:58:27 +0100	[thread overview]
Message-ID: <87vbxce6ks.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <CAFOYHZDW+N_0oOYDCigr8-hG=vP-wW=Yey7ADrponotyXnxRFg@mail.gmail.com> (Chris Packham's message of "Wed, 22 Jan 2014 16:07:10 +1300")

>>>>> "Chris" == Chris Packham <judge.packham@gmail.com> writes:

 > On Tue, Jan 21, 2014 at 11:41 PM, Martin Bark <martin@barkynet.com> wrote:
 >> tcpreplay fails to compile unless it finds the tcpdump binary.  This patch
 >> makes tcpreplay dependent on tcpdump and sets the configure script to use
 >> tcpdump on the target
 >> 
 >> Signed-off-by: Martin Bark <martin@barkynet.com>
 >> ---
 >> package/tcpreplay/Config.in    |    1 +
 >> package/tcpreplay/tcpreplay.mk |    5 +++--
 >> 2 files changed, 4 insertions(+), 2 deletions(-)
 >> 
 >> diff --git a/package/tcpreplay/Config.in b/package/tcpreplay/Config.in
 >> index 2ba2eb5..49c3284 100644
 >> --- a/package/tcpreplay/Config.in
 >> +++ b/package/tcpreplay/Config.in
 >> @@ -2,6 +2,7 @@ config BR2_PACKAGE_TCPREPLAY
 >> bool "tcpreplay"
 >> depends on BR2_USE_MMU # fork()
 >> select BR2_PACKAGE_LIBPCAP
 >> +       select BR2_PACKAGE_TCPDUMP
 >> help
 >> Tcpreplay is a tool for replaying network traffic from files saved
 >> with tcpdump or other tools which write pcap(3) files.
 >> diff --git a/package/tcpreplay/tcpreplay.mk b/package/tcpreplay/tcpreplay.mk
 >> index 0939c6c..f6a7c85 100644
 >> --- a/package/tcpreplay/tcpreplay.mk
 >> +++ b/package/tcpreplay/tcpreplay.mk
 >> @@ -11,8 +11,9 @@ TCPREPLAY_LICENSE_FILES = docs/LICENSE
 >> TCPREPLAY_CONF_ENV = \
 >> tr_cv_libpcap_version=">= 0.7.0" \
 >> ac_cv_have_bpf=no
 >> -TCPREPLAY_CONF_OPT = --with-libpcap=$(STAGING_DIR)/usr
 >> -TCPREPLAY_DEPENDENCIES = libpcap
 >> +TCPREPLAY_CONF_OPT = --with-libpcap=$(STAGING_DIR)/usr \
 >> +       --with-tcpdump=$(TARGET_DIR)/usr/sbin/tcpdump
 >> +TCPREPLAY_DEPENDENCIES = libpcap tcpdump

This doesn't work, as tcpreplay then ends up trying to execute
$(TARGET_DIR)/usr/bin/tcpdump on the target, which doesn't exist.

We also cannot set it to /usr/sbin/tcpdump (the target path), as the
configure script errors out if that isn't available on the build host :/

The configure script doesn't really take cross compilation into
consideration, so I guess we need to patch it to only warn if the binary
isn't available.


 >> 
 >> # libpcap may depend on symbols in libusb as well
 >> TCPREPLAY_LIBS = -lpcap $(if $(BR2_PACKAGE_LIBUSB),-lusb-1.0)
 >> --
 >> 1.7.9.5

 > I think it would be nice if tcpreplay could build without tcpdump (on
 > the host or target). In the meantime this seems like the best
 > solution.


Why don't we just fix the real problem (E.G. the buggy
tcpreplay_seterr() macro)?

I took a look now that we can reproduce it, and the problem is that the
macro expects atleast 3 arguments, and it gets called with only 2 when
tcpdump isn't found:

tcpreplay_seterr(ctx, "verbose mode not supported");

The definition of tcpreplay_seterr is:

#define tcpreplay_seterr(x, y, ...) __tcpreplay_seterr(x, __FUNCTION__, __LINE__, __FILE__, y, __VA_ARGS__)
void __tcpreplay_seterr(tcpreplay_t *ctx, const char *func, const int line, const char *file, const char *fmt, ...);

And the fix is just to get rid of the explicit y parameter:

#define tcpreplay_seterr(x, ...) __tcpreplay_seterr(x, __FUNCTION__, __LINE__, __FILE__, __VA_ARGS__)

Just like the GCC documentation suggests:

http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html


Care to send a patch (upstream and to buildroot) to fix this?


We also need to add:

# don't build in tcpdump support if the build host has it
TCPREPLAY_CONF_ENV += ac_cv_path_tcpdump_path=no

to tcpreplay.mk to forcible disable tcpdump support.

-- 
Bye, Peter Korsgaard

  reply	other threads:[~2014-01-22  8:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-21 10:41 [Buildroot] [PATCH 1/1] Fixed tcpreplay auto build errors Martin Bark
2014-01-22  3:07 ` Chris Packham
2014-01-22  8:58   ` Peter Korsgaard [this message]
2014-01-23  0:54     ` Chris Packham
2014-01-23  7:37       ` Peter Korsgaard
2014-01-23  9:07         ` [Buildroot] [PATCH] tcpreplay: cross-compile with tcpdump support Chris Packham
2014-01-23 11:30           ` Peter Korsgaard
2014-01-23 20:08             ` Martin Bark
2014-01-23 21:31               ` Peter Korsgaard
2014-01-23 22:47                 ` Chris Packham
2014-01-27 14:26                   ` Peter Korsgaard
2014-01-28  9:37                     ` [Buildroot] [PATCH] tcpreplay: Bump version to 4.0.2 Chris Packham
2014-01-28 10:28                       ` Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vbxce6ks.fsf@dell.be.48ers.dk \
    --to=jacmet@uclibc.org \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox