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/40437b9a6bbe
branches:  trunk
changeset: 337068:40437b9a6bbe
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Mar 31 21:39:42 2015 +0000

description:
merge conflicts

diffstat:

 external/bsd/libpcap/dist/bpf/net/bpf_filter.c               |    97 +-
 external/bsd/libpcap/dist/fad-gifc.c                         |    16 +-
 external/bsd/libpcap/dist/fad-win32.c                        |    24 +-
 external/bsd/libpcap/dist/gencode.c                          |  2120 +++++----
 external/bsd/libpcap/dist/gencode.h                          |    10 +-
 external/bsd/libpcap/dist/grammar.y                          |    14 +-
 external/bsd/libpcap/dist/inet.c                             |    43 +-
 external/bsd/libpcap/dist/lbl/os-osf4.h                      |     4 +-
 external/bsd/libpcap/dist/lbl/os-osf5.h                      |     4 +-
 external/bsd/libpcap/dist/optimize.c                         |   104 +-
 external/bsd/libpcap/dist/packaging/pcap.spec.in             |    77 -
 external/bsd/libpcap/dist/pcap-bpf.c                         |    47 +-
 external/bsd/libpcap/dist/pcap-bpf.h                         |     4 +-
 external/bsd/libpcap/dist/pcap-bt-linux.c                    |    53 +-
 external/bsd/libpcap/dist/pcap-bt-linux.h                    |     6 +-
 external/bsd/libpcap/dist/pcap-bt-monitor-linux.c            |     7 +-
 external/bsd/libpcap/dist/pcap-can-linux.c                   |     6 +-
 external/bsd/libpcap/dist/pcap-canusb-linux.c                |    70 +-
 external/bsd/libpcap/dist/pcap-common.c                      |    89 +-
 external/bsd/libpcap/dist/pcap-dag.c                         |   169 +-
 external/bsd/libpcap/dist/pcap-dbus.c                        |    16 +-
 external/bsd/libpcap/dist/pcap-dlpi.c                        |     6 +-
 external/bsd/libpcap/dist/pcap-dos.c                         |    16 +-
 external/bsd/libpcap/dist/pcap-dos.h                         |     4 +-
 external/bsd/libpcap/dist/pcap-int.h                         |    12 +-
 external/bsd/libpcap/dist/pcap-linux.c                       |   729 ++-
 external/bsd/libpcap/dist/pcap-netfilter-linux.c             |    47 +-
 external/bsd/libpcap/dist/pcap-netfilter-linux.h             |     6 +-
 external/bsd/libpcap/dist/pcap-nit.c                         |     6 +-
 external/bsd/libpcap/dist/pcap-pf.c                          |     6 +-
 external/bsd/libpcap/dist/pcap-septel.c                      |    12 +-
 external/bsd/libpcap/dist/pcap-sita.c                        |    12 +-
 external/bsd/libpcap/dist/pcap-snf.c                         |   205 +-
 external/bsd/libpcap/dist/pcap-snit.c                        |     6 +-
 external/bsd/libpcap/dist/pcap-snoop.c                       |     8 +-
 external/bsd/libpcap/dist/pcap-usb-linux.c                   |    92 +-
 external/bsd/libpcap/dist/pcap-usb-linux.h                   |     6 +-
 external/bsd/libpcap/dist/pcap-win32.c                       |   152 +-
 external/bsd/libpcap/dist/pcap.3pcap.in                      |    42 +-
 external/bsd/libpcap/dist/pcap.c                             |    25 +-
 external/bsd/libpcap/dist/pcap/bluetooth.h                   |     8 +-
 external/bsd/libpcap/dist/pcap/bpf.h                         |    57 +-
 external/bsd/libpcap/dist/pcap/pcap.h                        |     7 +-
 external/bsd/libpcap/dist/pcap/usb.h                         |    10 +-
 external/bsd/libpcap/dist/pcap_breakloop.3pcap               |     4 +-
 external/bsd/libpcap/dist/pcap_datalink_name_to_val.3pcap    |     4 +-
 external/bsd/libpcap/dist/pcap_dump.3pcap                    |     6 +-
 external/bsd/libpcap/dist/pcap_dump_open.3pcap.in            |    13 +-
 external/bsd/libpcap/dist/pcap_get_selectable_fd.3pcap       |    14 +-
 external/bsd/libpcap/dist/pcap_loop.3pcap                    |     9 +-
 external/bsd/libpcap/dist/pcap_setdirection.3pcap            |     4 +-
 external/bsd/libpcap/dist/pcap_setnonblock.3pcap             |    10 +-
 external/bsd/libpcap/dist/pcap_tstamp_type_name_to_val.3pcap |     4 +-
 external/bsd/libpcap/dist/savefile.c                         |    13 +-
 external/bsd/libpcap/dist/scanner.l                          |     9 +-
 external/bsd/libpcap/dist/sf-pcap-ng.c                       |    39 +-
 external/bsd/libpcap/dist/sf-pcap.c                          |   168 +-
 external/bsd/libpcap/dist/tests/filtertest.c                 |    42 +-
 external/bsd/libpcap/dist/tests/findalldevstest.c            |    31 +-
 external/bsd/libpcap/dist/tests/valgrindtest.c               |     6 +-
 external/bsd/libpcap/lib/shlib_version                       |     4 +-
 61 files changed, 3072 insertions(+), 1762 deletions(-)

diffs (truncated from 10438 to 300 lines):

diff -r 519c730bbac4 -r 40437b9a6bbe external/bsd/libpcap/dist/bpf/net/bpf_filter.c
--- a/external/bsd/libpcap/dist/bpf/net/bpf_filter.c    Tue Mar 31 21:25:19 2015 +0000
+++ b/external/bsd/libpcap/dist/bpf/net/bpf_filter.c    Tue Mar 31 21:39:42 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bpf_filter.c,v 1.5 2014/11/19 19:33:31 christos Exp $  */
+/*     $NetBSD: bpf_filter.c,v 1.6 2015/03/31 21:39:42 christos Exp $  */
 
 /*-
  * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -188,10 +188,25 @@
 }
 #endif
 
+#ifdef __linux__
+#include <linux/types.h>
+#include <linux/if_packet.h>
+#include <linux/filter.h>
+#endif
+
+enum {
+        BPF_S_ANC_NONE,
+        BPF_S_ANC_VLAN_TAG,
+        BPF_S_ANC_VLAN_TAG_PRESENT,
+};
+
 /*
  * Execute the filter program starting at pc on the packet p
  * wirelen is the length of the original packet
  * buflen is the amount of data present
+ * aux_data is auxiliary data, currently used only when interpreting
+ * filters intended for the Linux kernel in cases where the kernel
+ * rejects the filter; it contains VLAN tag information
  * For the kernel, p is assumed to be a pointer to an mbuf if buflen is 0,
  * in all other cases, p is a pointer to a buffer and buflen is its size.
  */
@@ -199,8 +214,9 @@
 bpf_filter(const struct bpf_insn *pc, const u_char *p, u_int wirelen,
     u_int buflen)
 {
-       u_int32 A, X, k;
-       int32 mem[BPF_MEMWORDS];
+       register u_int32 A, X;
+       register bpf_u_int32 k;
+       u_int32 mem[BPF_MEMWORDS];
 #if defined(KERNEL) || defined(_KERNEL)
        struct mbuf *m, *n;
        int merr, len;
@@ -240,7 +256,7 @@
 
                case BPF_LD|BPF_W|BPF_ABS:
                        k = pc->k;
-                       if (k + sizeof(int32) > buflen) {
+                       if (k > buflen || sizeof(int32_t) > buflen - k) {
 #if defined(KERNEL) || defined(_KERNEL)
                                if (m == NULL)
                                        return 0;
@@ -257,7 +273,7 @@
 
                case BPF_LD|BPF_H|BPF_ABS:
                        k = pc->k;
-                       if (k + sizeof(short) > buflen) {
+                       if (k > buflen || sizeof(int16_t) > buflen - k) {
 #if defined(KERNEL) || defined(_KERNEL)
                                if (m == NULL)
                                        return 0;
@@ -273,22 +289,50 @@
                        continue;
 
                case BPF_LD|BPF_B|BPF_ABS:
-                       k = pc->k;
-                       if (k >= (int)buflen) {
+                       {
+#if defined(SKF_AD_VLAN_TAG) && defined(SKF_AD_VLAN_TAG_PRESENT)
+                               int code = BPF_S_ANC_NONE;
+#define ANCILLARY(CODE) case SKF_AD_OFF + SKF_AD_##CODE:               \
+                               code = BPF_S_ANC_##CODE;                \
+                                        if (!aux_data)                  \
+                                                return 0;               \
+                                        break;
+
+                               switch (pc->k) {
+                                       ANCILLARY(VLAN_TAG);
+                                       ANCILLARY(VLAN_TAG_PRESENT);
+                               default :
+#endif
+                                       k = pc->k;
+                                       if (k >= (int)buflen) {
 #if defined(KERNEL) || defined(_KERNEL)
-                               if (m == NULL)
-                                       return 0;
-                               n = m;
-                               MINDEX(len, n, k);
-                               A = mtod(n, u_char *)[k];
-                               continue;
+                                               if (m == NULL)
+                                                       return 0;
+                                               n = m;
+                                               MINDEX(len, n, k);
+                                               A = mtod(n, u_char *)[k];
+                                               continue;
 #else
-                               return 0;
+                                               return 0;
 #endif
+                                       }
+                                       A = p[k];
+#if defined(SKF_AD_VLAN_TAG) && defined(SKF_AD_VLAN_TAG_PRESENT)
+                               }
+                               switch (code) {
+                               case BPF_S_ANC_VLAN_TAG:
+                                       if (aux_data)
+                                               A = aux_data->vlan_tag;
+                                       break;
+
+                               case BPF_S_ANC_VLAN_TAG_PRESENT:
+                                       if (aux_data)
+                                               A = aux_data->vlan_tag_present;
+                                       break;
+                               }
+#endif
+                               continue;
                        }
-                       A = p[k];
-                       continue;
-
                case BPF_LD|BPF_W|BPF_LEN:
                        A = wirelen;
                        continue;
@@ -299,7 +343,8 @@
 
                case BPF_LD|BPF_W|BPF_IND:
                        k = X + pc->k;
-                       if (k + sizeof(int32) > buflen) {
+                       if (pc->k > buflen || X > buflen - pc->k ||
+                           sizeof(int32_t) > buflen - k) {
 #if defined(KERNEL) || defined(_KERNEL)
                                if (m == NULL)
                                        return 0;
@@ -316,7 +361,8 @@
 
                case BPF_LD|BPF_H|BPF_IND:
                        k = X + pc->k;
-                       if (k + sizeof(short) > buflen) {
+                       if (X > buflen || pc->k > buflen - X ||
+                           sizeof(int16_t) > buflen - k) {
 #if defined(KERNEL) || defined(_KERNEL)
                                if (m == NULL)
                                        return 0;
@@ -333,7 +379,7 @@
 
                case BPF_LD|BPF_B|BPF_IND:
                        k = X + pc->k;
-                       if (k >= (int)buflen) {
+                       if (pc->k >= (int)buflen || X >= buflen - pc->k) {
 #if defined(KERNEL) || defined(_KERNEL)
                                if (m == NULL)
                                        return 0;
@@ -535,6 +581,17 @@
        }
 }
 
+u_int
+bpf_filter(pc, p, wirelen, buflen)
+       register const struct bpf_insn *pc;
+       register const u_char *p;
+       u_int wirelen;
+       register u_int buflen;
+{
+       return bpf_filter_with_aux_data(pc, p, wirelen, buflen, NULL);
+}
+
+
 /*
  * Return true if the 'fcode' is a valid filter program.
  * The constraints are that each jump be forward and to a valid
diff -r 519c730bbac4 -r 40437b9a6bbe external/bsd/libpcap/dist/fad-gifc.c
--- a/external/bsd/libpcap/dist/fad-gifc.c      Tue Mar 31 21:25:19 2015 +0000
+++ b/external/bsd/libpcap/dist/fad-gifc.c      Tue Mar 31 21:39:42 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fad-gifc.c,v 1.2 2014/11/19 19:33:30 christos Exp $    */
+/*     $NetBSD: fad-gifc.c,v 1.3 2015/03/31 21:39:42 christos Exp $    */
 
 /* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */
 /*
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: fad-gifc.c,v 1.2 2014/11/19 19:33:30 christos Exp $");
+__RCSID("$NetBSD: fad-gifc.c,v 1.3 2015/03/31 21:39:42 christos Exp $");
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -222,12 +222,12 @@
                /*
                 * XXX - The 32-bit compatibility layer for Linux on IA-64
                 * is slightly broken. It correctly converts the structures
-                * to and from kernel land from 64 bit to 32 bit but 
-                * doesn't update ifc.ifc_len, leaving it larger than the 
-                * amount really used. This means we read off the end 
-                * of the buffer and encounter an interface with an 
-                * "empty" name. Since this is highly unlikely to ever 
-                * occur in a valid case we can just finish looking for 
+                * to and from kernel land from 64 bit to 32 bit but
+                * doesn't update ifc.ifc_len, leaving it larger than the
+                * amount really used. This means we read off the end
+                * of the buffer and encounter an interface with an
+                * "empty" name. Since this is highly unlikely to ever
+                * occur in a valid case we can just finish looking for
                 * interfaces if we see an empty name.
                 */
                if (!(*ifrp->ifr_name))
diff -r 519c730bbac4 -r 40437b9a6bbe external/bsd/libpcap/dist/fad-win32.c
--- a/external/bsd/libpcap/dist/fad-win32.c     Tue Mar 31 21:25:19 2015 +0000
+++ b/external/bsd/libpcap/dist/fad-win32.c     Tue Mar 31 21:39:42 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fad-win32.c,v 1.2 2014/11/19 19:33:30 christos Exp $   */
+/*     $NetBSD: fad-win32.c,v 1.3 2015/03/31 21:39:42 christos Exp $   */
 
 /*
  * Copyright (c) 2002 - 2005 NetGroup, Politecnico di Torino (Italy)
@@ -14,9 +14,9 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Politecnico di Torino, CACE Technologies 
- * nor the names of its contributors may be used to endorse or promote 
- * products derived from this software without specific prior written 
+ * 3. Neither the name of the Politecnico di Torino, CACE Technologies
+ * nor the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior written
  * permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: fad-win32.c,v 1.2 2014/11/19 19:33:30 christos Exp $");
+__RCSID("$NetBSD: fad-win32.c,v 1.3 2015/03/31 21:39:42 christos Exp $");
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -132,7 +132,7 @@
        char *AdaptersName;
        ULONG NameLength;
        char *name;
-       
+
        /*
         * Find out how big a buffer we need.
         *
@@ -175,7 +175,7 @@
        {
                snprintf(errbuf, PCAP_ERRBUF_SIZE, "Cannot allocate enough memory to list the adapters.");
                return (-1);
-       }                       
+       }
 
        if (!PacketGetAdapterNames(AdaptersName, &NameLength)) {
                snprintf(errbuf, PCAP_ERRBUF_SIZE,
@@ -184,7 +184,7 @@
                free(AdaptersName);
                return (-1);
        }
-       
+
        /*
         * "PacketGetAdapterNames()" returned a list of
         * null-terminated ASCII interface name strings,
@@ -200,7 +200,7 @@
        desc = &AdaptersName[0];
        while (*desc != '\0' || *(desc + 1) != '\0')
                desc++;
-       
+
        /*
         * Found it - "desc" points to the first of the two
         * nulls at the end of the list of names, so the
@@ -208,7 +208,7 @@
         * after it.
         */
        desc += 2;
-       
+
        /*
         * Loop over the elements in the first list.
         */
@@ -236,7 +236,7 @@
                if (pcap_platform_finddevs(&devlist, errbuf) < 0)
                        ret = -1;
        }
-       
+
        if (ret == -1) {
                /*
                 * We had an error; free the list we've been constructing.
@@ -246,7 +246,7 @@
                        devlist = NULL;
                }



Home | Main Index | Thread Index | Old Index