summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannes <hannes>2004-08-18 14:56:27 +0000
committerhannes <hannes>2004-08-18 14:56:27 +0000
commita663702261188104f00e32b831218b102d1e14dd (patch)
tree0f0ca04ff514c5af5a0f615871a61d777bc11345
parent20d2f6830e2a10e35bb70e2d10f0ef8298bcf1bf (diff)
downloadtcpdump-a663702261188104f00e32b831218b102d1e14dd.tar.gz
add ppp support for DLT_PPP_WITHDIRECTION; print direction (hidden under eflag)
-rw-r--r--ppp.h5
-rw-r--r--print-ppp.c33
-rw-r--r--tcpdump.c5
3 files changed, 34 insertions, 9 deletions
diff --git a/ppp.h b/ppp.h
index 42348086..5c583f84 100644
--- a/ppp.h
+++ b/ppp.h
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/ppp.h,v 1.14 2003-05-22 15:29:22 hannes Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/ppp.h,v 1.15 2004-08-18 14:56:28 hannes Exp $ (LBL) */
/*
* Point to Point Protocol (PPP) RFC1331
*
@@ -20,6 +20,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 */
diff --git a/print-ppp.c b/print-ppp.c
index 486b25ae..ee903976 100644
--- a/print-ppp.c
+++ b/print-ppp.c
@@ -31,7 +31,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.100 2004-07-15 00:16:49 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.101 2004-08-18 14:56:28 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -1188,7 +1188,7 @@ handle_ppp(u_int proto, const u_char *p, int length)
u_int
ppp_print(register const u_char *p, u_int length)
{
- u_int proto;
+ u_int proto,ppp_header;
u_int olen = length; /* _o_riginal length */
u_int hdr_len = 0;
@@ -1199,11 +1199,30 @@ ppp_print(register const u_char *p, u_int length)
if (length < 2)
goto trunc;
TCHECK2(*p, 2);
- if (*p == PPP_ADDRESS && *(p + 1) == PPP_CONTROL) {
- p += 2; /* ACFC not used */
- length -= 2;
- hdr_len += 2;
- }
+ ppp_header = EXTRACT_16BITS(p);
+
+ switch(ppp_header) {
+ case (PPP_WITHDIRECTION_IN << 8 | PPP_CONTROL):
+ if (eflag) printf("In ");
+ p += 2;
+ length -= 2;
+ hdr_len += 2;
+ break;
+ case (PPP_WITHDIRECTION_OUT << 8 | PPP_CONTROL):
+ if (eflag) printf("Out ");
+ p += 2;
+ length -= 2;
+ hdr_len += 2;
+ break;
+ case (PPP_ADDRESS << 8 | PPP_CONTROL):
+ p += 2; /* ACFC not used */
+ length -= 2;
+ hdr_len += 2;
+ break;
+
+ default:
+ break;
+ }
if (length < 2)
goto trunc;
diff --git a/tcpdump.c b/tcpdump.c
index 25d81301..277e8ca6 100644
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -30,7 +30,7 @@ static const char copyright[] _U_ =
"@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
The Regents of the University of California. All rights reserved.\n";
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.246 2004-07-21 22:06:47 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.247 2004-08-18 14:56:27 hannes Exp $ (LBL)";
#endif
/*
@@ -154,6 +154,9 @@ static struct printer printers[] = {
{ sl_bsdos_if_print, DLT_SLIP_BSDOS },
#endif
{ ppp_if_print, DLT_PPP },
+#ifdef DLT_PPP_WITHDIRECTION
+ { ppp_if_print, DLT_PPP_WITHDIRECTION },
+#endif
#ifdef DLT_PPP_BSDOS
{ ppp_bsdos_if_print, DLT_PPP_BSDOS },
#endif