Deleted Added
full compact
2c2
< * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996
---
> * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
24c24
< "@(#) $Header: print-ppp.c,v 1.24 96/12/10 23:23:12 leres Exp $ (LBL)";
---
> "@(#) $Header: print-ppp.c,v 1.26 97/06/12 14:21:29 leres Exp $ (LBL)";
27d26
< #ifdef PPP
47d45
< #include <signal.h>
55a54
> #include "ppp.h"
198a198
> /* Standard PPP printer */
535,537d534
< #else
< #include <sys/types.h>
< #include <sys/time.h>
539c536,544
< #include <stdio.h>
---
> /* proto type to string mapping */
> static struct tok ptype2str[] = {
> { PPP_VJC, "VJC" },
> { PPP_VJNC, "VJNC" },
> { PPP_OSI, "OSI" },
> { PPP_LCP, "LCP" },
> { PPP_IPCP, "IPCP" },
> { 0, NULL }
> };
541c546,548
< #include "interface.h"
---
> #define PPP_BSDI_HDRLEN 24
>
> /* BSD/OS specific PPP printer */
543c550,551
< ppp_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
---
> ppp_bsdos_if_print(u_char *user, const struct pcap_pkthdr *h,
> register const u_char *p)
545,546c553,610
< error("not configured for ppp");
< /* NOTREACHED */
---
> register u_int length = h->len;
> register u_int caplen = h->caplen;
> register int hdrlength;
> u_short ptype;
>
> ts_print(&h->ts);
>
> if (caplen < PPP_BSDI_HDRLEN) {
> printf("[|ppp]");
> goto out;
> }
>
> /*
> * Some printers want to get back at the link level addresses,
> * and/or check that they're not walking off the end of the packet.
> * Rather than pass them all the way down, we set these globals.
> */
> packetp = p;
> snapend = p + caplen;
> hdrlength = 0;
>
> if (p[0] == PPP_ADDRESS && p[1] == PPP_CONTROL) {
> if (eflag)
> printf("%02x %02x ", p[0], p[1]);
> p += 2;
> hdrlength = 2;
> }
>
> if (eflag)
> printf("%d ", length);
> /* Retrieve the protocol type */
> if (*p & 01) {
> /* Compressed protocol field */
> ptype = *p;
> if (eflag)
> printf("%02x ", ptype);
> p++;
> hdrlength += 1;
> } else {
> /* Un-compressed protocol field */
> ptype = ntohs(*(u_short *)p);
> if (eflag)
> printf("%04x ", ptype);
> p += 2;
> hdrlength += 2;
> }
>
> length -= hdrlength;
>
> if (ptype == PPP_IP)
> ip_print(p, length);
> else
> printf("%s ", tok2str(ptype2str, "proto-#%d", ptype));
>
> if (xflag)
> default_print((const u_char *)p, caplen - hdrlength);
> out:
> putchar('\n');
548d611
< #endif