pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Import openvas-libraries-8.0.8 as wip/openvas-scanner.



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Tue Oct 11 20:43:01 2016 +0200
Changeset:	b7169f77021d4f4d741b245975880fa62ed9e792

Added Files:
	openvas-scanner/DESCR
	openvas-scanner/MESSAGE
	openvas-scanner/Makefile
	openvas-scanner/PLIST
	openvas-scanner/buildlink3.mk
	openvas-scanner/distinfo
	openvas-scanner/patches/patch-CMakeLists.txt
	openvas-scanner/patches/patch-base_openvas__networking.c
	openvas-scanner/patches/patch-misc_bpf__share.h
	openvas-scanner/patches/patch-misc_ftp__funcs.c
	openvas-scanner/patches/patch-misc_ids__send.c
	openvas-scanner/patches/patch-misc_network.c
	openvas-scanner/patches/patch-misc_openvas__server.h
	openvas-scanner/patches/patch-misc_pcap.c
	openvas-scanner/patches/patch-nasl_nasl__builtin__openvas__tcp__scanner.c
	openvas-scanner/patches/patch-nasl_nasl__builtin__synscan.c
	openvas-scanner/patches/patch-nasl_nasl__packet__forgery.c
	openvas-scanner/patches/patch-nasl_nasl__raw.h
	openvas-scanner/patches/patch-nasl_nasl__socket.c

Log Message:
Import openvas-libraries-8.0.8 as wip/openvas-scanner.

OpenVAS stands for Open Vulnerability Assessment System and is a
network security scanner with associated tools like a graphical
user front-end. The core component is a server with a set of network
vulnerability tests (NVTs) to detect security problems in remote
systems and applications.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=b7169f77021d4f4d741b245975880fa62ed9e792

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 openvas-scanner/DESCR                              |   5 +
 openvas-scanner/MESSAGE                            |  10 +
 openvas-scanner/Makefile                           |  31 ++
 openvas-scanner/PLIST                              |  59 ++++
 openvas-scanner/buildlink3.mk                      |  23 ++
 openvas-scanner/distinfo                           |  19 +
 openvas-scanner/patches/patch-CMakeLists.txt       |  16 +
 .../patches/patch-base_openvas__networking.c       |  49 +++
 openvas-scanner/patches/patch-misc_bpf__share.h    |  12 +
 openvas-scanner/patches/patch-misc_ftp__funcs.c    |  12 +
 openvas-scanner/patches/patch-misc_ids__send.c     |  24 ++
 openvas-scanner/patches/patch-misc_network.c       |  28 ++
 .../patches/patch-misc_openvas__server.h           |  15 +
 openvas-scanner/patches/patch-misc_pcap.c          | 382 +++++++++++++++++++++
 ...tch-nasl_nasl__builtin__openvas__tcp__scanner.c |  16 +
 .../patches/patch-nasl_nasl__builtin__synscan.c    |  28 ++
 .../patches/patch-nasl_nasl__packet__forgery.c     |  76 ++++
 openvas-scanner/patches/patch-nasl_nasl__raw.h     |  16 +
 openvas-scanner/patches/patch-nasl_nasl__socket.c  |  28 ++
 19 files changed, 849 insertions(+)

diffs:
diff --git a/openvas-scanner/DESCR b/openvas-scanner/DESCR
new file mode 100644
index 0000000..c6339b9
--- /dev/null
+++ b/openvas-scanner/DESCR
@@ -0,0 +1,5 @@
+OpenVAS stands for Open Vulnerability Assessment System and is a
+network security scanner with associated tools like a graphical
+user front-end. The core component is a server with a set of network
+vulnerability tests (NVTs) to detect security problems in remote
+systems and applications.
diff --git a/openvas-scanner/MESSAGE b/openvas-scanner/MESSAGE
new file mode 100644
index 0000000..9f6fb03
--- /dev/null
+++ b/openvas-scanner/MESSAGE
@@ -0,0 +1,10 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1.1.1 2009/01/04 01:08:52 adrianp Exp $
+
+If you are running a BPF-enabled operating system BPFs are used to capture
+incoming packets without using the operating system.  OpenVAS uses those
+for some of its security checks and port scanners.
+
+OpenVAS recommands that you get about 100 of them or else it might miss
+some hosts or produce inaccurate port scans.
+===========================================================================
diff --git a/openvas-scanner/Makefile b/openvas-scanner/Makefile
new file mode 100644
index 0000000..f567e8a
--- /dev/null
+++ b/openvas-scanner/Makefile
@@ -0,0 +1,31 @@
+# $NetBSD: Makefile,v 1.17 2016/09/19 13:04:27 wiz Exp $
+
+DISTNAME=	openvas-libraries-8.0.8
+CATEGORIES=	security
+MASTER_SITES=	http://wald.intevation.org/frs/download.php/2351/
+
+MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=	http://www.openvas.org/
+COMMENT=	Libraries for the Open Vulnerability Assessment System
+
+USE_CMAKE=	YES
+BUILD_DEFS+=	VARBASE
+USE_LANGUAGES=	c++ c
+USE_TOOLS+=	pkg-config
+
+CMAKE_ARGS+=	-DLOCALSTATEDIR:PATH=${VARBASE}
+
+# DragonFly-2.8.2 has dn_expand(3) in libc, and not have libresolv.
+BUILDLINK_TRANSFORM.DragonFly+=	rm:-lresolv
+
+.include "../../databases/hiredis/buildlink3.mk"
+.include "../../databases/openldap-client/buildlink3.mk"
+.include "../../devel/glib2/buildlink3.mk"
+.include "../../devel/libuuid/buildlink3.mk"
+.include "../../net/libpcap/buildlink3.mk"
+.include "../../security/gnutls/buildlink3.mk"
+.include "../../security/gpgme/buildlink3.mk"
+.include "../../security/libgcrypt/buildlink3.mk"
+.include "../../security/libksba/buildlink3.mk"
+.include "../../security/libssh/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/openvas-scanner/PLIST b/openvas-scanner/PLIST
new file mode 100644
index 0000000..6e62499
--- /dev/null
+++ b/openvas-scanner/PLIST
@@ -0,0 +1,59 @@
+@comment $NetBSD$
+bin/openvas-nasl
+bin/openvas-nasl-lint
+include/openvas/base/array.h
+include/openvas/base/credentials.h
+include/openvas/base/cvss.h
+include/openvas/base/drop_privileges.h
+include/openvas/base/gpgme_util.h
+include/openvas/base/nvti.h
+include/openvas/base/nvticache.h
+include/openvas/base/openvas_compress.h
+include/openvas/base/openvas_file.h
+include/openvas/base/openvas_hosts.h
+include/openvas/base/openvas_networking.h
+include/openvas/base/openvas_string.h
+include/openvas/base/osp.h
+include/openvas/base/pidfile.h
+include/openvas/base/pwpolicy.h
+include/openvas/base/settings.h
+include/openvas/misc/arglists.h
+include/openvas/misc/bpf_share.h
+include/openvas/misc/ftp_funcs.h
+include/openvas/misc/internal_com.h
+include/openvas/misc/kb.h
+include/openvas/misc/network.h
+include/openvas/misc/nvt_categories.h
+include/openvas/misc/openvas_auth.h
+include/openvas/misc/openvas_logging.h
+include/openvas/misc/openvas_proctitle.h
+include/openvas/misc/openvas_server.h
+include/openvas/misc/openvas_uuid.h
+include/openvas/misc/pcap_openvas.h
+include/openvas/misc/plugutils.h
+include/openvas/misc/popen.h
+include/openvas/misc/prefs.h
+include/openvas/misc/radius.h
+include/openvas/misc/www_funcs.h
+include/openvas/nasl/nasl.h
+include/openvas/omp/omp.h
+include/openvas/omp/xml.h
+lib/libopenvas_base.so
+lib/libopenvas_base.so.8
+lib/libopenvas_base.so.${PKGVERSION}
+lib/libopenvas_misc.so
+lib/libopenvas_misc.so.8
+lib/libopenvas_misc.so.${PKGVERSION}
+lib/libopenvas_nasl.so
+lib/libopenvas_nasl.so.8
+lib/libopenvas_nasl.so.${PKGVERSION}
+lib/libopenvas_omp.so
+lib/libopenvas_omp.so.8
+lib/libopenvas_omp.so.${PKGVERSION}
+lib/pkgconfig/libopenvas_base.pc
+lib/pkgconfig/libopenvas_misc.pc
+lib/pkgconfig/libopenvas_nasl.pc
+lib/pkgconfig/libopenvas_omp.pc
+man/man1/openvas-nasl.1
+@pkgdir share/openvas
+@pkgdir etc/openvas/gnupg
diff --git a/openvas-scanner/buildlink3.mk b/openvas-scanner/buildlink3.mk
new file mode 100644
index 0000000..ba09ee7
--- /dev/null
+++ b/openvas-scanner/buildlink3.mk
@@ -0,0 +1,23 @@
+# $NetBSD$
+
+BUILDLINK_TREE+=	openvas-libraries
+
+.if !defined(OPENVAS_LIBRARIES_BUILDLINK3_MK)
+OPENVAS_LIBRARIES_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.openvas-libraries+=	openvas-libraries>=8.0.8
+BUILDLINK_PKGSRCDIR.openvas-libraries?=	../../wip/openvas-libraries
+
+.include "../../databases/hiredis/buildlink3.mk"
+.include "../../databases/openldap-client/buildlink3.mk"
+.include "../../devel/glib2/buildlink3.mk"
+.include "../../devel/libuuid/buildlink3.mk"
+.include "../../net/libpcap/buildlink3.mk";
+.include "../../security/gnutls/buildlink3.mk"
+.include "../../security/gpgme/buildlink3.mk"
+.include "../../security/libgcrypt/buildlink3.mk"
+.include "../../security/libksba/buildlink3.mk"
+.include "../../security/libssh/buildlink3.mk"
+.endif	# OPENVAS_LIBRARIES_BUILDLINK3_MK
+
+BUILDLINK_TREE+=	-openvas-libraries
diff --git a/openvas-scanner/distinfo b/openvas-scanner/distinfo
new file mode 100644
index 0000000..e910095
--- /dev/null
+++ b/openvas-scanner/distinfo
@@ -0,0 +1,19 @@
+$NetBSD: distinfo,v 1.6 2015/11/04 01:17:52 agc Exp $
+
+SHA1 (openvas-libraries-8.0.8.tar.gz) = d26267c5974f031237a20ccbd3fe64b6fbadf543
+RMD160 (openvas-libraries-8.0.8.tar.gz) = 8bbd1c8c5ef19bacd4edf794e55f7e9762196a69
+SHA512 (openvas-libraries-8.0.8.tar.gz) = 3575544f034229cbebf882e68bab9f3352fbf42e258184890ba7e2858cf06abdfe79a661612e59efa2f7bd6f350d744d4f12900a829fbc9ffd21ed779b1dfde5
+Size (openvas-libraries-8.0.8.tar.gz) = 612053 bytes
+SHA1 (patch-CMakeLists.txt) = d98ffb43e2d90e88f9d37753a0e377853c61c9db
+SHA1 (patch-base_openvas__networking.c) = 6e35bc78a2776d3c8357a358c12101fac609b9c6
+SHA1 (patch-misc_bpf__share.h) = 3461b78b827b44aeb54af4ada5434c74eed7be62
+SHA1 (patch-misc_ftp__funcs.c) = a89da9d7f5d1c49a38782f36527b50f1f17f200f
+SHA1 (patch-misc_ids__send.c) = 3ae88bf6202a15ee641ece63b48be7074bc32088
+SHA1 (patch-misc_network.c) = 20016d1e4843a6a47cbafe7ffedf60adceefd894
+SHA1 (patch-misc_openvas__server.h) = d17e74fd3d8a087704a8e897f811acbeee600131
+SHA1 (patch-misc_pcap.c) = 1185d1ca920be12e80dc6e438e40eaa06fffc946
+SHA1 (patch-nasl_nasl__builtin__openvas__tcp__scanner.c) = cbf283a985e27aa438ae09bf625a68c91f0edcaf
+SHA1 (patch-nasl_nasl__builtin__synscan.c) = d804ff94469ec806a80b2f8d69e3d34e1f4902bb
+SHA1 (patch-nasl_nasl__packet__forgery.c) = 19f54d13e04cced421cb852eaf92db8d1d54aad8
+SHA1 (patch-nasl_nasl__raw.h) = 8aa26ccdbc580426078796faad5230e154bd0f82
+SHA1 (patch-nasl_nasl__socket.c) = 1083df9212249516d025f04716934bc94179685b
diff --git a/openvas-scanner/patches/patch-CMakeLists.txt b/openvas-scanner/patches/patch-CMakeLists.txt
new file mode 100644
index 0000000..2b92b38
--- /dev/null
+++ b/openvas-scanner/patches/patch-CMakeLists.txt
@@ -0,0 +1,16 @@
+$NetBSD$
+
+--- CMakeLists.txt.orig	2016-02-26 14:31:03.000000000 +0000
++++ CMakeLists.txt
+@@ -343,8 +343,10 @@ add_subdirectory (doc)
+ 
+ ## Install
+ 
++include(GNUInstallDirs)
++
+ install (FILES doc/openvas-nasl.1
+-         DESTINATION ${DATADIR}/man/man1 )
++         DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 )
+ 
+ install (FILES ${CMAKE_BINARY_DIR}/libopenvas_base.pc
+          DESTINATION ${LIBDIR}/pkgconfig)
diff --git a/openvas-scanner/patches/patch-base_openvas__networking.c b/openvas-scanner/patches/patch-base_openvas__networking.c
new file mode 100644
index 0000000..6bd33d4
--- /dev/null
+++ b/openvas-scanner/patches/patch-base_openvas__networking.c
@@ -0,0 +1,49 @@
+$NetBSD$
+
+--- base/openvas_networking.c.orig	2016-04-22 13:45:43.000000000 +0000
++++ base/openvas_networking.c
+@@ -44,7 +44,7 @@ char global_source_iface[IFNAMSIZ] = { '
+ struct in_addr global_source_addr = { .s_addr = 0 };
+ 
+ /* Source IPv6 address. */
+-struct in6_addr global_source_addr6 = { .s6_addr32 = { 0, 0, 0, 0 } };
++struct in6_addr global_source_addr6 = {};
+ 
+  /* Source Interface/Address related functions. */
+ 
+@@ -227,13 +227,23 @@ openvas_source_addr6_str (void)
+ void
+ ipv4_as_ipv6 (const struct in_addr *ip4, struct in6_addr *ip6)
+ {
++#if defined(__NetBSD__)
++  size_t i;
++#endif
++
+   if (ip4 == NULL || ip6 == NULL)
+     return;
+ 
++#if defined(__NetBSD__)
++  for (i = 0; i < 12; i++)
++    ip6->s6_addr[i] = 0;
++  memcpy (&ip6->s6_addr[12], ip4, sizeof (struct in_addr));
++#else
+   ip6->s6_addr32[0] = 0;
+   ip6->s6_addr32[1] = 0;
+   ip6->s6_addr32[2] = htonl (0xffff);
+   memcpy (&ip6->s6_addr32[3], ip4, sizeof (struct in_addr));
++#endif
+ }
+ 
+ char *
+@@ -246,7 +256,11 @@ addr6_as_str (const struct in6_addr *add
+ 
+   str = g_malloc0 (INET6_ADDRSTRLEN);
+   if (IN6_IS_ADDR_V4MAPPED (addr6))
++#if defined(__NetBSD__)
++    inet_ntop (AF_INET, &addr6->s6_addr[12], str, INET6_ADDRSTRLEN);
++#else
+     inet_ntop (AF_INET, &addr6->s6_addr32[3], str, INET6_ADDRSTRLEN);
++#endif
+   else
+     inet_ntop (AF_INET6, addr6, str, INET6_ADDRSTRLEN);
+   return str;
diff --git a/openvas-scanner/patches/patch-misc_bpf__share.h b/openvas-scanner/patches/patch-misc_bpf__share.h
new file mode 100644
index 0000000..4b28d2b
--- /dev/null
+++ b/openvas-scanner/patches/patch-misc_bpf__share.h
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- misc/bpf_share.h.orig	2015-08-03 10:14:29.000000000 +0000
++++ misc/bpf_share.h
+@@ -27,6 +27,7 @@
+ #define OPENVAS_BPF_SHARE_H
+ 
+ #include <sys/types.h>
++#include <time.h>
+ 
+ int bpf_open_live (char *, char *);
+ u_char *bpf_next (int, int *);
diff --git a/openvas-scanner/patches/patch-misc_ftp__funcs.c b/openvas-scanner/patches/patch-misc_ftp__funcs.c
new file mode 100644
index 0000000..17e1c62
--- /dev/null
+++ b/openvas-scanner/patches/patch-misc_ftp__funcs.c
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- misc/ftp_funcs.c.orig	2015-08-03 10:14:29.000000000 +0000
++++ misc/ftp_funcs.c
+@@ -30,6 +30,7 @@
+ /* this works for libc6 systems, unclear
+  * wether it will not work on other systems */
+ #include <netinet/in.h>
++#include <sys/socket.h>
+ 
+ #include "network.h"
+ 
diff --git a/openvas-scanner/patches/patch-misc_ids__send.c b/openvas-scanner/patches/patch-misc_ids__send.c
new file mode 100644
index 0000000..9ac70b5
--- /dev/null
+++ b/openvas-scanner/patches/patch-misc_ids__send.c
@@ -0,0 +1,24 @@
+$NetBSD$
+
+--- misc/ids_send.c.orig	2015-08-03 10:14:29.000000000 +0000
++++ misc/ids_send.c
+@@ -36,6 +36,7 @@
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <arpa/inet.h>
++#include <sys/socket.h>
+ 
+ #include "arglists.h"
+ #include "bpf_share.h"
+@@ -713,7 +714,11 @@ ids_open_sock_tcp (args, port, method, t
+   if (IN6_IS_ADDR_V4MAPPED (dst6))
+     {
+       family = AF_INET;
++#if defined(__NetBSD__)
++      memcpy(&dst.s_addr, &dst6->s6_addr[12], 4);
++#else
+       dst.s_addr = dst6->s6_addr32[3];
++#endif
+       src.s_addr = 0;
+       iface = routethrough (&dst, &src);
+       src_host = g_strdup (inet_ntoa (src));
diff --git a/openvas-scanner/patches/patch-misc_network.c b/openvas-scanner/patches/patch-misc_network.c
new file mode 100644
index 0000000..6b4e5c2
--- /dev/null
+++ b/openvas-scanner/patches/patch-misc_network.c
@@ -0,0 +1,28 @@
+$NetBSD$
+
+--- misc/network.c.orig	2016-08-25 12:02:52.000000000 +0000
++++ misc/network.c
+@@ -2068,7 +2068,11 @@ open_sock_opt_hn (const char *hostname, 
+       bzero ((void *) &addr, sizeof (addr));
+       addr.sin_family = AF_INET;
+       addr.sin_port = htons ((unsigned short) port);
++#if defined(__NetBSD__)
++      memcpy(&addr.sin_addr.s_addr, &in6addr.s6_addr[12], 4);
++#else
+       addr.sin_addr.s_addr = in6addr.s6_addr32[3];
++#endif
+       return open_socket ((struct sockaddr *) &addr, type, protocol,
+                           timeout, sizeof (struct sockaddr_in));
+     }
+@@ -2158,7 +2162,11 @@ open_sock_option (struct arglist *args, 
+       bzero ((void *) &addr, sizeof (addr));
+       addr.sin_family = AF_INET;
+       addr.sin_port = htons ((unsigned short) port);
++#if defined(__NetBSD__)
++      memcpy(&addr.sin_addr.s_addr, &t->s6_addr[12], 4);
++#else
+       addr.sin_addr.s_addr = t->s6_addr32[3];
++#endif
+       return open_socket ((struct sockaddr *) &addr, type, protocol,
+                           timeout, sizeof (struct sockaddr_in));
+     }
diff --git a/openvas-scanner/patches/patch-misc_openvas__server.h b/openvas-scanner/patches/patch-misc_openvas__server.h
new file mode 100644
index 0000000..cb16bc5
--- /dev/null
+++ b/openvas-scanner/patches/patch-misc_openvas__server.h
@@ -0,0 +1,15 @@
+$NetBSD$
+
+--- misc/openvas_server.h.orig	2015-08-03 10:14:29.000000000 +0000
++++ misc/openvas_server.h
+@@ -48,6 +48,10 @@ extern "C"
+ #ifdef _WIN32
+ #include <winsock2.h>
+ #else
++#if defined(__NetBSD__)
++#include <netinet/in_systm.h>
++#include <netinet/in.h>
++#endif
+ #include <netinet/ip.h>
+ #endif
+ 
diff --git a/openvas-scanner/patches/patch-misc_pcap.c b/openvas-scanner/patches/patch-misc_pcap.c
new file mode 100644
index 0000000..dbf9951
--- /dev/null
+++ b/openvas-scanner/patches/patch-misc_pcap.c
@@ -0,0 +1,382 @@
+$NetBSD$
+
+--- misc/pcap.c.orig	2015-08-03 10:14:29.000000000 +0000
++++ misc/pcap.c
+@@ -126,7 +126,13 @@ v6_is_local_ip (struct in6_addr *addr)
+           bpf_u_int32 net, mask;
+           char errbuf[PCAP_ERRBUF_SIZE];
+           pcap_lookupnet (ifs[i].name, &net, &mask, errbuf);
++#if defined(__NetBSD__)
++          uint32_t addr32;
++          memcpy(&addr32, &addr->s6_addr[12], 4);
++          if ((net & mask) == (addr32 & mask))
++#else
+           if ((net & mask) == (addr->s6_addr32[3] & mask))
++#endif
+             return 1;
+         }
+     }
+@@ -190,9 +196,17 @@ v6_get_mac_addr (struct in6_addr *addr, 
+       if (soc < 0)
+         return -1;
+ 
++#if defined(__NetBSD__)
++      memcpy(&inaddr.s_addr, &me.s6_addr[12], 4);
++#else
+       inaddr.s_addr = me.s6_addr32[3];
++#endif
+       src_host = g_strdup (inet_ntoa (inaddr));
++#if defined(__NetBSD__)
++      memcpy(&inaddr.s_addr, &addr->s6_addr[12], 4);
++#else
+       inaddr.s_addr = addr->s6_addr32[3];
++#endif
+       dst_host = g_strdup (inet_ntoa (inaddr));
+       snprintf (filter, sizeof (filter)-1, "ip and (src host %s and dst host %s)",
+                 src_host, dst_host);
+@@ -217,7 +231,11 @@ v6_get_mac_addr (struct in6_addr *addr, 
+         }
+ 
+ 
++#if defined(__NetBSD__)
++      memcpy(&soca.sin_addr.s_addr, &addr->s6_addr[12], 4);
++#else
+       soca.sin_addr.s_addr = addr->s6_addr32[3];
++#endif
+       soca.sin_port = htons (9);        /* or whatever */
+       soca.sin_family = AF_INET;
+       if (sendto (soc, NULL, 0, 0, (struct sockaddr *) &soca, sizeof (soca)) !=
+@@ -386,11 +404,21 @@ v6_islocalhost (struct in6_addr *addr)
+     {
+       /* If it is 0.0.0.0 or starts with 127.0.0.1 then it is
+          probably localhost */
++#if defined(__NetBSD__)
++      uint32_t addr32;
++      memcpy(&addr32, &addr->s6_addr[12], 4);
++      if ((addr32 & htonl (0xFF000000)) == htonl (0x7F000000))
++        return 1;
++
++      if (!addr32)
++        return 1;
++#else
+       if ((addr->s6_addr32[3] & htonl (0xFF000000)) == htonl (0x7F000000))
+         return 1;
+ 
+       if (!addr->s6_addr32[3])
+         return 1;
++#endif
+     }
+ 
+   if (IN6_IS_ADDR_LOOPBACK (addr))
+@@ -571,6 +599,37 @@ v6_getinterfaces (int *howmany)
+               memcpy (mydevs[numinterfaces].name, ifa->ifa_name,
+                       strlen (ifa->ifa_name));
+               saddr = (struct sockaddr_in *) ifa->ifa_addr;
++#if defined(__NetBSD__)
++              mydevs[numinterfaces].addr6.s6_addr[0] = 0;
++              mydevs[numinterfaces].addr6.s6_addr[1] = 0;
++              mydevs[numinterfaces].addr6.s6_addr[2] = 0;
++              mydevs[numinterfaces].addr6.s6_addr[3] = 0;
++              mydevs[numinterfaces].addr6.s6_addr[4] = 0;
++              mydevs[numinterfaces].addr6.s6_addr[5] = 0;
++              mydevs[numinterfaces].addr6.s6_addr[6] = 0;
++              mydevs[numinterfaces].addr6.s6_addr[7] = 0;
++              // TODO: Big endian
++              mydevs[numinterfaces].addr6.s6_addr[8] = 0;
++              mydevs[numinterfaces].addr6.s6_addr[9] = 0;
++              mydevs[numinterfaces].addr6.s6_addr[10] = 0xff;
++              mydevs[numinterfaces].addr6.s6_addr[11] = 0xff;
++              memcpy (&mydevs[numinterfaces].addr6.s6_addr[12], &saddr->sin_addr.s_addr, 4);
++              saddr = (struct sockaddr_in *) ifa->ifa_netmask;
++              mydevs[numinterfaces].mask.s6_addr[0] = 0;
++              mydevs[numinterfaces].mask.s6_addr[1] = 0;
++              mydevs[numinterfaces].mask.s6_addr[2] = 0;
++              mydevs[numinterfaces].mask.s6_addr[3] = 0;
++              mydevs[numinterfaces].mask.s6_addr[4] = 0;
++              mydevs[numinterfaces].mask.s6_addr[5] = 0;
++              mydevs[numinterfaces].mask.s6_addr[6] = 0;
++              mydevs[numinterfaces].mask.s6_addr[7] = 0;
++              // TODO: Big endian
++              mydevs[numinterfaces].mask.s6_addr[8] = 0;
++              mydevs[numinterfaces].mask.s6_addr[9] = 0;
++              mydevs[numinterfaces].mask.s6_addr[10] = 0xff;
++              mydevs[numinterfaces].mask.s6_addr[11] = 0xff;
++              memcpy (&mydevs[numinterfaces].mask.s6_addr[12], &saddr->sin_addr.s_addr, 4);
++#else
+               mydevs[numinterfaces].addr6.s6_addr32[0] = 0;
+               mydevs[numinterfaces].addr6.s6_addr32[1] = 0;
+               mydevs[numinterfaces].addr6.s6_addr32[2] = htonl (0xffff);
+@@ -580,6 +639,7 @@ v6_getinterfaces (int *howmany)
+               mydevs[numinterfaces].mask.s6_addr32[1] = 0;
+               mydevs[numinterfaces].mask.s6_addr32[2] = htonl (0xffff);
+               mydevs[numinterfaces].mask.s6_addr32[3] = saddr->sin_addr.s_addr;
++#endif
+ #ifdef TCPIP_DEBUGGING
+               printf ("interface name is %s\n", ifa->ifa_name);
+               printf ("\tAF_INET family\n");
+@@ -631,13 +691,19 @@ getinterfaces (int *howmany)
+   static struct interface_info mydevs[1024];
+   int numinterfaces = 0;
+   int sd;
++#if defined(__NetBSD__)
++  size_t n;
++#else
+   int len;
++#endif
+   char *p;
+   char buf[10240];
+   struct ifconf ifc;
+   struct ifreq *ifr;
+   struct sockaddr_in *sin;
++#if !defined(__NetBSD__)
+   char *bufp;
++#endif
+ 
+   /* Dummy socket for ioctl. */
+   sd = socket (AF_INET, SOCK_DGRAM, 0);
+@@ -655,12 +721,18 @@ getinterfaces (int *howmany)
+     log_legacy_write
+      ("getinterfaces: SIOCGIFCONF claims you have no network interfaces!");
+ 
++#if defined(__NetBSD__)
++  for (ifr = (struct ifreq *) buf; (char *) ifr < buf + ifc.ifc_len; )
++#else
+   len = sizeof (struct ifmap);
+ 
+   for (bufp = buf; bufp && *bufp && (bufp < (buf + ifc.ifc_len));
+        bufp += sizeof (ifr->ifr_name) + len)
++#endif
+     {
++#if !defined(__NetBSD__)
+       ifr = (struct ifreq *) bufp;
++#endif
+       sin = (struct sockaddr_in *) &ifr->ifr_addr;
+       memcpy (&(mydevs[numinterfaces].addr), (char *) &(sin->sin_addr),
+               sizeof (struct in_addr));
+@@ -670,6 +742,9 @@ getinterfaces (int *howmany)
+       strncpy (mydevs[numinterfaces].name, ifr->ifr_name, 63);
+       mydevs[numinterfaces].name[63] = '\0';
+       numinterfaces++;
++#if defined(__NetBSD__)
++      mydevs[numinterfaces].name[0] = '\0';
++#endif
+       if (numinterfaces == 1023)
+         {
+           log_legacy_write
+@@ -677,7 +752,15 @@ getinterfaces (int *howmany)
+             " Things may not work right.");
+           break;
+         }
++#if defined(__NetBSD__)
++      n = offsetof(struct ifreq, ifr_addr) + ifr->ifr_addr.sa_len;
++      if (n < sizeof(*ifr))
++          ifr++;
++      else
++          ifr = (struct ifreq *)((char *)ifr + n);
++#else
+       mydevs[numinterfaces].name[0] = '\0';
++#endif
+     }
+ 
+   // If output parameter given, set value
+@@ -712,7 +795,11 @@ v6_getsourceip (struct in6_addr *src, st
+           return 0;
+         }
+       sock.sin_family = AF_INET;
++#if defined(__NetBSD__)
++      memcpy(&sock.sin_addr.s_addr, &dst->s6_addr[12], 4);
++#else
+       sock.sin_addr.s_addr = dst->s6_addr32[3];
++#endif
+       sock.sin_port = htons (p1);
+       if (connect (sd, (struct sockaddr *) &sock, sizeof (struct sockaddr_in))
+           == -1)
+@@ -730,10 +817,27 @@ v6_getsourceip (struct in6_addr *src, st
+         }
+ 
+ 
++#if defined(__NetBSD__)
++      src->s6_addr[0] = 0;
++      src->s6_addr[1] = 0;
++      src->s6_addr[2] = 0;
++      src->s6_addr[3] = 0;
++      src->s6_addr[4] = 0;
++      src->s6_addr[5] = 0;
++      src->s6_addr[6] = 0;
++      src->s6_addr[7] = 0;
++      // TODO: Big-endian
++      src->s6_addr[8] = 0;
++      src->s6_addr[9] = 0;
++      src->s6_addr[10] = 0xff;
++      src->s6_addr[11] = 0xff;
++      memcpy (&src->s6_addr[12], &sock.sin_addr.s_addr, 4);
++#else
+       src->s6_addr32[0] = 0;
+       src->s6_addr32[1] = 0;
+       src->s6_addr32[2] = htonl (0xffff);
+       src->s6_addr32[3] = sock.sin_addr.s_addr;
++#endif
+ #ifdef TCPIP_DEBUGGING
+       printf ("source addrss is %s\n",
+               inet_ntop (AF_INET6, src, name, sizeof (name)));
+@@ -748,10 +852,16 @@ v6_getsourceip (struct in6_addr *src, st
+           return 0;
+         }
+       sock6.sin6_family = AF_INET6;
++#if defined(__NetBSD__)
++      size_t iter;
++      for (iter = 0; iter < 16; iter++)
++        sock6.sin6_addr.s6_addr[iter] = dst->s6_addr[iter];
++#else
+       sock6.sin6_addr.s6_addr32[0] = dst->s6_addr32[0];
+       sock6.sin6_addr.s6_addr32[1] = dst->s6_addr32[1];
+       sock6.sin6_addr.s6_addr32[2] = dst->s6_addr32[2];
+       sock6.sin6_addr.s6_addr32[3] = dst->s6_addr32[3];
++#endif
+       sock6.sin6_port = htons (p1);
+       if (connect (sd, (struct sockaddr *) &sock6, sizeof (struct sockaddr_in6))
+           == -1)
+@@ -768,10 +878,15 @@ v6_getsourceip (struct in6_addr *src, st
+           return 0;
+         }
+ 
++#if defined(__NetBSD__)
++      for (iter = 0; iter < 16; iter++)
++        src->s6_addr[iter] = sock6.sin6_addr.s6_addr[iter];
++#else
+       src->s6_addr32[0] = sock6.sin6_addr.s6_addr32[0];
+       src->s6_addr32[1] = sock6.sin6_addr.s6_addr32[1];
+       src->s6_addr32[2] = sock6.sin6_addr.s6_addr32[2];
+       src->s6_addr32[3] = sock6.sin6_addr.s6_addr32[3];
++#endif
+       memcpy (src, &sock6.sin6_addr, sizeof (struct in6_addr));
+ #ifdef TCPIP_DEBUGGING
+       printf ("source addrss is %s\n",
+@@ -880,10 +995,27 @@ getipv4routes (struct myroute *myroutes,
+               continue;
+             }
+           inaddr.s_addr = dest;
++#if defined(__NetBSD__)
++          myroutes[*numroutes].dest6.s6_addr[0] = 0;
++          myroutes[*numroutes].dest6.s6_addr[1] = 0;
++          myroutes[*numroutes].dest6.s6_addr[2] = 0;
++          myroutes[*numroutes].dest6.s6_addr[3] = 0;
++          myroutes[*numroutes].dest6.s6_addr[4] = 0;
++          myroutes[*numroutes].dest6.s6_addr[5] = 0;
++          myroutes[*numroutes].dest6.s6_addr[6] = 0;
++          myroutes[*numroutes].dest6.s6_addr[7] = 0;
++          // TODO: Big-endian
++          myroutes[*numroutes].dest6.s6_addr[8] = 0;
++          myroutes[*numroutes].dest6.s6_addr[9] = 0;
++          myroutes[*numroutes].dest6.s6_addr[10] = 0xff;
++          myroutes[*numroutes].dest6.s6_addr[11] = 0xff;
++          memcpy (&myroutes[*numroutes].dest6.s6_addr[12], &inaddr.s_addr, 4);
++#else
+           myroutes[*numroutes].dest6.s6_addr32[0] = 0;
+           myroutes[*numroutes].dest6.s6_addr32[1] = 0;
+           myroutes[*numroutes].dest6.s6_addr32[2] = htonl (0xffff);
+           myroutes[*numroutes].dest6.s6_addr32[3] = inaddr.s_addr;
++#endif
+           for (i = 0; i < 6; i++)
+             {
+               p = strtok (NULL, " \t\n");
+@@ -1112,17 +1244,55 @@ v6_routethrough (struct in6_addr *dest, 
+         {
+           if (IN6_IS_ADDR_V4MAPPED (source))
+             {
++#if defined(__NetBSD__)
++              source->s6_addr[0] = 0;
++              source->s6_addr[1] = 0;
++              source->s6_addr[2] = 0;
++              source->s6_addr[3] = 0;
++              source->s6_addr[4] = 0;
++              source->s6_addr[5] = 0;
++              source->s6_addr[6] = 0;
++              source->s6_addr[7] = 0;
++              source->s6_addr[8] = 0;
++              source->s6_addr[9] = 0;
++              source->s6_addr[10] = 0xff;
++              source->s6_addr[11] = 0xff;
++              source->s6_addr[12] = 0x7f;
++              source->s6_addr[13] = 0;
++              source->s6_addr[14] = 0;
++              source->s6_addr[15] = 1;
++#else
+               source->s6_addr32[0] = 0;
+               source->s6_addr32[1] = 0;
+               source->s6_addr32[2] = htonl (0xffff);
+               source->s6_addr32[3] = htonl (0x7F000001);
++#endif
+             }
+           else
+             {
++#if defined(__NetBSD__)
++              source->s6_addr[0] = 0;
++              source->s6_addr[1] = 0;
++              source->s6_addr[2] = 0;
++              source->s6_addr[3] = 0;
++              source->s6_addr[4] = 0;
++              source->s6_addr[5] = 0;
++              source->s6_addr[6] = 0;
++              source->s6_addr[7] = 0;
++              source->s6_addr[8] = 0;
++              source->s6_addr[9] = 0;
++              source->s6_addr[10] = 0;
++              source->s6_addr[11] = 0;
++              source->s6_addr[12] = 0;
++              source->s6_addr[13] = 0;
++              source->s6_addr[14] = 0;
++              source->s6_addr[15] = 1;
++#else
+               source->s6_addr32[0] = 0;
+               source->s6_addr32[1] = 0;
+               source->s6_addr32[2] = 0;
+               source->s6_addr32[3] = htonl (1);
++#endif
+             }
+         }
+       /* Now we find the localhost interface name, assuming 127.0.0.1
+@@ -1131,7 +1301,13 @@ v6_routethrough (struct in6_addr *dest, 
+         {
+           if (IN6_IS_ADDR_V4MAPPED (&mydevs[i].addr6))
+             {
++#if defined(__NetBSD__)
++              uint32_t addr32;
++              memcpy(&addr32, &mydevs[i].addr6.s6_addr[12], 4);
++              if (addr32 == htonl (0x7F000001))
++#else
+               if (mydevs[i].addr6.s6_addr32[3] == htonl (0x7F000001))
++#endif
+                 return mydevs[i].name;
+             }
+           else
+@@ -1195,11 +1371,28 @@ v6_routethrough (struct in6_addr *dest, 
+             log_legacy_write ("Cannot get hostname!");
+           if (myhostent->h_addrtype == AF_INET)
+             {
++#if defined(__NetBSD__)
++              addy.s6_addr[0] = 0;
++              addy.s6_addr[1] = 0;
++              addy.s6_addr[2] = 0;
++              addy.s6_addr[3] = 0;
++              addy.s6_addr[4] = 0;
++              addy.s6_addr[5] = 0;
++              addy.s6_addr[6] = 0;
++              addy.s6_addr[7] = 0;
++              addy.s6_addr[8] = 0;
++              addy.s6_addr[9] = 0;
++              addy.s6_addr[10] = 0xff;
++              addy.s6_addr[11] = 0xff;
++              memcpy (&addy.s6_addr[12], myhostent->h_addr_list[0],
++                      sizeof (struct in6_addr));
++#else
+               addy.s6_addr32[0] = 0;
+               addy.s6_addr32[1] = 0;
+               addy.s6_addr32[2] = htonl (0xffff);
+-              memcpy (&addy.s6_addr32[0], myhostent->h_addr_list[0],
++              memcpy (&addy.s6_addr32[0 /* bug? why not 3 */], myhostent->h_addr_list[0],
+                       sizeof (struct in6_addr));
++#endif
+             }
+           else
+             memcpy (&addy, myhostent->h_addr_list[0], sizeof (struct in6_addr));
diff --git a/openvas-scanner/patches/patch-nasl_nasl__builtin__openvas__tcp__scanner.c b/openvas-scanner/patches/patch-nasl_nasl__builtin__openvas__tcp__scanner.c
new file mode 100644
index 0000000..e6bcd52
--- /dev/null
+++ b/openvas-scanner/patches/patch-nasl_nasl__builtin__openvas__tcp__scanner.c
@@ -0,0 +1,16 @@
+$NetBSD$
+
+--- nasl/nasl_builtin_openvas_tcp_scanner.c.orig	2015-08-03 10:14:31.000000000 +0000
++++ nasl/nasl_builtin_openvas_tcp_scanner.c
+@@ -473,7 +473,11 @@ banner_grab(const struct in6_addr *pia, 
+ #endif
+         if(IN6_IS_ADDR_V4MAPPED(pia))
+         {
++#if defined(__NetBSD__)
++          memcpy(&sa.sin_addr.s_addr, &pia->s6_addr[12], 4);
++#else
+           sa.sin_addr.s_addr = pia->s6_addr32[3];
++#endif
+           sa.sin_family = AF_INET;
+           sa.sin_port = htons(port);
+           len = sizeof(struct sockaddr_in);
diff --git a/openvas-scanner/patches/patch-nasl_nasl__builtin__synscan.c b/openvas-scanner/patches/patch-nasl_nasl__builtin__synscan.c
new file mode 100644
index 0000000..9abc529
--- /dev/null
+++ b/openvas-scanner/patches/patch-nasl_nasl__builtin__synscan.c
@@ -0,0 +1,28 @@
+$NetBSD$
+
+--- nasl/nasl_builtin_synscan.c.orig	2015-08-03 10:14:31.000000000 +0000
++++ nasl/nasl_builtin_synscan.c
+@@ -692,7 +692,11 @@ scan (struct arglist * env, char* hostna
+   if (IN6_IS_ADDR_V4MAPPED (dst6))
+     {
+       family = AF_INET;
++#if defined(__NetBSD__)
++      memcpy(&dst.s_addr, &dst6->s6_addr[12], 4);
++#else
+       dst.s_addr = dst6->s6_addr32[3];
++#endif
+       soc = rawsocket (AF_INET);
+     }
+   else
+@@ -797,7 +801,11 @@ plugin_run_synscan (lex_ctxt * lexic)
+   struct timeval  tv;
+ #endif
+ 
++#if defined(__NetBSD__)
++  memcpy(&inaddr.s_addr, &dst6->s6_addr[12], 4);
++#else
+   inaddr.s_addr = dst6->s6_addr32[3];
++#endif
+   dst = &inaddr;
+ 
+   if (islocalhost (dst))
diff --git a/openvas-scanner/patches/patch-nasl_nasl__packet__forgery.c b/openvas-scanner/patches/patch-nasl_nasl__packet__forgery.c
new file mode 100644
index 0000000..e6c3d5c
--- /dev/null
+++ b/openvas-scanner/patches/patch-nasl_nasl__packet__forgery.c
@@ -0,0 +1,76 @@
+$NetBSD$
+
+--- nasl/nasl_packet_forgery.c.orig	2015-08-03 10:14:31.000000000 +0000
++++ nasl/nasl_packet_forgery.c
+@@ -146,7 +146,11 @@ forge_ip_packet (lex_ctxt * lexic)
+   if (s != NULL)
+     inet_aton (s, &pkt->ip_dst);
+   else
++#if defined(__NetBSD__)
++    memcpy(&pkt->ip_dst.s_addr, &dst_addr->s6_addr[12], 4);
++#else
+     pkt->ip_dst.s_addr = dst_addr->s6_addr32[3];
++#endif
+ 
+   if (data != NULL)
+     {
+@@ -1400,7 +1404,11 @@ nasl_tcp_ping (lex_ctxt * lexic)
+ 
+   if (dst == NULL || (IN6_IS_ADDR_V4MAPPED (dst) != 1))
+     return NULL;
++#if defined(__NetBSD__)
++  memcpy(&inaddr.s_addr, &dst->s6_addr[12], 4);
++#else
+   inaddr.s_addr = dst->s6_addr32[3];
++#endif
+   for (i = 0; i < sizeof (sports) / sizeof (int); i++)
+     {
+       if (sports[i] == 0)
+@@ -1422,7 +1430,11 @@ nasl_tcp_ping (lex_ctxt * lexic)
+     port = plug_get_host_open_port (script_infos);
+ 
+   if (islocalhost (&inaddr) > 0)
++#if defined(__NetBSD__)
++    memcpy(&src.s_addr, &dst->s6_addr[12], 4);
++#else
+     src.s_addr = dst->s6_addr32[3];
++#endif
+   else
+     {
+       bzero (&src, sizeof (src));
+@@ -1536,7 +1548,11 @@ nasl_send_packet (lex_ctxt * lexic)
+ 
+   if (dstip == NULL || (IN6_IS_ADDR_V4MAPPED (dstip) != 1))
+     return NULL;
++#if defined(__NetBSD__)
++  memcpy(&inaddr.s_addr, &dstip->s6_addr[12], 4);
++#else
+   inaddr.s_addr = dstip->s6_addr32[3];
++#endif
+   soc = socket (AF_INET, SOCK_RAW, IPPROTO_RAW);
+   if (soc < 0)
+     return NULL;
+@@ -1656,7 +1672,11 @@ nasl_pcap_next (lex_ctxt * lexic)
+         {
+           struct in_addr src;
+           bzero (&src, sizeof (src));
++#if defined(__NetBSD__)
++          memcpy(&inaddr.s_addr, &dst->s6_addr[12], 4);
++#else
+           inaddr.s_addr = dst->s6_addr32[3];
++#endif
+           interface = routethrough (&inaddr, &src);
+         }
+       else
+@@ -1791,7 +1811,11 @@ nasl_send_capture (lex_ctxt * lexic)
+         {
+           struct in_addr src;
+           bzero (&src, sizeof (src));
++#if defined(__NetBSD__)
++          memcpy(&inaddr.s_addr, &dst->s6_addr[12], 4);
++#else
+           inaddr.s_addr = dst->s6_addr32[3];
++#endif
+           interface = routethrough (&inaddr, &src);
+         }
+       else
diff --git a/openvas-scanner/patches/patch-nasl_nasl__raw.h b/openvas-scanner/patches/patch-nasl_nasl__raw.h
new file mode 100644
index 0000000..f44a8eb
--- /dev/null
+++ b/openvas-scanner/patches/patch-nasl_nasl__raw.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+--- nasl/nasl_raw.h.orig	2015-08-03 10:14:31.000000000 +0000
++++ nasl/nasl_raw.h
+@@ -43,6 +43,11 @@
+ 
+ #include <netinet/tcp.h>
+ #include <netinet/udp.h>
++#if defined(__NetBSD__)
++#include <netinet/in_systm.h>
++#include <netinet/in.h>
++#include <netinet/ip.h>
++#endif
+ #include <netinet/ip_icmp.h>
+ 
+ #endif
diff --git a/openvas-scanner/patches/patch-nasl_nasl__socket.c b/openvas-scanner/patches/patch-nasl_nasl__socket.c
new file mode 100644
index 0000000..8a4c8a8
--- /dev/null
+++ b/openvas-scanner/patches/patch-nasl_nasl__socket.c
@@ -0,0 +1,28 @@
+$NetBSD$
+
+--- nasl/nasl_socket.c.orig	2016-07-22 06:15:35.000000000 +0000
++++ nasl/nasl_socket.c
+@@ -266,7 +266,11 @@ tryagain:
+   if (IN6_IS_ADDR_V4MAPPED (p))
+     {
+       bzero (&daddr, sizeof (daddr));
++#if defined(__NetBSD__)
++      memcpy(&daddr.sin_addr.s_addr, &p->s6_addr[12], 4);
++#else
+       daddr.sin_addr.s_addr = p->s6_addr32[3];
++#endif
+       daddr.sin_family = AF_INET;
+       daddr.sin_port = htons (dport);
+       unblock_socket (sock);
+@@ -504,7 +508,11 @@ nasl_open_sock_udp (lex_ctxt * lexic)
+   if (IN6_IS_ADDR_V4MAPPED (ia))
+     {
+       bzero (&soca, sizeof (soca));
++#if defined(__NetBSD__)
++      memcpy(&soca.sin_addr.s_addr, &ia->s6_addr[12], 4);
++#else
+       soca.sin_addr.s_addr = ia->s6_addr32[3];
++#endif
+       soca.sin_port = htons (port);
+       soca.sin_family = AF_INET;
+ 


Home | Main Index | Thread Index | Old Index