]> The Tcpdump Group git mirrors - libpcap/commitdiff
Add DLT_AX25_KISS, for AX.25 with a KISS header, as per discussions in
authorguy <guy>
Fri, 5 Oct 2007 01:40:14 +0000 (01:40 +0000)
committerguy <guy>
Fri, 5 Oct 2007 01:40:14 +0000 (01:40 +0000)
the tcpdump-workers mailing list in early April, 2007.

Add Richard Stearn's support for DLT_AX25_KISS.

CREDITS
gencode.c
pcap-linux.c
pcap.c
pcap/bpf.h
savefile.c

diff --git a/CREDITS b/CREDITS
index ec28cbd83544d1551989006e25568083016174e3..0a01153b19410811780de6d5bdcf4478416caadd 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -86,6 +86,7 @@ Additional people who have contributed patches:
        Phil Wood                       <[email protected]>
        Rafal Maszkowski                <[email protected]>
                                        <[email protected]>
+       Richard Stearn                  <[email protected]>
        Rick Jones                      <[email protected]>
        Scott Barron                    <[email protected]>
        Scott Gifford                   <[email protected]>
index 54598eb8ed5ee0eb0693fb41dc0203af195f360d..142c31db3ac62d2e29945046ec9af77cb628a0c0 100644 (file)
--- a/gencode.c
+++ b/gencode.c
@@ -21,7 +21,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.289 2007-10-05 01:03:53 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.290 2007-10-05 01:40:14 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -1403,6 +1403,16 @@ init_linktype(p)
                off_nl = -1;
                off_nl_nosnap = -1;
                return;
+
+       case DLT_AX25_KISS:
+               /*
+                * Currently, only raw "link[N:M]" filtering is supported.
+                */
+               off_linktype = -1;      /* variable, min 15, max 71 steps of 7 */
+               off_nl = -1;            /* variable, min 16, max 71 steps of 7 */
+               off_nl_nosnap = -1;     /* no 802.2 LLC */
+               off_mac = 1;            /* step over the kiss length byte */
+               return;
        }
        bpf_error("unknown data link type %d", linktype);
        /* NOTREACHED */
@@ -2677,6 +2687,9 @@ gen_linktype(proto)
 
        case DLT_LINUX_LAPD:
                bpf_error("LAPD link-layer type filtering not implemented");
+
+       case DLT_AX25_KISS:
+               bpf_error("AX.25 link-layer type filtering not implemented");
        }
 
        /*
index 9e761f1b0e79d09c3a7e137ab7723408c4d57637..ce3ee3f5cdf485a7029edda6d70418251f2e66a9 100644 (file)
@@ -27,7 +27,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.128 2006-10-13 17:46:46 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.129 2007-10-05 01:40:14 guy Exp $ (LBL)";
 #endif
 
 /*
@@ -1169,7 +1169,7 @@ static void map_arphrd_to_dlt(pcap_t *handle, int arptype, int cooked_ok)
                break;
 
        case ARPHRD_AX25:
-               handle->linktype = DLT_AX25;
+               handle->linktype = DLT_AX25_KISS;
                break;
 
        case ARPHRD_PRONET:
diff --git a/pcap.c b/pcap.c
index a5879e5a1e8811d63a2ad4f4d75ff8f493de5305..c91a6547b7d891e1c742fff799ee38c36fc157b6 100644 (file)
--- a/pcap.c
+++ b/pcap.c
@@ -33,7 +33,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.111 2007-09-29 19:33:29 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.112 2007-10-05 01:40:14 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -409,6 +409,7 @@ static struct dlt_choice dlt_choices[] = {
        DLT_CHOICE(DLT_IPMB, "IPMB"),
        DLT_CHOICE(DLT_JUNIPER_ST, "Juniper Secure Tunnel"),
        DLT_CHOICE(DLT_BLUETOOTH_HCI_H4_WITH_PHDR, "Bluetooth HCI UART transport layer plus pseudo-header"),
+       DLT_CHOICE(DLT_AX25_KISS, "AX.25 with KISS header"),
        DLT_CHOICE_SENTINEL
 };
 
index 05ec514aec24bc71344d444f3c46fb80d653b189..e74e2f835e49c28cb1c87d3a6a054967f6369465 100644 (file)
@@ -37,7 +37,7 @@
  *
  *      @(#)bpf.h       7.1 (Berkeley) 5/7/91
  *
- * @(#) $Header: /tcpdump/master/libpcap/pcap/bpf.h,v 1.18 2007-09-29 19:33:29 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/libpcap/pcap/bpf.h,v 1.19 2007-10-05 01:40:15 guy Exp $ (LBL)
  */
 
 /*
@@ -741,6 +741,15 @@ struct bpf_version {
  */
 #define DLT_BLUETOOTH_HCI_H4_WITH_PHDR 201
 
+/*
+ * AX.25 packet with a 1-byte KISS header; see
+ *
+ *     http://www.ax25.net/kiss.htm
+ *
+ * as per Richard Stearn <[email protected]>.
+ */
+#define DLT_AX25_KISS          202
+
 
 /*
  * DLT and savefile link type values are split into a class and
index d589a45e9642f0a62cc97b3b8a6aab3d2868e67a..7375d012a47466368db84700d84ed95fc848c498 100644 (file)
@@ -30,7 +30,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.167 2007-09-29 19:33:29 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.168 2007-10-05 01:40:15 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -565,6 +565,15 @@ static const char rcsid[] _U_ =
  */
 #define LINKTYPE_BLUETOOTH_HCI_H4_WITH_PHDR    201
 
+/*
+ * AX.25 packet with a 1-byte KISS header; see
+ *
+ *     http://www.ax25.net/kiss.htm
+ *
+ * as per Richard Stearn <[email protected]>.
+ */
+#define LINKTYPE_AX25_KISS     202
+
 
 static struct linktype_map {
        int     dlt;
@@ -831,6 +840,9 @@ static struct linktype_map {
        /* Bluetooth HCI UART transport layer, with pseudo-header */
        { DLT_BLUETOOTH_HCI_H4_WITH_PHDR, LINKTYPE_BLUETOOTH_HCI_H4_WITH_PHDR },
 
+       /* AX.25 with KISS header */
+       { DLT_AX25_KISS,        LINKTYPE_AX25_KISS },
+
        { -1,                   -1 }
 };