diff options
author | pst <pst@FreeBSD.org> | 1996-08-21 20:01:08 +0000 |
---|---|---|
committer | pst <pst@FreeBSD.org> | 1996-08-21 20:01:08 +0000 |
commit | 624cf51a56f60de14c441f503a12de6a89001f9c (patch) | |
tree | baf87663b1bebe77fd7548e07a2b3bb94cd45ec8 /contrib/libpcap/gencode.c | |
parent | a9ea88b748a36504648eb9ae3a195fc7b1790176 (diff) | |
download | FreeBSD-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/libpcap/gencode.c')
-rw-r--r-- | contrib/libpcap/gencode.c | 49 |
1 files changed, 47 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; |