Fixed tcpreplay auto build errors
PATCH 1/1 Fixed tcpreplay auto build errors
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
--- package/tcpreplay/Config.in | 1 + package/tcpreplay/tcpreplay.mk | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-)
package/tcpreplay/Config.in +1 -0
@@ -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.
package/tcpreplay/tcpreplay.mk +3 -2
@@ -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 # libpcap may depend on symbols in libusb as well TCPREPLAY_LIBS = -lpcap $(if $(BR2_PACKAGE_LIBUSB),-lusb-1.0)
Signature · 1 line
1.7.9.5
PATCH 1/1 Fixed tcpreplay auto build errors
Quoted 39 lines · Martin Bark
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 <[email protected]>--- package/tcpreplay/Config.in | 1 + package/tcpreplay/tcpreplay.mk | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-)package/tcpreplay/Config.in +1
-0@@ -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.package/tcpreplay/tcpreplay.mk +3
-3@@ -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 # libpcap may depend on symbols in libusb as well TCPREPLAY_LIBS = -lpcap $(if $(BR2_PACKAGE_LIBUSB),-lusb-1.0) --
Quoted 1 line
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.
PATCH 1/1 Fixed tcpreplay auto build errors
Quoted 30 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Chris" == Chris Packham <[email protected]> writes:
Quoted 27 lines · Martin Bark
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 <[email protected]>---
package/tcpreplay/Config.in | 1 + package/tcpreplay/tcpreplay.mk | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-)package/tcpreplay/Config.in +0
-0@@ -2,6 +2,7 @@ config BR2_PACKAGE_TCPREPLAYbool "tcpreplay"
depends onBR2_USE_MMU#fork()
selectBR2_PACKAGE_LIBPCAP
+ selectBR2_PACKAGE_TCPDUMP
help
Tcpreplay is a tool for replaying network traffic from files saved with tcpdump or other tools which write pcap(3) files.package/tcpreplay/tcpreplay.mk +0
-0@@ -11,8 +11,9 @@ TCPREPLAY_LICENSE_FILES = docs/LICENSE
Quoted 8 lines
package/tcpreplay/tcpreplay.mk TCPREPLAY_LICENSE_FILES = docs/LICENSE · line 16
Quoted 8 lines
package/tcpreplay/tcpreplay.mk +0
-0TCPREPLAY_CONF_ENV = \ tr_cv_libpcap_version=">= 0.7.0" \ac_cv_have_bpf=no
package/tcpreplay/tcpreplay.mk +3
-2-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.
Quoted 9 lines
Quoted 5 lines
# libpcap may depend on symbols in libusb as well TCPREPLAY_LIBS = -lpcap $(if $(BR2_PACKAGE_LIBUSB),-lusb-1.0) -- 1.7.9.5I 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.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 Fixed tcpreplay auto build errors
Hi Peter,
Quoted 89 lines · Peter Korsgaard
Quoted 30 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Chris" == Chris Packham <[email protected]> writes:
Quoted 27 lines · Martin Bark
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 <[email protected]>---
package/tcpreplay/Config.in | 1 + package/tcpreplay/tcpreplay.mk | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-)package/tcpreplay/Config.in +0
-0@@ -2,6 +2,7 @@ config BR2_PACKAGE_TCPREPLAYbool "tcpreplay"
depends onBR2_USE_MMU#fork()
selectBR2_PACKAGE_LIBPCAP
+ selectBR2_PACKAGE_TCPDUMP
help
Tcpreplay is a tool for replaying network traffic from files saved with tcpdump or other tools which write pcap(3) files.package/tcpreplay/tcpreplay.mk +0
-0@@ -11,8 +11,9 @@ TCPREPLAY_LICENSE_FILES = docs/LICENSEQuoted 8 lines
package/tcpreplay/tcpreplay.mk TCPREPLAY_LICENSE_FILES = docs/LICENSE · line 16
Quoted 8 lines
package/tcpreplay/tcpreplay.mk +0
-0TCPREPLAY_CONF_ENV = \ tr_cv_libpcap_version=">= 0.7.0" \ac_cv_have_bpf=no
package/tcpreplay/tcpreplay.mk +3
-2-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 tcpdumpThis 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.
Quoted 9 lines
Quoted 5 lines
# libpcap may depend on symbols in libusb as well TCPREPLAY_LIBS = -lpcap $(if $(BR2_PACKAGE_LIBUSB),-lusb-1.0) -- 1.7.9.5I 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_seterris:#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:
Quoted 7 lines
# don't build in tcpdump support if the build host has it
TCPREPLAY_CONF_ENV+= ac_cv_path_tcpdump_path=noto tcpreplay.mk to forcible disable tcpdump support.
--
Bye, Peter Korsgaard
I'm already working on an upstream fix
https://github.com/appneta/tcpreplay/pull/60 just waiting to hear some feedback. Buildroot could carry my patch or just wait for the change to be merged upstream. I've also got a different change needed for x86_64 but I think that's more a ubuntu/debian thing than a x86_64 architecture thing.
Mine is a slightly different solution to what you suggest. Doing some grepping through the tcpreplay source it looks like my solution of adding a format string has been used in other places.
I'll take a look at your suggestion for TCPREPLAY_CONF_ENV and see if I can come up with a solution that works when cross compiling.
PATCH 1/1 Fixed tcpreplay auto build errors
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Chris" == Chris Packham <[email protected]> writes:
Hi,
Quoted 10 lines
I'm already working on an upstream fix
https://github.com/appneta/tcpreplay/pull/60 just waiting to hear some feedback. Buildroot could carry my patch or just wait for the change to be merged upstream. I've also got a different change needed forx86_64but I think that's more a ubuntu/debian thing than ax86_64architecture thing.Mine is a slightly different solution to what you suggest. Doing some grepping through the tcpreplay source it looks like my solution of adding a format string has been used in other places.
Ahh ok, yes - It also works to change the callers of the macro, naturally. Lets see what upstream says.
Quoted 2 lines
I'll take a look at your suggestion for
TCPREPLAY_CONF_ENVand see if I can come up with a solution that works when cross compiling.
Thanks!
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 tcpreplay: cross-compile with tcpdump support
If tcpdump is enabled set ac_cv_path_tcpdump_path so that verbose output is enabled on the target.
---
Hi,
This should get verbose support working if the tcpdump package is selected. This may also fix some of the build errors (if they set BR2_PACKAGE_TCPDUMP=y) but the real fix will come from upstream.
package/tcpreplay/tcpreplay.mk | 6 ++++++ 1 file changed, 6 insertions(+)
package/tcpreplay/tcpreplay.mk +6 -0
@@ -18,4 +18,10 @@ TCPREPLAY_DEPENDENCIES = libpcap TCPREPLAY_LIBS = -lpcap $(if $(BR2_PACKAGE_LIBUSB),-lusb-1.0) TCPREPLAY_CONF_ENV += ac_cv_search_pcap_close='$(TCPREPLAY_LIBS)' +ifeq ($(BR2_PACKAGE_TCPDUMP),y) +TCPREPLAY_CONF_ENV += ac_cv_path_tcpdump_path=/usr/sbin/tcpdump +else +TCPREPLAY_CONF_ENV += ac_cv_path_tcpdump_path=no +endif + $(eval $(autotools-package))
Signature · 1 line
1.8.4.rc2
PATCH 1/1 tcpreplay: cross-compile with tcpdump support
Quoted 21 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Chris" == Chris Packham <[email protected]> writes:
If tcpdump is enabled set
ac_cv_path_tcpdump_pathso that verbose output is enabled on the target.Signed-off-by Chris Packham <[email protected]>---
Hi,This should get verbose support working if the tcpdump package is selected. This may also fix some of the build errors (if they set BR2_PACKAGE_TCPDUMP=y) but the real fix will come from upstream.
package/tcpreplay/tcpreplay.mk | 6 ++++++ 1 file changed, 6 insertions(+)package/tcpreplay/tcpreplay.mk +0
-0
package/tcpreplay/tcpreplay.mk TCPREPLAY_DEPENDENCIES = libpcap · line 22
Quoted 5 lines
package/tcpreplay/tcpreplay.mk +2
-0@@ -18,4 +18,10 @@ TCPREPLAY_DEPENDENCIES = libpcap TCPREPLAY_LIBS = -lpcap $(if $(BR2_PACKAGE_LIBUSB),-lusb-1.0) TCPREPLAY_CONF_ENV += ac_cv_search_pcap_close='$(TCPREPLAY_LIBS)' +ifeq ($(BR2_PACKAGE_TCPDUMP),y) +TCPREPLAY_CONF_ENV += ac_cv_path_tcpdump_path=/usr/sbin/tcpdump
The problem here is that the configure script checks if /usr/bin/tcpdump (on the build machine) is executable, and otherwise errors out - So this breaks if you try to build it on a machine without tcpdump.
The configure script needs to be changed to not do this test when cross compiling (or only warn).
Quoted 7 lines
package/tcpreplay/tcpreplay.mk +4
-0+else +TCPREPLAY_CONF_ENV += ac_cv_path_tcpdump_path=no +endif + $(eval $(autotools-package))Signature · 1 line
1.8.4.rc2
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 tcpreplay: cross-compile with tcpdump support
Peter, Chris,
Quoted 24 lines · Peter Korsgaard
Quoted 23 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Chris" == Chris Packham <[email protected]> writes:
If tcpdump is enabled set
ac_cv_path_tcpdump_pathso that verbose output is enabled on the target.Signed-off-by Chris Packham <[email protected]>---
Hi,This should get verbose support working if the tcpdump package is selected. This may also fix some of the build errors (if they set BR2_PACKAGE_TCPDUMP=y) but the real fix will come from upstream.
package/tcpreplay/tcpreplay.mk | 6 ++++++ 1 file changed, 6 insertions(+)package/tcpreplay/tcpreplay.mk +0
-0@@ -18,4 +18,10 @@ TCPREPLAY_DEPENDENCIES = libpcap TCPREPLAY_LIBS = -lpcap $(if $(BR2_PACKAGE_LIBUSB),-lusb-1.0) TCPREPLAY_CONF_ENV += ac_cv_search_pcap_close='$(TCPREPLAY_LIBS)'
Quoted 6 lines
package/tcpreplay/tcpreplay.mk TCPREPLAY_DEPENDENCIES = libpcap · line 22
Quoted 2 lines
package/tcpreplay/tcpreplay.mk +2
-0+ifeq ($(BR2_PACKAGE_TCPDUMP),y) +TCPREPLAY_CONF_ENV += ac_cv_path_tcpdump_path=/usr/sbin/tcpdumpThe problem here is that the configure script checks if
/usr/bin/tcpdump(on the build machine) is executable, and otherwise errors out - So this breaks if you try to build it on a machine without tcpdump.
I think the patch is actually OK. Looking at the configure script when ac_cv_path_tcpdump_path is set it does not check if the executable exists. It only checks when using the --with-tcpdump option.
I tested the patch and choose tcpdump and tcpreplay with no /usr/sbin/tcpdump on the host. The code builds and I see in the configure output the lines
checking for tcpdump... (cached) /usr/sbin/tcpdump
and
tcpdump binary path: /usr/sbin/tcpdump
So i think this patch will work.
Thanks
Quoted 14 lines
The configure script needs to be changed to not do this test when cross compiling (or only warn).
Quoted 7 lines
package/tcpreplay/tcpreplay.mk +4
-1+else +TCPREPLAY_CONF_ENV += ac_cv_path_tcpdump_path=no +endif + $(eval $(autotools-package)) --1.8.4.rc2
PATCH 1/1 tcpreplay: cross-compile with tcpdump support
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Martin" == Martin Bark <[email protected]> writes:
Hi,
Quoted 16 lines
Quoted 6 lines
package/tcpreplay/tcpreplay.mk TCPREPLAY_DEPENDENCIES = libpcap · line 22
Quoted 2 lines
package/tcpreplay/tcpreplay.mk +2
-0+ifeq ($(BR2_PACKAGE_TCPDUMP),y) +TCPREPLAY_CONF_ENV += ac_cv_path_tcpdump_path=/usr/sbin/tcpdumpThe problem here is that the configure script checks if
/usr/bin/tcpdump(on the build machine) is executable, and otherwise errors out - So this breaks if you try to build it on a machine without tcpdump.I think the patch is actually OK. Looking at the configure script when
ac_cv_path_tcpdump_pathis set it does not check if the executable exists. It only checks when using the --with-tcpdump option.I tested the patch and choose tcpdump and tcpreplay with no
/usr/sbin/tcpdumpon the host. The code builds and I see in the configure output the lines
Quoted 7 lines
checking for tcpdump... (cached)
/usr/sbin/tcpdumpand
tcpdump binary path:
/usr/sbin/tcpdumpSo i think this patch will work.
Ups, you're right - Sorry.
Committed patch, thanks.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 tcpreplay: cross-compile with tcpdump support
Quoted 24 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Martin" == Martin Bark <[email protected]> writes:
Hi,
Quoted 19 lines
Quoted 6 lines
package/tcpreplay/tcpreplay.mk TCPREPLAY_DEPENDENCIES = libpcap · line 22
Quoted 2 lines
package/tcpreplay/tcpreplay.mk +2
-0+ifeq ($(BR2_PACKAGE_TCPDUMP),y) +TCPREPLAY_CONF_ENV += ac_cv_path_tcpdump_path=/usr/sbin/tcpdumpThe problem here is that the configure script checks if
/usr/bin/tcpdump(on the build machine) is executable, and otherwise errors out - So this breaks if you try to build it on a machine without tcpdump.I think the patch is actually OK. Looking at the configure script when
ac_cv_path_tcpdump_pathis set it does not check if the executable exists. It only checks when using the --with-tcpdump option.I tested the patch and choose tcpdump and tcpreplay with no
/usr/sbin/tcpdumpon the host. The code builds and I see in the configure output the lineschecking for tcpdump... (cached)
/usr/sbin/tcpdumpand
Quoted 8 lines
Quoted 3 lines
tcpdump binary path:
/usr/sbin/tcpdumpSo i think this patch will work.
Ups, you're right - Sorry.
Committed patch, thanks.
Thanks. I was about to say the same thing.
On the build error front are we concerned about the failures? I haven't heard anything from upstream yet. We probably want to move to tcpreplay 4.0.2 before the buildroot 2014.02 release.
PATCH 1/1 tcpreplay: cross-compile with tcpdump support
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Chris" == Chris Packham <[email protected]> writes:
Hi,
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
So i think this patch will work.
Ups, you're right - Sorry.
Quoted 8 lines
Quoted 2 lines
Committed patch, thanks.
Thanks. I was about to say the same thing.
On the build error front are we concerned about the failures? I haven't heard anything from upstream yet. We probably want to move to tcpreplay 4.0.2 before the buildroot 2014.02 release.
Yes, I got tired of the autobuilder issues, so I've added your patch from the pull request.
A patch to bump the version would be good as well, thank.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 tcpreplay: Bump version to 4.0.2
---
Quoted 3 lines · Peter Korsgaard
A patch to bump the version would be good as well, thank.
Here you go. I've heard back from upstream, the maintainer is dealing with some family issues so the patch from my pull request will do for now. Build tested with/without BR2_PACKAGE_TCPDUMP.
package/tcpreplay/tcpreplay.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/tcpreplay/tcpreplay.mk +1 -1
@@ -4,7 +4,7 @@ # ################################################################################ -TCPREPLAY_VERSION = 4.0.0 +TCPREPLAY_VERSION = 4.0.2 TCPREPLAY_SITE = http://downloads.sourceforge.net/project/tcpreplay/tcpreplay/$(TCPREPLAY_VERSION) TCPREPLAY_LICENSE = GPLv3 TCPREPLAY_LICENSE_FILES = docs/LICENSE
Signature · 1 line
1.8.4.rc2
PATCH 1/1 tcpreplay: Bump version to 4.0.2
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Chris" == Chris Packham <[email protected]> writes:
Signed-off-by Chris Packham <[email protected]>---
Quoted 3 lines · Peter Korsgaard
A patch to bump the version would be good as well, thank.
Committed, thanks.
Quoted 3 lines
Here you go. I've heard back from upstream, the maintainer is dealing with some family issues so the patch from my pull request will do for now. Build tested with/without
BR2_PACKAGE_TCPDUMP.
Ok, thanks.
Signature · 1 line
Bye, Peter Korsgaard