On Mon, Feb 22, 2021 at 01:07:05AM +0100, Jeremie Courreges-Anglas wrote:
> I've never used those tools on OpenBSD before, do they actually work?
> scan6 -i iwm0 -L doesn't print anything here for example.
scan6 -i em0 -L works for me. These tools are not production
quality. Fernando Gont asked me to integrate the port on OpenBSD
some years ago. They may help him testing and debugging IPv6.
> ok?
OK bluhm@
> 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