As reported by naddy@ this fails to build after clang switched
to -fno-common.

--8<--
===>  Building for ipv6toolkit-2.0p0
cc  -O2 -pipe -Wall -c -o libipv6.o tools/libipv6.c
cc  -O2 -pipe -Wall -o addr6 tools/addr6.c libipv6.o  -lpcap -lm
cp tools/blackhole6 ./
cc  -O2 -pipe -Wall -o flow6 tools/flow6.c libipv6.o  -lpcap -lm
ld: error: duplicate symbol: errbuf
>>> defined at flow6.c
>>>            /tmp/flow6-b85880.o:(errbuf)
>>> defined at libipv6.c
>>>            libipv6.o:(.bss+0x80)

ld: error: duplicate symbol: pcap_filter
>>> defined at flow6.c
>>>            /tmp/flow6-b85880.o:(pcap_filter)
>>> defined at libipv6.c
>>>            libipv6.o:(.bss+0x0)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error 1 in /usr/ports/pobj/ipv6toolkit-2.0/ipv6toolkit-v2.0 (Makefile:58 
'flow6')
*** Error 2 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2935 
'/usr/ports/pobj/ipv6toolkit-2.0/.build_done': @cd /usr/ports/pobj/ipv6toolk...)
*** Error 2 in /usr/ports/net/ipv6-toolkit 
(/usr/ports/infrastructure/mk/bsd.port.mk:2594 'all': @lock=ipv6toolkit-2.0p0;  
export _LOCKS_HEL...)
-->8--

This has already been fixed in an upstream commit.

I've never used those tools on OpenBSD before, do they actually work?
scan6 -i iwm0 -L doesn't print anything here for example.

ok?


Index: Makefile
===================================================================
RCS file: /d/cvs/ports/net/ipv6-toolkit/Makefile,v
retrieving revision 1.5
diff -u -p -r1.5 Makefile
--- Makefile    12 Jul 2019 20:48:29 -0000      1.5
+++ Makefile    21 Feb 2021 23:42:50 -0000
@@ -5,7 +5,7 @@ COMMENT =               SI6 networks IPv6 toolkit
 VERSION =              2.0
 DISTNAME =             ipv6toolkit-v${VERSION}
 PKGNAME =              ipv6toolkit-${VERSION}
-REVISION =             0
+REVISION =             1
 
 CATEGORIES =           net
 
Index: patches/patch-tools_libipv6_c
===================================================================
RCS file: /d/cvs/ports/net/ipv6-toolkit/patches/patch-tools_libipv6_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-tools_libipv6_c
--- patches/patch-tools_libipv6_c       4 Apr 2019 19:18:18 -0000       1.1
+++ patches/patch-tools_libipv6_c       21 Feb 2021 23:40:56 -0000
@@ -1,11 +1,38 @@
 $OpenBSD: patch-tools_libipv6_c,v 1.1 2019/04/04 19:18:18 bluhm Exp $
 
-https://github.com/fgont/ipv6toolkit/pull/52
+RTA_IFP removal: https://github.com/fgont/ipv6toolkit/pull/52
+
+Other chunks: fix with -fno-common
+https://github.com/fgont/ipv6toolkit/commit/2bde90f3845234490549640dc6ed5712d84969ba
 
 Index: tools/libipv6.c
 --- tools/libipv6.c.orig
 +++ tools/libipv6.c
-@@ -2815,7 +2815,7 @@ int sel_next_hop(struct iface_data *idata){
+@@ -66,13 +66,9 @@
+ 
+ 
+ /* IPv6 Address Resolution */
+-sigjmp_buf                    env;
+-unsigned int          canjump;
++static sigjmp_buf                     env;
++static unsigned int                   canjump;
+ 
+-/* pcap variables */
+-char                          errbuf[PCAP_ERRBUF_SIZE];
+-struct bpf_program    pcap_filter;
+-
+ #ifdef __linux__
+ /* Netlink requests */
+ struct nlrequest{
+@@ -517,6 +513,7 @@ int ether_pton(const char *ascii, struct ether_addr *e
+ 
+ int find_ipv6_router_full(pcap_t *pfd, struct iface_data *idata){
+       struct pcap_pkthdr                      *pkthdr;
++      struct bpf_program      pcap_filter;
+       const u_char                            *pktdata;
+       struct ether_header                     *pkt_ether;
+       struct ip6_hdr                          *pkt_ipv6;
+@@ -2815,7 +2812,7 @@ int sel_next_hop(struct iface_data *idata){
                rtm->rtm_msglen= sizeof(struct rt_msghdr) + sizeof(struct 
sockaddr_in6);
                rtm->rtm_version= RTM_VERSION;
                rtm->rtm_type= RTM_GET;
@@ -14,3 +41,11 @@ Index: tools/libipv6.c
                rtm->rtm_pid= pid= getpid();
                rtm->rtm_seq= seq= random();
  
+@@ -4233,6 +4230,7 @@ int find_ipv6_router(pcap_t *pfd, struct ether_addr *h
+                                       struct ether_addr *result_ether, struct 
in6_addr *result_ipv6){
+ 
+       struct pcap_pkthdr                      *pkthdr;
++      struct bpf_program                      pcap_filter;
+       const u_char                            *pktdata;
+       struct ether_header                     *pkt_ether;
+       struct ip6_hdr                          *pkt_ipv6;
Index: patches/patch-tools_scan6_c
===================================================================
RCS file: patches/patch-tools_scan6_c
diff -N patches/patch-tools_scan6_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-tools_scan6_c 21 Feb 2021 23:41:28 -0000
@@ -0,0 +1,19 @@
+$OpenBSD$
+
+Fix with -fno-common
+https://github.com/fgont/ipv6toolkit/commit/2bde90f3845234490549640dc6ed5712d84969ba
+
+Index: tools/scan6.c
+--- tools/scan6.c.orig
++++ tools/scan6.c
+@@ -251,8 +251,8 @@ uint16_t                           
service_ports_dec[]={21, 22, 23, 25, 49, 5
+ 
+ 
+ /* IPv6 Address Resolution */
+-sigjmp_buf                            env;
+-unsigned int                  canjump;
++static sigjmp_buf                             env;
++static unsigned int                           canjump;
+ 
+ int main(int argc, char **argv){
+       extern char                             *optarg;


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to