- printf("unknown addr %02x; ctrl %02x", p[0], p[1]);
- break;
- }
-
- return (hdrlen);
-}
-
-#define PPP_BSDI_HDRLEN 24
-
-/* BSD/OS specific PPP printer */
-u_int
-ppp_bsdos_if_print(const struct pcap_pkthdr *h _U_, register const u_char *p _U_)
-{
- register int hdrlength;
-#ifdef __bsdi__
- register u_int length = h->len;
- register u_int caplen = h->caplen;
- u_int16_t ptype;
- const u_char *q;
- int i;
-
- if (caplen < PPP_BSDI_HDRLEN) {
- printf("[|ppp]");
- return (caplen)
- }
-
- hdrlength = 0;
-
-#if 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 = EXTRACT_16BITS(p);
- if (eflag)
- printf("%04x ", ptype);
- p += 2;
- hdrlength += 2;
- }
-#else
- ptype = 0; /*XXX*/
- if (eflag)
- printf("%c ", p[SLC_DIR] ? 'O' : 'I');
- if (p[SLC_LLHL]) {
- /* link level header */
- struct ppp_header *ph;
-
- q = p + SLC_BPFHDRLEN;
- ph = (struct ppp_header *)q;
- if (ph->phdr_addr == PPP_ADDRESS
- && ph->phdr_ctl == PPP_CONTROL) {
- if (eflag)
- printf("%02x %02x ", q[0], q[1]);
- ptype = EXTRACT_16BITS(&ph->phdr_type);
- if (eflag && (ptype == PPP_VJC || ptype == PPP_VJNC)) {
- printf("%s ", tok2str(ppptype2str,
- "proto-#%d", ptype));
- }
- } else {
- if (eflag) {
- printf("LLH=[");
- for (i = 0; i < p[SLC_LLHL]; i++)
- printf("%02x", q[i]);
- printf("] ");
- }
- }
- }
- if (eflag)
- printf("%d ", length);
- if (p[SLC_CHL]) {
- q = p + SLC_BPFHDRLEN + p[SLC_LLHL];
-
- switch (ptype) {
- case PPP_VJC:
- ptype = vjc_print(q, ptype);
- hdrlength = PPP_BSDI_HDRLEN;
- p += hdrlength;
- switch (ptype) {
- case PPP_IP:
- ip_print(gndo, p, length);
- break;
-#ifdef INET6
- case PPP_IPV6:
- ip6_print(gndo, p, length);
- break;
-#endif
- case PPP_MPLS_UCAST:
- case PPP_MPLS_MCAST:
- mpls_print(p, length);
- break;
- }
- goto printx;
- case PPP_VJNC:
- ptype = vjc_print(q, ptype);
- hdrlength = PPP_BSDI_HDRLEN;
- p += hdrlength;
- switch (ptype) {
- case PPP_IP:
- ip_print(gndo, p, length);
- break;
-#ifdef INET6
- case PPP_IPV6:
- ip6_print(gndo, p, length);
- break;
-#endif
- case PPP_MPLS_UCAST:
- case PPP_MPLS_MCAST:
- mpls_print(p, length);
- break;
- }
- goto printx;
- default:
- if (eflag) {
- printf("CH=[");
- for (i = 0; i < p[SLC_LLHL]; i++)
- printf("%02x", q[i]);
- printf("] ");
- }
- break;
- }
- }
-
- hdrlength = PPP_BSDI_HDRLEN;
-#endif
-
- length -= hdrlength;
- p += hdrlength;
-
- switch (ptype) {
- case PPP_IP:
- ip_print(p, length);
- break;
-#ifdef INET6
- case PPP_IPV6:
- ip6_print(gndo, p, length);