aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorBruce M Simpson <bms@FreeBSD.org>2004-04-03 06:24:17 +0000
committerBruce M Simpson <bms@FreeBSD.org>2004-04-03 06:24:17 +0000
commit636cf71163d6bbe046512b4f78dc31baf0bb2478 (patch)
tree16c9bd409594c82f16dbc0f8cd2a9aa927f34aae /net
parent2c7983e007f20bd300c32b1632b7b851a00d02f5 (diff)
downloadports-636cf71163d6bbe046512b4f78dc31baf0bb2478.tar.gz
ports-636cf71163d6bbe046512b4f78dc31baf0bb2478.zip
Notes
Diffstat (limited to 'net')
-rw-r--r--net/tcpdump/Makefile5
-rw-r--r--net/tcpdump/files/extra-patch-Makefile.in20
-rw-r--r--net/tcpdump/files/extra-patch-cpack.c184
-rw-r--r--net/tcpdump/files/extra-patch-cpack.h56
-rw-r--r--net/tcpdump/files/extra-patch-extract.h4
-rw-r--r--net/tcpdump/files/extra-patch-ieee802_11_radio.h10
-rw-r--r--net/tcpdump/files/extra-patch-print-802_11.c332
-rw-r--r--net/tcpdump/files/extra-patch-tcpdump.c15
8 files changed, 209 insertions, 417 deletions
diff --git a/net/tcpdump/Makefile b/net/tcpdump/Makefile
index b80741ff18c3..444161c57076 100644
--- a/net/tcpdump/Makefile
+++ b/net/tcpdump/Makefile
@@ -49,10 +49,7 @@ CONFIGURE_ARGS+= --without-crypto
.endif
.if defined(WITH_RADIOTAP)
-EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-Makefile.in \
- ${PATCHDIR}/extra-patch-cpack.c \
- ${PATCHDIR}/extra-patch-cpack.h \
- ${PATCHDIR}/extra-patch-extract.h \
+EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-extract.h \
${PATCHDIR}/extra-patch-ieee802_11_radio.h \
${PATCHDIR}/extra-patch-print-802_11.c
.endif
diff --git a/net/tcpdump/files/extra-patch-Makefile.in b/net/tcpdump/files/extra-patch-Makefile.in
deleted file mode 100644
index 5f69c1f012ca..000000000000
--- a/net/tcpdump/files/extra-patch-Makefile.in
+++ /dev/null
@@ -1,20 +0,0 @@
---- Makefile.in.orig Sun Mar 28 22:25:02 2004
-+++ Makefile.in Wed Mar 31 01:04:18 2004
-@@ -65,7 +65,7 @@
- @rm -f $@
- $(CC) $(CFLAGS) -c $(srcdir)/$*.c
-
--CSRC = addrtoname.c gmpls.c gmt2local.c machdep.c oui.c parsenfsfh.c \
-+CSRC = addrtoname.c cpack.c gmpls.c gmt2local.c machdep.c oui.c parsenfsfh.c \
- print-802_11.c print-ap1394.c print-ah.c print-arcnet.c \
- print-aodv.c print-arp.c print-ascii.c print-atalk.c print-atm.c \
- print-beep.c print-bfd.c print-bgp.c print-bootp.c print-cdp.c \
-@@ -95,7 +95,7 @@
- # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
- # hack the extra indirection
- OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o) $(LOCALSRC:.c=.o) $(LIBOBJS)
--HDR = addrtoname.h appletalk.h bootp.h decnet.h \
-+HDR = addrtoname.h appletalk.h bootp.h cpack.h decnet.h \
- ethertype.h extract.h fddi.h gmt2local.h igrp.h interface.h \
- ipx.h llc.h machdep.h mib.h nfsfh.h nfsv2.h ntp.h ospf.h \
- setsignal.h \
diff --git a/net/tcpdump/files/extra-patch-cpack.c b/net/tcpdump/files/extra-patch-cpack.c
deleted file mode 100644
index b646ce9ed5b3..000000000000
--- a/net/tcpdump/files/extra-patch-cpack.c
+++ /dev/null
@@ -1,184 +0,0 @@
---- cpack.c.orig Wed Mar 31 01:03:41 2004
-+++ cpack.c Wed Mar 31 01:03:41 2004
-@@ -0,0 +1,181 @@
-+/*-
-+ * Copyright (c) 2003, 2004 David Young. All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ * 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. The name of David Young may not be used to endorse or promote
-+ * products derived from this software without specific prior
-+ * written permission.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``AS IS'' AND ANY
-+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID
-+ * YOUNG BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-+ * OF SUCH DAMAGE.
-+ */
-+
-+#ifdef HAVE_CONFIG_H
-+#include "config.h"
-+#endif
-+
-+#include <stdlib.h>
-+#include <tcpdump-stdinc.h>
-+
-+#include "cpack.h"
-+
-+static u_char *
-+cpack_next_boundary(u_char *p, size_t alignment)
-+{
-+ size_t misalignment = (u_int)p % alignment;
-+
-+ if (misalignment == 0)
-+ return p;
-+
-+ return p + (alignment - misalignment);
-+}
-+
-+/* Advance to the next wordsize boundary. Return NULL if fewer than
-+ * wordsize bytes remain in the buffer after the boundary. Otherwise,
-+ * return a pointer to the boundary.
-+ */
-+static u_char *
-+cpack_align_and_reserve(struct cpack_state *cs, size_t wordsize)
-+{
-+ u_char *next;
-+
-+ /* Ensure alignment. */
-+ next = cpack_next_boundary(cs->c_next, wordsize);
-+
-+ /* Too little space for wordsize bytes? */
-+ if (next - cs->c_buf + wordsize > cs->c_len)
-+ return NULL;
-+
-+ return next;
-+}
-+
-+int
-+cpack_init_in(struct cpack_state *cs, u_int8_t *buf, size_t buflen)
-+{
-+ memset(cs, 0, sizeof(*cs));
-+ cs->c_mode = CPACK_MODE_UNPACK;
-+ cs->c_buf = buf;
-+ cs->c_len = buflen;
-+ cs->c_next = cs->c_buf;
-+
-+ return 0;
-+}
-+
-+int
-+cpack_init_out(struct cpack_state *cs, size_t buflen, size_t max_alignment)
-+{
-+ u_int8_t *buf;
-+ size_t len;
-+
-+ memset(cs, 0, sizeof(*cs));
-+ cs->c_mode = CPACK_MODE_PACK;
-+ len = buflen + max_alignment - 1;
-+
-+ if ((cs->c_buf = malloc(len)) == NULL)
-+ return -1;
-+
-+ /* Correct alignment. */
-+ buf = cpack_next_boundary(cs->c_buf, max_alignment);
-+ cs->c_len = len - (buf - cs->c_buf);
-+ cs->c_buf = buf;
-+ cs->c_next = cs->c_buf;
-+
-+ return 0;
-+}
-+
-+/* (Un)pack a 64-bit unsigned integer. */
-+int
-+cpack_uint64(struct cpack_state *cs, u_int64_t *u)
-+{
-+ u_char *next;
-+
-+ if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
-+ return -1;
-+
-+ /* (Un)pack depending on mode. */
-+ if (cs->c_mode == CPACK_MODE_PACK)
-+ *(u_int64_t*)next = *u;
-+ else
-+ *u = *(u_int64_t*)next;
-+
-+ /* Move pointer past the u_int64_t. */
-+ cs->c_next = next + sizeof(*u);
-+ return 0;
-+}
-+
-+/* (Un)pack a 32-bit unsigned integer. */
-+int
-+cpack_uint32(struct cpack_state *cs, u_int32_t *u)
-+{
-+ u_char *next;
-+
-+ if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
-+ return -1;
-+
-+ /* (Un)pack depending on mode. */
-+ if (cs->c_mode == CPACK_MODE_PACK)
-+ *(u_int32_t*)next = *u;
-+ else
-+ *u = *(u_int32_t*)next;
-+
-+ /* Move pointer past the u_int32_t. */
-+ cs->c_next = next + sizeof(*u);
-+ return 0;
-+}
-+
-+/* (Un)pack a 16-bit unsigned integer. */
-+int
-+cpack_uint16(struct cpack_state *cs, u_int16_t *u)
-+{
-+ u_char *next;
-+
-+ if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
-+ return -1;
-+
-+ /* (Un)pack depending on mode. */
-+ if (cs->c_mode == CPACK_MODE_PACK)
-+ *(u_int16_t*)next = *u;
-+ else
-+ *u = *(u_int16_t*)next;
-+
-+ /* Move pointer past the u_int16_t. */
-+ cs->c_next = next + sizeof(*u);
-+ return 0;
-+}
-+
-+/* (Un)pack an 8-bit unsigned integer. */
-+int
-+cpack_uint8(struct cpack_state *cs, u_int8_t *u)
-+{
-+ /* No space left? */
-+ if (cs->c_next - cs->c_buf >= cs->c_len)
-+ return -1;
-+
-+ /* (Un)pack depending on mode. */
-+ if (cs->c_mode == CPACK_MODE_PACK)
-+ *cs->c_next = *u;
-+ else
-+ *u = *cs->c_next;
-+
-+ /* Move pointer past the u_int8_t. */
-+ cs->c_next++;
-+ return 0;
-+}
-+
diff --git a/net/tcpdump/files/extra-patch-cpack.h b/net/tcpdump/files/extra-patch-cpack.h
deleted file mode 100644
index 9832261f5c8d..000000000000
--- a/net/tcpdump/files/extra-patch-cpack.h
+++ /dev/null
@@ -1,56 +0,0 @@
---- cpack.h.orig Wed Mar 31 01:03:41 2004
-+++ cpack.h Wed Mar 31 01:03:41 2004
-@@ -0,0 +1,53 @@
-+/*-
-+ * Copyright (c) 2003, 2004 David Young. All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ * 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. The name of David Young may not be used to endorse or promote
-+ * products derived from this software without specific prior
-+ * written permission.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``AS IS'' AND ANY
-+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID
-+ * YOUNG BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-+ * OF SUCH DAMAGE.
-+ */
-+
-+#ifndef _CPACK_H
-+#define _CPACK_H
-+
-+struct cpack_state {
-+ u_int8_t *c_buf;
-+ u_int8_t *c_next;
-+ size_t c_len;
-+ enum {CPACK_MODE_PACK, CPACK_MODE_UNPACK} c_mode;
-+};
-+
-+int cpack_init_in(struct cpack_state *, u_int8_t *, size_t);
-+int cpack_init_out(struct cpack_state *, size_t, size_t);
-+
-+int cpack_uint8(struct cpack_state *, u_int8_t *);
-+int cpack_uint16(struct cpack_state *, u_int16_t *);
-+int cpack_uint32(struct cpack_state *, u_int32_t *);
-+int cpack_uint64(struct cpack_state *, u_int64_t *);
-+
-+#define cpack_int8(s, i) cpack_uint8((s), (u_int8_t*)(i))
-+#define cpack_int16(s, i) cpack_uint16((s), (u_int16_t*)(i))
-+#define cpack_int32(s, i) cpack_uint32((s), (u_int32_t*)(i))
-+#define cpack_int64(s, i) cpack_uint64((s), (u_int64_t*)(i))
-+
-+#endif /* _CPACK_H */
diff --git a/net/tcpdump/files/extra-patch-extract.h b/net/tcpdump/files/extra-patch-extract.h
index 1accfcbab2c5..0557722c67f2 100644
--- a/net/tcpdump/files/extra-patch-extract.h
+++ b/net/tcpdump/files/extra-patch-extract.h
@@ -1,5 +1,5 @@
---- extract.h.orig Wed Dec 11 07:13:51 2002
-+++ extract.h Wed Mar 31 01:03:41 2004
+--- extract.h.orig Tue Dec 10 23:13:51 2002
++++ extract.h Tue Mar 30 20:38:35 2004
@@ -96,3 +96,12 @@
(u_int32_t)*((const u_int8_t *)(p) + 2) << 16 | \
(u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \
diff --git a/net/tcpdump/files/extra-patch-ieee802_11_radio.h b/net/tcpdump/files/extra-patch-ieee802_11_radio.h
index ae2132628418..5851fe5ca4ef 100644
--- a/net/tcpdump/files/extra-patch-ieee802_11_radio.h
+++ b/net/tcpdump/files/extra-patch-ieee802_11_radio.h
@@ -1,7 +1,7 @@
---- ieee802_11_radio.h.orig Wed Mar 31 01:03:41 2004
-+++ ieee802_11_radio.h Wed Mar 31 01:03:41 2004
-@@ -0,0 +1,201 @@
-+/* $FreeBSD: /tmp/pcvs/ports/net/tcpdump/files/Attic/extra-patch-ieee802_11_radio.h,v 1.2 2004-03-31 00:14:06 bms Exp $ */
+--- ieee802_11_radio.h.orig Tue Mar 30 20:38:35 2004
++++ ieee802_11_radio.h Wed Mar 31 10:51:15 2004
+@@ -0,0 +1,203 @@
++/* $FreeBSD: /tmp/pcvs/ports/net/tcpdump/files/Attic/extra-patch-ieee802_11_radio.h,v 1.3 2004-04-03 06:24:17 bms Exp $ */
+/* $NetBSD: ieee80211_radiotap.h,v 1.3 2003/11/16 09:02:42 dyoung Exp $ */
+/* $Header$ */
+
@@ -184,6 +184,8 @@
+#define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */
+#define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */
+#define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */
++#define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */
++#define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */
+#endif /* !_KERNEL */
+
+/* For IEEE80211_RADIOTAP_FLAGS */
diff --git a/net/tcpdump/files/extra-patch-print-802_11.c b/net/tcpdump/files/extra-patch-print-802_11.c
index 571adc13b29d..9166b213ad69 100644
--- a/net/tcpdump/files/extra-patch-print-802_11.c
+++ b/net/tcpdump/files/extra-patch-print-802_11.c
@@ -1,11 +1,8 @@
---- print-802_11.c.orig Wed Dec 10 09:52:33 2003
-+++ print-802_11.c Wed Mar 31 01:03:41 2004
-@@ -41,15 +41,20 @@
-
+--- print-802_11.c.orig Wed Dec 10 01:52:33 2003
++++ print-802_11.c Wed Mar 31 11:51:54 2004
+@@ -42,14 +42,17 @@
#include "extract.h"
-+#include "cpack.h"
-+
#include "ieee802_11.h"
+#include "ieee802_11_radio.h"
@@ -23,124 +20,38 @@
sep = " "; \
} \
if (p.rates.length != 0) \
-@@ -919,9 +924,194 @@
+@@ -919,9 +922,265 @@
return ieee802_11_print(p, h->len, h->caplen);
}
-+static int
-+print_radiotap_field(struct cpack_state *s, u_int32_t bit)
-+{
-+ union {
-+ int8_t i8;
-+ u_int8_t u8;
-+ int16_t i16;
-+ u_int16_t u16;
-+ u_int32_t u32;
-+ u_int64_t u64;
-+ } u, u2;
-+ int rc;
-+
-+ switch (bit) {
-+ case IEEE80211_RADIOTAP_FLAGS:
-+ case IEEE80211_RADIOTAP_RATE:
-+ case IEEE80211_RADIOTAP_DB_ANTSIGNAL:
-+ case IEEE80211_RADIOTAP_DB_ANTNOISE:
-+ case IEEE80211_RADIOTAP_ANTENNA:
-+ rc = cpack_uint8(s, &u.u8);
-+ break;
-+ case IEEE80211_RADIOTAP_DBM_ANTSIGNAL:
-+ case IEEE80211_RADIOTAP_DBM_ANTNOISE:
-+ rc = cpack_int8(s, &u.i8);
-+ break;
-+ case IEEE80211_RADIOTAP_CHANNEL:
-+ rc = cpack_uint16(s, &u.u16);
-+ if (rc != 0)
-+ break;
-+ rc = cpack_uint16(s, &u2.u16);
-+ break;
-+ case IEEE80211_RADIOTAP_FHSS:
-+ case IEEE80211_RADIOTAP_LOCK_QUALITY:
-+ case IEEE80211_RADIOTAP_TX_ATTENUATION:
-+ rc = cpack_uint16(s, &u.u16);
-+ break;
-+ case IEEE80211_RADIOTAP_DB_TX_ATTENUATION:
-+ rc = cpack_uint8(s, &u.u8);
-+ break;
-+ case IEEE80211_RADIOTAP_DBM_TX_POWER:
-+ rc = cpack_uint8(s, &u.i8);
-+ break;
-+ case IEEE80211_RADIOTAP_TSFT:
-+ rc = cpack_uint64(s, &u.u64);
-+ break;
-+ default:
-+ /* this bit indicates a field whose
-+ * size we do not know, so we cannot
-+ * proceed.
-+ */
-+ printf("[0x%08x] ", bit);
-+ return -1;
-+ }
++/*
++ * Useful combinations of channel characteristics.
++ */
++#define IEEE80211_CHAN_FHSS \
++ (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK)
++#define IEEE80211_CHAN_A \
++ (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)
++#define IEEE80211_CHAN_B \
++ (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK)
++#define IEEE80211_CHAN_PUREG \
++ (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM)
++#define IEEE80211_CHAN_G \
++ (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN)
++#define IEEE80211_CHAN_T \
++ (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO)
+
-+ if (rc != 0) {
-+ printf("[|802.11]");
-+ return rc;
-+ }
-+
-+ switch (bit) {
-+ case IEEE80211_RADIOTAP_CHANNEL:
-+ printf("%u MHz ", u.u16);
-+ if (u2.u16 != 0)
-+ printf("(0x%04x) ", u2.u16);
-+ break;
-+ case IEEE80211_RADIOTAP_FHSS:
-+ printf("fhset %d fhpat %d ", u.u16 & 0xff, (u.u16 >> 8) & 0xff);
-+ break;
-+ case IEEE80211_RADIOTAP_RATE:
-+ PRINT_RATE("", u.u8, " Mb/s ");
-+ break;
-+ case IEEE80211_RADIOTAP_DBM_ANTSIGNAL:
-+ printf("%ddB signal ", u.i8);
-+ break;
-+ case IEEE80211_RADIOTAP_DBM_ANTNOISE:
-+ printf("%ddB noise ", u.i8);
-+ break;
-+ case IEEE80211_RADIOTAP_DB_ANTSIGNAL:
-+ printf("%ddB signal ", u.u8);
-+ break;
-+ case IEEE80211_RADIOTAP_DB_ANTNOISE:
-+ printf("%ddB noise ", u.u8);
-+ break;
-+ case IEEE80211_RADIOTAP_LOCK_QUALITY:
-+ printf("%u sq ", u.u16);
-+ break;
-+ case IEEE80211_RADIOTAP_TX_ATTENUATION:
-+ printf("%d tx power ", -(int)u.u16);
-+ break;
-+ case IEEE80211_RADIOTAP_DB_TX_ATTENUATION:
-+ printf("%ddB tx power ", -(int)u.u8);
-+ break;
-+ case IEEE80211_RADIOTAP_DBM_TX_POWER:
-+ printf("%ddBm tx power ", u.i8);
-+ break;
-+ case IEEE80211_RADIOTAP_FLAGS:
-+ if (u.u8 & IEEE80211_RADIOTAP_F_CFP)
-+ printf("cfp ");
-+ if (u.u8 & IEEE80211_RADIOTAP_F_SHORTPRE)
-+ printf("short preamble ");
-+ if (u.u8 & IEEE80211_RADIOTAP_F_WEP)
-+ printf("wep ");
-+ if (u.u8 & IEEE80211_RADIOTAP_F_FRAG)
-+ printf("fragmented ");
-+ break;
-+ case IEEE80211_RADIOTAP_ANTENNA:
-+ printf("antenna %d ", u.u8);
-+ break;
-+ case IEEE80211_RADIOTAP_TSFT:
-+ printf("%lldus tsft ", (long long)u.u64);
-+ break;
-+ }
-+ return 0;
-+}
++#define IEEE80211_IS_CHAN_FHSS(_flags) \
++ (((_flags) & IEEE80211_CHAN_FHSS) == IEEE80211_CHAN_FHSS)
++#define IEEE80211_IS_CHAN_A(_flags) \
++ (((_flags) & IEEE80211_CHAN_A) == IEEE80211_CHAN_A)
++#define IEEE80211_IS_CHAN_B(_flags) \
++ (((_flags) & IEEE80211_CHAN_B) == IEEE80211_CHAN_B)
++#define IEEE80211_IS_CHAN_PUREG(_flags) \
++ (((_flags) & IEEE80211_CHAN_PUREG) == IEEE80211_CHAN_PUREG)
++#define IEEE80211_IS_CHAN_G(_flags) \
++ (((_flags) & IEEE80211_CHAN_G) == IEEE80211_CHAN_G)
++#define IEEE80211_IS_CHAN_T(_flags) \
++ (((_flags) & IEEE80211_CHAN_T) == IEEE80211_CHAN_T)
+
static u_int
ieee802_11_radio_print(const u_char *p, u_int length, u_int caplen)
@@ -152,13 +63,43 @@
+#define BITNO_2(x) (((x) & 2) ? 1 : 0)
+#define BIT(n) (1 << n)
+
-+ struct cpack_state cpacker;
++#define CHECK_EXTRACT_LE_8BITS(_v,_bad) do { \
++ if (iter + sizeof(u_int8_t) > iterlast) { \
++ _bad; \
++ } \
++ _v = EXTRACT_LE_8BITS(iter); \
++ iter += sizeof(u_int8_t); \
++} while (0)
++#define CHECK_EXTRACT_LE_16BITS(_v,_bad) do { \
++ if (iter + sizeof(u_int16_t) > iterlast) { \
++ _bad; \
++ } \
++ _v = EXTRACT_LE_16BITS(iter); \
++ iter += sizeof(u_int16_t); \
++} while (0)
++#define CHECK_EXTRACT_LE_64BITS(_v,_bad) do { \
++ if (iter + sizeof(u_int64_t) > iterlast) { \
++ _bad; \
++ } \
++ _v = EXTRACT_LE_64BITS(iter); \
++ iter += sizeof(u_int64_t); \
++} while (0)
++
+ struct ieee80211_radiotap_header *hdr;
+ u_int32_t present, next_present;
+ u_int32_t *presentp, *last_presentp;
+ enum ieee80211_radiotap_type bit;
-+ int bit0;
-+ const u_char *iter;
++ int bit0, len;
++ const u_int8_t *iter;
++ const u_int8_t *iterlast;
++ union {
++ int8_t i8;
++ u_int8_t u8;
++ int16_t i16;
++ u_int16_t u16;
++ u_int32_t u32;
++ u_int64_t u64;
++ } u, u2;
+
+ if (caplen < sizeof(*hdr)) {
+ printf("[|802.11]");
@@ -167,14 +108,15 @@
+
+ hdr = (struct ieee80211_radiotap_header *)p;
+
-+ if (caplen < hdr->it_len) {
++ len = EXTRACT_LE_16BITS(&hdr->it_len);
++ if (caplen < len) {
+ printf("[|802.11]");
+ return caplen;
+ }
+
+ for (last_presentp = &hdr->it_present;
+ (*last_presentp & BIT(IEEE80211_RADIOTAP_EXT)) != 0 &&
-+ (u_char*)(last_presentp + 1) <= p + hdr->it_len;
++ (u_char*)(last_presentp + 1) <= p + len;
+ last_presentp++);
+
+ /* are there more bitmap extensions than bytes in header? */
@@ -184,26 +126,138 @@
+ }
+
+ iter = (u_char*)(last_presentp + 1);
-+
-+ cpack_init_in(&cpacker, (u_int8_t*)iter, hdr->it_len - (iter - p));
++ iterlast = (u_char*)(p + len);
+
+ for (bit0 = 0, presentp = &hdr->it_present; presentp <= last_presentp;
+ presentp++, bit0 += 32) {
-+ for (present = *presentp; present; present = next_present) {
++ present = EXTRACT_LE_32BITS(presentp);
++ for (; present; present = next_present) {
+ /* clear the least significant bit that is set */
+ next_present = present & (present - 1);
+
+ /* extract the least significant bit that is set */
+ bit = bit0 + BITNO_32(present ^ next_present);
+
-+ if (print_radiotap_field(&cpacker, bit) != 0)
++ switch (bit) {
++ case IEEE80211_RADIOTAP_FLAGS:
++ case IEEE80211_RADIOTAP_RATE:
++ case IEEE80211_RADIOTAP_DB_ANTSIGNAL:
++ case IEEE80211_RADIOTAP_DB_ANTNOISE:
++ case IEEE80211_RADIOTAP_ANTENNA:
++ case IEEE80211_RADIOTAP_DB_TX_ATTENUATION:
++ CHECK_EXTRACT_LE_8BITS(u.u8, goto bad);
++ break;
++ case IEEE80211_RADIOTAP_DBM_ANTSIGNAL:
++ case IEEE80211_RADIOTAP_DBM_ANTNOISE:
++ case IEEE80211_RADIOTAP_DBM_TX_POWER:
++ CHECK_EXTRACT_LE_8BITS(u.i8, goto bad);
++ break;
++ case IEEE80211_RADIOTAP_FHSS:
++ case IEEE80211_RADIOTAP_LOCK_QUALITY:
++ case IEEE80211_RADIOTAP_TX_ATTENUATION:
++ case IEEE80211_RADIOTAP_CHANNEL:
++ CHECK_EXTRACT_LE_16BITS(u.u16, goto bad);
++ if (bit == IEEE80211_RADIOTAP_CHANNEL)
++ CHECK_EXTRACT_LE_16BITS(u2.u16,
++ goto bad);
++ break;
++ case IEEE80211_RADIOTAP_TSFT:
++ CHECK_EXTRACT_LE_64BITS(u.u64, goto bad);
++ break;
++ default:
++ /* this bit indicates a field whose
++ * size we do not know, so we cannot
++ * proceed.
++ */
++ printf("[0x%08x] ", bit);
++ return -1;
++ bad:
++ /*
++ * There wasn't enough data for the
++ * data type; stop decoding.
++ */
++ printf("[|802.11]");
+ goto out;
++ }
++
++ switch (bit) {
++ case IEEE80211_RADIOTAP_CHANNEL:
++ printf("%u MHz ", u.u16);
++ if (u2.u16 != 0) {
++ /* use flags to disambiguate */
++ if (IEEE80211_IS_CHAN_G(u2.u16) ||
++ IEEE80211_IS_CHAN_PUREG(u2.u16))
++ printf("(11g) ", u2.u16);
++ else if (IEEE80211_IS_CHAN_T(u2.u16))
++ printf("(turbo) ", u2.u16);
++ else if (IEEE80211_IS_CHAN_B(u2.u16))
++ ;
++ else if (IEEE80211_IS_CHAN_A(u2.u16))
++ ;
++ else if (IEEE80211_IS_CHAN_FHSS(u2.u16))
++ ;
++ else
++ printf("(0x%04x) ", u2.u16);
++ }
++ break;
++ case IEEE80211_RADIOTAP_FHSS:
++ printf("fhset %d fhpat %d ",
++ u.u16 & 0xff, (u.u16 >> 8) & 0xff);
++ break;
++ case IEEE80211_RADIOTAP_RATE:
++ PRINT_RATE("", u.u8, " Mb/s ");
++ break;
++ case IEEE80211_RADIOTAP_DBM_ANTSIGNAL:
++ printf("%ddB signal ", u.i8);
++ break;
++ case IEEE80211_RADIOTAP_DBM_ANTNOISE:
++ printf("%ddB noise ", u.i8);
++ break;
++ case IEEE80211_RADIOTAP_DB_ANTSIGNAL:
++ printf("%ddB signal ", u.u8);
++ break;
++ case IEEE80211_RADIOTAP_DB_ANTNOISE:
++ printf("%ddB noise ", u.u8);
++ break;
++ case IEEE80211_RADIOTAP_LOCK_QUALITY:
++ printf("%u sq ", u.u16);
++ break;
++ case IEEE80211_RADIOTAP_TX_ATTENUATION:
++ printf("%d tx power ", -(int)u.u16);
++ break;
++ case IEEE80211_RADIOTAP_DB_TX_ATTENUATION:
++ printf("%ddB tx power ", -(int)u.u8);
++ break;
++ case IEEE80211_RADIOTAP_DBM_TX_POWER:
++ printf("%ddBm tx power ", u.i8);
++ break;
++ case IEEE80211_RADIOTAP_FLAGS:
++ if (u.u8 & IEEE80211_RADIOTAP_F_CFP)
++ printf("cfp ");
++ if (u.u8 & IEEE80211_RADIOTAP_F_SHORTPRE)
++ printf("short preamble ");
++ if (u.u8 & IEEE80211_RADIOTAP_F_WEP)
++ printf("wep ");
++ if (u.u8 & IEEE80211_RADIOTAP_F_FRAG)
++ printf("fragmented ");
++ break;
++ case IEEE80211_RADIOTAP_ANTENNA:
++ printf("antenna %d ", u.u8);
++ break;
++ case IEEE80211_RADIOTAP_TSFT:
++ printf("%lldus tsft ", (long long)u.u64);
++ break;
++ }
+ }
+ }
+out:
+
-+ return hdr->it_len + ieee802_11_print(p + hdr->it_len,
-+ length - hdr->it_len, caplen - hdr->it_len);
++ return len + ieee802_11_print(p + len, length - len, caplen - len);
++
++#undef CHECK_EXTRACT_8BITS
++#undef CHECK_EXTRACT_LE_16BITS
++#undef CHECK_EXTRACT_LE_64BITS
++
+#undef BITNO_32
+#undef BITNO_16
+#undef BITNO_8
@@ -212,13 +266,27 @@
+#undef BIT
+}
+
++#undef IEEE80211_CHAN_FHSS
++#undef IEEE80211_CHAN_A
++#undef IEEE80211_CHAN_B
++#undef IEEE80211_CHAN_PUREG
++#undef IEEE80211_CHAN_G
++#undef IEEE80211_CHAN_T
++
++#undef IEEE80211_IS_CHAN_FHSS
++#undef IEEE80211_IS_CHAN_A
++#undef IEEE80211_IS_CHAN_B
++#undef IEEE80211_IS_CHAN_PUREG
++#undef IEEE80211_IS_CHAN_G
++#undef IEEE80211_IS_CHAN_T
++
+static u_int
+ieee802_11_avs_radio_print(const u_char *p, u_int length, u_int caplen)
+{
u_int32_t caphdr_len;
caphdr_len = EXTRACT_32BITS(p + 4);
-@@ -972,7 +1162,7 @@
+@@ -972,7 +1231,7 @@
}
if (EXTRACT_32BITS(p) == WLANCAP_MAGIC_COOKIE_V1)
diff --git a/net/tcpdump/files/extra-patch-tcpdump.c b/net/tcpdump/files/extra-patch-tcpdump.c
deleted file mode 100644
index 348eaa29bb46..000000000000
--- a/net/tcpdump/files/extra-patch-tcpdump.c
+++ /dev/null
@@ -1,15 +0,0 @@
---- tcpdump.c.orig Wed Mar 17 19:47:48 2004
-+++ tcpdump.c Wed Mar 31 01:03:41 2004
-@@ -69,6 +69,12 @@
- #include "gmt2local.h"
- #include "pcap-missing.h"
-
-+/*
-+ * XXX: quick and dirty until FreeBSD defines DLT_IEEE802_11_RADIO in
-+ * <net/bpf.h>. -bms
-+ */
-+#include "ieee802_11_radio.h"
-+
- int dflag; /* print filter code */
- int eflag; /* print ethernet header */
- int fflag; /* don't translate "foreign" IP address */