summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorpst <pst@FreeBSD.org>1996-08-21 20:01:08 +0000
committerpst <pst@FreeBSD.org>1996-08-21 20:01:08 +0000
commit624cf51a56f60de14c441f503a12de6a89001f9c (patch)
treebaf87663b1bebe77fd7548e07a2b3bb94cd45ec8 /contrib
parenta9ea88b748a36504648eb9ae3a195fc7b1790176 (diff)
downloadFreeBSD-src-624cf51a56f60de14c441f503a12de6a89001f9c.zip
FreeBSD-src-624cf51a56f60de14c441f503a12de6a89001f9c.tar.gz
Add support for ISO CLNP/ES-IS/IS-IS.
These changes have been also sent back to LBL for inclusion in next release. Submitted by: Tony Li <tli@jnx.com>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/libpcap/gencode.c49
-rw-r--r--contrib/libpcap/gencode.h3
-rw-r--r--contrib/libpcap/grammar.y4
-rw-r--r--contrib/libpcap/nlpid.h43
-rw-r--r--contrib/libpcap/scanner.l6
5 files changed, 103 insertions, 2 deletions
diff --git a/contrib/libpcap/gencode.c b/contrib/libpcap/gencode.c
index 409934b..126e228 100644
--- a/contrib/libpcap/gencode.c
+++ b/contrib/libpcap/gencode.c
@@ -40,6 +40,7 @@ struct rtentry;
#include <stdlib.h>
#include <memory.h>
#include <setjmp.h>
+#include <net/if_llc.h>
#if __STDC__
#include <stdarg.h>
#else
@@ -49,6 +50,7 @@ struct rtentry;
#include "pcap-int.h"
#include "ethertype.h"
+#include "nlpid.h"
#include "gencode.h"
#include <pcap-namedb.h>
@@ -565,6 +567,24 @@ gen_linktype(proto)
return (gen_cmp(0, BPF_W, (bpf_int32)AF_INET));
else
return gen_false();
+ case DLT_EN10MB:
+ /*
+ * Having to look at SAP's here is quite disgusting,
+ * but given an internal architecture that _knows_ that
+ * it's looking at IP on Ethernet...
+ */
+ if (proto == LLC_ISO_LSAP) {
+ struct block *b0, *b1;
+
+ b0 = gen_cmp(off_linktype, BPF_H, (long)ETHERMTU);
+ b0->s.code = JMP(BPF_JGT);
+ gen_not(b0);
+ b1 = gen_cmp(off_linktype + 2, BPF_H, (long)
+ ((LLC_ISO_LSAP << 8) | LLC_ISO_LSAP));
+ gen_and(b0, b1);
+ return b1;
+ }
+ break;
}
return gen_cmp(off_linktype, BPF_H, (bpf_int32)proto);
}
@@ -836,6 +856,9 @@ gen_host(addr, mask, proto, dir)
case Q_MOPRC:
bpf_error("MOPRC host filtering not implemented");
+ case Q_ISO:
+ bpf_error("ISO host filtering not implemented");
+
default:
abort();
}
@@ -917,7 +940,7 @@ gen_proto_abbrev(proto)
#define IPPROTO_IGRP 9
#endif
case Q_IGRP:
- b0 = gen_linktype(ETHERTYPE_IP);
+ b0 = gen_linktype(ETHERTYPE_IP);
b1 = gen_cmp(off_nl + 9, BPF_B, (long)IPPROTO_IGRP);
gen_and(b0, b1);
break;
@@ -961,6 +984,18 @@ gen_proto_abbrev(proto)
b1 = gen_linktype(ETHERTYPE_MOPRC);
break;
+ case Q_ISO:
+ b1 = gen_linktype(LLC_ISO_LSAP);
+ break;
+
+ case Q_ESIS:
+ b1 = gen_proto(ISO9542_ESIS, Q_ISO, Q_DEFAULT);
+ break;
+
+ case Q_ISIS:
+ b1 = gen_proto(ISO10589_ISIS, Q_ISO, Q_DEFAULT);
+ break;
+
default:
abort();
}
@@ -1125,6 +1160,12 @@ gen_proto(v, proto, dir)
gen_and(b0, b1);
return b1;
+ case Q_ISO:
+ b0 = gen_linktype(LLC_ISO_LSAP);
+ b1 = gen_cmp(off_nl + 3, BPF_B, (long)v);
+ gen_and(b0, b1);
+ return b1;
+
case Q_ARP:
bpf_error("arp does not encapsulate another protocol");
/* NOTREACHED */
@@ -1510,7 +1551,7 @@ gen_load(proto, index, size)
case Q_LAT:
case Q_MOPRC:
case Q_MOPDL:
- /* XXX Note that we assume a fixed link link header here. */
+ /* XXX Note that we assume a fixed link header here. */
s = xfer_to_x(index);
tmp = new_stmt(BPF_LD|BPF_IND|size);
tmp->s.k = off_nl;
@@ -1738,6 +1779,10 @@ gen_greater(n)
return gen_len(BPF_JGE, n);
}
+/*
+ * Actually, this is less than or equal.
+ */
+
struct block *
gen_less(n)
int n;
diff --git a/contrib/libpcap/gencode.h b/contrib/libpcap/gencode.h
index 3a770e3..eb97ec2 100644
--- a/contrib/libpcap/gencode.h
+++ b/contrib/libpcap/gencode.h
@@ -51,6 +51,9 @@
#define Q_SCA 13
#define Q_MOPRC 14
#define Q_MOPDL 15
+#define Q_ISO 16
+#define Q_ESIS 17
+#define Q_ISIS 18
/* Directional qualifiers. */
diff --git a/contrib/libpcap/grammar.y b/contrib/libpcap/grammar.y
index 283e2ea..08f639f 100644
--- a/contrib/libpcap/grammar.y
+++ b/contrib/libpcap/grammar.y
@@ -112,6 +112,7 @@ pcap_parse()
%token ID EID HID
%token LSH RSH
%token LEN
+%token ISO ESIS ISIS
%type <s> ID
%type <e> EID
@@ -235,6 +236,9 @@ pname: LINK { $$ = Q_LINK; }
| SCA { $$ = Q_SCA; }
| MOPDL { $$ = Q_MOPDL; }
| MOPRC { $$ = Q_MOPRC; }
+ | ISO { $$ = Q_ISO; }
+ | ESIS { $$ = Q_ESIS; }
+ | ISIS { $$ = Q_ISIS; }
;
other: pqual TK_BROADCAST { $$ = gen_broadcast($1); }
| pqual TK_MULTICAST { $$ = gen_multicast($1); }
diff --git a/contrib/libpcap/nlpid.h b/contrib/libpcap/nlpid.h
new file mode 100644
index 0000000..c033da2
--- /dev/null
+++ b/contrib/libpcap/nlpid.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 1996
+ * Juniper Networks, Inc. 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. The name of Juniper Networks 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$ (Juniper)
+ */
+
+/* Types missing from some systems */
+
+/*
+ * Network layer prototocol identifiers
+ */
+#ifndef ISO8473_CLNP
+#define ISO8473_CLNP 0x81
+#endif
+#ifndef ISO9542_ESIS
+#define ISO9542_ESIS 0x82
+#endif
+#ifndef ISO9542X25_ESIS
+#define ISO9542X25_ESIS 0x8a
+#endif
+#ifndef ISO10589_ISIS
+#define ISO10589_ISIS 0x83
+#endif
+#ifndef ISO8878A_CONS
+#define ISO8878A_CONS 0x84
+#endif
+#ifndef ISO10747_IDRP
+#define ISO10747_IDRP 0x85
+#endif
diff --git a/contrib/libpcap/scanner.l b/contrib/libpcap/scanner.l
index 641466f..741ca7d 100644
--- a/contrib/libpcap/scanner.l
+++ b/contrib/libpcap/scanner.l
@@ -100,6 +100,12 @@ sca return SCA;
moprc return MOPRC;
mopdl return MOPDL;
+iso return ISO;
+esis return ESIS;
+es-is return ESIS;
+isis return ISIS;
+is-is return ISIS;
+
host return HOST;
net return NET;
mask return MASK;
OpenPOWER on IntegriCloud