From c1401d47257475f7c1e0b63da7e5e7dfa37cefe0 Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 8 Feb 2005 19:52:18 +0000 Subject: [PATCH] The DLT_LINUX_PPP_WITHDIRECTION is also used for pppd on some BSDs, so rename it again to DLT_PPP_PPPD, and rename other #defines to match. Add backwards-compatibility #defines of DLT_PPP_WITH_DIRECTION and DLT_LINUX_PPP_WITHDIRECTION for software that used them. --- gencode.c | 12 ++++++------ pcap-bpf.h | 13 ++++++++++--- pcap.c | 4 ++-- ppp.h | 6 +++--- savefile.c | 10 +++++----- 5 files changed, 26 insertions(+), 19 deletions(-) diff --git a/gencode.c b/gencode.c index ad54316..cb23b9e 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.218 2005-01-31 01:47:27 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.219 2005-02-08 19:52:18 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -757,7 +757,7 @@ init_linktype(p) return; case DLT_PPP: - case DLT_LINUX_PPP_WITHDIRECTION: + case DLT_PPP_PPPD: case DLT_C_HDLC: /* BSD/OS Cisco HDLC */ case DLT_PPP_SERIAL: /* NetBSD sync/async serial PPP */ off_linktype = 2; @@ -1542,7 +1542,7 @@ gen_linktype(proto) break; case DLT_PPP: - case DLT_LINUX_PPP_WITHDIRECTION: + case DLT_PPP_PPPD: case DLT_PPP_SERIAL: case DLT_PPP_ETHER: /* @@ -5117,13 +5117,13 @@ gen_inbound(dir) (bpf_int32)((dir == 0) ? PF_IN : PF_OUT)); break; - case DLT_LINUX_PPP_WITHDIRECTION: + case DLT_PPP_PPPD: if (dir) { /* match outgoing packets */ - b0 = gen_cmp(0, BPF_B, LINUX_PPP_WITHDIRECTION_OUT); + b0 = gen_cmp(0, BPF_B, PPP_PPPD_OUT); } else { /* match incoming packets */ - b0 = gen_cmp(0, BPF_B, LINUX_PPP_WITHDIRECTION_IN); + b0 = gen_cmp(0, BPF_B, PPP_PPPD_IN); } break; diff --git a/pcap-bpf.h b/pcap-bpf.h index 2708a9b..534690b 100644 --- a/pcap-bpf.h +++ b/pcap-bpf.h @@ -37,7 +37,7 @@ * * @(#)bpf.h 7.1 (Berkeley) 5/7/91 * - * @(#) $Header: /tcpdump/master/libpcap/pcap-bpf.h,v 1.32 2005-01-31 01:47:27 guy Exp $ (LBL) + * @(#) $Header: /tcpdump/master/libpcap/pcap-bpf.h,v 1.33 2005-02-08 19:52:18 guy Exp $ (LBL) */ /* @@ -524,7 +524,7 @@ struct bpf_version { /* * Another PPP variant as per request from Karsten Keil . * - * This is used in Linux to allow a kernel socket filter to distinguish + * This is used in some OSes to allow a kernel socket filter to distinguish * between incoming and outgoing packets, on a socket intended to * supply pppd with outgoing packets so it can do dial-on-demand and * hangup-on-lack-of-demand; incoming packets are filtered out so they @@ -535,7 +535,14 @@ struct bpf_version { * The first byte of the PPP header (0xff03) is modified to accomodate * the direction - 0x00 = IN, 0x01 = OUT. */ -#define DLT_LINUX_PPP_WITHDIRECTION 166 +#define DLT_PPP_PPPD 166 + +/* + * Names for backwards compatibility with older versions of some PPP + * software; new software should use DLT_PPP_PPPD. + */ +#define DLT_PPP_WITH_DIRECTION DLT_PPP_PPPD +#define DLT_LINUX_PPP_WITHDIRECTION DLT_PPP_PPPD /* * Juniper-private data link type, as per request from diff --git a/pcap.c b/pcap.c index 6c25d31..0a87b2e 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.86 2005-01-31 01:47:27 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.87 2005-02-08 19:52:18 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -359,7 +359,7 @@ static struct dlt_choice dlt_choices[] = { DLT_CHOICE(DLT_JUNIPER_ATM1, "Juniper ATM1 PIC"), DLT_CHOICE(DLT_JUNIPER_ATM2, "Juniper ATM2 PIC"), DLT_CHOICE(DLT_JUNIPER_MLPPP, "Juniper Multi-Link PPP"), - DLT_CHOICE(DLT_LINUX_PPP_WITHDIRECTION, "Linux PPP with direction flag"), + DLT_CHOICE(DLT_PPP_PPPD, "PPP for pppd, with direction flag"), DLT_CHOICE(DLT_JUNIPER_PPPOE, "Juniper PPPoE"), DLT_CHOICE(DLT_JUNIPER_PPPOE_ATM, "Juniper PPPoE/ATM"), DLT_CHOICE(DLT_GPRS_LLC, "GPRS LLC"), diff --git a/ppp.h b/ppp.h index 327c890..4e1d08d 100644 --- a/ppp.h +++ b/ppp.h @@ -1,4 +1,4 @@ -/* @(#) $Header: /tcpdump/master/libpcap/ppp.h,v 1.11 2005-01-31 01:47:28 guy Exp $ (LBL) */ +/* @(#) $Header: /tcpdump/master/libpcap/ppp.h,v 1.12 2005-02-08 19:52:19 guy Exp $ (LBL) */ /* * Point to Point Protocol (PPP) RFC1331 * @@ -18,8 +18,8 @@ #define PPP_ADDRESS 0xff /* The address byte value */ #define PPP_CONTROL 0x03 /* The control byte value */ -#define LINUX_PPP_WITHDIRECTION_IN 0x00 /* non-standard for DLT_LINUX_PPP_WITHDIRECTION */ -#define LINUX_PPP_WITHDIRECTION_OUT 0x01 /* non-standard for DLT_LINUX_PPP_WITHDIRECTION */ +#define PPP_PPPD_IN 0x00 /* non-standard for DLT_PPP_PPPD */ +#define PPP_PPPD_OUT 0x01 /* non-standard for DLT_PPP_PPPD */ /* Protocol numbers */ #define PPP_IP 0x0021 /* Raw IP */ diff --git a/savefile.c b/savefile.c index 4574f78..9c0e8ef 100644 --- a/savefile.c +++ b/savefile.c @@ -30,7 +30,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.124 2005-01-31 01:47:28 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.125 2005-02-08 19:52:19 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -355,7 +355,7 @@ static const char rcsid[] _U_ = /* * Another PPP variant as per request from Karsten Keil . * - * This is used in Linux to allow a kernel socket filter to distinguish + * This is used in some OSes to allow a kernel socket filter to distinguish * between incoming and outgoing packets, on a socket intended to * supply pppd with outgoing packets so it can do dial-on-demand and * hangup-on-lack-of-demand; incoming packets are filtered out so they @@ -366,7 +366,7 @@ static const char rcsid[] _U_ = * The first byte of the PPP header (0xff03) is modified to accomodate * the direction - 0x00 = IN, 0x01 = OUT. */ -#define LINKTYPE_LINUX_PPP_WITHDIRECTION 166 +#define LINKTYPE_PPP_PPPD 166 /* * Juniper-private data link type, as per request from @@ -559,8 +559,8 @@ static struct linktype_map { /* BACnet MS/TP */ { DLT_BACNET_MS_TP, LINKTYPE_BACNET_MS_TP }, - /* Linux PPP with direction flag in the PPP header */ - { DLT_LINUX_PPP_WITHDIRECTION,LINKTYPE_LINUX_PPP_WITHDIRECTION}, + /* PPP for pppd, with direction flag in the PPP header */ + { DLT_PPP_PPPD, LINKTYPE_PPP_PPPD}, /* Juniper-internal chassis encapsulation */ { DLT_JUNIPER_PPPOE, LINKTYPE_JUNIPER_PPPOE },