2 * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
9 * this paragraph in its entirety in the documentation or other materials
10 * provided with the distribution, and (3) all advertising materials mentioning
11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the University of California,
13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 * Extensively modified by Motonori Shindo (mshindo@mshindo.net) for more
22 * complete PPP support.
27 * o resolve XXX as much as possible
36 #include <tcpdump-stdinc.h>
39 #include <net/slcompress.h>
40 #include <net/if_ppp.h>
45 #include "interface.h"
47 #include "addrtoname.h"
50 #include "ethertype.h"
54 * The following constatns are defined by IANA. Please refer to
55 * http://www.isi.edu/in-notes/iana/assignments/ppp-numbers
56 * for the up-to-date information.
59 /* Protocol Codes defined in ppp.h */
61 static const struct tok ppptype2str
[] = {
65 { PPP_DECNET
, "DECNET" },
66 { PPP_APPLE
, "APPLE" },
68 { PPP_VJC
, "VJC IP" },
69 { PPP_VJNC
, "VJNC IP" },
70 { PPP_BRPDU
, "BRPDU" },
72 { PPP_VINES
, "VINES" },
73 { PPP_MPLS_UCAST
, "MPLS" },
74 { PPP_MPLS_MCAST
, "MPLS" },
75 { PPP_COMP
, "Compressed"},
79 { PPP_HELLO
, "HELLO" },
80 { PPP_LUXCOM
, "LUXCOM" },
83 { PPP_OSICP
, "OSICP" },
85 { PPP_DECNETCP
, "DECNETCP" },
86 { PPP_APPLECP
, "APPLECP" },
87 { PPP_IPXCP
, "IPXCP" },
88 { PPP_STIICP
, "STIICP" },
89 { PPP_VINESCP
, "VINESCP" },
90 { PPP_IPV6CP
, "IP6CP" },
91 { PPP_MPLSCP
, "MPLSCP" },
99 { PPP_SPAP_OLD
, "Old-SPAP" },
100 { PPP_BACP
, "BACP" },
102 { PPP_MPCP
, "MLPPP-CP" },
107 /* Control Protocols (LCP/IPCP/CCP etc.) Codes defined in RFC 1661 */
109 #define CPCODES_VEXT 0 /* Vendor-Specific (RFC2153) */
110 #define CPCODES_CONF_REQ 1 /* Configure-Request */
111 #define CPCODES_CONF_ACK 2 /* Configure-Ack */
112 #define CPCODES_CONF_NAK 3 /* Configure-Nak */
113 #define CPCODES_CONF_REJ 4 /* Configure-Reject */
114 #define CPCODES_TERM_REQ 5 /* Terminate-Request */
115 #define CPCODES_TERM_ACK 6 /* Terminate-Ack */
116 #define CPCODES_CODE_REJ 7 /* Code-Reject */
117 #define CPCODES_PROT_REJ 8 /* Protocol-Reject (LCP only) */
118 #define CPCODES_ECHO_REQ 9 /* Echo-Request (LCP only) */
119 #define CPCODES_ECHO_RPL 10 /* Echo-Reply (LCP only) */
120 #define CPCODES_DISC_REQ 11 /* Discard-Request (LCP only) */
121 #define CPCODES_ID 12 /* Identification (LCP only) RFC1570 */
122 #define CPCODES_TIME_REM 13 /* Time-Remaining (LCP only) RFC1570 */
123 #define CPCODES_RESET_REQ 14 /* Reset-Request (CCP only) RFC1962 */
124 #define CPCODES_RESET_REP 15 /* Reset-Reply (CCP only) */
126 static const struct tok cpcodes
[] = {
127 {CPCODES_VEXT
, "Vendor-Extension"}, /* RFC2153 */
128 {CPCODES_CONF_REQ
, "Conf-Request"},
129 {CPCODES_CONF_ACK
, "Conf-Ack"},
130 {CPCODES_CONF_NAK
, "Conf-Nack"},
131 {CPCODES_CONF_REJ
, "Conf-Reject"},
132 {CPCODES_TERM_REQ
, "Term-Request"},
133 {CPCODES_TERM_ACK
, "Term-Ack"},
134 {CPCODES_CODE_REJ
, "Code-Reject"},
135 {CPCODES_PROT_REJ
, "Prot-Reject"},
136 {CPCODES_ECHO_REQ
, "Echo-Request"},
137 {CPCODES_ECHO_RPL
, "Echo-Reply"},
138 {CPCODES_DISC_REQ
, "Disc-Req"},
139 {CPCODES_ID
, "Ident"}, /* RFC1570 */
140 {CPCODES_TIME_REM
, "Time-Rem"}, /* RFC1570 */
141 {CPCODES_RESET_REQ
, "Reset-Req"}, /* RFC1962 */
142 {CPCODES_RESET_REP
, "Reset-Ack"}, /* RFC1962 */
146 /* LCP Config Options */
148 #define LCPOPT_VEXT 0
150 #define LCPOPT_ACCM 2
154 #define LCPOPT_DEP6 6
156 #define LCPOPT_ACFC 8
157 #define LCPOPT_FCSALT 9
158 #define LCPOPT_SDP 10
159 #define LCPOPT_NUMMODE 11
160 #define LCPOPT_DEP12 12
161 #define LCPOPT_CBACK 13
162 #define LCPOPT_DEP14 14
163 #define LCPOPT_DEP15 15
164 #define LCPOPT_DEP16 16
165 #define LCPOPT_MLMRRU 17
166 #define LCPOPT_MLSSNHF 18
167 #define LCPOPT_MLED 19
168 #define LCPOPT_PROP 20
169 #define LCPOPT_DCEID 21
170 #define LCPOPT_MPP 22
172 #define LCPOPT_LCPAOPT 24
173 #define LCPOPT_COBS 25
175 #define LCPOPT_MLHF 27
176 #define LCPOPT_I18N 28
177 #define LCPOPT_SDLOS 29
178 #define LCPOPT_PPPMUX 30
180 #define LCPOPT_MIN LCPOPT_VEXT
181 #define LCPOPT_MAX LCPOPT_PPPMUX
183 static const char *lcpconfopts
[] = {
184 "Vend-Ext", /* (0) */
187 "Auth-Prot", /* (3) */
188 "Qual-Prot", /* (4) */
189 "Magic-Num", /* (5) */
190 "deprecated(6)", /* used to be a Quality Protocol */
195 "Num-Mode", /* (11) */
196 "deprecated(12)", /* used to be a Multi-Link-Procedure*/
197 "Call-Back", /* (13) */
198 "deprecated(14)", /* used to be a Connect-Time */
199 "deprecated(15)", /* used to be a Compund-Frames */
200 "deprecated(16)", /* used to be a Nominal-Data-Encap */
202 "12-Bit seq #", /* (18) */
203 "End-Disc", /* (19) */
204 "Proprietary", /* (20) */
207 "Link-Disc", /* (23) */
208 "LCP-Auth-Opt", /* (24) */
210 "Prefix-elision", /* (26) */
211 "Multilink-header-Form",/* (27) */
213 "SDL-over-SONET/SDH", /* (29) */
214 "PPP-Muxing", /* (30) */
217 /* ECP - to be supported */
219 /* CCP Config Options */
221 #define CCPOPT_OUI 0 /* RFC1962 */
222 #define CCPOPT_PRED1 1 /* RFC1962 */
223 #define CCPOPT_PRED2 2 /* RFC1962 */
224 #define CCPOPT_PJUMP 3 /* RFC1962 */
225 /* 4-15 unassigned */
226 #define CCPOPT_HPPPC 16 /* RFC1962 */
227 #define CCPOPT_STACLZS 17 /* RFC1974 */
228 #define CCPOPT_MPPC 18 /* RFC2118 */
229 #define CCPOPT_GFZA 19 /* RFC1962 */
230 #define CCPOPT_V42BIS 20 /* RFC1962 */
231 #define CCPOPT_BSDCOMP 21 /* RFC1977 */
233 #define CCPOPT_LZSDCP 23 /* RFC1967 */
234 #define CCPOPT_MVRCA 24 /* RFC1975 */
235 #define CCPOPT_DEC 25 /* RFC1976 */
236 #define CCPOPT_DEFLATE 26 /* RFC1979 */
237 /* 27-254 unassigned */
238 #define CCPOPT_RESV 255 /* RFC1962 */
240 static const struct tok ccpconfopts_values
[] = {
241 { CCPOPT_OUI
, "OUI" },
242 { CCPOPT_PRED1
, "Pred-1" },
243 { CCPOPT_PRED2
, "Pred-2" },
244 { CCPOPT_PJUMP
, "Puddle" },
245 { CCPOPT_HPPPC
, "HP-PPC" },
246 { CCPOPT_STACLZS
, "Stac-LZS" },
247 { CCPOPT_MPPC
, "MPPC" },
248 { CCPOPT_GFZA
, "Gand-FZA" },
249 { CCPOPT_V42BIS
, "V.42bis" },
250 { CCPOPT_BSDCOMP
, "BSD-Comp" },
251 { CCPOPT_LZSDCP
, "LZS-DCP" },
252 { CCPOPT_MVRCA
, "MVRCA" },
253 { CCPOPT_DEC
, "DEC" },
254 { CCPOPT_DEFLATE
, "Deflate" },
255 { CCPOPT_RESV
, "Reserved"},
259 /* BACP Config Options */
261 #define BACPOPT_FPEER 1 /* RFC2125 */
263 static const struct tok bacconfopts_values
[] = {
264 { BACPOPT_FPEER
, "Favored-Peer" },
269 /* SDCP - to be supported */
271 /* IPCP Config Options */
272 #define IPCPOPT_2ADDR 1 /* RFC1172, RFC1332 (deprecated) */
273 #define IPCPOPT_IPCOMP 2 /* RFC1332 */
274 #define IPCPOPT_ADDR 3 /* RFC1332 */
275 #define IPCPOPT_MOBILE4 4 /* RFC2290 */
276 #define IPCPOPT_PRIDNS 129 /* RFC1877 */
277 #define IPCPOPT_PRINBNS 130 /* RFC1877 */
278 #define IPCPOPT_SECDNS 131 /* RFC1877 */
279 #define IPCPOPT_SECNBNS 132 /* RFC1877 */
281 static const struct tok ipcpopt_values
[] = {
282 { IPCPOPT_2ADDR
, "IP-Addrs" },
283 { IPCPOPT_IPCOMP
, "IP-Comp" },
284 { IPCPOPT_ADDR
, "IP-Addr" },
285 { IPCPOPT_MOBILE4
, "Home-Addr" },
286 { IPCPOPT_PRIDNS
, "Pri-DNS" },
287 { IPCPOPT_PRINBNS
, "Pri-NBNS" },
288 { IPCPOPT_SECDNS
, "Sec-DNS" },
289 { IPCPOPT_SECNBNS
, "Sec-NBNS" },
293 #define IPCPOPT_IPCOMP_HDRCOMP 0x61 /* rfc3544 */
294 #define IPCPOPT_IPCOMP_MINLEN 14
296 static const struct tok ipcpopt_compproto_values
[] = {
297 { PPP_VJC
, "VJ-Comp" },
298 { IPCPOPT_IPCOMP_HDRCOMP
, "IP Header Compression" },
302 static const struct tok ipcpopt_compproto_subopt_values
[] = {
303 { 1, "RTP-Compression" },
304 { 2, "Enhanced RTP-Compression" },
308 /* IP6CP Config Options */
311 static const struct tok ip6cpopt_values
[] = {
312 { IP6CP_IFID
, "Interface-ID" },
316 /* ATCP - to be supported */
317 /* OSINLCP - to be supported */
318 /* BVCP - to be supported */
319 /* BCP - to be supported */
320 /* IPXCP - to be supported */
321 /* MPLSCP - to be supported */
323 /* Auth Algorithms */
325 /* 0-4 Reserved (RFC1994) */
326 #define AUTHALG_CHAPMD5 5 /* RFC1994 */
327 #define AUTHALG_MSCHAP1 128 /* RFC2433 */
328 #define AUTHALG_MSCHAP2 129 /* RFC2795 */
330 static const struct tok authalg_values
[] = {
331 { AUTHALG_CHAPMD5
, "MD5" },
332 { AUTHALG_MSCHAP1
, "MS-CHAPv1" },
333 { AUTHALG_MSCHAP2
, "MS-CHAPv2" },
337 /* FCS Alternatives - to be supported */
339 /* Multilink Endpoint Discriminator (RFC1717) */
340 #define MEDCLASS_NULL 0 /* Null Class */
341 #define MEDCLASS_LOCAL 1 /* Locally Assigned */
342 #define MEDCLASS_IPV4 2 /* Internet Protocol (IPv4) */
343 #define MEDCLASS_MAC 3 /* IEEE 802.1 global MAC address */
344 #define MEDCLASS_MNB 4 /* PPP Magic Number Block */
345 #define MEDCLASS_PSNDN 5 /* Public Switched Network Director Number */
347 /* PPP LCP Callback */
348 #define CALLBACK_AUTH 0 /* Location determined by user auth */
349 #define CALLBACK_DSTR 1 /* Dialing string */
350 #define CALLBACK_LID 2 /* Location identifier */
351 #define CALLBACK_E164 3 /* E.164 number */
352 #define CALLBACK_X500 4 /* X.500 distinguished name */
353 #define CALLBACK_CBCP 6 /* Location is determined during CBCP nego */
355 static const struct tok ppp_callback_values
[] = {
356 { CALLBACK_AUTH
, "UserAuth" },
357 { CALLBACK_DSTR
, "DialString" },
358 { CALLBACK_LID
, "LocalID" },
359 { CALLBACK_E164
, "E.164" },
360 { CALLBACK_X500
, "X.500" },
361 { CALLBACK_CBCP
, "CBCP" },
372 static const struct tok chapcode_values
[] = {
373 { CHAP_CHAL
, "Challenge" },
374 { CHAP_RESP
, "Response" },
375 { CHAP_SUCC
, "Success" },
376 { CHAP_FAIL
, "Fail" },
386 static const struct tok papcode_values
[] = {
387 { PAP_AREQ
, "Auth-Req" },
388 { PAP_AACK
, "Auth-ACK" },
389 { PAP_ANAK
, "Auth-NACK" },
394 #define BAP_CALLREQ 1
395 #define BAP_CALLRES 2
403 static int print_lcp_config_options(netdissect_options
*, const u_char
*p
, int);
404 static int print_ipcp_config_options(netdissect_options
*, const u_char
*p
, int);
405 static int print_ip6cp_config_options(netdissect_options
*, const u_char
*p
, int);
406 static int print_ccp_config_options(netdissect_options
*, const u_char
*p
, int);
407 static int print_bacp_config_options(netdissect_options
*, const u_char
*p
, int);
408 static void handle_ppp(netdissect_options
*, u_int proto
, const u_char
*p
, int length
);
410 /* generic Control Protocol (e.g. LCP, IPCP, CCP, etc.) handler */
412 handle_ctrl_proto(netdissect_options
*ndo
,
413 u_int proto
, const u_char
*pptr
, int length
)
417 int (*pfunc
)(netdissect_options
*, const u_char
*, int);
423 typestr
= tok2str(ppptype2str
, "unknown ctrl-proto (0x%04x)", proto
);
424 ND_PRINT((ndo
, "%s, ", typestr
));
426 if (length
< 4) /* FIXME weak boundary checking */
428 ND_TCHECK2(*tptr
, 2);
432 ND_PRINT((ndo
, "%s (0x%02x), id %u, length %u",
433 tok2str(cpcodes
, "Unknown Opcode",code
),
442 return; /* there may be a NULL confreq etc. */
444 ND_TCHECK2(*tptr
, 2);
445 len
= EXTRACT_16BITS(tptr
);
448 ND_PRINT((ndo
, "\n\tencoded length %u (=Option(s) length %u)", len
, len
- 4));
450 if (ndo
->ndo_vflag
> 1)
451 print_unknown_data(ndo
, pptr
- 2, "\n\t", 6);
458 ND_TCHECK2(*tptr
, 4);
459 ND_PRINT((ndo
, "\n\t Magic-Num 0x%08x", EXTRACT_32BITS(tptr
)));
461 ND_TCHECK2(*tptr
, 3);
462 ND_PRINT((ndo
, " Vendor: %s (%u)",
463 tok2str(oui_values
,"Unknown",EXTRACT_24BITS(tptr
)),
464 EXTRACT_24BITS(tptr
)));
465 /* XXX: need to decode Kind and Value(s)? */
467 case CPCODES_CONF_REQ
:
468 case CPCODES_CONF_ACK
:
469 case CPCODES_CONF_NAK
:
470 case CPCODES_CONF_REJ
:
471 x
= len
- 4; /* Code(1), Identifier(1) and Length(2) */
475 pfunc
= print_lcp_config_options
;
478 pfunc
= print_ipcp_config_options
;
481 pfunc
= print_ip6cp_config_options
;
484 pfunc
= print_ccp_config_options
;
487 pfunc
= print_bacp_config_options
;
491 * No print routine for the options for
498 if (pfunc
== NULL
) /* catch the above null pointer if unknown CP */
501 if ((j
= (*pfunc
)(ndo
, tptr
, len
)) == 0)
508 case CPCODES_TERM_REQ
:
509 case CPCODES_TERM_ACK
:
510 /* XXX: need to decode Data? */
512 case CPCODES_CODE_REJ
:
513 /* XXX: need to decode Rejected-Packet? */
515 case CPCODES_PROT_REJ
:
518 ND_TCHECK2(*tptr
, 2);
519 ND_PRINT((ndo
, "\n\t Rejected %s Protocol (0x%04x)",
520 tok2str(ppptype2str
,"unknown", EXTRACT_16BITS(tptr
)),
521 EXTRACT_16BITS(tptr
)));
522 /* XXX: need to decode Rejected-Information? - hexdump for now */
524 ND_PRINT((ndo
, "\n\t Rejected Packet"));
525 print_unknown_data(ndo
, tptr
+ 2, "\n\t ", len
- 2);
528 case CPCODES_ECHO_REQ
:
529 case CPCODES_ECHO_RPL
:
530 case CPCODES_DISC_REQ
:
533 ND_TCHECK2(*tptr
, 4);
534 ND_PRINT((ndo
, "\n\t Magic-Num 0x%08x", EXTRACT_32BITS(tptr
)));
535 /* XXX: need to decode Data? - hexdump for now */
537 ND_PRINT((ndo
, "\n\t -----trailing data-----"));
538 ND_TCHECK2(tptr
[4], len
- 8);
539 print_unknown_data(ndo
, tptr
+ 4, "\n\t ", len
- 8);
545 ND_TCHECK2(*tptr
, 4);
546 ND_PRINT((ndo
, "\n\t Magic-Num 0x%08x", EXTRACT_32BITS(tptr
)));
547 /* RFC 1661 says this is intended to be human readable */
549 ND_PRINT((ndo
, "\n\t Message\n\t "));
550 if (fn_printn(ndo
, tptr
+ 4, len
- 4, ndo
->ndo_snapend
))
554 case CPCODES_TIME_REM
:
557 ND_TCHECK2(*tptr
, 4);
558 ND_PRINT((ndo
, "\n\t Magic-Num 0x%08x", EXTRACT_32BITS(tptr
)));
559 ND_TCHECK2(*(tptr
+ 4), 4);
560 ND_PRINT((ndo
, ", Seconds-Remaining %us", EXTRACT_32BITS(tptr
+ 4)));
561 /* XXX: need to decode Message? */
564 /* XXX this is dirty but we do not get the
565 * original pointer passed to the begin
567 if (ndo
->ndo_vflag
<= 1)
568 print_unknown_data(ndo
, pptr
- 2, "\n\t ", length
+ 2);
574 ND_PRINT((ndo
, "[|%s]", typestr
));
577 /* LCP config options */
579 print_lcp_config_options(netdissect_options
*ndo
,
580 const u_char
*p
, int length
)
592 if ((opt
>= LCPOPT_MIN
) && (opt
<= LCPOPT_MAX
))
593 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u (length bogus, should be >= 2)",
594 lcpconfopts
[opt
], opt
, len
));
596 ND_PRINT((ndo
, "\n\tunknown LCP option 0x%02x", opt
));
599 if ((opt
>= LCPOPT_MIN
) && (opt
<= LCPOPT_MAX
))
600 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u", lcpconfopts
[opt
], opt
, len
));
602 ND_PRINT((ndo
, "\n\tunknown LCP option 0x%02x", opt
));
609 ND_PRINT((ndo
, " (length bogus, should be >= 6)"));
612 ND_TCHECK2(*(p
+ 2), 3);
613 ND_PRINT((ndo
, ": Vendor: %s (%u)",
614 tok2str(oui_values
,"Unknown",EXTRACT_24BITS(p
+2)),
615 EXTRACT_24BITS(p
+ 2)));
618 ND_PRINT((ndo
, ", kind: 0x%02x", p
[5]));
619 ND_PRINT((ndo
, ", Value: 0x"));
620 for (i
= 0; i
< len
- 6; i
++) {
622 ND_PRINT((ndo
, "%02x", p
[6 + i
]));
628 ND_PRINT((ndo
, " (length bogus, should be = 4)"));
631 ND_TCHECK2(*(p
+ 2), 2);
632 ND_PRINT((ndo
, ": %u", EXTRACT_16BITS(p
+ 2)));
636 ND_PRINT((ndo
, " (length bogus, should be = 6)"));
639 ND_TCHECK2(*(p
+ 2), 4);
640 ND_PRINT((ndo
, ": 0x%08x", EXTRACT_32BITS(p
+ 2)));
644 ND_PRINT((ndo
, " (length bogus, should be >= 4)"));
647 ND_TCHECK2(*(p
+ 2), 2);
648 ND_PRINT((ndo
, ": %s", tok2str(ppptype2str
, "Unknown Auth Proto (0x04x)", EXTRACT_16BITS(p
+ 2))));
650 switch (EXTRACT_16BITS(p
+2)) {
653 ND_PRINT((ndo
, ", %s", tok2str(authalg_values
, "Unknown Auth Alg %u", p
[4])));
655 case PPP_PAP
: /* fall through */
661 print_unknown_data(ndo
, p
, "\n\t", len
);
666 ND_PRINT((ndo
, " (length bogus, should be >= 4)"));
669 ND_TCHECK2(*(p
+ 2), 2);
670 if (EXTRACT_16BITS(p
+2) == PPP_LQM
)
671 ND_PRINT((ndo
, ": LQR"));
673 ND_PRINT((ndo
, ": unknown"));
677 ND_PRINT((ndo
, " (length bogus, should be = 6)"));
680 ND_TCHECK2(*(p
+ 2), 4);
681 ND_PRINT((ndo
, ": 0x%08x", EXTRACT_32BITS(p
+ 2)));
689 ND_PRINT((ndo
, " (length bogus, should be = 4)"));
692 ND_TCHECK2(*(p
+ 2), 2);
693 ND_PRINT((ndo
, ": 0x%04x", EXTRACT_16BITS(p
+ 2)));
697 ND_PRINT((ndo
, " (length bogus, should be >= 3)"));
700 ND_PRINT((ndo
, ": "));
702 ND_PRINT((ndo
, ": Callback Operation %s (%u)",
703 tok2str(ppp_callback_values
, "Unknown", p
[2]),
708 ND_PRINT((ndo
, " (length bogus, should be = 4)"));
711 ND_TCHECK2(*(p
+ 2), 2);
712 ND_PRINT((ndo
, ": %u", EXTRACT_16BITS(p
+ 2)));
716 ND_PRINT((ndo
, " (length bogus, should be >= 3)"));
720 switch (p
[2]) { /* class */
722 ND_PRINT((ndo
, ": Null"));
725 ND_PRINT((ndo
, ": Local")); /* XXX */
729 ND_PRINT((ndo
, " (length bogus, should be = 7)"));
732 ND_TCHECK2(*(p
+ 3), 4);
733 ND_PRINT((ndo
, ": IPv4 %s", ipaddr_string(ndo
, p
+ 3)));
737 ND_PRINT((ndo
, " (length bogus, should be = 9)"));
740 ND_TCHECK2(*(p
+ 3), 6);
741 ND_PRINT((ndo
, ": MAC %s", etheraddr_string(ndo
, p
+ 3)));
744 ND_PRINT((ndo
, ": Magic-Num-Block")); /* XXX */
747 ND_PRINT((ndo
, ": PSNDN")); /* XXX */
750 ND_PRINT((ndo
, ": Unknown class %u", p
[2]));
755 /* XXX: to be supported */
780 * Unknown option; dump it as raw bytes now if we're
781 * not going to do so below.
783 if (ndo
->ndo_vflag
< 2)
784 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2);
788 if (ndo
->ndo_vflag
> 1)
789 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2); /* exclude TLV header */
794 ND_PRINT((ndo
, "[|lcp]"));
799 static const struct tok ppp_ml_flag_values
[] = {
806 handle_mlppp(netdissect_options
*ndo
,
807 const u_char
*p
, int length
)
810 ND_PRINT((ndo
, "MLPPP, "));
812 ND_PRINT((ndo
, "seq 0x%03x, Flags [%s], length %u",
813 (EXTRACT_16BITS(p
))&0x0fff, /* only support 12-Bit sequence space for now */
814 bittok2str(ppp_ml_flag_values
, "none", *p
& 0xc0),
820 handle_chap(netdissect_options
*ndo
,
821 const u_char
*p
, int length
)
824 int val_size
, name_size
, msg_size
;
830 ND_PRINT((ndo
, "[|chap]"));
832 } else if (length
< 4) {
834 ND_PRINT((ndo
, "[|chap 0x%02x]", *p
));
840 ND_PRINT((ndo
, "CHAP, %s (0x%02x)",
841 tok2str(chapcode_values
,"unknown",code
),
846 ND_PRINT((ndo
, ", id %u", *p
)); /* ID */
850 len
= EXTRACT_16BITS(p
);
854 * Note that this is a generic CHAP decoding routine. Since we
855 * don't know which flavor of CHAP (i.e. CHAP-MD5, MS-CHAPv1,
856 * MS-CHAPv2) is used at this point, we can't decode packet
857 * specifically to each algorithms. Instead, we simply decode
858 * the GCD (Gratest Common Denominator) for all algorithms.
863 if (length
- (p
- p0
) < 1)
866 val_size
= *p
; /* value size */
868 if (length
- (p
- p0
) < val_size
)
870 ND_PRINT((ndo
, ", Value "));
871 for (i
= 0; i
< val_size
; i
++) {
873 ND_PRINT((ndo
, "%02x", *p
++));
875 name_size
= len
- (p
- p0
);
876 ND_PRINT((ndo
, ", Name "));
877 for (i
= 0; i
< name_size
; i
++) {
879 safeputchar(ndo
, *p
++);
884 msg_size
= len
- (p
- p0
);
885 ND_PRINT((ndo
, ", Msg "));
886 for (i
= 0; i
< msg_size
; i
++) {
888 safeputchar(ndo
, *p
++);
895 ND_PRINT((ndo
, "[|chap]"));
898 /* PAP (see RFC 1334) */
900 handle_pap(netdissect_options
*ndo
,
901 const u_char
*p
, int length
)
904 int peerid_len
, passwd_len
, msg_len
;
910 ND_PRINT((ndo
, "[|pap]"));
912 } else if (length
< 4) {
914 ND_PRINT((ndo
, "[|pap 0x%02x]", *p
));
920 ND_PRINT((ndo
, "PAP, %s (0x%02x)",
921 tok2str(papcode_values
, "unknown", code
),
926 ND_PRINT((ndo
, ", id %u", *p
)); /* ID */
930 len
= EXTRACT_16BITS(p
);
933 if ((int)len
> length
) {
934 ND_PRINT((ndo
, ", length %u > packet size", len
));
938 if (length
< (p
- p0
)) {
939 ND_PRINT((ndo
, ", length %u < PAP header length", length
));
945 if (length
- (p
- p0
) < 1)
948 peerid_len
= *p
; /* Peer-ID Length */
950 if (length
- (p
- p0
) < peerid_len
)
952 ND_PRINT((ndo
, ", Peer "));
953 for (i
= 0; i
< peerid_len
; i
++) {
955 safeputchar(ndo
, *p
++);
958 if (length
- (p
- p0
) < 1)
961 passwd_len
= *p
; /* Password Length */
963 if (length
- (p
- p0
) < passwd_len
)
965 ND_PRINT((ndo
, ", Name "));
966 for (i
= 0; i
< passwd_len
; i
++) {
968 safeputchar(ndo
, *p
++);
973 if (length
- (p
- p0
) < 1)
976 msg_len
= *p
; /* Msg-Length */
978 if (length
- (p
- p0
) < msg_len
)
980 ND_PRINT((ndo
, ", Msg "));
981 for (i
= 0; i
< msg_len
; i
++) {
983 safeputchar(ndo
, *p
++);
990 ND_PRINT((ndo
, "[|pap]"));
995 handle_bap(netdissect_options
*ndo _U_
,
996 const u_char
*p _U_
, int length _U_
)
998 /* XXX: to be supported!! */
1002 /* IPCP config options */
1004 print_ipcp_config_options(netdissect_options
*ndo
,
1005 const u_char
*p
, int length
)
1008 u_int compproto
, ipcomp_subopttotallen
, ipcomp_subopt
, ipcomp_suboptlen
;
1018 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u (length bogus, should be >= 2)",
1019 tok2str(ipcpopt_values
,"unknown",opt
),
1025 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u",
1026 tok2str(ipcpopt_values
,"unknown",opt
),
1031 case IPCPOPT_2ADDR
: /* deprecated */
1033 ND_PRINT((ndo
, " (length bogus, should be = 10)"));
1036 ND_TCHECK2(*(p
+ 6), 4);
1037 ND_PRINT((ndo
, ": src %s, dst %s",
1038 ipaddr_string(ndo
, p
+ 2),
1039 ipaddr_string(ndo
, p
+ 6)));
1041 case IPCPOPT_IPCOMP
:
1043 ND_PRINT((ndo
, " (length bogus, should be >= 4)"));
1046 ND_TCHECK2(*(p
+ 2), 2);
1047 compproto
= EXTRACT_16BITS(p
+2);
1049 ND_PRINT((ndo
, ": %s (0x%02x):",
1050 tok2str(ipcpopt_compproto_values
, "Unknown", compproto
),
1053 switch (compproto
) {
1055 /* XXX: VJ-Comp parameters should be decoded */
1057 case IPCPOPT_IPCOMP_HDRCOMP
:
1058 if (len
< IPCPOPT_IPCOMP_MINLEN
) {
1059 ND_PRINT((ndo
, " (length bogus, should be >= %u)",
1060 IPCPOPT_IPCOMP_MINLEN
));
1064 ND_TCHECK2(*(p
+ 2), IPCPOPT_IPCOMP_MINLEN
);
1065 ND_PRINT((ndo
, "\n\t TCP Space %u, non-TCP Space %u" \
1066 ", maxPeriod %u, maxTime %u, maxHdr %u",
1067 EXTRACT_16BITS(p
+4),
1068 EXTRACT_16BITS(p
+6),
1069 EXTRACT_16BITS(p
+8),
1070 EXTRACT_16BITS(p
+10),
1071 EXTRACT_16BITS(p
+12)));
1073 /* suboptions present ? */
1074 if (len
> IPCPOPT_IPCOMP_MINLEN
) {
1075 ipcomp_subopttotallen
= len
- IPCPOPT_IPCOMP_MINLEN
;
1076 p
+= IPCPOPT_IPCOMP_MINLEN
;
1078 ND_PRINT((ndo
, "\n\t Suboptions, length %u", ipcomp_subopttotallen
));
1080 while (ipcomp_subopttotallen
>= 2) {
1083 ipcomp_suboptlen
= *(p
+1);
1086 if (ipcomp_subopt
== 0 ||
1087 ipcomp_suboptlen
== 0 )
1090 /* XXX: just display the suboptions for now */
1091 ND_PRINT((ndo
, "\n\t\t%s Suboption #%u, length %u",
1092 tok2str(ipcpopt_compproto_subopt_values
,
1098 ipcomp_subopttotallen
-= ipcomp_suboptlen
;
1099 p
+= ipcomp_suboptlen
;
1108 case IPCPOPT_ADDR
: /* those options share the same format - fall through */
1109 case IPCPOPT_MOBILE4
:
1110 case IPCPOPT_PRIDNS
:
1111 case IPCPOPT_PRINBNS
:
1112 case IPCPOPT_SECDNS
:
1113 case IPCPOPT_SECNBNS
:
1115 ND_PRINT((ndo
, " (length bogus, should be = 6)"));
1118 ND_TCHECK2(*(p
+ 2), 4);
1119 ND_PRINT((ndo
, ": %s", ipaddr_string(ndo
, p
+ 2)));
1123 * Unknown option; dump it as raw bytes now if we're
1124 * not going to do so below.
1126 if (ndo
->ndo_vflag
< 2)
1127 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2);
1130 if (ndo
->ndo_vflag
> 1)
1131 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2); /* exclude TLV header */
1135 ND_PRINT((ndo
, "[|ipcp]"));
1139 /* IP6CP config options */
1141 print_ip6cp_config_options(netdissect_options
*ndo
,
1142 const u_char
*p
, int length
)
1154 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u (length bogus, should be >= 2)",
1155 tok2str(ip6cpopt_values
,"unknown",opt
),
1161 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u",
1162 tok2str(ip6cpopt_values
,"unknown",opt
),
1169 ND_PRINT((ndo
, " (length bogus, should be = 10)"));
1172 ND_TCHECK2(*(p
+ 2), 8);
1173 ND_PRINT((ndo
, ": %04x:%04x:%04x:%04x",
1174 EXTRACT_16BITS(p
+ 2),
1175 EXTRACT_16BITS(p
+ 4),
1176 EXTRACT_16BITS(p
+ 6),
1177 EXTRACT_16BITS(p
+ 8)));
1181 * Unknown option; dump it as raw bytes now if we're
1182 * not going to do so below.
1184 if (ndo
->ndo_vflag
< 2)
1185 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2);
1188 if (ndo
->ndo_vflag
> 1)
1189 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2); /* exclude TLV header */
1194 ND_PRINT((ndo
, "[|ip6cp]"));
1199 /* CCP config options */
1201 print_ccp_config_options(netdissect_options
*ndo
,
1202 const u_char
*p
, int length
)
1214 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u (length bogus, should be >= 2)",
1215 tok2str(ccpconfopts_values
, "Unknown", opt
),
1221 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u",
1222 tok2str(ccpconfopts_values
, "Unknown", opt
),
1227 case CCPOPT_BSDCOMP
:
1229 ND_PRINT((ndo
, " (length bogus, should be >= 3)"));
1232 ND_TCHECK2(*(p
+ 2), 1);
1233 ND_PRINT((ndo
, ": Version: %u, Dictionary Bits: %u",
1234 p
[2] >> 5, p
[2] & 0x1f));
1238 ND_PRINT((ndo
, " (length bogus, should be >= 4)"));
1241 ND_TCHECK2(*(p
+ 2), 1);
1242 ND_PRINT((ndo
, ": Features: %u, PxP: %s, History: %u, #CTX-ID: %u",
1244 (p
[2] & 0x20) ? "Enabled" : "Disabled",
1245 p
[2] & 0x1f, p
[3]));
1247 case CCPOPT_DEFLATE
:
1249 ND_PRINT((ndo
, " (length bogus, should be >= 4)"));
1252 ND_TCHECK2(*(p
+ 2), 1);
1253 ND_PRINT((ndo
, ": Window: %uK, Method: %s (0x%x), MBZ: %u, CHK: %u",
1255 ((p
[2] & 0x0f) == 8) ? "zlib" : "unkown",
1256 p
[2] & 0x0f, (p
[3] & 0xfc) >> 2, p
[3] & 0x03));
1259 /* XXX: to be supported */
1266 case CCPOPT_STACLZS
:
1277 * Unknown option; dump it as raw bytes now if we're
1278 * not going to do so below.
1280 if (ndo
->ndo_vflag
< 2)
1281 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2);
1284 if (ndo
->ndo_vflag
> 1)
1285 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2); /* exclude TLV header */
1290 ND_PRINT((ndo
, "[|ccp]"));
1294 /* BACP config options */
1296 print_bacp_config_options(netdissect_options
*ndo
,
1297 const u_char
*p
, int length
)
1309 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u (length bogus, should be >= 2)",
1310 tok2str(bacconfopts_values
, "Unknown", opt
),
1316 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u",
1317 tok2str(bacconfopts_values
, "Unknown", opt
),
1324 ND_PRINT((ndo
, " (length bogus, should be = 6)"));
1327 ND_TCHECK2(*(p
+ 2), 4);
1328 ND_PRINT((ndo
, ": Magic-Num 0x%08x", EXTRACT_32BITS(p
+ 2)));
1332 * Unknown option; dump it as raw bytes now if we're
1333 * not going to do so below.
1335 if (ndo
->ndo_vflag
< 2)
1336 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2);
1339 if (ndo
->ndo_vflag
> 1)
1340 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2); /* exclude TLV header */
1345 ND_PRINT((ndo
, "[|bacp]"));
1350 ppp_hdlc(netdissect_options
*ndo
,
1351 const u_char
*p
, int length
)
1361 b
= (u_char
*)malloc(length
);
1366 * Unescape all the data into a temporary, private, buffer.
1367 * Do this so that we dont overwrite the original packet
1370 for (s
= p
, t
= b
, i
= length
; i
> 0 && ND_TTEST(*s
); i
--) {
1373 if (i
<= 1 || !ND_TTEST(*s
))
1381 se
= ndo
->ndo_snapend
;
1382 ndo
->ndo_snapend
= t
;
1385 /* now lets guess about the payload codepoint format */
1388 proto
= *b
; /* start with a one-octet codepoint guess */
1392 ip_print(ndo
, b
+ 1, length
- 1);
1395 ip6_print(ndo
, b
+ 1, length
- 1);
1397 default: /* no luck - try next guess */
1403 proto
= EXTRACT_16BITS(b
); /* next guess - load two octets */
1406 case (PPP_ADDRESS
<< 8 | PPP_CONTROL
): /* looks like a PPP frame */
1409 proto
= EXTRACT_16BITS(b
+2); /* load the PPP proto-id */
1410 handle_ppp(ndo
, proto
, b
+ 4, length
- 4);
1412 default: /* last guess - proto must be a PPP proto-id */
1413 handle_ppp(ndo
, proto
, b
+ 2, length
- 2);
1418 ndo
->ndo_snapend
= se
;
1423 ndo
->ndo_snapend
= se
;
1425 ND_PRINT((ndo
, "[|ppp]"));
1431 handle_ppp(netdissect_options
*ndo
,
1432 u_int proto
, const u_char
*p
, int length
)
1434 if ((proto
& 0xff00) == 0x7e00) { /* is this an escape code ? */
1435 ppp_hdlc(ndo
, p
- 1, length
);
1440 case PPP_LCP
: /* fall through */
1447 handle_ctrl_proto(ndo
, proto
, p
, length
);
1450 handle_mlppp(ndo
, p
, length
);
1453 handle_chap(ndo
, p
, length
);
1456 handle_pap(ndo
, p
, length
);
1458 case PPP_BAP
: /* XXX: not yet completed */
1459 handle_bap(ndo
, p
, length
);
1461 case ETHERTYPE_IP
: /*XXX*/
1464 ip_print(ndo
, p
, length
);
1466 case ETHERTYPE_IPV6
: /*XXX*/
1468 ip6_print(ndo
, p
, length
);
1470 case ETHERTYPE_IPX
: /*XXX*/
1472 ipx_print(ndo
, p
, length
);
1475 isoclns_print(ndo
, p
, length
, length
);
1477 case PPP_MPLS_UCAST
:
1478 case PPP_MPLS_MCAST
:
1479 mpls_print(ndo
, p
, length
);
1482 ND_PRINT((ndo
, "compressed PPP data"));
1485 ND_PRINT((ndo
, "%s ", tok2str(ppptype2str
, "unknown PPP protocol (0x%04x)", proto
)));
1486 print_unknown_data(ndo
, p
, "\n\t", length
);
1491 /* Standard PPP printer */
1493 ppp_print(netdissect_options
*ndo
,
1494 register const u_char
*p
, u_int length
)
1496 u_int proto
,ppp_header
;
1497 u_int olen
= length
; /* _o_riginal length */
1501 * Here, we assume that p points to the Address and Control
1502 * field (if they present).
1507 ppp_header
= EXTRACT_16BITS(p
);
1509 switch(ppp_header
) {
1510 case (PPP_WITHDIRECTION_IN
<< 8 | PPP_CONTROL
):
1511 if (ndo
->ndo_eflag
) ND_PRINT((ndo
, "In "));
1516 case (PPP_WITHDIRECTION_OUT
<< 8 | PPP_CONTROL
):
1517 if (ndo
->ndo_eflag
) ND_PRINT((ndo
, "Out "));
1522 case (PPP_ADDRESS
<< 8 | PPP_CONTROL
):
1523 p
+= 2; /* ACFC not used */
1536 proto
= *p
; /* PFC is used */
1542 proto
= EXTRACT_16BITS(p
);
1549 ND_PRINT((ndo
, "%s (0x%04x), length %u: ",
1550 tok2str(ppptype2str
, "unknown", proto
),
1554 handle_ppp(ndo
, proto
, p
, length
);
1557 ND_PRINT((ndo
, "[|ppp]"));
1562 /* PPP I/F printer */
1564 ppp_if_print(netdissect_options
*ndo
,
1565 const struct pcap_pkthdr
*h
, register const u_char
*p
)
1567 register u_int length
= h
->len
;
1568 register u_int caplen
= h
->caplen
;
1570 if (caplen
< PPP_HDRLEN
) {
1571 ND_PRINT((ndo
, "[|ppp]"));
1577 * XXX: seems to assume that there are 2 octets prepended to an
1578 * actual PPP frame. The 1st octet looks like Input/Output flag
1579 * while 2nd octet is unknown, at least to me
1580 * (mshindo@mshindo.net).
1582 * That was what the original tcpdump code did.
1584 * FreeBSD's "if_ppp.c" *does* set the first octet to 1 for outbound
1585 * packets and 0 for inbound packets - but only if the
1586 * protocol field has the 0x8000 bit set (i.e., it's a network
1587 * control protocol); it does so before running the packet through
1588 * "bpf_filter" to see if it should be discarded, and to see
1589 * if we should update the time we sent the most recent packet...
1591 * ...but it puts the original address field back after doing
1594 * NetBSD's "if_ppp.c" doesn't set the first octet in that fashion.
1596 * I don't know if any PPP implementation handed up to a BPF
1597 * device packets with the first octet being 1 for outbound and
1598 * 0 for inbound packets, so I (guy@alum.mit.edu) don't know
1599 * whether that ever needs to be checked or not.
1601 * Note that NetBSD has a DLT_PPP_SERIAL, which it uses for PPP,
1602 * and its tcpdump appears to assume that the frame always
1603 * begins with an address field and a control field, and that
1604 * the address field might be 0x0f or 0x8f, for Cisco
1605 * point-to-point with HDLC framing as per section 4.3.1 of RFC
1606 * 1547, as well as 0xff, for PPP in HDLC-like framing as per
1609 * (Is the Cisco framing in question what DLT_C_HDLC, in
1613 ND_PRINT((ndo
, "%c %4d %02x ", p
[0] ? 'O' : 'I', length
, p
[1]));
1616 ppp_print(ndo
, p
, length
);
1622 * PPP I/F printer to use if we know that RFC 1662-style PPP in HDLC-like
1623 * framing, or Cisco PPP with HDLC framing as per section 4.3.1 of RFC 1547,
1624 * is being used (i.e., we don't check for PPP_ADDRESS and PPP_CONTROL,
1625 * discard them *if* those are the first two octets, and parse the remaining
1626 * packet as a PPP packet, as "ppp_print()" does).
1628 * This handles, for example, DLT_PPP_SERIAL in NetBSD.
1631 ppp_hdlc_if_print(netdissect_options
*ndo
,
1632 const struct pcap_pkthdr
*h
, register const u_char
*p
)
1634 register u_int length
= h
->len
;
1635 register u_int caplen
= h
->caplen
;
1640 ND_PRINT((ndo
, "[|ppp]"));
1648 ND_PRINT((ndo
, "[|ppp]"));
1653 ND_PRINT((ndo
, "%02x %02x %d ", p
[0], p
[1], length
));
1658 proto
= EXTRACT_16BITS(p
);
1662 ND_PRINT((ndo
, "%s: ", tok2str(ppptype2str
, "unknown PPP protocol (0x%04x)", proto
)));
1664 handle_ppp(ndo
, proto
, p
, length
);
1669 return (chdlc_if_print(ndo
, h
, p
));
1673 ND_PRINT((ndo
, "%02x %02x %d ", p
[0], p
[1], length
));
1678 * XXX - NetBSD's "ppp_netbsd_serial_if_print()" treats
1679 * the next two octets as an Ethernet type; does that
1682 ND_PRINT((ndo
, "unknown addr %02x; ctrl %02x", p
[0], p
[1]));
1689 #define PPP_BSDI_HDRLEN 24
1691 /* BSD/OS specific PPP printer */
1693 ppp_bsdos_if_print(netdissect_options
*ndo _U_
,
1694 const struct pcap_pkthdr
*h _U_
, register const u_char
*p _U_
)
1696 register int hdrlength
;
1698 register u_int length
= h
->len
;
1699 register u_int caplen
= h
->caplen
;
1704 if (caplen
< PPP_BSDI_HDRLEN
) {
1705 ND_PRINT((ndo
, "[|ppp]"));
1712 if (p
[0] == PPP_ADDRESS
&& p
[1] == PPP_CONTROL
) {
1714 ND_PRINT((ndo
, "%02x %02x ", p
[0], p
[1]));
1720 ND_PRINT((ndo
, "%d ", length
));
1721 /* Retrieve the protocol type */
1723 /* Compressed protocol field */
1726 ND_PRINT((ndo
, "%02x ", ptype
));
1730 /* Un-compressed protocol field */
1731 ptype
= EXTRACT_16BITS(p
);
1733 ND_PRINT((ndo
, "%04x ", ptype
));
1740 ND_PRINT((ndo
, "%c ", p
[SLC_DIR
] ? 'O' : 'I'));
1742 /* link level header */
1743 struct ppp_header
*ph
;
1745 q
= p
+ SLC_BPFHDRLEN
;
1746 ph
= (struct ppp_header
*)q
;
1747 if (ph
->phdr_addr
== PPP_ADDRESS
1748 && ph
->phdr_ctl
== PPP_CONTROL
) {
1750 ND_PRINT((ndo
, "%02x %02x ", q
[0], q
[1]));
1751 ptype
= EXTRACT_16BITS(&ph
->phdr_type
);
1752 if (ndo
->ndo_eflag
&& (ptype
== PPP_VJC
|| ptype
== PPP_VJNC
)) {
1753 ND_PRINT((ndo
, "%s ", tok2str(ppptype2str
,
1754 "proto-#%d", ptype
)));
1757 if (ndo
->ndo_eflag
) {
1758 ND_PRINT((ndo
, "LLH=["));
1759 for (i
= 0; i
< p
[SLC_LLHL
]; i
++)
1760 ND_PRINT((ndo
, "%02x", q
[i
]));
1761 ND_PRINT((ndo
, "] "));
1766 ND_PRINT((ndo
, "%d ", length
));
1768 q
= p
+ SLC_BPFHDRLEN
+ p
[SLC_LLHL
];
1772 ptype
= vjc_print(ndo
, q
, ptype
);
1773 hdrlength
= PPP_BSDI_HDRLEN
;
1777 ip_print(ndo
, p
, length
);
1780 ip6_print(ndo
, p
, length
);
1782 case PPP_MPLS_UCAST
:
1783 case PPP_MPLS_MCAST
:
1784 mpls_print(ndo
, p
, length
);
1789 ptype
= vjc_print(ndo
, q
, ptype
);
1790 hdrlength
= PPP_BSDI_HDRLEN
;
1794 ip_print(ndo
, p
, length
);
1797 ip6_print(ndo
, p
, length
);
1799 case PPP_MPLS_UCAST
:
1800 case PPP_MPLS_MCAST
:
1801 mpls_print(ndo
, p
, length
);
1806 if (ndo
->ndo_eflag
) {
1807 ND_PRINT((ndo
, "CH=["));
1808 for (i
= 0; i
< p
[SLC_LLHL
]; i
++)
1809 ND_PRINT((ndo
, "%02x", q
[i
]));
1810 ND_PRINT((ndo
, "] "));
1816 hdrlength
= PPP_BSDI_HDRLEN
;
1819 length
-= hdrlength
;
1824 ip_print(p
, length
);
1827 ip6_print(ndo
, p
, length
);
1829 case PPP_MPLS_UCAST
:
1830 case PPP_MPLS_MCAST
:
1831 mpls_print(ndo
, p
, length
);
1834 ND_PRINT((ndo
, "%s ", tok2str(ppptype2str
, "unknown PPP protocol (0x%04x)", ptype
)));
1840 #endif /* __bsdi__ */
1847 * c-style: whitesmith