appletalk.h
atime.awk
bootp.h
+chdlc.h
config.guess
config.h.in
config.sub
--- /dev/null
+/* @(#) $Header: /tcpdump/master/tcpdump/chdlc.h,v 1.1 2000-09-18 05:11:43 guy Exp $ (LBL) */
+/*
+ * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code distributions
+ * retain the above copyright notice and this paragraph in its entirety, (2)
+ * distributions including binary code include the above copyright notice and
+ * this paragraph in its entirety in the documentation or other materials
+ * provided with the distribution, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#define CHDLC_HDRLEN 4
+#define CHDLC_UNICAST 0x0f
+#define CHDLC_BCAST 0x8f
+#define CHDLC_TYPE_SLARP 0x8035
+#define CHDLC_TYPE_CDP 0x2000
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.134 2000-07-25 05:28:11 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.135 2000-09-18 05:11:43 guy Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
extern void pim_print(const u_char *, u_int);
extern void pppoe_print(const u_char *, u_int);
extern void ppp_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
+extern void ppp_hdlc_if_print(u_char *, const struct pcap_pkthdr *,
+ const u_char *);
extern void ppp_bsdos_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *);
extern int vjc_print(register const char *, register u_int, u_short);
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.4 2000-07-01 03:39:01 assar Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.5 2000-09-18 05:11:44 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "interface.h"
#include "addrtoname.h"
#include "ppp.h"
-
-/* XXX This goes somewhere else. */
-#define CHDLC_HDRLEN 4
-#define CHDLC_UNICAST 0x0f
-#define CHDLC_BCAST 0x8f
-#define CHDLC_TYPE_SLARP 0x8035
-#define CHDLC_TYPE_CDP 0x2000
+#include "chdlc.h"
static void chdlc_slarp_print(const u_char *, u_int);
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.43 2000-09-09 07:06:17 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.44 2000-09-18 05:11:44 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "extract.h"
#include "addrtoname.h"
#include "ppp.h"
+#include "chdlc.h"
/* XXX This goes somewhere else. */
#define PPP_HDRLEN 4
putchar('\n');
}
+/*
+ * PPP I/F printer to use if we know that RFC 1662-style PPP in HDLC-like
+ * framing, or Cisco PPP with HDLC framing as per section 4.3.1 of RFC 1547,
+ * is being used (i.e., we don't check for PPP_ADDRESS and PPP_CONTROL,
+ * discard them *if* those are the first two octets, and parse the remaining
+ * packet as a PPP packet, as "ppp_print()" does).
+ *
+ * This handles, for example, DLT_PPP_SERIAL in NetBSD.
+ */
+void
+ppp_hdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
+ register const u_char *p)
+{
+ register u_int length = h->len;
+ register u_int caplen = h->caplen;
+ u_int proto;
+
+ if (caplen < 2) {
+ printf("[|ppp]");
+ goto out;
+ }
+
+ /*
+ * Some printers want to get back at the link level addresses,
+ * and/or check that they're not walking off the end of the packet.
+ * Rather than pass them all the way down, we set these globals.
+ */
+ packetp = p;
+ snapend = p + caplen;
+
+ switch (p[0]) {
+
+ case PPP_ADDRESS:
+ if (caplen < 4) {
+ printf("[|ppp]");
+ goto out;
+ }
+
+ ts_print(&h->ts);
+ if (eflag)
+ printf("%02x %02x %d ", p[0], p[1], length);
+ p += 2;
+ length -= 2;
+
+ proto = EXTRACT_16BITS(p);
+ p += 2;
+ length -= 2;
+ printf("%s: ", ppp_protoname(proto));
+
+ handle_ppp(proto, p, length);
+ break;
+
+ case CHDLC_UNICAST:
+ case CHDLC_BCAST:
+ /*
+ * Have the Cisco HDLC print routine do all the work.
+ */
+ chdlc_if_print(user, h, p);
+ return;
+
+ default:
+ ts_print(&h->ts);
+ if (eflag)
+ printf("%02x %02x %d ", p[0], p[1], length);
+ p += 2;
+ length -= 2;
+
+ /*
+ * XXX - NetBSD's "ppp_netbsd_serial_if_print()" treats
+ * the next two octets as an Ethernet type; does that
+ * ever happen?
+ */
+ printf("unknown addr %02x; ctrl %02x", p[0], p[1]);
+ break;
+ }
+
+ if (xflag)
+ default_print(p, caplen);
+out:
+ putchar('\n');
+}
+
struct tok ppptype2str[] = {
"@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997\n\
The Regents of the University of California. All rights reserved.\n";
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.151 2000-09-17 04:13:13 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.152 2000-09-18 05:11:44 guy Exp $ (LBL)";
#endif
/*
{ fddi_if_print, PCAP_ENCAP_FDDI },
/*
- * DLT_* codes that aren't the same on all platforms.
+ * DLT_* codes that aren't the same on all platforms, or that
+ * aren't present on all platforms.
*/
#ifdef DLT_ATM_RFC1483
{ atm_if_print, DLT_ATM_RFC1483 },
#ifdef DLT_LANE8023
{ lane_if_print, DLT_LANE8023 },
#endif
+#ifdef DLT_PPP_SERIAL
+ { ppp_hdlc_if_print, DLT_PPP_SERIAL },
+#endif
/*
* PCAP_ENCAP_* codes corresponding to DLT_* codes that aren't
{ ppp_bsdos_if_print, PCAP_ENCAP_PPP_BSDOS },
{ chdlc_if_print, PCAP_ENCAP_C_HDLC },
{ cip_if_print, PCAP_ENCAP_ATM_CLIP },
+ { ppp_hdlc_if_print, PCAP_ENCAP_PPP_HDLC },
{ NULL, 0 },
};