add support for another PPP variant as per request from Karsten Keil <kkeil@suse.de>
the first byte (0xff) of the PPP header (0xff03) is tweaked to accomodate the direction 0x00 = IN, 0x01 = OUT the DLT_ supports the libpcap tokens "inbound" and "outbound"
This commit is contained in:
parent
3f7430de17
commit
4017783b36
14
gencode.c
14
gencode.c
|
@ -21,7 +21,7 @@
|
|||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.207 2004-07-15 00:08:06 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.208 2004-08-18 14:25:02 hannes Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -750,6 +750,7 @@ init_linktype(type)
|
|||
return;
|
||||
|
||||
case DLT_PPP:
|
||||
case DLT_PPP_WITHDIRECTION:
|
||||
case DLT_C_HDLC: /* BSD/OS Cisco HDLC */
|
||||
case DLT_PPP_SERIAL: /* NetBSD sync/async serial PPP */
|
||||
off_linktype = 2;
|
||||
|
@ -1506,6 +1507,7 @@ gen_linktype(proto)
|
|||
break;
|
||||
|
||||
case DLT_PPP:
|
||||
case DLT_PPP_WITHDIRECTION:
|
||||
case DLT_PPP_SERIAL:
|
||||
case DLT_PPP_ETHER:
|
||||
/*
|
||||
|
@ -5067,6 +5069,16 @@ gen_inbound(dir)
|
|||
(bpf_int32)((dir == 0) ? PF_IN : PF_OUT));
|
||||
break;
|
||||
|
||||
case DLT_PPP_WITHDIRECTION:
|
||||
if (dir) {
|
||||
/* match outgoing packets */
|
||||
b0 = gen_cmp(0, BPF_B, PPP_WITHDIRECTION_OUT);
|
||||
} else {
|
||||
/* match incoming packets */
|
||||
b0 = gen_cmp(0, BPF_B, PPP_WITHDIRECTION_IN);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
bpf_error("inbound/outbound not supported on linktype %d",
|
||||
linktype);
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
*
|
||||
* @(#)bpf.h 7.1 (Berkeley) 5/7/91
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/libpcap/pcap-bpf.h,v 1.21 2004-06-07 20:00:08 guy Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/libpcap/pcap-bpf.h,v 1.22 2004-08-18 14:25:01 hannes Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -509,6 +509,13 @@ struct bpf_version {
|
|||
*/
|
||||
#define DLT_BACNET_MS_TP 165
|
||||
|
||||
/*
|
||||
* another PPP variant as per request from Karsten Keil <kkeil@suse.de>
|
||||
* the first byte of the PPP header (0xff03) is modified to accomodate
|
||||
* the direction 0x00 = IN, 0x01 = OUT
|
||||
*/
|
||||
#define DLT_PPP_WITHDIRECTION 166
|
||||
|
||||
/*
|
||||
* The instruction encodings.
|
||||
*/
|
||||
|
|
5
ppp.h
5
ppp.h
|
@ -1,4 +1,4 @@
|
|||
/* @(#) $Header: /tcpdump/master/libpcap/ppp.h,v 1.9 2004-06-16 08:20:28 hannes Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/libpcap/ppp.h,v 1.10 2004-08-18 14:25:01 hannes Exp $ (LBL) */
|
||||
/*
|
||||
* Point to Point Protocol (PPP) RFC1331
|
||||
*
|
||||
|
@ -18,6 +18,9 @@
|
|||
#define PPP_ADDRESS 0xff /* The address byte value */
|
||||
#define PPP_CONTROL 0x03 /* The control byte value */
|
||||
|
||||
#define PPP_WITHDIRECTION_IN 0x00 /* non-standard for DLT_PPP_WITHDIRECTION */
|
||||
#define PPP_WITHDIRECTION_OUT 0x01 /* non-standard for DLT_PPP_WITHDIRECTION */
|
||||
|
||||
/* Protocol numbers */
|
||||
#define PPP_IP 0x0021 /* Raw IP */
|
||||
#define PPP_OSI 0x0023 /* OSI Network Layer */
|
||||
|
|
13
savefile.c
13
savefile.c
|
@ -30,7 +30,7 @@
|
|||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.108 2004-08-17 17:50:33 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.109 2004-08-18 14:25:01 hannes Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -333,6 +333,14 @@ static const char rcsid[] _U_ =
|
|||
*/
|
||||
#define LINKTYPE_BACNET_MS_TP 165
|
||||
|
||||
/*
|
||||
* another PPP variant as per request from Karsten Keil <kkeil@suse.de>
|
||||
* the first byte (0xff) of the PPP header (0xff03) is tweaked to accomodate
|
||||
* the direction 0x00 = IN, 0x01 = OUT
|
||||
*/
|
||||
#define LINKTYPE_PPP_WITHDIRECTION 166
|
||||
|
||||
|
||||
static struct linktype_map {
|
||||
int dlt;
|
||||
int linktype;
|
||||
|
@ -497,6 +505,9 @@ static struct linktype_map {
|
|||
/* BACnet MS/TP */
|
||||
{ DLT_BACNET_MS_TP, LINKTYPE_BACNET_MS_TP },
|
||||
|
||||
/* PPP with direction flag in the PPP header */
|
||||
{ DLT_PPP_WITHDIRECTION,LINKTYPE_PPP_WITHDIRECTION},
|
||||
|
||||
{ -1, -1 }
|
||||
};
|
||||
|
||||
|
|
Reference in New Issue