Reed, with additions to get the PPP header length from the PPP print
routine.
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.183 2002-05-29 10:06:24 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.184 2002-05-29 10:32:01 guy Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
*/
#ifndef tcpdump_interface_h
extern void cisco_autorp_print(const u_char *, u_int);
extern void mobile_print(const u_char *, u_int);
extern void pim_print(const u_char *, u_int);
extern void cisco_autorp_print(const u_char *, u_int);
extern void mobile_print(const u_char *, u_int);
extern void pim_print(const u_char *, u_int);
-extern void pppoe_print(const u_char *, u_int);
-extern void ppp_print(register const u_char *, u_int);
+extern u_int pppoe_print(const u_char *, u_int);
+extern u_int ppp_print(register const u_char *, u_int);
extern void ppp_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
extern void ppp_hdlc_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *);
extern void ppp_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
extern void ppp_hdlc_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *);
#ifndef lint
static const char rcsid[] =
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.65 2001-10-24 03:49:19 itojun 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
#endif
#ifdef HAVE_CONFIG_H
}
/* Standard PPP printer */
}
/* Standard PPP printer */
ppp_print(register const u_char *p, u_int length)
{
u_int proto;
u_int full_length = length;
ppp_print(register const u_char *p, u_int length)
{
u_int proto;
u_int full_length = length;
/*
* Here, we assume that p points to the Address and Control
/*
* 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;
if (*p == PPP_ADDRESS && *(p + 1) == PPP_CONTROL) {
p += 2; /* ACFC not used */
length -= 2;
proto = *p; /* PFC is used */
p++;
length--;
proto = *p; /* PFC is used */
p++;
length--;
} else {
proto = EXTRACT_16BITS(p);
p += 2;
length -= 2;
} else {
proto = EXTRACT_16BITS(p);
p += 2;
length -= 2;
}
printf("%s %d: ", ppp_protoname(proto), full_length);
handle_ppp(proto, p, length);
}
printf("%s %d: ", ppp_protoname(proto), full_length);
handle_ppp(proto, p, length);
#ifndef lint
static const char rcsid[] =
#ifndef lint
static const char rcsid[] =
-"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.15 2001-07-05 18:54:17 guy Exp $ (LBL)";
+"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.16 2002-05-29 10:32:01 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#endif
#ifdef HAVE_CONFIG_H
{
register u_int length = h->len;
register u_int caplen = h->caplen;
{
register u_int length = h->len;
register u_int caplen = h->caplen;
++infodelay;
ts_print(&h->ts);
++infodelay;
ts_print(&h->ts);
packetp = p;
snapend = p + caplen;
packetp = p;
snapend = p + caplen;
- pppoe_print(p, length);
+ hdr_len = pppoe_print(p, length);
+
+ /*
+ * If "-x" was specified, print stuff past the PPPoE and PPP headers,
+ * if there's anything to print.
+ */
+ if (xflag && caplen > hdr_len)
+ default_print(p + hdr_len, caplen - hdr_len);
+
--infodelay;
if (infoprint)
info(0);
}
--infodelay;
if (infoprint)
info(0);
}
pppoe_print(register const u_char *bp, u_int length)
{
u_short pppoe_ver, pppoe_type, pppoe_code, pppoe_sessionid, pppoe_length;
pppoe_print(register const u_char *bp, u_int length)
{
u_short pppoe_ver, pppoe_type, pppoe_code, pppoe_sessionid, pppoe_length;
pppoe_packet = bp;
if (pppoe_packet > snapend) {
printf("[|pppoe]");
pppoe_packet = bp;
if (pppoe_packet > snapend) {
printf("[|pppoe]");
}
pppoe_ver = (pppoe_packet[0] & 0xF0) >> 4;
}
pppoe_ver = (pppoe_packet[0] & 0xF0) >> 4;
if (snapend < pppoe_payload) {
printf(" truncated PPPoE");
if (snapend < pppoe_payload) {
printf(" truncated PPPoE");
p += tag_len;
/* p points to next tag */
}
p += tag_len;
/* p points to next tag */
}
- ppp_print(pppoe_payload, pppoe_length);
+ return (PPPOE_HDRLEN + ppp_print(pppoe_payload, pppoe_length));