#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.53 2000-10-06 04:25:59 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.66 2002-05-29 10:32:02 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include <sys/param.h>
#include <sys/time.h>
-#include <sys/socket.h>
-#include <sys/file.h>
-#include <sys/ioctl.h>
-struct mbuf;
-struct rtentry;
+#ifdef __bsdi__
+#include <net/slcompress.h>
+#include <net/if_ppp.h>
+#endif
#include <netinet/in.h>
#include <netdb.h>
#include <pcap.h>
#include <stdio.h>
-#ifdef __bsdi__
-#include <net/slcompress.h>
-#include <net/if_ppp.h>
-#endif
#include "interface.h"
#include "extract.h"
#include "chdlc.h"
#include "ethertype.h"
-/* XXX This goes somewhere else. */
-#define PPP_HDRLEN 4
-
/*
* The following constatns are defined by IANA. Please refer to
* http://www.isi.edu/in-notes/iana/assignments/ppp-numbers
#define BAP_CSIND 7
#define BAP_CSRES 8
-static const char *ppp_protoname __P((u_int proto));
-static void handle_ctrl_proto __P((u_int proto,const u_char *p, int length));
-static void handle_chap __P((const u_char *p, int length));
-static void handle_pap __P((const u_char *p, int length));
-static void handle_bap __P((const u_char *p, int length));
-static int print_lcp_config_options __P((const u_char *p, int));
-static int print_ipcp_config_options __P((const u_char *p, int));
-static int print_ccp_config_options __P((const u_char *p, int));
-static int print_bacp_config_options __P((const u_char *p, int));
-static void handle_ppp __P((u_int proto, const u_char *p, int length));
+static const char *ppp_protoname (u_int proto);
+static void handle_ctrl_proto (u_int proto,const u_char *p, int length);
+static void handle_chap (const u_char *p, int length);
+static void handle_pap (const u_char *p, int length);
+static void handle_bap (const u_char *p, int length);
+static int print_lcp_config_options (const u_char *p, int);
+static int print_ipcp_config_options (const u_char *p, int);
+static int print_ccp_config_options (const u_char *p, int);
+static int print_bacp_config_options (const u_char *p, int);
+static void handle_ppp (u_int proto, const u_char *p, int length);
static const char *
ppp_protoname(u_int proto)
switch (proto) {
case PPP_IP: return "IP";
+ case PPP_IPV6: return "IPv6";
#ifdef PPP_XNS
case PPP_XNS: return "XNS";
#endif
case PPP_IPX: return "IPX";
+ case PPP_OSI: return "OSI";
case PPP_VJC: return "VJC";
case PPP_VJNC: return "VJNC";
-#ifdef PPP_COMP
case PPP_COMP: return "COMP";
-#endif
case PPP_IPCP: return "IPCP";
- case PPP_IPV6CP: return "IPV6CP";
+ case PPP_IPV6CP: return "IPv6CP";
case PPP_IPXCP: return "IPXCP";
+ case PPP_OSICP: return "OSICP";
case PPP_CCP: return "CCP";
case PPP_LCP: return "LCP";
case PPP_PAP: return "PAP";
case PPP_IPX:
ipx_print(p, length);
break;
+ case PPP_OSI:
+ isoclns_print(p, length, length, NULL, NULL);
+ break;
+ default:
+ break;
}
}
/* Standard PPP printer */
-void
+u_int
ppp_print(register const u_char *p, u_int length)
{
u_int proto;
+ u_int full_length = length;
+ u_int hdr_len = 0;
/*
* Here, we assume that p points to the Address and Control
if (*p == PPP_ADDRESS && *(p + 1) == PPP_CONTROL) {
p += 2; /* ACFC not used */
length -= 2;
+ hdr_len += 2;
}
if (length < 2)
proto = *p; /* PFC is used */
p++;
length--;
+ hdr_len++;
} else {
proto = EXTRACT_16BITS(p);
p += 2;
length -= 2;
+ hdr_len += 2;
}
- printf("%s: ", ppp_protoname(proto));
+ printf("%s %d: ", ppp_protoname(proto), full_length);
handle_ppp(proto, p, length);
- return;
+ return (hdr_len);
trunc:
printf("[|ppp]");
+ return (0);
}
register u_int length = h->len;
register u_int caplen = h->caplen;
+ ++infodelay;
ts_print(&h->ts);
if (caplen < PPP_HDRLEN) {
default_print(p, caplen);
out:
putchar('\n');
+ --infodelay;
+ if (infoprint)
+ info(0);
}
/*
register u_int caplen = h->caplen;
u_int proto;
+ ++infodelay;
+ ts_print(&h->ts);
+
if (caplen < 2) {
printf("[|ppp]");
goto out;
goto out;
}
- ts_print(&h->ts);
if (eflag)
printf("%02x %02x %d ", p[0], p[1], length);
p += 2;
case CHDLC_UNICAST:
case CHDLC_BCAST:
- /*
- * Have the Cisco HDLC print routine do all the work.
- */
- chdlc_if_print(user, h, p);
- return;
+ chdlc_print(p, length, caplen);
+ goto out;
default:
- ts_print(&h->ts);
if (eflag)
printf("%02x %02x %d ", p[0], p[1], length);
p += 2;
default_print(p, caplen);
out:
putchar('\n');
+ --infodelay;
+ if (infoprint)
+ info(0);
}
const u_char *q;
int i;
+ ++infodelay;
ts_print(&h->ts);
if (caplen < PPP_BSDI_HDRLEN) {
printf("] ");
}
}
- if (eflag)
- printf("%d ", length);
}
+ if (eflag)
+ printf("%d ", length);
if (p[SLC_CHL]) {
q = p + SLC_BPFHDRLEN + p[SLC_LLHL];
default_print((const u_char *)p, caplen - hdrlength);
out:
putchar('\n');
+ --infodelay;
+ if (infoprint)
+ info(0);
#endif /* __bsdi__ */
}