Jasper Lievisse Adriaanse <[email protected]> ha scritto:
>On Mon, Feb 10, 2014 at 12:26:24PM +0000, Stuart Henderson wrote:
>> On 2014/02/10 13:42, Vadim Zhukov wrote:
>> > We're under a lock and this didn't go in yet. I think it should,
>> > otherwise we'll ship totally broken nmap for i386 (and probably
>> > other 32-bit archs).
>> 
>> > There was a 6.40 update, too, but it's too late now.
>> 
>> I'd honestly prefer the update, it's been tested more as a whole than
>> 6.25 plus this patch. Diff below is the one sent around before with
>jca's
>> assertion fix for i386 added (that addition doesn't affect things on
>> amd64/macppc and fixes i386). Dependent ports seem OK in so far as
>I'm
>> able to test them, and this moves to internal pcap which removes a
>bunch
>> of suspect bpf_timeval patches. It does not fix the timing problem
>seen
>> by rgouveia (http://marc.info/?l=openbsd-ports&m=136881566332166) but
>> gets us onto code much closer to upstream's which should make it a
>lot
>> easier to get help with that.
>> 
>> What say anyone else?
>I think this full update plus assertion fix should go in as this has
>had wider testing.
>
>> Index: Makefile
>> ===================================================================
>> RCS file: /cvs/ports/net/nmap/Makefile,v
>> retrieving revision 1.109
>> diff -u -p -r1.109 Makefile
>> --- Makefile 23 Jan 2014 00:40:57 -0000      1.109
>> +++ Makefile 10 Feb 2014 12:01:05 -0000
>> @@ -3,10 +3,9 @@
>>  COMMENT-main=       scan ports and fingerprint stack of network hosts
>>  COMMENT-zenmap=     graphical frontend for nmap
>>  
>> -MODPY_EGG_VERSION=  6.25
>> +MODPY_EGG_VERSION=  6.40
>>  DISTNAME=           nmap-${MODPY_EGG_VERSION}
>>  PKGNAME-main=               ${DISTNAME}
>> -REVISION-main=              1
>>  PKGNAME-zenmap=             nmap-zenmap-${MODPY_EGG_VERSION}
>>  
>>  CATEGORIES= net security
>> @@ -22,18 +21,20 @@ PERMIT_PACKAGE_CDROM=    Yes
>>  
>>  MULTI_PACKAGES=     -main -zenmap
>>  
>> -USE_GMAKE=  yes
>> +USE_GMAKE=  Yes
>>  MODLUA_SA=  Yes
>> -MODLUA_VERSION=5.2
>> +MODLUA_VERSION=     5.2
>>  MODULES=    lang/python \
>> -                    lang/lua
>> +            lang/lua
>>  
>>  CONFIGURE_STYLE=gnu
>>  CONFIGURE_ENV=      CFLAGS="${CFLAGS} -I${LOCALBASE}/include" \
>> -            CPPFLAGS="${CPPFLAGS} -I${LOCALBASE}/include" \
>> +            CPPFLAGS="${CPPFLAGS} -I${LOCALBASE}/include 
>> -I${MODLUA_INCL_DIR}"
>\
>>              CXXFLAGS="${CXXFLAGS} -I${LOCALBASE}/include" \
>> -            LDFLAGS="${LDFLAGS} -L${LOCALBASE}/lib"
>> -CONFIGURE_ARGS=     --with-libpcap=/usr \
>> +            LDFLAGS="${LDFLAGS} -L${LOCALBASE}/lib -L${MODLUA_LIBDIR}"
>> +# XXX uses internal copy of libpcap, previous attempts to deal with
>the
>> +#     bpf_timeval changes in base libpcap have not been entirely
>successful
>> +CONFIGURE_ARGS=     --with-libpcap=included \
>>              --with-openssl=/usr \
>>              --with-liblua=${LOCALBASE} \
>>              --with-libpcre=${LOCALBASE} \
>> @@ -41,9 +42,9 @@ CONFIGURE_ARGS=    --with-libpcap=/usr \
>>              --without-nmap-update \
>>              --disable-nls
>>  
>> -WANTLIB-main=               c crypto m pcap ssl stdc++ pcre pthread
>${MODLUA_WANTLIB}
>> -LIB_DEPENDS-main=   devel/pcre \
>> -                    ${MODLUA_LIB_DEPENDS}
>> +WANTLIB-main=       c crypto m ssl stdc++ pcre pthread ${MODLUA_WANTLIB}
>> +LIB_DEPENDS-main=devel/pcre \
>> +            ${MODLUA_LIB_DEPENDS}
>>  
>>  RUN_DEPENDS-main=
>>  
>> @@ -55,7 +56,7 @@ RUN_DEPENDS-zenmap=        x11/py-gtk2 \
>>  NO_TEST=            Yes
>>  
>>  post-extract:
>> -    @cd ${WRKSRC} && rm -rf libpcap/ liblua/ libpcre/
>> +    @cd ${WRKSRC} && rm -rf liblua/ libpcre/
>>  
>>  pre-configure:
>>      ${SUBST_CMD} ${WRKSRC}/zenmap/install_scripts/unix/su-to-zenmap.sh
>\
>> Index: distinfo
>> ===================================================================
>> RCS file: /cvs/ports/net/nmap/distinfo,v
>> retrieving revision 1.27
>> diff -u -p -r1.27 distinfo
>> --- distinfo 19 Dec 2012 17:12:11 -0000      1.27
>> +++ distinfo 10 Feb 2014 12:01:05 -0000
>> @@ -1,2 +1,2 @@
>> -SHA256 (nmap-6.25.tgz) =
>QsVP1cxfBeXfkJdX1iMHECqP8d+vXCYmsctfLs0Anlc=
>> -SIZE (nmap-6.25.tgz) = 9374716
>> +SHA256 (nmap-6.40.tgz) =
>zri/0TgAZxlENol4fXGzMjsSZJH2q9odCg1/PU8De0s=
>> +SIZE (nmap-6.40.tgz) = 9638479
>> Index: patches/patch-FPEngine_cc
>> ===================================================================
>> RCS file: patches/patch-FPEngine_cc
>> diff -N patches/patch-FPEngine_cc
>> --- patches/patch-FPEngine_cc        19 Dec 2012 17:12:11 -0000      1.2
>> +++ /dev/null        1 Jan 1970 00:00:00 -0000
>> @@ -1,12 +0,0 @@
>> -$OpenBSD: patch-FPEngine_cc,v 1.2 2012/12/19 17:12:11 giovanni Exp $
>> ---- FPEngine.cc.orig        Wed Oct 31 18:00:55 2012
>> -+++ FPEngine.cc     Fri Nov 30 12:41:47 2012
>> -@@ -477,7 +477,7 @@ void
>FPNetworkControl::response_reception_handler(nsoc
>> -   enum nse_type type = nse_type(nse);
>> -   const u8 *rcvd_pkt = NULL;                    /* Points to the
>captured packet */
>> -   size_t rcvd_pkt_len = 0;                      /* Lenght of the
>captured packet */
>> --  struct timeval pcaptime;                    /* Time the packet
>was captured  */
>> -+  struct bpf_timeval pcaptime;                    /* Time the
>packet was captured  */
>> -   struct sockaddr_storage sent_ss;
>> -   struct sockaddr_storage rcvd_ss;
>> -   struct sockaddr_in *rcvd_ss4 = (struct sockaddr_in *)&rcvd_ss;
>> Index: patches/patch-NmapOps_cc
>> ===================================================================
>> RCS file: patches/patch-NmapOps_cc
>> diff -N patches/patch-NmapOps_cc
>> --- patches/patch-NmapOps_cc 16 Jul 2012 07:39:31 -0000      1.1
>> +++ /dev/null        1 Jan 1970 00:00:00 -0000
>> @@ -1,17 +0,0 @@
>> -$OpenBSD: patch-NmapOps_cc,v 1.1 2012/07/16 07:39:31 giovanni Exp $
>> ---- NmapOps.cc.orig Tue May  8 07:49:51 2012
>> -+++ NmapOps.cc      Fri May 25 14:45:19 2012
>> -@@ -197,11 +197,11 @@ void NmapOps::setSourceSockAddr(struct
>sockaddr_storag
>> - 
>> - // Number of seconds since getStartTime().  The current time is an
>> - // optional argument to avoid an extra gettimeofday() call.
>> --float NmapOps::TimeSinceStart(const struct timeval *now) {
>> -+float NmapOps::TimeSinceStart(const struct bpf_timeval *now) {
>> -   struct timeval tv;
>> -   if (!now)
>> -     gettimeofday(&tv, NULL);
>> --  else tv = *now;
>> -+  else tv = (timeval &)*now;
>> - 
>> -   return TIMEVAL_FSEC_SUBTRACT(tv, start_time);
>> - }
>> Index: patches/patch-NmapOps_h
>> ===================================================================
>> RCS file: patches/patch-NmapOps_h
>> diff -N patches/patch-NmapOps_h
>> --- patches/patch-NmapOps_h  16 Jul 2012 07:39:31 -0000      1.1
>> +++ /dev/null        1 Jan 1970 00:00:00 -0000
>> @@ -1,16 +0,0 @@
>> -$OpenBSD: patch-NmapOps_h,v 1.1 2012/07/16 07:39:31 giovanni Exp $
>> ---- NmapOps.h.orig  Tue May  8 07:49:51 2012
>> -+++ NmapOps.h       Fri May 25 12:39:10 2012
>> -@@ -117,10 +117,10 @@ class NmapOps {
>> -   void setSourceSockAddr(struct sockaddr_storage *ss, size_t
>ss_len);
>> - 
>> - // The time this obj. was instantiated   or last ReInit()ed.
>> --  const struct timeval *getStartTime() { return &start_time; }
>> -+  const struct bpf_timeval *getStartTime() { return (const
>bpf_timeval*)&start_time; }
>> -   // Number of seconds since getStartTime().  The current time is
>an
>> -   // optional argument to avoid an extra gettimeofday() call.
>> --  float TimeSinceStart(const struct timeval *now=NULL);
>> -+  float TimeSinceStart(const struct bpf_timeval *now=NULL);
>> - 
>> - 
>> - 
>> Index: patches/patch-configure
>> ===================================================================
>> RCS file: patches/patch-configure
>> diff -N patches/patch-configure
>> --- patches/patch-configure  19 Dec 2012 17:12:11 -0000      1.16
>> +++ /dev/null        1 Jan 1970 00:00:00 -0000
>> @@ -1,20 +0,0 @@
>> -$OpenBSD: patch-configure,v 1.16 2012/12/19 17:12:11 giovanni Exp $
>> ---- configure.orig  Fri Nov 16 01:54:16 2012
>> -+++ configure       Fri Nov 30 12:41:47 2012
>> -@@ -6311,6 +6311,7 @@ else
>> - extern char pcap_version[];
>> - int main() {
>> -   int major, minor1, minor2;
>> -+  exit(0); /* fool it, use our libpcap */
>> -   sscanf(pcap_version,"%d.%d.%d", &major, &minor1, &minor2);
>> -   if (major > 0)
>> -     return 0;
>> -@@ -6726,7 +6727,7 @@ if test "${with_liblua+set}" = set; then :
>> -     no_lua="yes"
>> -   ;;
>> -   *)
>> --    CPPFLAGS="-I$with_liblua/include $CPPFLAGS"
>> -+    CPPFLAGS="-I$with_liblua/include/lua-5.2 $CPPFLAGS"
>> -     LDFLAGS="-L$with_liblua/lib $LDFLAGS"
>> -   ;;
>> -   esac
>> Index: patches/patch-libdnet-stripped_src_intf_c
>> ===================================================================
>> RCS file: patches/patch-libdnet-stripped_src_intf_c
>> diff -N patches/patch-libdnet-stripped_src_intf_c
>> --- patches/patch-libdnet-stripped_src_intf_c        10 May 2013 12:27:45
>-0000  1.3
>> +++ /dev/null        1 Jan 1970 00:00:00 -0000
>> @@ -1,27 +0,0 @@
>> -$OpenBSD: patch-libdnet-stripped_src_intf_c,v 1.3 2013/05/10
>12:27:45 giovanni Exp $
>> ---- libdnet-stripped/src/intf.c.orig        Mon Sep 10 03:17:28 2012
>> -+++ libdnet-stripped/src/intf.c     Fri May 10 09:54:54 2013
>> -@@ -77,7 +77,13 @@
>> - /* XXX - superset of ifreq, for portable SIOC{A,D}IFADDR */
>> - struct dnet_ifaliasreq {
>> -    char            ifra_name[IFNAMSIZ];
>> --   struct sockaddr ifra_addr;
>> -+   union {
>> -+           struct sockaddr ifrau_addr;
>> -+           int             ifrau_align;
>> -+   } ifra_ifrau;
>> -+#ifndef ifra_addr
>> -+#define ifra_addr  ifra_ifrau.ifrau_addr
>> -+#endif
>> -    struct sockaddr ifra_brdaddr;
>> -    struct sockaddr ifra_mask;
>> -    int             ifra_cookie;    /* XXX - IRIX!@#$ */
>> -@@ -308,7 +314,7 @@ intf_set(intf_t *intf, const struct intf_entry
>*entry)
>> -    }
>> -    /* Set interface address. */
>> -    if (entry->intf_addr.addr_type == ADDR_TYPE_IP) {
>> --#ifdef BSD
>> -+#if defined(BSD) && !defined(__OpenBSD__)
>> -            /* XXX - why must this happen before SIOCSIFADDR? */
>> -            if (addr_btos(entry->intf_addr.addr_bits,
>> -                &ifr.ifr_addr) == 0) {
>> Index: patches/patch-libnetutil_netutil_cc
>> ===================================================================
>> RCS file: /cvs/ports/net/nmap/patches/patch-libnetutil_netutil_cc,v
>> retrieving revision 1.3
>> diff -u -p -r1.3 patch-libnetutil_netutil_cc
>> --- patches/patch-libnetutil_netutil_cc      19 Dec 2012 17:12:11
>-0000  1.3
>> +++ patches/patch-libnetutil_netutil_cc      10 Feb 2014 12:01:05 -0000
>> @@ -1,7 +1,13 @@
>>  $OpenBSD: patch-libnetutil_netutil_cc,v 1.3 2012/12/19 17:12:11
>giovanni Exp $
>> ---- libnetutil/netutil.cc.orig      Thu Oct 11 05:11:53 2012
>> -+++ libnetutil/netutil.cc   Fri Nov 30 12:41:47 2012
>> -@@ -3087,7 +3087,6 @@ static int route_dst_netlink(const struct
>sockaddr_sto
>> +
>> +chunks dealing with DLT_LINUX_SLL are to cope with non-bundled
>libpcap (not
>> +currently used). should probably be #ifdef DLT_LINUX_SLL and go
>upstream?
>> +
>> +chunks dealing with iovec: ???
>> +
>> +--- libnetutil/netutil.cc.orig      Mon Jul 29 00:08:48 2013
>> ++++ libnetutil/netutil.cc   Wed Oct 16 22:00:54 2013
>> +@@ -3124,7 +3124,6 @@ static int route_dst_netlink(const struct
>sockaddr_sto
>>                                const struct sockaddr_storage
>*spoofss) {
>>     struct sockaddr_nl snl;
>>     struct msghdr msg;
>> @@ -9,8 +15,8 @@ $OpenBSD: patch-libnetutil_netutil_cc,v 
>>     struct nlmsghdr *nlmsg;
>>     struct rtmsg *rtmsg;
>>     struct rtattr *rtattr;
>> -@@ -3128,22 +3127,14 @@ static int route_dst_netlink(const struct
>sockaddr_sto
>> -     add_rtattr_addr(nlmsg, &rtattr, &len, RTA_SRC, spoofss);
>> +@@ -3176,22 +3175,14 @@ static int route_dst_netlink(const struct
>sockaddr_sto
>> +     add_rtattr_addr(nlmsg, &rtattr, &len, RTA_SRC, spoofss,
>intf_index);
>>     }
>>   
>>  -  iov.iov_base = nlmsg;
>> @@ -32,7 +38,7 @@ $OpenBSD: patch-libnetutil_netutil_cc,v 
>>     len = recvmsg(fd, &msg, 0);
>>     if (len <= 0)
>>       netutil_fatal("%s: cannot recvmsg: %s", __func__,
>strerror(errno));
>> -@@ -3769,7 +3760,6 @@ static const unsigned char
>*add_exthdr_ancillary(struc
>> +@@ -3822,7 +3813,6 @@ static const unsigned char
>*add_exthdr_ancillary(struc
>>   static int send_ipv6_ip(const struct sockaddr_in6 *dst,
>>     const unsigned char *packet, size_t packetlen) {
>>     struct msghdr msg;
>> @@ -40,7 +46,7 @@ $OpenBSD: patch-libnetutil_netutil_cc,v 
>>   
>>     const unsigned char *end;
>>     struct ip6_hdr *hdr;
>> -@@ -3785,8 +3775,6 @@ static int send_ipv6_ip(const struct
>sockaddr_in6 *dst
>> +@@ -3838,8 +3828,6 @@ static int send_ipv6_ip(const struct
>sockaddr_in6 *dst
>>     /* Set up sendmsg data structure. iov is filled in below. */
>>     msg.msg_name = (void *) dst;
>>     msg.msg_namelen = sizeof(*dst);
>> @@ -49,7 +55,7 @@ $OpenBSD: patch-libnetutil_netutil_cc,v 
>>     msg.msg_control = NULL;
>>     msg.msg_controllen = 0;
>>     msg.msg_flags = 0;
>> -@@ -3845,8 +3833,6 @@ static int send_ipv6_ip(const struct
>sockaddr_in6 *dst
>> +@@ -3898,8 +3886,6 @@ static int send_ipv6_ip(const struct
>sockaddr_in6 *dst
>>     }
>>   
>>     assert(packet <= end);
>> @@ -58,7 +64,7 @@ $OpenBSD: patch-libnetutil_netutil_cc,v 
>>   
>>     n = sendmsg(sd, &msg, 0);
>>     if (n == -1)
>> -@@ -4015,9 +4001,6 @@ int datalink_offset(int datalink)
>> +@@ -4068,9 +4054,6 @@ int datalink_offset(int datalink)
>>   {
>>     if (datalink == DLT_EN10MB)
>>       return ETH_HDR_LEN;
>> @@ -68,7 +74,7 @@ $OpenBSD: patch-libnetutil_netutil_cc,v 
>>     else
>>       return -1;
>>   }
>> -@@ -4054,7 +4037,7 @@ static int read_reply_pcap(pcap_t *pd, long
>to_usec,
>> +@@ -4107,7 +4090,7 @@ static int read_reply_pcap(pcap_t *pd, long
>to_usec,
>>       netutil_fatal("Cannot obtain datalink information: %s",
>pcap_geterr(pd));
>>     ioffset = datalink_offset(*datalink);
>>     if (ioffset < 0)
>> @@ -77,7 +83,7 @@ $OpenBSD: patch-libnetutil_netutil_cc,v 
>>     *offset = (unsigned int) ioffset;
>>   
>>     if (to_usec > 0) {
>> -@@ -4154,10 +4137,6 @@ static bool accept_arp(const unsigned char
>*p, const s
>> +@@ -4207,10 +4190,6 @@ static bool accept_arp(const unsigned char
>*p, const s
>>   
>>     if (datalink == DLT_EN10MB) {
>>       return ntohs(*((u16 *) (p + 12))) == ETH_TYPE_ARP;
>> Index: patches/patch-ncat_ncat_core_c
>> ===================================================================
>> RCS file: patches/patch-ncat_ncat_core_c
>> diff -N patches/patch-ncat_ncat_core_c
>> --- patches/patch-ncat_ncat_core_c   19 Dec 2012 17:12:11 -0000      1.2
>> +++ /dev/null        1 Jan 1970 00:00:00 -0000
>> @@ -1,12 +0,0 @@
>> -$OpenBSD: patch-ncat_ncat_core_c,v 1.2 2012/12/19 17:12:11 giovanni
>Exp $
>> ---- ncat/ncat_core.c.orig   Tue Nov 13 09:40:49 2012
>> -+++ ncat/ncat_core.c        Fri Nov 30 12:41:47 2012
>> -@@ -127,7 +127,7 @@ union sockaddr_u socksconnect;
>> - struct options o;
>> - 
>> - /* The time the program was started, for exit statistics in connect
>mode. */
>> --struct timeval start_time;
>> -+struct bpf_timeval start_time;
>> - 
>> - /* Initializes global options to their default values. */
>> - void options_init(void)
>> Index: patches/patch-ncat_ncat_core_h
>> ===================================================================
>> RCS file: patches/patch-ncat_ncat_core_h
>> diff -N patches/patch-ncat_ncat_core_h
>> --- patches/patch-ncat_ncat_core_h   19 Dec 2012 17:12:11 -0000      1.2
>> +++ /dev/null        1 Jan 1970 00:00:00 -0000
>> @@ -1,12 +0,0 @@
>> -$OpenBSD: patch-ncat_ncat_core_h,v 1.2 2012/12/19 17:12:11 giovanni
>Exp $
>> ---- ncat/ncat_core.h.orig   Tue Nov 13 09:40:49 2012
>> -+++ ncat/ncat_core.h        Fri Nov 30 12:41:47 2012
>> -@@ -168,7 +168,7 @@ struct options {
>> - extern struct options o;
>> - 
>> - /* The time the program was started, for exit statistics in connect
>mode. */
>> --extern struct timeval start_time;
>> -+extern struct bpf_timeval start_time;
>> - 
>> - /* Initializes global options to their default values. */
>> - void options_init(void);
>> Index: patches/patch-nmap_tty_cc
>> ===================================================================
>> RCS file: patches/patch-nmap_tty_cc
>> diff -N patches/patch-nmap_tty_cc
>> --- patches/patch-nmap_tty_cc        16 Jul 2012 07:39:31 -0000      1.1
>> +++ /dev/null        1 Jan 1970 00:00:00 -0000
>> @@ -1,12 +0,0 @@
>> -$OpenBSD: patch-nmap_tty_cc,v 1.1 2012/07/16 07:39:31 giovanni Exp $
>> ---- nmap_tty.cc.orig        Fri May 25 15:11:33 2012
>> -+++ nmap_tty.cc     Fri May 25 15:13:22 2012
>> -@@ -290,7 +290,7 @@ bool keyWasPressed()
>> -     gettimeofday(&now, NULL);
>> -     if (stats_time.tv_sec == 0) {
>> -       /* Initialize the scheduled stats time. */
>> --      stats_time = *o.getStartTime();
>> -+      stats_time = (const timeval&)*o.getStartTime();
>> -       TIMEVAL_ADD(stats_time, stats_time, (time_t)
>(o.stats_interval * 1000000));
>> -     }
>> - 
>> Index: patches/patch-nping_EchoServer_cc
>> ===================================================================
>> RCS file: patches/patch-nping_EchoServer_cc
>> diff -N patches/patch-nping_EchoServer_cc
>> --- patches/patch-nping_EchoServer_cc        16 Jul 2012 07:39:31 -0000      
>> 1.3
>> +++ /dev/null        1 Jan 1970 00:00:00 -0000
>> @@ -1,24 +0,0 @@
>> -$OpenBSD: patch-nping_EchoServer_cc,v 1.3 2012/07/16 07:39:31
>giovanni Exp $
>> ---- nping/EchoServer.cc.orig        Thu Mar  1 07:53:35 2012
>> -+++ nping/EchoServer.cc     Wed Jul 11 15:20:46 2012
>> -@@ -840,7 +840,7 @@ int EchoServer::nep_capture_handler(nsock_pool
>nsp, ns
>> -   const unsigned char *packet=NULL;
>> -   const unsigned char *link=NULL;
>> -   nsock_iod nsi = nse_iod(nse);
>> --  struct timeval pcaptime;
>> -+  struct bpf_timeval pcaptime;
>> -   nsock_iod clnt_iod=NULL;
>> -   NEPContext *ctx=NULL;
>> -   EchoHeader pkt_out;
>> -@@ -1421,9 +1421,9 @@ int EchoServer::start() {
>> -   /* Set nsock trace level */
>> -   gettimeofday(&now, NULL);
>> -   if( o.getDebugging() == DBG_5)
>> --    nsp_settrace(nsp, NULL, 1 , &now);
>> -+    nsp_settrace(nsp, NULL, 1 , (const bpf_timeval*)&now);
>> -   else if( o.getDebugging() > DBG_5 )
>> --    nsp_settrace(nsp, NULL, 10 , &now);
>> -+    nsp_settrace(nsp, NULL, 10 , (const bpf_timeval*)&now);
>> - 
>> -   /* Create new IOD for pcap */
>> -   if ((pcap_nsi = nsi_new(nsp, NULL)) == NULL)
>> Index: patches/patch-nping_Makefile_in
>> ===================================================================
>> RCS file: patches/patch-nping_Makefile_in
>> diff -N patches/patch-nping_Makefile_in
>> --- patches/patch-nping_Makefile_in  16 Jul 2012 07:39:31 -0000      1.2
>> +++ /dev/null        1 Jan 1970 00:00:00 -0000
>> @@ -1,12 +0,0 @@
>> -$OpenBSD: patch-nping_Makefile_in,v 1.2 2012/07/16 07:39:31 giovanni
>Exp $
>> ---- nping/Makefile.in.orig  Mon Sep 19 20:33:22 2011
>> -+++ nping/Makefile.in       Fri May 25 15:28:20 2012
>> -@@ -48,7 +48,7 @@ export CFLAGS = $(CXXFLAGS)
>> - STATIC =
>> - LDFLAGS = @LDFLAGS@ $(DBGFLAGS) $(STATIC)
>> - OPENSSL_LIBS = @OPENSSL_LIBS@
>> --LIBS =  $(NBASEDIR)/libnbase.a $(NSOCKDIR)/src/libnsock.a
>../libnetutil/libnetutil.a $(OPENSSL_LIBS) @LIBPCAP_LIBS@
>@LIBDNET_LIBS@ @LIBS@
>> -+LIBS =  $(NBASEDIR)/libnbase.a $(NSOCKDIR)/src/libnsock.a
>../libnetutil/libnetutil.a $(OPENSSL_LIBS) @LIBDNET_LIBS@ @LIBS@ -lpcap
>-lpthread
>> - # LIBS =  -lefence @LIBS@
>> - # LIBS =  -lrmalloc @LIBS@
>> - INSTALL = @INSTALL@
>> Index: patches/patch-nping_ProbeMode_cc
>> ===================================================================
>> RCS file: patches/patch-nping_ProbeMode_cc
>> diff -N patches/patch-nping_ProbeMode_cc
>> --- patches/patch-nping_ProbeMode_cc 19 Dec 2012 17:12:11 -0000      1.3
>> +++ /dev/null        1 Jan 1970 00:00:00 -0000
>> @@ -1,26 +0,0 @@
>> -$OpenBSD: patch-nping_ProbeMode_cc,v 1.3 2012/12/19 17:12:11
>giovanni Exp $
>> ---- nping/ProbeMode.cc.orig Wed Oct  3 17:43:18 2012
>> -+++ nping/ProbeMode.cc      Fri Nov 30 12:41:48 2012
>> -@@ -130,9 +130,9 @@ int ProbeMode::init_nsock(){
>> -       /* Set nsock trace level */
>> -       gettimeofday(&now, NULL);
>> -       if( o.getDebugging() == DBG_5)
>> --        nsp_settrace(nsp, NULL, 1 , &now);
>> -+        nsp_settrace(nsp, NULL, 1 , (const bpf_timeval*)&now);
>> -       else if( o.getDebugging() > DBG_5 )
>> --        nsp_settrace(nsp, NULL, 10 , &now);
>> -+        nsp_settrace(nsp, NULL, 10 , (const bpf_timeval*)&now);
>> -       /* Flag it as already inited so we don't do it again */
>> -       nsock_init=true;
>> -   }
>> -@@ -1521,8 +1521,8 @@ void
>ProbeMode::probe_nping_event_handler(nsock_pool n
>> -  u16 *ethtype=NULL;
>> -  u8 buffer[512+1];
>> -  size_t link_offset=0;
>> -- static struct timeval pcaptime;
>> -- static struct timeval prevtime;
>> -+ static struct bpf_timeval pcaptime;
>> -+ static struct bpf_timeval prevtime;
>> -  NpingTarget *trg=NULL;
>> -  u16 *prt=NULL;
>> -  u8 proto=0;
>> Index: patches/patch-nse_nsock_cc
>> ===================================================================
>> RCS file: patches/patch-nse_nsock_cc
>> diff -N patches/patch-nse_nsock_cc
>> --- patches/patch-nse_nsock_cc       19 Dec 2012 17:12:11 -0000      1.3
>> +++ /dev/null        1 Jan 1970 00:00:00 -0000
>> @@ -1,12 +0,0 @@
>> -$OpenBSD: patch-nse_nsock_cc,v 1.3 2012/12/19 17:12:11 giovanni Exp
>$
>> ---- nse_nsock.cc.orig       Thu Nov 29 04:19:52 2012
>> -+++ nse_nsock.cc    Fri Nov 30 12:41:48 2012
>> -@@ -982,7 +982,7 @@ static void pcap_receive_handler (nsock_pool
>nsp, nsoc
>> -   {
>> -     const unsigned char *l2_data, *l3_data;
>> -     size_t l2_len, l3_len, packet_len;
>> --    struct timeval tv;
>> -+    struct bpf_timeval tv;
>> - 
>> -     nse_readpcap(nse, &l2_data, &l2_len, &l3_data, &l3_len,
>&packet_len, &tv);
>> - 
>> Index: patches/patch-nsock_include_nsock_h
>> ===================================================================
>> RCS file: patches/patch-nsock_include_nsock_h
>> diff -N patches/patch-nsock_include_nsock_h
>> --- patches/patch-nsock_include_nsock_h      19 Dec 2012 17:12:11
>-0000  1.8
>> +++ /dev/null        1 Jan 1970 00:00:00 -0000
>> @@ -1,39 +0,0 @@
>> -$OpenBSD: patch-nsock_include_nsock_h,v 1.8 2012/12/19 17:12:11
>giovanni Exp $
>> ---- nsock/include/nsock.h.orig      Mon Nov 12 21:44:37 2012
>> -+++ nsock/include/nsock.h   Fri Nov 30 12:41:48 2012
>> -@@ -90,6 +90,8 @@
>> - extern "C" {
>> - #endif
>> - 
>> -+#include <pcap.h>
>> -+
>> - /* The read calls will generally return after reading at least this
>> -  * much data so that the caller can process it and so that the
>> -  * connection spewing data doesn't monopolize resources.  The
>caller
>> -@@ -186,7 +188,7 @@ void *nsp_getud(nsock_pool nsp);
>> -  * everything.  The basetime can be NULL to print trace lines with
>the current
>> -  * time, otherwise the difference between the current time and
>basetime will be
>> -  * used (the time program execution starts would be a good
>candidate) */
>> --void nsp_settrace(nsock_pool nsp, FILE *file, int level, const
>struct timeval *basetime);
>> -+void nsp_settrace(nsock_pool nsp, FILE *file, int level, const
>struct bpf_timeval *basetime);
>> - 
>> - /* Turns on or off broadcast support on new sockets. Default is off
>(0, false)
>> -  * set in nsp_new(). Any non-zero (true) value sets SO_BROADCAST on
>all new
>> -@@ -550,7 +552,7 @@ int nsock_event_cancel(nsock_pool ms_pool,
>nsock_event
>> -  * avoid a system call, but in many circumstances it is better to
>use nsock's
>> -  * time rather than the system time.  If nsock has never obtained
>the time when
>> -  * you call it, it will do so before returning */
>> --const struct timeval *nsock_gettimeofday();
>> -+const struct bpf_timeval *nsock_gettimeofday();
>> - 
>> - 
>> - #ifdef HAVE_PCAP
>> -@@ -581,7 +583,7 @@ nsock_event_id nsock_pcap_read_packet(nsock_pool
>nsp, 
>> -  * think that host is a bit further.
>> -  * */
>> - void nse_readpcap(nsock_event nsee, const unsigned char **l2_data,
>size_t *l2_len, const unsigned char **l3_data, size_t *l3_len,
>> --                  size_t *packet_len, struct timeval *ts);
>> -+                  size_t *packet_len, struct bpf_timeval *ts);
>> - 
>> - /* Well. Just pcap-style datalink. Like DLT_EN10MB or DLT_SLIP.
>Check in pcap(3) manpage. */
>> - int nsi_pcap_linktype(nsock_iod nsiod);
>> Index: patches/patch-nsock_src_nsock_core_c
>> ===================================================================
>> RCS file: patches/patch-nsock_src_nsock_core_c
>> diff -N patches/patch-nsock_src_nsock_core_c
>> --- patches/patch-nsock_src_nsock_core_c     19 Dec 2012 17:12:11
>-0000  1.2
>> +++ /dev/null        1 Jan 1970 00:00:00 -0000
>> @@ -1,12 +0,0 @@
>> -$OpenBSD: patch-nsock_src_nsock_core_c,v 1.2 2012/12/19 17:12:11
>giovanni Exp $
>> ---- nsock/src/nsock_core.c.orig     Thu Nov 29 04:19:52 2012
>> -+++ nsock/src/nsock_core.c  Fri Nov 30 12:41:48 2012
>> -@@ -1130,7 +1130,7 @@ void nsock_loop_quit(nsock_pool nsp) {
>> -  * avoid a system call, but in many circumstances it is better to
>use nsock's
>> -  * time rather than the system time.  If nsock has never obtained
>the time when
>> -  * you call it, it will do so before returning */
>> --const struct timeval *nsock_gettimeofday() {
>> -+const struct bpf_timeval *nsock_gettimeofday() {
>> -   if (nsock_tod.tv_sec == 0)
>> -     gettimeofday(&nsock_tod, NULL);
>> -   return &nsock_tod;
>> Index: patches/patch-nsock_src_nsock_internal_h
>> ===================================================================
>> RCS file: patches/patch-nsock_src_nsock_internal_h
>> diff -N patches/patch-nsock_src_nsock_internal_h
>> --- patches/patch-nsock_src_nsock_internal_h 19 Dec 2012 17:12:11
>-0000  1.2
>> +++ /dev/null        1 Jan 1970 00:00:00 -0000
>> @@ -1,12 +0,0 @@
>> -$OpenBSD: patch-nsock_src_nsock_internal_h,v 1.2 2012/12/19 17:12:11
>giovanni Exp $
>> ---- nsock/src/nsock_internal.h.orig Mon Nov 12 21:44:37 2012
>> -+++ nsock/src/nsock_internal.h      Fri Nov 30 12:41:48 2012
>> -@@ -203,7 +203,7 @@ typedef struct {
>> -   int tracelevel;
>> -   FILE *tracefile;
>> -   /* This time is subtracted from the current time for trace
>reports */
>> --  struct timeval tracebasetime;
>> -+  struct bpf_timeval tracebasetime;
>> - 
>> -   /* If true, new sockets will have SO_BROADCAST set */
>> -   int broadcast;
>> Index: patches/patch-nsock_src_nsock_pcap_c
>> ===================================================================
>> RCS file: patches/patch-nsock_src_nsock_pcap_c
>> diff -N patches/patch-nsock_src_nsock_pcap_c
>> --- patches/patch-nsock_src_nsock_pcap_c     16 Jul 2012 07:39:31
>-0000  1.5
>> +++ /dev/null        1 Jan 1970 00:00:00 -0000
>> @@ -1,30 +0,0 @@
>> -$OpenBSD: patch-nsock_src_nsock_pcap_c,v 1.5 2012/07/16 07:39:31
>giovanni Exp $
>> ---- nsock/src/nsock_pcap.c.orig     Thu Mar  1 07:32:23 2012
>> -+++ nsock/src/nsock_pcap.c  Fri May 25 09:38:27 2012
>> -@@ -76,7 +76,7 @@
>> - 
>> - #include "nsock_pcap.h"
>> - 
>> --extern struct timeval nsock_tod;
>> -+extern struct bpf_timeval nsock_tod;
>> - 
>> - #if HAVE_PCAP
>> - static int nsock_pcap_get_l3_offset(pcap_t *pt, int *dl);
>> -@@ -375,7 +375,7 @@ int do_actual_pcap_read(msevent *nse) {
>> -       npp.ts     = pkt_header->ts;
>> -       #else
>> -       /* on these platforms time received from pcap is invalid.
>It's better to set current time */
>> --      memcpy(&npp.ts, nsock_gettimeofday(), sizeof(struct
>timeval));
>> -+      memcpy(&npp.ts, nsock_gettimeofday(), sizeof(struct
>bpf_timeval));
>> -       #endif
>> -       npp.len    = pkt_header->len;
>> -       npp.caplen = pkt_header->caplen;
>> -@@ -406,7 +406,7 @@ int do_actual_pcap_read(msevent *nse) {
>> - }
>> - 
>> - void nse_readpcap(nsock_event nsee, const unsigned char **l2_data,
>size_t *l2_len,
>> --                  const unsigned char **l3_data, size_t *l3_len,
>size_t *packet_len, struct timeval *ts) {
>> -+                  const unsigned char **l3_data, size_t *l3_len,
>size_t *packet_len, struct bpf_timeval *ts) {
>> -   msevent *nse = (msevent *)nsee;
>> -   msiod  *iod = nse->iod;
>> -   mspcap *mp = (mspcap *)iod->pcap;
>> Index: patches/patch-nsock_src_nsock_pcap_h
>> ===================================================================
>> RCS file: patches/patch-nsock_src_nsock_pcap_h
>> diff -N patches/patch-nsock_src_nsock_pcap_h
>> --- patches/patch-nsock_src_nsock_pcap_h     16 Jul 2012 07:39:31
>-0000  1.5
>> +++ /dev/null        1 Jan 1970 00:00:00 -0000
>> @@ -1,12 +0,0 @@
>> -$OpenBSD: patch-nsock_src_nsock_pcap_h,v 1.5 2012/07/16 07:39:31
>giovanni Exp $
>> ---- nsock/src/nsock_pcap.h.orig     Sat Apr  7 10:16:08 2012
>> -+++ nsock/src/nsock_pcap.h  Fri May 25 09:38:57 2012
>> -@@ -137,7 +137,7 @@ typedef struct{
>> - } mspcap;
>> - 
>> - typedef struct{
>> --  struct timeval ts;
>> -+  struct bpf_timeval ts;
>> -   int caplen;
>> -   int len;
>> -   const unsigned char *packet;  /* caplen bytes */
>> Index: patches/patch-nsock_src_nsock_pool_c
>> ===================================================================
>> RCS file: patches/patch-nsock_src_nsock_pool_c
>> diff -N patches/patch-nsock_src_nsock_pool_c
>> --- patches/patch-nsock_src_nsock_pool_c     16 Jul 2012 07:39:31
>-0000  1.1
>> +++ /dev/null        1 Jan 1970 00:00:00 -0000
>> @@ -1,21 +0,0 @@
>> -$OpenBSD: patch-nsock_src_nsock_pool_c,v 1.1 2012/07/16 07:39:31
>giovanni Exp $
>> ---- nsock/src/nsock_pool.c.orig     Fri May 25 10:21:45 2012
>> -+++ nsock/src/nsock_pool.c  Fri May 25 10:22:23 2012
>> -@@ -123,7 +123,7 @@ void *nsp_getud(nsock_pool nsp) {
>> -  * everything.  The basetime can be NULL to print trace lines with
>the current
>> -  * time, otherwise the difference between the current time and
>basetime will be
>> -  * used (the time program execution starts would be a good
>candidate) */
>> --void nsp_settrace(nsock_pool nsp, FILE *file, int level, const
>struct timeval *basetime) {
>> -+void nsp_settrace(nsock_pool nsp, FILE *file, int level, const
>struct bpf_timeval *basetime) {
>> -   mspool *mt = (mspool *)nsp;
>> - 
>> -   if (file == NULL)
>> -@@ -134,7 +134,7 @@ void nsp_settrace(nsock_pool nsp, FILE *file,
>int leve
>> -   mt->tracelevel = level;
>> - 
>> -   if (!basetime)
>> --    memset(&mt->tracebasetime, 0, sizeof(struct timeval));
>> -+    memset(&mt->tracebasetime, 0, sizeof(struct bpf_timeval));
>> -   else
>> -     mt->tracebasetime = *basetime;
>> - }
>> Index: patches/patch-osscan2_cc
>> ===================================================================
>> RCS file: patches/patch-osscan2_cc
>> diff -N patches/patch-osscan2_cc
>> --- /dev/null        1 Jan 1970 00:00:00 -0000
>> +++ patches/patch-osscan2_cc 10 Feb 2014 12:01:05 -0000
>> @@ -0,0 +1,17 @@
>> +$OpenBSD$
>> +
>> +Format changes for 64-bit time_t, should go upstream
>> +
>> +--- osscan2.cc.orig Mon Jul 29 00:08:48 2013
>> ++++ osscan2.cc      Thu Jan  9 11:58:50 2014
>> +@@ -2460,8 +2460,8 @@ void HostOsScan::makeTSeqFP(HostOsScanStats
>*hss) {
>> +     if (lastboot != 0.0 && (hss->seq_send_times[0].tv_sec -
>lastboot > 63072000)) {
>> +       /* Up 2 years?  Perhaps, but they're probably lying. */
>> +       if (o.debugging) {
>> +-        log_write(LOG_STDOUT, "Ignoring claimed %s uptime of %lu
>days\n",
>> +-        hss->target->targetipstr(), (hss->seq_send_times[0].tv_sec
>- hss->si.lastboot) / 86400);
>> ++        log_write(LOG_STDOUT, "Ignoring claimed %s uptime of %lld
>days\n",
>> ++        hss->target->targetipstr(), (long long)
>((hss->seq_send_times[0].tv_sec - hss->si.lastboot) / 86400));
>> +       }
>> +       lastboot = 0;
>> +     }
>> Index: patches/patch-output_cc
>> ===================================================================
>> RCS file: patches/patch-output_cc
>> diff -N patches/patch-output_cc
>> --- patches/patch-output_cc  19 Dec 2012 17:12:11 -0000      1.2
>> +++ /dev/null        1 Jan 1970 00:00:00 -0000
>> @@ -1,46 +0,0 @@
>> -$OpenBSD: patch-output_cc,v 1.2 2012/12/19 17:12:11 giovanni Exp $
>> ---- output.cc.orig  Thu Nov 29 04:19:52 2012
>> -+++ output.cc       Fri Nov 30 12:41:48 2012
>> -@@ -2411,7 +2411,7 @@ void printStatusMessage() {
>> -   // Pre-computations
>> -   struct timeval tv;
>> -   gettimeofday(&tv, NULL);
>> --  int time = (int) (o.TimeSinceStart(&tv));
>> -+  int time = (int) (o.TimeSinceStart((const bpf_timeval*)&tv));
>> - 
>> -   log_write(LOG_STDOUT, "Stats: %d:%02d:%02d elapsed; %d hosts
>completed (%d up), %d undergoing %s\n",
>> -             time / 60 / 60, time / 60 % 60, time % 60,
>o.numhosts_scanned,
>> -@@ -2431,13 +2431,13 @@ void print_xml_finished_open(time_t timep,
>const struc
>> -   xml_open_start_tag("finished");
>> -   xml_attribute("time", "%lu", (unsigned long) timep);
>> -   xml_attribute("timestr", "%s", mytime);
>> --  xml_attribute("elapsed", "%.2f", o.TimeSinceStart(tv));
>> -+  xml_attribute("elapsed", "%.2f", o.TimeSinceStart((const
>bpf_timeval*)&tv));
>> -   xml_attribute("summary",
>> -     "Nmap done at %s; %d %s (%d %s up) scanned in %.2f seconds",
>> -     mytime, o.numhosts_scanned,
>> -     (o.numhosts_scanned == 1) ? "IP address" : "IP addresses",
>> -     o.numhosts_up, (o.numhosts_up == 1) ? "host" : "hosts",
>> --    o.TimeSinceStart(tv));
>> -+    o.TimeSinceStart((const bpf_timeval*)&tv));
>> - }
>> - 
>> - void print_xml_hosts() {
>> -@@ -2482,7 +2482,7 @@ void printfinaloutput() {
>> -             o.numhosts_scanned,
>> -             (o.numhosts_scanned == 1) ? "IP address" : "IP
>addresses",
>> -             o.numhosts_up, (o.numhosts_up == 1) ? "host" : "hosts",
>> --            o.TimeSinceStart(&tv));
>> -+            o.TimeSinceS

Ok for me as well, I have used 6.40 for some time without any issues.
  Cheers
     Giovanni
  

Reply via email to