University.
+ Yen Yen Lim
The original LBL crew:
Steve McCanne
appletalk.h
arcnet.h
atime.awk
+atm.h
+atmuni31.h
bootp.h
bpf_dump.c
chdlc.h
print-smb.c
print-snmp.c
print-stp.c
+print-sunatm.c
print-sunrpc.c
print-tcp.c
print-telnet.c
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.264 2002-07-11 08:09:46 guy Exp $ (LBL)
+# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.265 2002-07-11 09:17:22 guy Exp $ (LBL)
#
# Various configurable paths (remember to edit Makefile.in, not Makefile)
print-ospf.c print-pflog.c print-pim.c print-ppp.c \
print-pppoe.c print-pptp.c print-radius.c print-raw.c \
print-rip.c print-rx.c print-sctp.c print-sl.c print-sll.c \
- print-snmp.c print-stp.c print-sunrpc.c print-tcp.c \
- print-telnet.c print-tftp.c print-timed.c print-token.c \
- print-udp.c print-vjc.c print-vrrp.c print-wb.c print-zephyr.c \
- setsignal.c tcpdump.c util.c
+ print-snmp.c print-stp.c print-sunatm.c print-sunrpc.c \
+ print-tcp.c print-telnet.c print-tftp.c print-timed.c \
+ print-token.c print-udp.c print-vjc.c print-vrrp.c \
+ print-wb.c print-zephyr.c setsignal.c tcpdump.c util.c
LOCALSRC = @LOCALSRC@
GENSRC = version.c
--- /dev/null
+/*
+ * Copyright (c) 2002 Guy Harris.
+ * 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, and (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.
+ * The name of Guy Harris may not 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.
+ *
+ * @(#) $Header: /tcpdump/master/tcpdump/atm.h,v 1.1 2002-07-11 09:17:22 guy Exp $
+ */
+
+/*
+ * Traffic types for ATM.
+ */
+#define ATM_UNKNOWN 0 /* Unknown */
+#define ATM_LANE 1 /* LANE */
+#define ATM_LLC 2 /* LLC encapsulation */
--- /dev/null
+/*
+ * Copyright (c) 1997 Yen Yen Lim and North Dakota State University
+ * 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. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Yen Yen Lim and
+ North Dakota State University
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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.
+ */
+
+/* Based on UNI3.1 standard by ATM Forum */
+
+/* ATM traffic types based on VPI=0 and (the following VCI */
+#define PPC 0x05 /* Point-to-point signal msg */
+#define BCC 0x02 /* Broadcast signal msg */
+#define OAMF4SC 0x03 /* Segment OAM F4 flow cell */
+#define OAMF4EC 0x04 /* End-to-end OAM F4 flow cell */
+#define METAC 0x01 /* Meta signal msg */
+#define ILMIC 0x10 /* ILMI msg */
+
+/* Q.2931 signalling messages */
+#define CALL_PROCEED 0x02 /* call proceeding */
+#define CONNECT 0x07 /* connect */
+#define CONNECT_ACK 0x0f /* connect_ack */
+#define SETUP 0x05 /* setup */
+#define RELEASE 0x4d /* release */
+#define RELEASE_DONE 0x5a /* release_done */
+#define RESTART 0x46 /* restart */
+#define RESTART_ACK 0x4e /* restart ack */
+#define STATUS 0x7d /* status */
+#define STATUS_ENQ 0x75 /* status ack */
+#define ADD_PARTY 0x80 /* add party */
+#define ADD_PARTY_ACK 0x81 /* add party ack */
+#define ADD_PARTY_REJ 0x82 /* add party rej */
+#define DROP_PARTY 0x83 /* drop party */
+#define DROP_PARTY_ACK 0x84 /* drop party ack */
+
+/* Information Element Parameters in the signalling messages */
+#define CAUSE 0x08 /* cause */
+#define ENDPT_REF 0x54 /* endpoint reference */
+#define AAL_PARA 0x58 /* ATM adaptation layer parameters */
+#define TRAFF_DESCRIP 0x59 /* atm traffic descriptors */
+#define CONNECT_ID 0x5a /* connection identifier */
+#define QOS_PARA 0x5c /* quality of service parameters */
+#define B_HIGHER 0x5d /* broadband higher layer information */
+#define B_BEARER 0x5e /* broadband bearer capability */
+#define B_LOWER 0x5f /* broadband lower information */
+#define CALLING_PARTY 0x6c /* calling party number */
+#define CALLED_PARTY 0x70 /* called party nmber */
+
+#define Q2931 0x09
+
+/* Q.2931 signalling general messages format */
+#define PROTO_POS 0 /* offset of protocol discriminator */
+#define CALL_REF_POS 2 /* offset of call reference value */
+#define MSG_TYPE_POS 5 /* offset of message type */
+#define MSG_LEN_POS 7 /* offset of mesage length */
+#define IE_BEGIN_POS 9 /* offset of first information element */
+
+/* format of signalling messages */
+#define TYPE_POS 0
+#define LEN_POS 2
+#define FIELD_BEGIN_POS 4
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.189 2002-07-11 08:27:03 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.190 2002-07-11 09:17:22 guy Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
extern void aarp_print(const u_char *, u_int);
extern void arp_print(const u_char *, u_int, u_int);
extern void atalk_print(const u_char *, u_int);
+extern void atm_print(u_int, u_int, u_int, const u_char *, u_int, u_int);
extern void atm_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
+extern void bpfatm_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
+extern void sunatm_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
extern void bootp_print(const u_char *, u_int, u_short, u_short);
extern void bgp_print(const u_char *, int);
extern void beep_print(const u_char *, u_int);
extern void raw_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
extern void rip_print(const u_char *, u_int);
extern void sl_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
+extern void lane_print(const u_char *, u_int, u_int);
extern void lane_if_print(u_char *, const struct pcap_pkthdr *,const u_char *);
extern void cip_if_print(u_char *, const struct pcap_pkthdr *,const u_char *);
extern void sl_bsdos_if_print(u_char *, const struct pcap_pkthdr *,
*
*/
-/* $Id: lane.h,v 1.4 2002-06-11 17:08:39 itojun Exp $ */
+/* $Id: lane.h,v 1.5 2002-07-11 09:17:23 guy Exp $ */
#ifndef ETHER_ADDR_LEN
#define ETHER_ADDR_LEN 6
u_int8_t h_source[ETHER_ADDR_LEN];
u_int16_t h_type;
};
+
+struct lane_controlhdr {
+ u_int16_t lec_header;
+ u_int8_t lec_proto;
+ u_int8_t lec_vers;
+ u_int16_t lec_opcode;
+};
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-arp.c,v 1.53 2002-04-25 04:37:31 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-arp.c,v 1.54 2002-07-11 09:17:23 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#define THA(ap) (ar_tha(ap))
#define TPA(ap) (ar_tpa(ap))
+/*
+ * ATM Address Resolution Protocol.
+ *
+ * See RFC 2225 for protocol description. ARP packets are variable
+ * in size; the arphdr structure defines the fixed-length portion.
+ * Protocol type values are the same as those for 10 Mb/s Ethernet.
+ * It is followed by the variable-sized fields ar_sha, arp_spa,
+ * arp_tha and arp_tpa in that order, according to the lengths
+ * specified. Field names used correspond to RFC 826.
+ */
+struct atmarp_pkthdr {
+ u_short ar_hrd; /* format of hardware address */
+#define ARPHRD_ATM2225 19 /* ATM (RFC 2225) */
+ u_short ar_pro; /* format of protocol address */
+ u_char ar_shtl; /* length of hardware address */
+ u_char ar_sstl; /* length of hardware address */
+ u_short ar_op; /* same as regular ARP */
+ u_char ar_spln;
+ u_char ar_thtl;
+ u_char ar_tstl;
+ u_char ar_tpln;
+/*
+ * The remaining fields are variable in size,
+ * according to the sizes above.
+ */
+#ifdef COMMENT_ONLY
+ u_char ar_sha[]; /* sender hardware address */
+ u_char ar_spa[]; /* sender protocol address */
+ u_char ar_tha[]; /* target hardware address */
+ u_char ar_tpa[]; /* target protocol address */
+#endif
+#define ar_sha(ap) (((const u_char *)((ap)+1))+0)
+#define ar_spa(ap) (((const u_char *)((ap)+1))+ (ap)->ar_hln)
+#define ar_tha(ap) (((const u_char *)((ap)+1))+ (ap)->ar_hln+(ap)->ar_pln)
+#define ar_tpa(ap) (((const u_char *)((ap)+1))+2*(ap)->ar_hln+(ap)->ar_pln)
+};
+
static u_char ezero[6];
+static void
+atmarp_print(const u_char *bp, u_int length, u_int caplen)
+{
+ const struct arp_pkthdr *ap;
+ u_short pro, hrd, op;
+
+ ap = (const struct arp_pkthdr *)bp;
+ TCHECK(*ap);
+ if ((const u_char *)(ar_tpa(ap) + PLN(ap)) > snapend) {
+ (void)printf("truncated-arp");
+ default_print((const u_char *)ap, length);
+ return;
+ }
+
+ hrd = EXTRACT_16BITS(&HRD(ap));
+ if (hrd == ARPHRD_ATM2225)
+ atmarp_print(bp, length, caplen);
+ pro = EXTRACT_16BITS(&PRO(ap));
+ op = EXTRACT_16BITS(&OP(ap));
+
+ if (pro != ETHERTYPE_IP && pro != ETHERTYPE_TRAIL) {
+ (void)printf("arp-#%d for proto #%d (%d) hardware #%d (%d)",
+ op, pro, PLN(ap), hrd, HLN(ap));
+ return;
+ }
+ if (pro == ETHERTYPE_TRAIL)
+ (void)printf("trailer-");
+ switch (op) {
+
+ case ARPOP_REQUEST:
+ (void)printf("arp who-has %s", ipaddr_string(TPA(ap)));
+ if (memcmp((const char *)ezero, (const char *)THA(ap), HLN(ap)) != 0)
+ (void)printf(" (%s)",
+ linkaddr_string(THA(ap), HLN(ap)));
+ (void)printf(" tell %s", ipaddr_string(SPA(ap)));
+ break;
+
+ case ARPOP_REPLY:
+ (void)printf("arp reply %s", ipaddr_string(SPA(ap)));
+ (void)printf(" is-at %s", linkaddr_string(SHA(ap), HLN(ap)));
+ break;
+
+ case ARPOP_REVREQUEST:
+ (void)printf("rarp who-is %s tell %s",
+ linkaddr_string(THA(ap), HLN(ap)),
+ linkaddr_string(SHA(ap), HLN(ap)));
+ break;
+
+ case ARPOP_REVREPLY:
+ (void)printf("rarp reply %s at %s",
+ linkaddr_string(THA(ap), HLN(ap)),
+ ipaddr_string(TPA(ap)));
+ break;
+
+ case ARPOP_INVREQUEST:
+ (void)printf("invarp who-is %s tell %s",
+ linkaddr_string(THA(ap), HLN(ap)),
+ linkaddr_string(SHA(ap), HLN(ap)));
+ break;
+
+ case ARPOP_INVREPLY:
+ (void)printf("invarp reply %s at %s",
+ linkaddr_string(THA(ap), HLN(ap)),
+ ipaddr_string(TPA(ap)));
+ break;
+
+ default:
+ (void)printf("arp-#%d", op);
+ default_print((const u_char *)ap, caplen);
+ return;
+ }
+ if (hrd != ARPHRD_ETHER)
+ printf(" hardware #%d", hrd);
+ return;
+trunc:
+ (void)printf("[|arp]");
+}
+
void
arp_print(const u_char *bp, u_int length, u_int caplen)
{
return;
}
- pro = EXTRACT_16BITS(&PRO(ap));
hrd = EXTRACT_16BITS(&HRD(ap));
+ if (hrd == ARPHRD_ATM2225)
+ atmarp_print(bp, length, caplen);
+ pro = EXTRACT_16BITS(&PRO(ap));
op = EXTRACT_16BITS(&OP(ap));
if (pro != ETHERTYPE_IP && pro != ETHERTYPE_TRAIL) {
ipaddr_string(TPA(ap)));
break;
+ case ARPOP_INVREQUEST:
+ (void)printf("invarp who-is %s tell %s",
+ linkaddr_string(THA(ap), HLN(ap)),
+ linkaddr_string(SHA(ap), HLN(ap)));
+ break;
+
+ case ARPOP_INVREPLY:
+ (void)printf("invarp reply %s at %s",
+ linkaddr_string(THA(ap), HLN(ap)),
+ ipaddr_string(TPA(ap)));
+ break;
+
default:
(void)printf("arp-#%d", op);
default_print((const u_char *)ap, caplen);
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.23 2002-04-07 10:05:40 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.24 2002-07-11 09:17:23 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include <string.h>
#include "interface.h"
+#include "extract.h"
#include "addrtoname.h"
#include "ethertype.h"
+#include "atm.h"
+#include "atmuni31.h"
#include "ether.h"
memset(&ehdr, '\0', sizeof ehdr);
/*
- * Some printers want to get back at the ethernet 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.
- */
- snapend = p + caplen;
- /*
+ * Some printers want to get back at the ethernet addresses.
+ * Rather than pass it all the way down, we set this global.
+ *
* Actually, the only printers that use packetp are print-arp.c
* and print-bootp.c, and they assume that packetp points to an
* Ethernet header. The right thing to do is to fix them to know
printf("[|atm]");
goto out;
}
+
+ /*
+ * Some printers want to check that they're not walking off the
+ * end of the packet.
+ * Rather than pass it all the way down, we set this global.
+ */
+ snapend = p + caplen;
+
if (p[0] != 0xaa || p[1] != 0xaa || p[2] != 0x03) {
/*
* XXX - assume 802.6 MAC header from Fore driver.
default_print(p, caplen);
out:
putchar('\n');
- --infodelay;
- if (infoprint)
- info(0);
+}
+
+/*
+ * ATM signalling.
+ */
+static struct tok msgtype2str[] = {
+ { CALL_PROCEED, "Call_proceeding" },
+ { CONNECT, "Connect" },
+ { CONNECT_ACK, "Connect_ack" },
+ { SETUP, "Setup" },
+ { RELEASE, "Release" },
+ { RELEASE_DONE, "Release_complete" },
+ { RESTART, "Restart" },
+ { RESTART_ACK, "Restart_ack" },
+ { STATUS, "Status" },
+ { STATUS_ENQ, "Status_enquiry" },
+ { ADD_PARTY, "Add_party" },
+ { ADD_PARTY_ACK, "Add_party_ack" },
+ { ADD_PARTY_REJ, "Add_party_reject" },
+ { DROP_PARTY, "Drop_party" },
+ { DROP_PARTY_ACK, "Drop_party_ack" },
+ { 0, NULL }
+};
+
+static void
+sig_print(const u_char *p, int caplen)
+{
+ bpf_u_int32 call_ref;
+
+ if (caplen < PROTO_POS) {
+ printf("[|atm]");
+ return;
+ }
+ if (p[PROTO_POS] == Q2931) {
+ /*
+ * protocol:Q.2931 for User to Network Interface
+ * (UNI 3.1) signalling
+ */
+ printf("Q.2931");
+ if (caplen < MSG_TYPE_POS) {
+ printf(" [|atm]");
+ return;
+ }
+ printf(":%s ",
+ tok2str(msgtype2str, "msgtype#%d", p[MSG_TYPE_POS]));
+
+ if (caplen < CALL_REF_POS+3) {
+ printf("[|atm]");
+ return;
+ }
+ call_ref = EXTRACT_24BITS(&p[CALL_REF_POS]);
+ printf("CALL_REF:0x%06x", call_ref);
+ } else {
+ /* SCCOP with some unknown protocol atop it */
+ printf("SSCOP, proto %d ", p[PROTO_POS]);
+ }
+}
+
+/*
+ * Print an ATM PDU (such as an AAL5 PDU).
+ */
+void
+atm_print(u_int vpi, u_int vci, u_int traftype, const u_char *p, u_int length,
+ u_int caplen)
+{
+ if (eflag)
+ printf("VPI:%u VCI:%u ", vpi, vci);
+
+ /*
+ * Some printers want to check that they're not walking off the
+ * end of the packet.
+ * Rather than pass it all the way down, we set this global.
+ */
+ snapend = p + caplen;
+
+ if (vpi == 0) {
+ switch (vci) {
+
+ case PPC:
+ sig_print(p, caplen);
+ goto out;
+
+ case BCC:
+ printf("broadcast sig: ");
+ goto out;
+
+ case OAMF4SC:
+ printf("oamF4(segment): ");
+ goto out;
+
+ case OAMF4EC:
+ printf("oamF4(end): ");
+ goto out;
+
+ case METAC:
+ printf("meta: ");
+ goto out;
+
+ case ILMIC:
+ printf("ilmi: ");
+ snmp_print(p, length);
+ goto out;
+ }
+ }
+
+ switch (traftype) {
+
+ case ATM_LLC:
+ default:
+ /*
+ * Assumes traffic is LLC if unknown.
+ */
+ atm_llc_print(p, length, caplen);
+ break;
+
+ case ATM_LANE:
+ lane_print(p, length, caplen);
+ break;
+ }
+
+out:
+ if (xflag)
+ default_print(p, caplen);
}
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.13 2002-06-11 17:08:51 itojun Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.14 2002-07-11 09:17:24 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "ether.h"
#include "lane.h"
+static const struct tok lecop2str[] = {
+ { 0x0001, "configure request" },
+ { 0x0101, "configure response" },
+ { 0x0002, "join request" },
+ { 0x0102, "join response" },
+ { 0x0003, "ready query" },
+ { 0x0103, "ready indication" },
+ { 0x0004, "register request" },
+ { 0x0104, "register response" },
+ { 0x0005, "unregister request" },
+ { 0x0105, "unregister response" },
+ { 0x0006, "ARP request" },
+ { 0x0106, "ARP response" },
+ { 0x0007, "flush request" },
+ { 0x0107, "flush response" },
+ { 0x0008, "NARP request" },
+ { 0x0009, "topology request" },
+ { 0, NULL }
+};
+
static inline void
-lane_print(register const u_char *bp, int length)
+lane_hdr_print(register const u_char *bp, int length)
{
register const struct lecdatahdr_8023 *ep;
ep = (const struct lecdatahdr_8023 *)bp;
if (qflag)
- (void)printf("lecid:%d %s %s %d: ",
+ (void)printf("lecid:%x %s %s %d: ",
ntohs(ep->le_header),
etheraddr_string(ep->h_source),
etheraddr_string(ep->h_dest),
length);
else
- (void)printf("lecid:%d %s %s %s %d: ",
+ (void)printf("lecid:%x %s %s %s %d: ",
ntohs(ep->le_header),
etheraddr_string(ep->h_source),
etheraddr_string(ep->h_dest),
* to the ether header of the packet, 'h->tv' is the timestamp,
* 'h->length' is the length of the packet off the wire, and 'h->caplen'
* is the number of bytes actually captured.
+ *
+ * This assumes 802.3, not 802.5, LAN emulation.
*/
void
-lane_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
+lane_print(const u_char *p, u_int length, u_int caplen)
{
- int caplen = h->caplen;
- int length = h->len;
+ struct lane_controlhdr *lec;
struct lecdatahdr_8023 *ep;
u_short ether_type;
u_short extracted_ethertype;
- ++infodelay;
- ts_print(&h->ts);
+ if (caplen < sizeof(struct lane_controlhdr)) {
+ printf("[|lane]");
+ return;
+ }
+
+ lec = (struct lane_controlhdr *)p;
+ if (ntohs(lec->lec_header) == 0xff00) {
+ /*
+ * LE Control.
+ */
+ printf("lec: proto %x vers %x %s",
+ lec->lec_proto, lec->lec_vers,
+ tok2str(lecop2str, "opcode-#%u", ntohs(lec->lec_opcode)));
+ return;
+ }
if (caplen < sizeof(struct lecdatahdr_8023)) {
printf("[|lane]");
- goto out;
+ return;
}
if (eflag)
- lane_print(p, length);
+ lane_hdr_print(p, length);
/*
* Some printers want to get back at the ethernet 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;
+ packetp = p + 2; /* skip the LECID */
snapend = p + caplen;
length -= sizeof(struct lecdatahdr_8023);
* Is it (gag) an 802.3 encapsulation?
*/
extracted_ethertype = 0;
- if (ether_type < ETHERMTU) {
+ if (ether_type <= ETHERMTU) {
/* Try to print the LLC-layer header & higher layers */
if (llc_print(p, length, caplen, ep->h_source, ep->h_dest,
&extracted_ethertype) == 0) {
/* ether_type not known, print raw packet */
if (!eflag)
- lane_print((u_char *)ep, length + sizeof(*ep));
+ lane_hdr_print((u_char *)ep, length + sizeof(*ep));
if (extracted_ethertype) {
printf("(LLC %s) ",
etherproto_string(htons(extracted_ethertype)));
&extracted_ethertype) == 0) {
/* ether_type not known, print raw packet */
if (!eflag)
- lane_print((u_char *)ep, length + sizeof(*ep));
+ lane_hdr_print((u_char *)ep, length + sizeof(*ep));
if (!xflag && !qflag)
default_print(p, caplen);
}
if (xflag)
default_print(p, caplen);
- out:
+}
+
+void
+lane_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
+{
+ int caplen = h->caplen;
+ int length = h->len;
+
+ ++infodelay;
+ ts_print(&h->ts);
+
+ lane_print(p, length, caplen);
+
putchar('\n');
--infodelay;
if (infoprint)
--- /dev/null
+/*
+ * Copyright (c) 1997 Yen Yen Lim and North Dakota State University
+ * 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. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Yen Yen Lim and
+ North Dakota State University
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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 <sys/param.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+
+struct mbuf;
+struct rtentry;
+
+#include <netinet/in.h>
+
+#include <stdio.h>
+#include <pcap.h>
+
+#include "interface.h"
+#include "extract.h"
+#include "addrtoname.h"
+
+#include "atm.h"
+#include "atmuni31.h"
+
+/* SunATM header for ATM packet */
+#define DIR_POS 0 /* Direction (0x80 = transmit, 0x00 = receive) */
+#define VPI_POS 1 /* VPI */
+#define VCI_POS 2 /* VCI */
+#define PKT_BEGIN_POS 4 /* Start of the ATM packet */
+
+/* Protocol type values in the bottom for bits of the byte at SUNATM_DIR_POS. */
+#define PT_LANE 0x01 /* LANE */
+#define PT_LLC 0x02 /* LLC encapsulation */
+
+/*
+ * This is the top level routine of the printer. 'p' is the points
+ * to the SunATM pseudo-header for the packet, 'h->tv' is the timestamp,
+ * 'h->length' is the length of the packet off the wire, and 'h->caplen'
+ * is the number of bytes actually captured.
+ */
+void
+sunatm_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
+{
+ u_int caplen = h->caplen;
+ u_int length = h->len;
+ u_short vci;
+ u_char vpi;
+ u_int traftype;
+
+ ts_print(&h->ts);
+
+ if (caplen < PKT_BEGIN_POS) {
+ printf("[|atm]");
+ goto out;
+ }
+
+ if (eflag) {
+ if (p[DIR_POS] & 0x80)
+ printf("Tx: ");
+ else
+ printf("Rx: ");
+ }
+
+ switch (p[DIR_POS] & 0x0f) {
+
+ case PT_LANE:
+ traftype = ATM_LANE;
+ break;
+
+ case PT_LLC:
+ traftype = ATM_LLC;
+ break;
+
+ default:
+ traftype = ATM_UNKNOWN;
+ break;
+ }
+
+ vci = EXTRACT_16BITS(&p[VCI_POS]);
+ vpi = p[VPI_POS];
+
+ p += PKT_BEGIN_POS;
+ caplen -= PKT_BEGIN_POS;
+ length -= PKT_BEGIN_POS;
+ atm_print(vpi, vci, traftype, p, length, caplen);
+
+ out:
+ putchar('\n');
+ --infodelay;
+ if (infoprint)
+ info(0);
+}
-.\" @(#) $Header: /tcpdump/master/tcpdump/Attic/tcpdump.1,v 1.122 2002-06-24 21:06:23 fenner Exp $ (LBL)
+.\" @(#) $Header: /tcpdump/master/tcpdump/Attic/tcpdump.1,v 1.123 2002-07-11 09:17:24 guy Exp $ (LBL)
.\"
.\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997
.\" The Regents of the University of California. All rights reserved.
.in -.5i
where \fIp\fR is one of the above protocols.
Note that \fItcpdump\fR does an incomplete job of parsing these protocols.
+.IP "\fBvpi\fP \fIn\fR
+True if the packet is an ATM packet, for SunATM on Solaris, with a
+virtual path identifier of
+.IR n .
+.IP "\fBvci\fP \fIn\fR
+True if the packet is an ATM packet, for SunATM on Solaris, with a
+virtual channel identifier of
+.IR n .
+.IP \fBlane\fP
+True if the packet is an ATM packet, for SunATM on Solaris, and is
+an ATM LANE packet.
+.IP \fBllc\fP
+True if the packet is an ATM packet, for SunATM on Solaris, and is
+an LLC-encapsulated packet.
+.IP \fBoamf4s\fP
+True if the packet is an ATM packet, for SunATM on Solaris, and is
+a segment OAM F4 flow cell (VPI=0 & VCI=3).
+.IP \fBoamf4e\fP
+True if the packet is an ATM packet, for SunATM on Solaris, and is
+an end-to-end OAM F4 flow cell (VPI=0 & VCI=4).
+.IP \fBoamf4\fP
+True if the packet is an ATM packet, for SunATM on Solaris, and is
+a segment or end-to-end OAM F4 flow cell (VPI=0 & (VCI=3 | VCI=4)).
+.IP \fBoam\fP
+True if the packet is an ATM packet, for SunATM on Solaris, and is
+a segment or end-to-end OAM F4 flow cell (VPI=0 & (VCI=3 | VCI=4)).
+.IP \fBmetac\fP
+True if the packet is an ATM packet, for SunATM on Solaris, and is
+on a meta signaling circuit (VPI=0 & VCI=1).
+.IP \fBbcc\fP
+True if the packet is an ATM packet, for SunATM on Solaris, and is
+on a broadcast signaling circuit (VPI=0 & VCI=2).
+.IP \fBsc\fP
+True if the packet is an ATM packet, for SunATM on Solaris, and is
+on a signaling circuit (VPI=0 & VCI=5).
+.IP \fBilmic\fP
+True if the packet is an ATM packet, for SunATM on Solaris, and is
+on an ILMI circuit (VPI=0 & VCI=16).
+.IP \fBconnectmsg\fP
+True if the packet is an ATM packet, for SunATM on Solaris, and is
+on a signaling circuit and is a Q.2931 Setup, Call Proceeding, Connect,
+Connect Ack, Release, or Release Done message.
+.IP \fBmetaconnect\fP
+True if the packet is an ATM packet, for SunATM on Solaris, and is
+on a meta signaling circuit and is a Q.2931 Setup, Call Proceeding, Connect,
+Release, or Release Done message.
.IP "\fIexpr relop expr\fR"
True if the relation holds, where \fIrelop\fR is one of >, <, >=, <=, =, !=,
and \fIexpr\fR is an arithmetic expression composed of integer constants
"@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
The Regents of the University of California. All rights reserved.\n";
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.178 2002-07-11 08:09:47 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.179 2002-07-11 09:17:25 guy Exp $ (LBL)";
#endif
/*
#endif
#ifdef DLT_FRELAY
{ fr_if_print, DLT_FRELAY },
+#endif
+#ifdef DLT_SUNATM
+ { sunatm_if_print, DLT_SUNATM },
#endif
{ NULL, 0 },
};