home *** CD-ROM | disk | FTP | other *** search
- /*
- * PPPDUMP.C
- *
- * 12-89 -- Katie Stevens (dkstevens@ucdavis.edu)
- * UC Davis, Computing Services
- * PPP.08 05-90 [ks] improve tracing reports
- * PPP.09 05-90 [ks] add UPAP packet reporting
- * PPP.14 08-90 [ks] change UPAP to PAP for consistency with RFC1172
- * PPP.15 09-90 [ks] update to KA9Q NOS v900828
- * Jan 91 [Bill Simpson] small changes to match rewrite of PPP
- */
- #include <stdio.h>
- #include "global.h"
- #include "mbuf.h"
- #include "proc.h"
- #include "iface.h"
- #include "internet.h"
- #include "ppp.h"
- #include "trace.h"
- /*#pragma option -G- */
- /* dump a PPP packet */
- void
- ppp_dump(fp,bpp,unused)
- FILE *fp;
- struct mbuf **bpp;
- int unused;
- {
- struct ppp_hdr phdr;
- struct mbuf *bp, *tbp;
-
- ntohppp(&phdr,bpp);
- fprintf(fp,"PPP: len %3u ",(PPP_HDR_LEN + len_p(*bpp)));
- if (phdr.addr != HDLC_ALL_ADDR)
- fprintf(fp,"!invalid addr field ");
- if (phdr.control != HDLC_UI)
- fprintf(fp,"!invalid ctl field ");
-
- switch(phdr.protocol){
- case PPP_IP_PROTOCOL:
- fprintf(fp,"\t\tprotocol: IP\n");
- ip_dump(fp,bpp,1);
- break;
- case PPP_IPCP_PROTOCOL:
- fprintf(fp,"\t\tprotocol: IPCP\n");
- break;
- case PPP_LCP_PROTOCOL:
- fprintf(fp,"\t\tprotocol: LCP\n");
- break;
- case PPP_PAP_PROTOCOL:
- fprintf(fp,"\t\tprotocol: PAP\n");
- break;
- case PPP_COMPR_PROTOCOL:
- fprintf(fp,"\t\tprotocol: VJ Compr TCP/IP\n");
- vjcomp_dump(fp,bpp,0);
- break;
- case PPP_UNCOMP_PROTOCOL:
- fprintf(fp,"\t\tprotocol: VJ Uncompr TCP/IP\n");
- fprintf(fp,"VJ Uncompr TCP/IP: connection 0x%02x\n",
- (*bpp)->data[9]); /* FIX THIS! */
- /* Get our own copy so we can mess with the data */
- bp = *bpp;
- tbp = copy_p(bp, len_p(bp));
- /* Restore the bytes used with Uncompressed TCP */
- tbp->data[9] = TCP_PTCL; /* FIX THIS! */
- ip_dump(fp,&tbp,1);
- break;
- default:
- fprintf(fp," unknown protocol: 0x%04x\n",phdr.protocol);
- break;
- }
- }
- /*#pragma option -G */
-