mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-31 12:13:10 +00:00
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>
This commit is contained in:
parent
7b4e5796b9
commit
0d086d2934
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=17749
@ -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;
|
||||
|
@ -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. */
|
||||
|
||||
|
@ -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); }
|
||||
|
43
contrib/libpcap/nlpid.h
Normal file
43
contrib/libpcap/nlpid.h
Normal file
@ -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
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user