Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/libpcap merge conflicts



details:   https://anonhg.NetBSD.org/src/rev/7187d813f3db
branches:  trunk
changeset: 845401:7187d813f3db
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Oct 01 16:02:11 2019 +0000

description:
merge conflicts

diffstat:

 external/bsd/libpcap/bin/Makefile                            |     6 +-
 external/bsd/libpcap/dist/bpf_filter.c                       |    19 +-
 external/bsd/libpcap/dist/bpf_image.c                        |     4 +-
 external/bsd/libpcap/dist/doc/README.Win32                   |    46 -
 external/bsd/libpcap/dist/gencode.c                          |  1941 ++++++---
 external/bsd/libpcap/dist/gencode.h                          |    57 +-
 external/bsd/libpcap/dist/grammar.y                          |   316 +-
 external/bsd/libpcap/dist/nametoaddr.c                       |    21 +-
 external/bsd/libpcap/dist/optimize.c                         |   320 +-
 external/bsd/libpcap/dist/pcap-bpf.c                         |   108 +-
 external/bsd/libpcap/dist/pcap-bt-linux.c                    |    19 +-
 external/bsd/libpcap/dist/pcap-bt-monitor-linux.c            |     7 +-
 external/bsd/libpcap/dist/pcap-common.c                      |    80 +-
 external/bsd/libpcap/dist/pcap-dag.c                         |    71 +-
 external/bsd/libpcap/dist/pcap-dlpi.c                        |    18 +-
 external/bsd/libpcap/dist/pcap-dos.c                         |     6 +-
 external/bsd/libpcap/dist/pcap-int.h                         |    40 +-
 external/bsd/libpcap/dist/pcap-libdlpi.c                     |     6 +-
 external/bsd/libpcap/dist/pcap-linux.c                       |   819 +++-
 external/bsd/libpcap/dist/pcap-netfilter-linux.c             |     8 +-
 external/bsd/libpcap/dist/pcap-null.c                        |    10 +-
 external/bsd/libpcap/dist/pcap-septel.c                      |    15 +-
 external/bsd/libpcap/dist/pcap-sita.c                        |     6 +-
 external/bsd/libpcap/dist/pcap-snf.c                         |     8 +-
 external/bsd/libpcap/dist/pcap-usb-linux.c                   |   277 +-
 external/bsd/libpcap/dist/pcap.3pcap.in                      |    43 +-
 external/bsd/libpcap/dist/pcap.c                             |   400 +-
 external/bsd/libpcap/dist/pcap/bpf.h                         |    13 +-
 external/bsd/libpcap/dist/pcap/pcap.h                        |    53 +-
 external/bsd/libpcap/dist/pcap/sll.h                         |    42 +-
 external/bsd/libpcap/dist/pcap_activate.3pcap                |    10 +-
 external/bsd/libpcap/dist/pcap_breakloop.3pcap               |    25 +-
 external/bsd/libpcap/dist/pcap_can_set_rfmon.3pcap           |     8 +-
 external/bsd/libpcap/dist/pcap_create.3pcap                  |     6 +-
 external/bsd/libpcap/dist/pcap_datalink_name_to_val.3pcap    |     8 +-
 external/bsd/libpcap/dist/pcap_datalink_val_to_name.3pcap    |    16 +-
 external/bsd/libpcap/dist/pcap_dump.3pcap                    |    11 +-
 external/bsd/libpcap/dist/pcap_dump_file.3pcap               |     4 +-
 external/bsd/libpcap/dist/pcap_dump_flush.3pcap              |    12 +-
 external/bsd/libpcap/dist/pcap_dump_ftell.3pcap              |    17 +-
 external/bsd/libpcap/dist/pcap_dump_open.3pcap.in            |    33 +-
 external/bsd/libpcap/dist/pcap_file.3pcap                    |    18 +-
 external/bsd/libpcap/dist/pcap_fileno.3pcap                  |    23 +-
 external/bsd/libpcap/dist/pcap_findalldevs.3pcap             |    39 +-
 external/bsd/libpcap/dist/pcap_freecode.3pcap                |     8 +-
 external/bsd/libpcap/dist/pcap_get_selectable_fd.3pcap       |    44 +-
 external/bsd/libpcap/dist/pcap_inject.3pcap                  |    24 +-
 external/bsd/libpcap/dist/pcap_is_swapped.3pcap              |     6 +-
 external/bsd/libpcap/dist/pcap_lookupdev.3pcap               |    13 +-
 external/bsd/libpcap/dist/pcap_lookupnet.3pcap               |    11 +-
 external/bsd/libpcap/dist/pcap_loop.3pcap                    |    39 +-
 external/bsd/libpcap/dist/pcap_next_ex.3pcap                 |    28 +-
 external/bsd/libpcap/dist/pcap_offline_filter.3pcap          |     6 +-
 external/bsd/libpcap/dist/pcap_open_live.3pcap               |     4 +-
 external/bsd/libpcap/dist/pcap_open_offline.3pcap.in         |     9 +-
 external/bsd/libpcap/dist/pcap_set_datalink.3pcap            |    18 +-
 external/bsd/libpcap/dist/pcap_set_immediate_mode.3pcap      |    49 -
 external/bsd/libpcap/dist/pcap_set_timeout.3pcap             |     4 +-
 external/bsd/libpcap/dist/pcap_setdirection.3pcap            |    17 +-
 external/bsd/libpcap/dist/pcap_setfilter.3pcap               |    19 +-
 external/bsd/libpcap/dist/pcap_setnonblock.3pcap             |    24 +-
 external/bsd/libpcap/dist/pcap_snapshot.3pcap                |    10 +-
 external/bsd/libpcap/dist/pcap_stats.3pcap                   |    19 +-
 external/bsd/libpcap/dist/pcap_strerror.3pcap                |     4 +-
 external/bsd/libpcap/dist/pcap_tstamp_type_name_to_val.3pcap |     7 +-
 external/bsd/libpcap/dist/pcap_tstamp_type_val_to_name.3pcap |     7 +-
 external/bsd/libpcap/dist/rpcapd/log-stderr.c                |    41 -
 external/bsd/libpcap/dist/savefile.c                         |    53 +-
 external/bsd/libpcap/dist/scanner.l                          |    41 +-
 external/bsd/libpcap/dist/sf-pcap.c                          |   173 +-
 external/bsd/libpcap/dist/sf-pcap.h                          |     4 +-
 external/bsd/libpcap/include/config.h                        |    22 +-
 external/bsd/libpcap/lib/Makefile                            |    28 +-
 external/bsd/libpcap/lib/shlib_version                       |     4 +-
 74 files changed, 3784 insertions(+), 1961 deletions(-)

diffs (truncated from 11619 to 300 lines):

diff -r 616b8872378e -r 7187d813f3db external/bsd/libpcap/bin/Makefile
--- a/external/bsd/libpcap/bin/Makefile Tue Oct 01 16:00:25 2019 +0000
+++ b/external/bsd/libpcap/bin/Makefile Tue Oct 01 16:02:11 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.2 2010/12/05 09:09:39 mrg Exp $
+#      $NetBSD: Makefile,v 1.3 2019/10/01 16:02:11 christos Exp $
 
 .include <bsd.own.mk>
 
@@ -13,6 +13,10 @@
        @rm -f ${.TARGET}
        ${TOOL_SED} -e 's,@libdir@,/usr/lib,g' \
            -e 's,@includedir@,/usr/include,g' \
+           -e 's,@PACKAGE_NAME@,pcap,g' \
+           -e 's,@prefix@,/usr,g' \
+           -e 's,@exec_prefix@,/usr,g' \
+           -e 's/@V_RPATH_OPT@/-Wl,-rpath,/g' \
            -e 's,@LIBS@,,g' < ${.ALLSRC} > ${.TARGET}
        chmod a+x ${.TARGET}
 
diff -r 616b8872378e -r 7187d813f3db external/bsd/libpcap/dist/bpf_filter.c
--- a/external/bsd/libpcap/dist/bpf_filter.c    Tue Oct 01 16:00:25 2019 +0000
+++ b/external/bsd/libpcap/dist/bpf_filter.c    Tue Oct 01 16:02:11 2019 +0000
@@ -330,11 +330,17 @@
                        continue;
 
                case BPF_ALU|BPF_LSH|BPF_X:
-                       A <<= X;
+                       if (X < 32)
+                               A <<= X;
+                       else
+                               A = 0;
                        continue;
 
                case BPF_ALU|BPF_RSH|BPF_X:
-                       A >>= X;
+                       if (X < 32)
+                               A >>= X;
+                       else
+                               A = 0;
                        continue;
 
                case BPF_ALU|BPF_ADD|BPF_K:
@@ -380,10 +386,13 @@
                case BPF_ALU|BPF_NEG:
                        /*
                         * Most BPF arithmetic is unsigned, but negation
-                        * can't be unsigned; throw some casts to
-                        * specify what we're trying to do.
+                        * can't be unsigned; respecify it as subtracting
+                        * the accumulator from 0U, so that 1) we don't
+                        * get compiler warnings about negating an unsigned
+                        * value and 2) don't get UBSan warnings about
+                        * the result of negating 0x80000000 being undefined.
                         */
-                       A = (u_int32)(-(int32)A);
+                       A = (0U - A);
                        continue;
 
                case BPF_MISC|BPF_TAX:
diff -r 616b8872378e -r 7187d813f3db external/bsd/libpcap/dist/bpf_image.c
--- a/external/bsd/libpcap/dist/bpf_image.c     Tue Oct 01 16:00:25 2019 +0000
+++ b/external/bsd/libpcap/dist/bpf_image.c     Tue Oct 01 16:02:11 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bpf_image.c,v 1.4 2018/09/03 15:26:43 christos Exp $   */
+/*     $NetBSD: bpf_image.c,v 1.5 2019/10/01 16:02:11 christos Exp $   */
 
 /*
  * Copyright (c) 1990, 1991, 1992, 1994, 1995, 1996
@@ -22,7 +22,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: bpf_image.c,v 1.4 2018/09/03 15:26:43 christos Exp $");
+__RCSID("$NetBSD: bpf_image.c,v 1.5 2019/10/01 16:02:11 christos Exp $");
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
diff -r 616b8872378e -r 7187d813f3db external/bsd/libpcap/dist/doc/README.Win32
--- a/external/bsd/libpcap/dist/doc/README.Win32        Tue Oct 01 16:00:25 2019 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-Under Win32, libpcap is integrated in the WinPcap packet capture system.
-WinPcap provides a framework that allows libpcap to capture the packets
-under Windows 95, Windows 98, Windows ME, Windows NT 4, Windows 2000
-and Windows XP.
-WinPcap binaries and source code can be found at http://winpcap.polito.it:
-they include also a developer's pack with all the necessary to compile
-libpcap-based applications under Windows.
-
-How to compile libpcap with Visual Studio
------------------------------------------
-
-In order to compile libpcap you will need:
-
-- version 6 (or higher) of Microsoft Visual Studio
-- The November 2001 (or later) edition of Microsoft Platform
-Software Development Kit (SDK), that contains some necessary includes
-for IPv6 support. You can download it from http://www.microsoft.com/sdk
-- the latest WinPcap sources from http://winpcap.polito.it/install
-
-The WinPcap source code already contains a recent (usually the latest
-stable) version of libpcap. If you need to compile a different one,
-simply download it from www.tcpdump.org and copy the sources in the
-winpcap\wpcap\libpcap folder of the WinPcap distribution. If you want to
-compile a libpcap source retrieved from the tcpdump.org Git, you will
-have to create the scanner and the grammar by hand (with lex and yacc)
-or with the cygnus makefile, since The Visual Studio project is not able
-to build them.
-
-Open the project file winpcap\wpcap\prj\wpcap.dsw with Visual Studio and
-build wpcap.dll. wpcap.lib, the library file to link with the applications,
-will be generated in winpcap\wpcap\lib\. wpcap.dll will be generated in
-winpcap\wpcap\prj\release or winpcap\wpcap\prj\debug depending on the type
-of binary that is being created.
-
-How to compile libpcap with Cygnus
-----------------------------------
-
-To build wpcap.dll, cd to the directory WPCAP/PRJ of the WinPcap source code
-distribution and type "make". libwpcap.a, the library file to link with the
-applications, will be generated in winpcap\wpcap\lib\. wpcap.dll will be
-generated in winpcap\wpcap\prj.
-
-Remember, you CANNOT use the MSVC-generated .lib files with gcc, use
-libwpcap.a instead.
-
-"make install" installs wpcap.dll in the Windows system folder.
diff -r 616b8872378e -r 7187d813f3db external/bsd/libpcap/dist/gencode.c
--- a/external/bsd/libpcap/dist/gencode.c       Tue Oct 01 16:00:25 2019 +0000
+++ b/external/bsd/libpcap/dist/gencode.c       Tue Oct 01 16:02:11 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gencode.c,v 1.11 2018/09/03 15:26:43 christos Exp $    */
+/*     $NetBSD: gencode.c,v 1.12 2019/10/01 16:02:11 christos Exp $    */
 
 /*#define CHASE_CHAIN*/
 /*
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: gencode.c,v 1.11 2018/09/03 15:26:43 christos Exp $");
+__RCSID("$NetBSD: gencode.c,v 1.12 2019/10/01 16:02:11 christos Exp $");
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -55,6 +55,8 @@
 
 #include "pcap-int.h"
 
+#include "extract.h"
+
 #include "ethertype.h"
 #include "nlpid.h"
 #include "llc.h"
@@ -282,6 +284,13 @@
        struct addrinfo *ai;
 
        /*
+        * Another thing that's allocated is the result of pcap_ether_aton();
+        * it must be freed with free().  This variable points to any
+        * address that would need to be freed.
+        */
+       u_char *e;
+
+       /*
         * Various code constructs need to know the layout of the packet.
         * These values give the necessary offsets from the beginning
         * of the packet data.
@@ -422,35 +431,49 @@
        int cur_chunk;
 };
 
-void PCAP_NORETURN
-bpf_syntax_error(compiler_state_t *cstate, const char *msg)
-{
-       bpf_error(cstate, "syntax error in filter expression: %s", msg);
-       /* NOTREACHED */
-}
+/*
+ * For use by routines outside this file.
+ */
+/* VARARGS */
+void
+bpf_set_error(compiler_state_t *cstate, const char *fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+       (void)pcap_vsnprintf(cstate->bpf_pcap->errbuf, PCAP_ERRBUF_SIZE,
+           fmt, ap);
+       va_end(ap);
+}
+
+/*
+ * For use *ONLY* in routines in this file.
+ */
+static void PCAP_NORETURN bpf_error(compiler_state_t *, const char *, ...)
+    PCAP_PRINTFLIKE(2, 3);
 
 /* VARARGS */
-void PCAP_NORETURN
+static void PCAP_NORETURN
 bpf_error(compiler_state_t *cstate, const char *fmt, ...)
 {
        va_list ap;
 
        va_start(ap, fmt);
-       if (cstate->bpf_pcap != NULL)
-               (void)pcap_vsnprintf(pcap_geterr(cstate->bpf_pcap),
-                   PCAP_ERRBUF_SIZE, fmt, ap);
+       (void)pcap_vsnprintf(cstate->bpf_pcap->errbuf, PCAP_ERRBUF_SIZE,
+           fmt, ap);
        va_end(ap);
        longjmp(cstate->top_ctx, 1);
-       /* NOTREACHED */
-}
-
-static void init_linktype(compiler_state_t *, pcap_t *);
+       /*NOTREACHED*/
+}
+
+static int init_linktype(compiler_state_t *, pcap_t *);
 
 static void init_regs(compiler_state_t *);
 static int alloc_reg(compiler_state_t *);
 static void free_reg(compiler_state_t *, int);
 
 static void initchunks(compiler_state_t *cstate);
+static void *newchunk_nolongjmp(compiler_state_t *cstate, size_t);
 static void *newchunk(compiler_state_t *cstate, size_t);
 static void freechunks(compiler_state_t *cstate);
 static inline struct block *new_block(compiler_state_t *cstate, int);
@@ -548,6 +571,9 @@
 static struct block *gen_geneve_ll_check(compiler_state_t *cstate);
 
 static struct block *gen_ppi_dlt_check(compiler_state_t *);
+static struct block *gen_atmfield_code_internal(compiler_state_t *, int,
+    bpf_int32, bpf_u_int32, int);
+static struct block *gen_atmtype_llc(compiler_state_t *);
 static struct block *gen_msg_abbrev(compiler_state_t *, int type);
 
 static void
@@ -563,7 +589,7 @@
 }
 
 static void *
-newchunk(compiler_state_t *cstate, size_t n)
+newchunk_nolongjmp(compiler_state_t *cstate, size_t n)
 {
        struct chunk *cp;
        int k;
@@ -581,21 +607,40 @@
        if (n > cp->n_left) {
                ++cp;
                k = ++cstate->cur_chunk;
-               if (k >= NCHUNKS)
-                       bpf_error(cstate, "out of memory");
+               if (k >= NCHUNKS) {
+                       bpf_set_error(cstate, "out of memory");
+                       return (NULL);
+               }
                size = CHUNK0SIZE << k;
                cp->m = (void *)malloc(size);
-               if (cp->m == NULL)
-                       bpf_error(cstate, "out of memory");
+               if (cp->m == NULL) {
+                       bpf_set_error(cstate, "out of memory");
+                       return (NULL);
+               }
                memset((char *)cp->m, 0, size);
                cp->n_left = size;
-               if (n > size)
-                       bpf_error(cstate, "out of memory");
+               if (n > size) {
+                       bpf_set_error(cstate, "out of memory");
+                       return (NULL);
+               }
        }
        cp->n_left -= n;
        return (void *)((char *)cp->m + cp->n_left);
 }
 
+static void *
+newchunk(compiler_state_t *cstate, size_t n)
+{
+       void *p;
+
+       p = newchunk_nolongjmp(cstate, n);
+       if (p == NULL) {
+               longjmp(cstate->top_ctx, 1);
+               /*NOTREACHED*/
+       }
+       return (p);
+}
+
 static void
 freechunks(compiler_state_t *cstate)
 {
@@ -608,14 +653,19 @@



Home | Main Index | Thread Index | Old Index