[netsniff-ng] [PATCH v2] pcap_io.h: fix if_arp.h musl libc/kernel headers conflict

2017-04-16 Thread Baruch Siach
Use libc provided arp definitions to avoid build failure with musl libc:

In file included from pcap_io.h:19:0,
 from trafgen.c:59:
.../usr/x86_64-buildroot-linux-musl/sysroot/usr/include/linux/if_arp.h:113:8: 
error: redefinition of ‘struct arpreq’
 struct arpreq {
^
In file included from 
.../usr/x86_64-buildroot-linux-musl/sysroot/usr/include/netinet/if_ether.h:111:0,
 from 
.../usr/x86_64-buildroot-linux-musl/sysroot/usr/include/net/ethernet.h:10,
 from trafgen.c:23:
.../usr/x86_64-buildroot-linux-musl/sysroot/usr/include/net/if_arp.h:99:8: 
note: originally defined here
 struct arpreq {
^

Add a local definition of the ARPHRD_CAN macro that glibc does not provide.

Signed-off-by: Baruch Siach <bar...@tkos.co.il>
---
v2: add ARPHRD_CAN to fix build with glibc
---
 built_in.h | 4 
 pcap_io.h  | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/built_in.h b/built_in.h
index d10579abd689..fa8af60d6029 100644
--- a/built_in.h
+++ b/built_in.h
@@ -382,6 +382,10 @@ static inline u64 cpu_to_le64(u64 val)
 # define PACKET_QDISC_BYPASS 20
 #endif
 
+#ifndef ARPHRD_CAN
+# define ARPHRD_CAN280
+#endif
+
 #ifndef ARPHRD_IEEE802154_MONITOR
 # define ARPHRD_IEEE802154_MONITOR 805
 #endif
diff --git a/pcap_io.h b/pcap_io.h
index 3d70b217ada6..088858e89ccd 100644
--- a/pcap_io.h
+++ b/pcap_io.h
@@ -16,7 +16,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include "built_in.h"
 #include "die.h"
-- 
2.11.0

-- 
You received this message because you are subscribed to the Google Groups 
"netsniff-ng" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to netsniff-ng+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[netsniff-ng] Re: [PATCH 2/2] pcap_io.h: fix if_arp.h musl libc/kernel headers conflict

2017-04-16 Thread Baruch Siach
Hi netsniff-ng list,

On Sun, Apr 16, 2017 at 08:22:21AM +0300, Baruch Siach wrote:
> Use libc provided arp definitions to avoid build failure with musl libc:
> 
> In file included from pcap_io.h:19:0,
>  from trafgen.c:59:
> .../usr/x86_64-buildroot-linux-musl/sysroot/usr/include/linux/if_arp.h:113:8: 
> error: redefinition of ‘struct arpreq’
>  struct arpreq {
> ^
> In file included from 
> .../usr/x86_64-buildroot-linux-musl/sysroot/usr/include/netinet/if_ether.h:111:0,
>  from 
> .../usr/x86_64-buildroot-linux-musl/sysroot/usr/include/net/ethernet.h:10,
>  from trafgen.c:23:
> .../usr/x86_64-buildroot-linux-musl/sysroot/usr/include/net/if_arp.h:99:8: 
> note: originally defined here
>  struct arpreq {
> ^
> 
> Signed-off-by: Baruch Siach <bar...@tkos.co.il>
> ---
>  pcap_io.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/pcap_io.h b/pcap_io.h
> index 3d70b217ada6..088858e89ccd 100644
> --- a/pcap_io.h
> +++ b/pcap_io.h
> @@ -16,7 +16,7 @@
>  #include 
>  #include 
>  #include 
> -#include 
> +#include 

Turns out that glibc if_arp.h is missing the ARPHRD_CAN macro. I'll post an 
updated patch fixing that.

baruch

-- 
 http://baruch.siach.name/blog/  ~. .~   Tk Open Systems
=}ooO--U--Ooo{=
   - bar...@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -

-- 
You received this message because you are subscribed to the Google Groups 
"netsniff-ng" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to netsniff-ng+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[netsniff-ng] [PATCH] flowtop: take PKG_CONFIG into account for libnetfilter_conntrack

2017-04-16 Thread Baruch Siach
Use $PKG_CONFIG to determine the linker flags for libnetfilter_conntrack. This
fixes static link failure like the following:

  LDflowtop
.../usr/x86_64-buildroot-linux-musl/sysroot/usr/lib/../lib64/libnetfilter_conntrack.a(main.o):
 In function `nfct_open_nfnl':
main.c:(.text+0x52): undefined reference to `nfnl_subsys_open'
main.c:(.text+0x69): undefined reference to `nfnl_subsys_close'
main.c:(.text+0x87): undefined reference to `nfnl_subsys_open'
main.c:(.text+0xa3): undefined reference to `nfnl_subsys_close'
.../usr/x86_64-buildroot-linux-musl/sysroot/usr/lib/../lib64/libnetfilter_conntrack.a(main.o):
 In function `nfct_open':
main.c:(.text+0xc9): undefined reference to `nfnl_open'
main.c:(.text+0xf0): undefined reference to `nfnl_close'
...

Signed-off-by: Baruch Siach <bar...@tkos.co.il>
---
 flowtop/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flowtop/Makefile b/flowtop/Makefile
index effe7eb33fc3..e001ce8aaf13 100644
--- a/flowtop/Makefile
+++ b/flowtop/Makefile
@@ -1,5 +1,5 @@
 flowtop-libs = -lurcu \
-   -lnetfilter_conntrack \
+   $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --libs 
libnetfilter_conntrack 2> /dev/null ) \
$(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --libs 
ncurses 2> /dev/null \
|| echo '-lncurses') \
$(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --libs 
tinfo 2> /dev/null ) \
-- 
2.11.0

-- 
You received this message because you are subscribed to the Google Groups 
"netsniff-ng" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to netsniff-ng+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[netsniff-ng] [PATCH 2/2] pcap_io.h: fix if_arp.h musl libc/kernel headers conflict

2017-04-16 Thread Baruch Siach
Use libc provided arp definitions to avoid build failure with musl libc:

In file included from pcap_io.h:19:0,
 from trafgen.c:59:
.../usr/x86_64-buildroot-linux-musl/sysroot/usr/include/linux/if_arp.h:113:8: 
error: redefinition of ‘struct arpreq’
 struct arpreq {
^
In file included from 
.../usr/x86_64-buildroot-linux-musl/sysroot/usr/include/netinet/if_ether.h:111:0,
 from 
.../usr/x86_64-buildroot-linux-musl/sysroot/usr/include/net/ethernet.h:10,
 from trafgen.c:23:
.../usr/x86_64-buildroot-linux-musl/sysroot/usr/include/net/if_arp.h:99:8: 
note: originally defined here
 struct arpreq {
^

Signed-off-by: Baruch Siach <bar...@tkos.co.il>
---
 pcap_io.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pcap_io.h b/pcap_io.h
index 3d70b217ada6..088858e89ccd 100644
--- a/pcap_io.h
+++ b/pcap_io.h
@@ -16,7 +16,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include "built_in.h"
 #include "die.h"
-- 
2.11.0

-- 
You received this message because you are subscribed to the Google Groups 
"netsniff-ng" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to netsniff-ng+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[netsniff-ng] [PATCH] Detect libpcap dependencies using pkg-config

2021-09-02 Thread Baruch Siach
When building statically the link command line must include all
dependencies of all libraries. libpcap can optionally depend on libnl.
mausezahn can't build statically in this case.

Use pkg-config in configure and in the link command to construct the
library flags we need to link with libpcap.

Signed-off-by: Baruch Siach 
---
 configure  | 4 +++-
 mausezahn/Makefile | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 510826a798f5..598ae2433a7a 100755
--- a/configure
+++ b/configure
@@ -588,7 +588,9 @@ int main(void)
 }
 EOF
 
-   $CC -o $TMPDIR/pcaptest $TMPDIR/pcaptest.c -lpcap >> config.log 2>&1
+   $CC -o $TMPDIR/pcaptest $TMPDIR/pcaptest.c \
+   $($PKG_CONFIG --libs libpcap 2>> config.log) \
+   >> config.log 2>&1
if [ ! -x $TMPDIR/pcaptest ] ; then
echo "[NO]"
echo "CONFIG_LIBPCAP=0" >> Config
diff --git a/mausezahn/Makefile b/mausezahn/Makefile
index ca16b6579583..9544565355cc 100644
--- a/mausezahn/Makefile
+++ b/mausezahn/Makefile
@@ -1,6 +1,6 @@
 mausezahn-libs =   -lcli \
-lnet \
-   -lpcap \
+   $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) 
$(PKG_CONFIG) --libs libpcap 2> /dev/null ) \
-lrt \
-lpthread \
-lm
-- 
2.33.0

-- 
You received this message because you are subscribed to the Google Groups 
"netsniff-ng" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to netsniff-ng+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/netsniff-ng/0649cc0f467f091369c5f73df3b26dcc405a70ee.1630576560.git.baruch%40tkos.co.il.


[netsniff-ng] [PATCH] trafgen.8: fix typo in example packet

2021-09-02 Thread Baruch Siach
First MAC address is destination, but the second is source.

Signed-off-by: Baruch Siach 
---
 trafgen.8 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/trafgen.8 b/trafgen.8
index 97b9479d4f62..0b0fb317ceed 100644
--- a/trafgen.8
+++ b/trafgen.8
@@ -914,7 +914,7 @@ The above example rewritten using the header generation 
functions:
 .PP
{
  # --- ethernet header ---
- eth(da=00:1b:21:3c:9d:f8, da=90:e2:ba:0a:56:b4)
+ eth(da=00:1b:21:3c:9d:f8, sa=90:e2:ba:0a:56:b4)
  # --- ip header ---
  ipv4(id=drnd(), mf, ttl=64, sa=192.168.51.1, da=192.168.51.2)
  # --- udp header ---
-- 
2.33.0

-- 
You received this message because you are subscribed to the Google Groups 
"netsniff-ng" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to netsniff-ng+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/netsniff-ng/562d7e9800de18b9ea2be9c90f8d4c0aebe6c497.1630580470.git.baruch%40tkos.co.il.