From: hannes Date: Tue, 19 Oct 2004 15:55:28 +0000 (+0000) Subject: add support for DLT_JUNIPER_ATM1 (137) and DLT_JUNIPER_ATM2 (135) X-Git-Tag: libpcap-0.9.1~144 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/3bcf07168cf6ca0b0ca90bd054bcb4b55ac64fff add support for DLT_JUNIPER_ATM1 (137) and DLT_JUNIPER_ATM2 (135) --- diff --git a/gencode.c b/gencode.c index e8c5fb0f..3889ba36 100644 --- 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.209 2004-08-27 07:37:10 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.210 2004-10-19 15:55:28 hannes Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -1016,6 +1016,18 @@ init_linktype(type) off_nl_nosnap = PFLOG_HDRLEN; return; + case DLT_JUNIPER_ATM1: + off_linktype = 4; /* in reality variable between 4-8 */ + off_nl = 4; + off_nl_nosnap = 14; + return; + + case DLT_JUNIPER_ATM2: + off_linktype = 8; /* in reality variable between 8-12 */ + off_nl = 8; + off_nl_nosnap = 18; + return; + #ifdef DLT_PFSYNC case DLT_PFSYNC: off_linktype = -1; @@ -1794,6 +1806,17 @@ gen_linktype(proto) /*NOTREACHED*/ break; + case DLT_JUNIPER_ATM1: + case DLT_JUNIPER_ATM2: + /* just lets verify the magic number for now - + * we may have upto 6 different encapsulations on the wire + * and need a lot of heuristics to figure out that the payload + * might be; + * + * FIXME encapsulation specific BPF_ filters + */ + return gen_mcmp(0, BPF_W, 0x4d474300, 0xffffff00); /* compare the magic number */ + case DLT_LINUX_IRDA: bpf_error("IrDA link-layer type filtering not implemented"); @@ -5079,6 +5102,19 @@ gen_inbound(dir) } break; + case DLT_JUNIPER_ATM1: + case DLT_JUNIPER_ATM2: + /* juniper flags (including direction) are stored + * the byte after the 3-byte magic number */ + if (dir) { + /* match outgoing packets */ + b0 = gen_mcmp(3, BPF_B, 0, 0x01); + } else { + /* match incoming packets */ + b0 = gen_mcmp(3, BPF_B, 1, 0x01); + } + break; + default: bpf_error("inbound/outbound not supported on linktype %d", linktype); diff --git a/pcap.c b/pcap.c index 7bf33744..eb4cd957 100644 --- 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.75 2004-10-19 07:06:14 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.76 2004-10-19 15:55:28 hannes Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -352,6 +352,8 @@ static struct dlt_choice dlt_choices[] = { DLT_CHOICE(DLT_LINUX_IRDA, "Linux IrDA"), DLT_CHOICE(DLT_IEEE802_11_RADIO_AVS, "802.11 plus AVS radio information header"), DLT_CHOICE(DLT_SYMANTEC_FIREWALL, "Symantec Firewall"), + DLT_CHOICE(DLT_JUNIPER_ATM1, "Juniper ATM1 PIC"), + DLT_CHOICE(DLT_JUNIPER_ATM2, "Juniper ATM2 PIC"), DLT_CHOICE_SENTINEL };