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.
25 /* \summary: Point to Point Protocol (PPP) printer */
29 * o resolve XXX as much as possible
38 #include <netdissect-stdinc.h>
41 #include <net/slcompress.h>
42 #include <net/if_ppp.h>
47 #include "netdissect.h"
49 #include "addrtoname.h"
52 #include "ethertype.h"
56 * The following constatns are defined by IANA. Please refer to
57 * http://www.isi.edu/in-notes/iana/assignments/ppp-numbers
58 * for the up-to-date information.
61 /* Protocol Codes defined in ppp.h */
63 static const struct tok ppptype2str
[] = {
67 { PPP_DECNET
, "DECNET" },
68 { PPP_APPLE
, "APPLE" },
70 { PPP_VJC
, "VJC IP" },
71 { PPP_VJNC
, "VJNC IP" },
72 { PPP_BRPDU
, "BRPDU" },
74 { PPP_VINES
, "VINES" },
75 { PPP_MPLS_UCAST
, "MPLS" },
76 { PPP_MPLS_MCAST
, "MPLS" },
77 { PPP_COMP
, "Compressed"},
81 { PPP_HELLO
, "HELLO" },
82 { PPP_LUXCOM
, "LUXCOM" },
85 { PPP_OSICP
, "OSICP" },
87 { PPP_DECNETCP
, "DECNETCP" },
88 { PPP_APPLECP
, "APPLECP" },
89 { PPP_IPXCP
, "IPXCP" },
90 { PPP_STIICP
, "STIICP" },
91 { PPP_VINESCP
, "VINESCP" },
92 { PPP_IPV6CP
, "IP6CP" },
93 { PPP_MPLSCP
, "MPLSCP" },
100 { PPP_SPAP
, "SPAP" },
101 { PPP_SPAP_OLD
, "Old-SPAP" },
102 { PPP_BACP
, "BACP" },
104 { PPP_MPCP
, "MLPPP-CP" },
109 /* Control Protocols (LCP/IPCP/CCP etc.) Codes defined in RFC 1661 */
111 #define CPCODES_VEXT 0 /* Vendor-Specific (RFC2153) */
112 #define CPCODES_CONF_REQ 1 /* Configure-Request */
113 #define CPCODES_CONF_ACK 2 /* Configure-Ack */
114 #define CPCODES_CONF_NAK 3 /* Configure-Nak */
115 #define CPCODES_CONF_REJ 4 /* Configure-Reject */
116 #define CPCODES_TERM_REQ 5 /* Terminate-Request */
117 #define CPCODES_TERM_ACK 6 /* Terminate-Ack */
118 #define CPCODES_CODE_REJ 7 /* Code-Reject */
119 #define CPCODES_PROT_REJ 8 /* Protocol-Reject (LCP only) */
120 #define CPCODES_ECHO_REQ 9 /* Echo-Request (LCP only) */
121 #define CPCODES_ECHO_RPL 10 /* Echo-Reply (LCP only) */
122 #define CPCODES_DISC_REQ 11 /* Discard-Request (LCP only) */
123 #define CPCODES_ID 12 /* Identification (LCP only) RFC1570 */
124 #define CPCODES_TIME_REM 13 /* Time-Remaining (LCP only) RFC1570 */
125 #define CPCODES_RESET_REQ 14 /* Reset-Request (CCP only) RFC1962 */
126 #define CPCODES_RESET_REP 15 /* Reset-Reply (CCP only) */
128 static const struct tok cpcodes
[] = {
129 {CPCODES_VEXT
, "Vendor-Extension"}, /* RFC2153 */
130 {CPCODES_CONF_REQ
, "Conf-Request"},
131 {CPCODES_CONF_ACK
, "Conf-Ack"},
132 {CPCODES_CONF_NAK
, "Conf-Nack"},
133 {CPCODES_CONF_REJ
, "Conf-Reject"},
134 {CPCODES_TERM_REQ
, "Term-Request"},
135 {CPCODES_TERM_ACK
, "Term-Ack"},
136 {CPCODES_CODE_REJ
, "Code-Reject"},
137 {CPCODES_PROT_REJ
, "Prot-Reject"},
138 {CPCODES_ECHO_REQ
, "Echo-Request"},
139 {CPCODES_ECHO_RPL
, "Echo-Reply"},
140 {CPCODES_DISC_REQ
, "Disc-Req"},
141 {CPCODES_ID
, "Ident"}, /* RFC1570 */
142 {CPCODES_TIME_REM
, "Time-Rem"}, /* RFC1570 */
143 {CPCODES_RESET_REQ
, "Reset-Req"}, /* RFC1962 */
144 {CPCODES_RESET_REP
, "Reset-Ack"}, /* RFC1962 */
148 /* LCP Config Options */
150 #define LCPOPT_VEXT 0
152 #define LCPOPT_ACCM 2
156 #define LCPOPT_DEP6 6
158 #define LCPOPT_ACFC 8
159 #define LCPOPT_FCSALT 9
160 #define LCPOPT_SDP 10
161 #define LCPOPT_NUMMODE 11
162 #define LCPOPT_DEP12 12
163 #define LCPOPT_CBACK 13
164 #define LCPOPT_DEP14 14
165 #define LCPOPT_DEP15 15
166 #define LCPOPT_DEP16 16
167 #define LCPOPT_MLMRRU 17
168 #define LCPOPT_MLSSNHF 18
169 #define LCPOPT_MLED 19
170 #define LCPOPT_PROP 20
171 #define LCPOPT_DCEID 21
172 #define LCPOPT_MPP 22
174 #define LCPOPT_LCPAOPT 24
175 #define LCPOPT_COBS 25
177 #define LCPOPT_MLHF 27
178 #define LCPOPT_I18N 28
179 #define LCPOPT_SDLOS 29
180 #define LCPOPT_PPPMUX 30
182 #define LCPOPT_MIN LCPOPT_VEXT
183 #define LCPOPT_MAX LCPOPT_PPPMUX
185 static const char *lcpconfopts
[] = {
186 "Vend-Ext", /* (0) */
189 "Auth-Prot", /* (3) */
190 "Qual-Prot", /* (4) */
191 "Magic-Num", /* (5) */
192 "deprecated(6)", /* used to be a Quality Protocol */
197 "Num-Mode", /* (11) */
198 "deprecated(12)", /* used to be a Multi-Link-Procedure*/
199 "Call-Back", /* (13) */
200 "deprecated(14)", /* used to be a Connect-Time */
201 "deprecated(15)", /* used to be a Compund-Frames */
202 "deprecated(16)", /* used to be a Nominal-Data-Encap */
204 "12-Bit seq #", /* (18) */
205 "End-Disc", /* (19) */
206 "Proprietary", /* (20) */
209 "Link-Disc", /* (23) */
210 "LCP-Auth-Opt", /* (24) */
212 "Prefix-elision", /* (26) */
213 "Multilink-header-Form",/* (27) */
215 "SDL-over-SONET/SDH", /* (29) */
216 "PPP-Muxing", /* (30) */
219 /* ECP - to be supported */
221 /* CCP Config Options */
223 #define CCPOPT_OUI 0 /* RFC1962 */
224 #define CCPOPT_PRED1 1 /* RFC1962 */
225 #define CCPOPT_PRED2 2 /* RFC1962 */
226 #define CCPOPT_PJUMP 3 /* RFC1962 */
227 /* 4-15 unassigned */
228 #define CCPOPT_HPPPC 16 /* RFC1962 */
229 #define CCPOPT_STACLZS 17 /* RFC1974 */
230 #define CCPOPT_MPPC 18 /* RFC2118 */
231 #define CCPOPT_GFZA 19 /* RFC1962 */
232 #define CCPOPT_V42BIS 20 /* RFC1962 */
233 #define CCPOPT_BSDCOMP 21 /* RFC1977 */
235 #define CCPOPT_LZSDCP 23 /* RFC1967 */
236 #define CCPOPT_MVRCA 24 /* RFC1975 */
237 #define CCPOPT_DEC 25 /* RFC1976 */
238 #define CCPOPT_DEFLATE 26 /* RFC1979 */
239 /* 27-254 unassigned */
240 #define CCPOPT_RESV 255 /* RFC1962 */
242 static const struct tok ccpconfopts_values
[] = {
243 { CCPOPT_OUI
, "OUI" },
244 { CCPOPT_PRED1
, "Pred-1" },
245 { CCPOPT_PRED2
, "Pred-2" },
246 { CCPOPT_PJUMP
, "Puddle" },
247 { CCPOPT_HPPPC
, "HP-PPC" },
248 { CCPOPT_STACLZS
, "Stac-LZS" },
249 { CCPOPT_MPPC
, "MPPC" },
250 { CCPOPT_GFZA
, "Gand-FZA" },
251 { CCPOPT_V42BIS
, "V.42bis" },
252 { CCPOPT_BSDCOMP
, "BSD-Comp" },
253 { CCPOPT_LZSDCP
, "LZS-DCP" },
254 { CCPOPT_MVRCA
, "MVRCA" },
255 { CCPOPT_DEC
, "DEC" },
256 { CCPOPT_DEFLATE
, "Deflate" },
257 { CCPOPT_RESV
, "Reserved"},
261 /* BACP Config Options */
263 #define BACPOPT_FPEER 1 /* RFC2125 */
265 static const struct tok bacconfopts_values
[] = {
266 { BACPOPT_FPEER
, "Favored-Peer" },
271 /* SDCP - to be supported */
273 /* IPCP Config Options */
274 #define IPCPOPT_2ADDR 1 /* RFC1172, RFC1332 (deprecated) */
275 #define IPCPOPT_IPCOMP 2 /* RFC1332 */
276 #define IPCPOPT_ADDR 3 /* RFC1332 */
277 #define IPCPOPT_MOBILE4 4 /* RFC2290 */
278 #define IPCPOPT_PRIDNS 129 /* RFC1877 */
279 #define IPCPOPT_PRINBNS 130 /* RFC1877 */
280 #define IPCPOPT_SECDNS 131 /* RFC1877 */
281 #define IPCPOPT_SECNBNS 132 /* RFC1877 */
283 static const struct tok ipcpopt_values
[] = {
284 { IPCPOPT_2ADDR
, "IP-Addrs" },
285 { IPCPOPT_IPCOMP
, "IP-Comp" },
286 { IPCPOPT_ADDR
, "IP-Addr" },
287 { IPCPOPT_MOBILE4
, "Home-Addr" },
288 { IPCPOPT_PRIDNS
, "Pri-DNS" },
289 { IPCPOPT_PRINBNS
, "Pri-NBNS" },
290 { IPCPOPT_SECDNS
, "Sec-DNS" },
291 { IPCPOPT_SECNBNS
, "Sec-NBNS" },
295 #define IPCPOPT_IPCOMP_HDRCOMP 0x61 /* rfc3544 */
296 #define IPCPOPT_IPCOMP_MINLEN 14
298 static const struct tok ipcpopt_compproto_values
[] = {
299 { PPP_VJC
, "VJ-Comp" },
300 { IPCPOPT_IPCOMP_HDRCOMP
, "IP Header Compression" },
304 static const struct tok ipcpopt_compproto_subopt_values
[] = {
305 { 1, "RTP-Compression" },
306 { 2, "Enhanced RTP-Compression" },
310 /* IP6CP Config Options */
313 static const struct tok ip6cpopt_values
[] = {
314 { IP6CP_IFID
, "Interface-ID" },
318 /* ATCP - to be supported */
319 /* OSINLCP - to be supported */
320 /* BVCP - to be supported */
321 /* BCP - to be supported */
322 /* IPXCP - to be supported */
323 /* MPLSCP - to be supported */
325 /* Auth Algorithms */
327 /* 0-4 Reserved (RFC1994) */
328 #define AUTHALG_CHAPMD5 5 /* RFC1994 */
329 #define AUTHALG_MSCHAP1 128 /* RFC2433 */
330 #define AUTHALG_MSCHAP2 129 /* RFC2795 */
332 static const struct tok authalg_values
[] = {
333 { AUTHALG_CHAPMD5
, "MD5" },
334 { AUTHALG_MSCHAP1
, "MS-CHAPv1" },
335 { AUTHALG_MSCHAP2
, "MS-CHAPv2" },
339 /* FCS Alternatives - to be supported */
341 /* Multilink Endpoint Discriminator (RFC1717) */
342 #define MEDCLASS_NULL 0 /* Null Class */
343 #define MEDCLASS_LOCAL 1 /* Locally Assigned */
344 #define MEDCLASS_IPV4 2 /* Internet Protocol (IPv4) */
345 #define MEDCLASS_MAC 3 /* IEEE 802.1 global MAC address */
346 #define MEDCLASS_MNB 4 /* PPP Magic Number Block */
347 #define MEDCLASS_PSNDN 5 /* Public Switched Network Director Number */
349 /* PPP LCP Callback */
350 #define CALLBACK_AUTH 0 /* Location determined by user auth */
351 #define CALLBACK_DSTR 1 /* Dialing string */
352 #define CALLBACK_LID 2 /* Location identifier */
353 #define CALLBACK_E164 3 /* E.164 number */
354 #define CALLBACK_X500 4 /* X.500 distinguished name */
355 #define CALLBACK_CBCP 6 /* Location is determined during CBCP nego */
357 static const struct tok ppp_callback_values
[] = {
358 { CALLBACK_AUTH
, "UserAuth" },
359 { CALLBACK_DSTR
, "DialString" },
360 { CALLBACK_LID
, "LocalID" },
361 { CALLBACK_E164
, "E.164" },
362 { CALLBACK_X500
, "X.500" },
363 { CALLBACK_CBCP
, "CBCP" },
374 static const struct tok chapcode_values
[] = {
375 { CHAP_CHAL
, "Challenge" },
376 { CHAP_RESP
, "Response" },
377 { CHAP_SUCC
, "Success" },
378 { CHAP_FAIL
, "Fail" },
388 static const struct tok papcode_values
[] = {
389 { PAP_AREQ
, "Auth-Req" },
390 { PAP_AACK
, "Auth-ACK" },
391 { PAP_ANAK
, "Auth-NACK" },
396 #define BAP_CALLREQ 1
397 #define BAP_CALLRES 2
405 static int print_lcp_config_options(netdissect_options
*, const u_char
*p
, int);
406 static int print_ipcp_config_options(netdissect_options
*, const u_char
*p
, int);
407 static int print_ip6cp_config_options(netdissect_options
*, const u_char
*p
, int);
408 static int print_ccp_config_options(netdissect_options
*, const u_char
*p
, int);
409 static int print_bacp_config_options(netdissect_options
*, const u_char
*p
, int);
410 static void handle_ppp(netdissect_options
*, u_int proto
, const u_char
*p
, int length
);
412 /* generic Control Protocol (e.g. LCP, IPCP, CCP, etc.) handler */
414 handle_ctrl_proto(netdissect_options
*ndo
,
415 u_int proto
, const u_char
*pptr
, int length
)
419 int (*pfunc
)(netdissect_options
*, const u_char
*, int);
425 typestr
= tok2str(ppptype2str
, "unknown ctrl-proto (0x%04x)", proto
);
426 ND_PRINT((ndo
, "%s, ", typestr
));
428 if (length
< 4) /* FIXME weak boundary checking */
430 ND_TCHECK2(*tptr
, 2);
432 code
= EXTRACT_U_1(tptr
);
435 ND_PRINT((ndo
, "%s (0x%02x), id %u, length %u",
436 tok2str(cpcodes
, "Unknown Opcode",code
),
438 EXTRACT_U_1(tptr
), /* ID */
446 return; /* there may be a NULL confreq etc. */
448 ND_TCHECK2(*tptr
, 2);
449 len
= EXTRACT_BE_U_2(tptr
);
452 ND_PRINT((ndo
, "\n\tencoded length %u (=Option(s) length %u)", len
, len
- 4));
454 if (ndo
->ndo_vflag
> 1)
455 print_unknown_data(ndo
, pptr
- 2, "\n\t", 6);
462 ND_TCHECK2(*tptr
, 4);
463 ND_PRINT((ndo
, "\n\t Magic-Num 0x%08x", EXTRACT_BE_U_4(tptr
)));
465 ND_TCHECK2(*tptr
, 3);
466 ND_PRINT((ndo
, " Vendor: %s (%u)",
467 tok2str(oui_values
,"Unknown",EXTRACT_BE_U_3(tptr
)),
468 EXTRACT_BE_U_3(tptr
)));
469 /* XXX: need to decode Kind and Value(s)? */
471 case CPCODES_CONF_REQ
:
472 case CPCODES_CONF_ACK
:
473 case CPCODES_CONF_NAK
:
474 case CPCODES_CONF_REJ
:
475 x
= len
- 4; /* Code(1), Identifier(1) and Length(2) */
479 pfunc
= print_lcp_config_options
;
482 pfunc
= print_ipcp_config_options
;
485 pfunc
= print_ip6cp_config_options
;
488 pfunc
= print_ccp_config_options
;
491 pfunc
= print_bacp_config_options
;
495 * No print routine for the options for
502 if (pfunc
== NULL
) /* catch the above null pointer if unknown CP */
505 if ((j
= (*pfunc
)(ndo
, tptr
, len
)) == 0)
512 case CPCODES_TERM_REQ
:
513 case CPCODES_TERM_ACK
:
514 /* XXX: need to decode Data? */
516 case CPCODES_CODE_REJ
:
517 /* XXX: need to decode Rejected-Packet? */
519 case CPCODES_PROT_REJ
:
522 ND_TCHECK2(*tptr
, 2);
523 ND_PRINT((ndo
, "\n\t Rejected %s Protocol (0x%04x)",
524 tok2str(ppptype2str
,"unknown", EXTRACT_BE_U_2(tptr
)),
525 EXTRACT_BE_U_2(tptr
)));
526 /* XXX: need to decode Rejected-Information? - hexdump for now */
528 ND_PRINT((ndo
, "\n\t Rejected Packet"));
529 print_unknown_data(ndo
, tptr
+ 2, "\n\t ", len
- 2);
532 case CPCODES_ECHO_REQ
:
533 case CPCODES_ECHO_RPL
:
534 case CPCODES_DISC_REQ
:
537 ND_TCHECK2(*tptr
, 4);
538 ND_PRINT((ndo
, "\n\t Magic-Num 0x%08x", EXTRACT_BE_U_4(tptr
)));
539 /* XXX: need to decode Data? - hexdump for now */
541 ND_PRINT((ndo
, "\n\t -----trailing data-----"));
542 ND_TCHECK2(tptr
[4], len
- 8);
543 print_unknown_data(ndo
, tptr
+ 4, "\n\t ", len
- 8);
549 ND_TCHECK2(*tptr
, 4);
550 ND_PRINT((ndo
, "\n\t Magic-Num 0x%08x", EXTRACT_BE_U_4(tptr
)));
551 /* RFC 1661 says this is intended to be human readable */
553 ND_PRINT((ndo
, "\n\t Message\n\t "));
554 if (fn_printn(ndo
, tptr
+ 4, len
- 4, ndo
->ndo_snapend
))
558 case CPCODES_TIME_REM
:
561 ND_TCHECK2(*tptr
, 4);
562 ND_PRINT((ndo
, "\n\t Magic-Num 0x%08x", EXTRACT_BE_U_4(tptr
)));
563 ND_TCHECK2(*(tptr
+ 4), 4);
564 ND_PRINT((ndo
, ", Seconds-Remaining %us", EXTRACT_BE_U_4(tptr
+ 4)));
565 /* XXX: need to decode Message? */
568 /* XXX this is dirty but we do not get the
569 * original pointer passed to the begin
571 if (ndo
->ndo_vflag
<= 1)
572 print_unknown_data(ndo
, pptr
- 2, "\n\t ", length
+ 2);
578 ND_PRINT((ndo
, "[|%s]", typestr
));
581 /* LCP config options */
583 print_lcp_config_options(netdissect_options
*ndo
,
584 const u_char
*p
, int length
)
596 if ((opt
>= LCPOPT_MIN
) && (opt
<= LCPOPT_MAX
))
597 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u (length bogus, should be >= 2)",
598 lcpconfopts
[opt
], opt
, len
));
600 ND_PRINT((ndo
, "\n\tunknown LCP option 0x%02x", opt
));
603 if ((opt
>= LCPOPT_MIN
) && (opt
<= LCPOPT_MAX
))
604 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u", lcpconfopts
[opt
], opt
, len
));
606 ND_PRINT((ndo
, "\n\tunknown LCP option 0x%02x", opt
));
613 ND_PRINT((ndo
, " (length bogus, should be >= 6)"));
617 ND_PRINT((ndo
, ": Vendor: %s (%u)",
618 tok2str(oui_values
,"Unknown",EXTRACT_BE_U_3(p
+ 2)),
619 EXTRACT_BE_U_3(p
+ 2)));
622 ND_PRINT((ndo
, ", kind: 0x%02x", p
[5]));
623 ND_PRINT((ndo
, ", Value: 0x"));
624 for (i
= 0; i
< len
- 6; i
++) {
626 ND_PRINT((ndo
, "%02x", p
[6 + i
]));
632 ND_PRINT((ndo
, " (length bogus, should be = 4)"));
636 ND_PRINT((ndo
, ": %u", EXTRACT_BE_U_2(p
+ 2)));
640 ND_PRINT((ndo
, " (length bogus, should be = 6)"));
644 ND_PRINT((ndo
, ": 0x%08x", EXTRACT_BE_U_4(p
+ 2)));
648 ND_PRINT((ndo
, " (length bogus, should be >= 4)"));
652 ND_PRINT((ndo
, ": %s", tok2str(ppptype2str
, "Unknown Auth Proto (0x04x)", EXTRACT_BE_U_2(p
+ 2))));
654 switch (EXTRACT_BE_U_2(p
+ 2)) {
657 ND_PRINT((ndo
, ", %s", tok2str(authalg_values
, "Unknown Auth Alg %u", EXTRACT_U_1(p
+ 4))));
659 case PPP_PAP
: /* fall through */
665 print_unknown_data(ndo
, p
, "\n\t", len
);
670 ND_PRINT((ndo
, " (length bogus, should be >= 4)"));
674 if (EXTRACT_BE_U_2(p
+ 2) == PPP_LQM
)
675 ND_PRINT((ndo
, ": LQR"));
677 ND_PRINT((ndo
, ": unknown"));
681 ND_PRINT((ndo
, " (length bogus, should be = 6)"));
685 ND_PRINT((ndo
, ": 0x%08x", EXTRACT_BE_U_4(p
+ 2)));
693 ND_PRINT((ndo
, " (length bogus, should be = 4)"));
697 ND_PRINT((ndo
, ": 0x%04x", EXTRACT_BE_U_2(p
+ 2)));
701 ND_PRINT((ndo
, " (length bogus, should be >= 3)"));
704 ND_PRINT((ndo
, ": "));
706 ND_PRINT((ndo
, ": Callback Operation %s (%u)",
707 tok2str(ppp_callback_values
, "Unknown", EXTRACT_U_1(p
+ 2)),
712 ND_PRINT((ndo
, " (length bogus, should be = 4)"));
716 ND_PRINT((ndo
, ": %u", EXTRACT_BE_U_2(p
+ 2)));
720 ND_PRINT((ndo
, " (length bogus, should be >= 3)"));
724 switch (p
[2]) { /* class */
726 ND_PRINT((ndo
, ": Null"));
729 ND_PRINT((ndo
, ": Local")); /* XXX */
733 ND_PRINT((ndo
, " (length bogus, should be = 7)"));
736 ND_TCHECK2(*(p
+ 3), 4);
737 ND_PRINT((ndo
, ": IPv4 %s", ipaddr_string(ndo
, p
+ 3)));
741 ND_PRINT((ndo
, " (length bogus, should be = 9)"));
744 ND_TCHECK2(*(p
+ 3), 6);
745 ND_PRINT((ndo
, ": MAC %s", etheraddr_string(ndo
, p
+ 3)));
748 ND_PRINT((ndo
, ": Magic-Num-Block")); /* XXX */
751 ND_PRINT((ndo
, ": PSNDN")); /* XXX */
754 ND_PRINT((ndo
, ": Unknown class %u", p
[2]));
759 /* XXX: to be supported */
784 * Unknown option; dump it as raw bytes now if we're
785 * not going to do so below.
787 if (ndo
->ndo_vflag
< 2)
788 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2);
792 if (ndo
->ndo_vflag
> 1)
793 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2); /* exclude TLV header */
798 ND_PRINT((ndo
, "[|lcp]"));
803 static const struct tok ppp_ml_flag_values
[] = {
810 handle_mlppp(netdissect_options
*ndo
,
811 const u_char
*p
, int length
)
814 ND_PRINT((ndo
, "MLPPP, "));
817 ND_PRINT((ndo
, "[|mlppp]"));
820 if (!ND_TTEST_2(p
)) {
821 ND_PRINT((ndo
, "[|mlppp]"));
825 ND_PRINT((ndo
, "seq 0x%03x, Flags [%s], length %u",
826 (EXTRACT_BE_U_2(p
))&0x0fff, /* only support 12-Bit sequence space for now */
827 bittok2str(ppp_ml_flag_values
, "none", EXTRACT_U_1(p
) & 0xc0),
833 handle_chap(netdissect_options
*ndo
,
834 const u_char
*p
, int length
)
837 int val_size
, name_size
, msg_size
;
843 ND_PRINT((ndo
, "[|chap]"));
845 } else if (length
< 4) {
847 ND_PRINT((ndo
, "[|chap 0x%02x]", *p
));
853 ND_PRINT((ndo
, "CHAP, %s (0x%02x)",
854 tok2str(chapcode_values
,"unknown",code
),
859 ND_PRINT((ndo
, ", id %u", *p
)); /* ID */
863 len
= EXTRACT_BE_U_2(p
);
867 * Note that this is a generic CHAP decoding routine. Since we
868 * don't know which flavor of CHAP (i.e. CHAP-MD5, MS-CHAPv1,
869 * MS-CHAPv2) is used at this point, we can't decode packet
870 * specifically to each algorithms. Instead, we simply decode
871 * the GCD (Gratest Common Denominator) for all algorithms.
876 if (length
- (p
- p0
) < 1)
879 val_size
= *p
; /* value size */
881 if (length
- (p
- p0
) < val_size
)
883 ND_PRINT((ndo
, ", Value "));
884 for (i
= 0; i
< val_size
; i
++) {
886 ND_PRINT((ndo
, "%02x", EXTRACT_U_1(p
)));
889 name_size
= len
- (p
- p0
);
890 ND_PRINT((ndo
, ", Name "));
891 for (i
= 0; i
< name_size
; i
++) {
893 safeputchar(ndo
, EXTRACT_U_1(p
));
899 msg_size
= len
- (p
- p0
);
900 ND_PRINT((ndo
, ", Msg "));
901 for (i
= 0; i
< msg_size
; i
++) {
903 safeputchar(ndo
, EXTRACT_U_1(p
));
911 ND_PRINT((ndo
, "[|chap]"));
914 /* PAP (see RFC 1334) */
916 handle_pap(netdissect_options
*ndo
,
917 const u_char
*p
, int length
)
920 int peerid_len
, passwd_len
, msg_len
;
926 ND_PRINT((ndo
, "[|pap]"));
928 } else if (length
< 4) {
930 ND_PRINT((ndo
, "[|pap 0x%02x]", *p
));
936 ND_PRINT((ndo
, "PAP, %s (0x%02x)",
937 tok2str(papcode_values
, "unknown", code
),
942 ND_PRINT((ndo
, ", id %u", *p
)); /* ID */
946 len
= EXTRACT_BE_U_2(p
);
949 if ((int)len
> length
) {
950 ND_PRINT((ndo
, ", length %u > packet size", len
));
954 if (length
< (p
- p0
)) {
955 ND_PRINT((ndo
, ", length %u < PAP header length", length
));
961 /* A valid Authenticate-Request is 6 or more octets long. */
964 if (length
- (p
- p0
) < 1)
967 peerid_len
= *p
; /* Peer-ID Length */
969 if (length
- (p
- p0
) < peerid_len
)
971 ND_PRINT((ndo
, ", Peer "));
972 for (i
= 0; i
< peerid_len
; i
++) {
974 safeputchar(ndo
, EXTRACT_U_1(p
));
978 if (length
- (p
- p0
) < 1)
981 passwd_len
= *p
; /* Password Length */
983 if (length
- (p
- p0
) < passwd_len
)
985 ND_PRINT((ndo
, ", Name "));
986 for (i
= 0; i
< passwd_len
; i
++) {
988 safeputchar(ndo
, EXTRACT_U_1(p
));
994 /* Although some implementations ignore truncation at
995 * this point and at least one generates a truncated
996 * packet, RFC 1334 section 2.2.2 clearly states that
997 * both AACK and ANAK are at least 5 bytes long.
1001 if (length
- (p
- p0
) < 1)
1004 msg_len
= *p
; /* Msg-Length */
1006 if (length
- (p
- p0
) < msg_len
)
1008 ND_PRINT((ndo
, ", Msg "));
1009 for (i
= 0; i
< msg_len
; i
++) {
1011 safeputchar(ndo
, EXTRACT_U_1(p
));
1019 ND_PRINT((ndo
, "[|pap]"));
1024 handle_bap(netdissect_options
*ndo _U_
,
1025 const u_char
*p _U_
, int length _U_
)
1027 /* XXX: to be supported!! */
1031 /* IPCP config options */
1033 print_ipcp_config_options(netdissect_options
*ndo
,
1034 const u_char
*p
, int length
)
1037 u_int compproto
, ipcomp_subopttotallen
, ipcomp_subopt
, ipcomp_suboptlen
;
1047 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u (length bogus, should be >= 2)",
1048 tok2str(ipcpopt_values
,"unknown",opt
),
1054 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u",
1055 tok2str(ipcpopt_values
,"unknown",opt
),
1060 case IPCPOPT_2ADDR
: /* deprecated */
1062 ND_PRINT((ndo
, " (length bogus, should be = 10)"));
1065 ND_TCHECK2(*(p
+ 6), 4);
1066 ND_PRINT((ndo
, ": src %s, dst %s",
1067 ipaddr_string(ndo
, p
+ 2),
1068 ipaddr_string(ndo
, p
+ 6)));
1070 case IPCPOPT_IPCOMP
:
1072 ND_PRINT((ndo
, " (length bogus, should be >= 4)"));
1076 compproto
= EXTRACT_BE_U_2(p
+ 2);
1078 ND_PRINT((ndo
, ": %s (0x%02x):",
1079 tok2str(ipcpopt_compproto_values
, "Unknown", compproto
),
1082 switch (compproto
) {
1084 /* XXX: VJ-Comp parameters should be decoded */
1086 case IPCPOPT_IPCOMP_HDRCOMP
:
1087 if (len
< IPCPOPT_IPCOMP_MINLEN
) {
1088 ND_PRINT((ndo
, " (length bogus, should be >= %u)",
1089 IPCPOPT_IPCOMP_MINLEN
));
1093 ND_TCHECK2(*(p
+ 2), IPCPOPT_IPCOMP_MINLEN
);
1094 ND_PRINT((ndo
, "\n\t TCP Space %u, non-TCP Space %u" \
1095 ", maxPeriod %u, maxTime %u, maxHdr %u",
1096 EXTRACT_BE_U_2(p
+ 4),
1097 EXTRACT_BE_U_2(p
+ 6),
1098 EXTRACT_BE_U_2(p
+ 8),
1099 EXTRACT_BE_U_2(p
+ 10),
1100 EXTRACT_BE_U_2(p
+ 12)));
1102 /* suboptions present ? */
1103 if (len
> IPCPOPT_IPCOMP_MINLEN
) {
1104 ipcomp_subopttotallen
= len
- IPCPOPT_IPCOMP_MINLEN
;
1105 p
+= IPCPOPT_IPCOMP_MINLEN
;
1107 ND_PRINT((ndo
, "\n\t Suboptions, length %u", ipcomp_subopttotallen
));
1109 while (ipcomp_subopttotallen
>= 2) {
1112 ipcomp_suboptlen
= EXTRACT_U_1(p
+ 1);
1115 if (ipcomp_subopt
== 0 ||
1116 ipcomp_suboptlen
== 0 )
1119 /* XXX: just display the suboptions for now */
1120 ND_PRINT((ndo
, "\n\t\t%s Suboption #%u, length %u",
1121 tok2str(ipcpopt_compproto_subopt_values
,
1127 ipcomp_subopttotallen
-= ipcomp_suboptlen
;
1128 p
+= ipcomp_suboptlen
;
1137 case IPCPOPT_ADDR
: /* those options share the same format - fall through */
1138 case IPCPOPT_MOBILE4
:
1139 case IPCPOPT_PRIDNS
:
1140 case IPCPOPT_PRINBNS
:
1141 case IPCPOPT_SECDNS
:
1142 case IPCPOPT_SECNBNS
:
1144 ND_PRINT((ndo
, " (length bogus, should be = 6)"));
1147 ND_TCHECK2(*(p
+ 2), 4);
1148 ND_PRINT((ndo
, ": %s", ipaddr_string(ndo
, p
+ 2)));
1152 * Unknown option; dump it as raw bytes now if we're
1153 * not going to do so below.
1155 if (ndo
->ndo_vflag
< 2)
1156 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2);
1159 if (ndo
->ndo_vflag
> 1)
1160 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2); /* exclude TLV header */
1164 ND_PRINT((ndo
, "[|ipcp]"));
1168 /* IP6CP config options */
1170 print_ip6cp_config_options(netdissect_options
*ndo
,
1171 const u_char
*p
, int length
)
1183 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u (length bogus, should be >= 2)",
1184 tok2str(ip6cpopt_values
,"unknown",opt
),
1190 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u",
1191 tok2str(ip6cpopt_values
,"unknown",opt
),
1198 ND_PRINT((ndo
, " (length bogus, should be = 10)"));
1201 ND_TCHECK2(*(p
+ 2), 8);
1202 ND_PRINT((ndo
, ": %04x:%04x:%04x:%04x",
1203 EXTRACT_BE_U_2(p
+ 2),
1204 EXTRACT_BE_U_2(p
+ 4),
1205 EXTRACT_BE_U_2(p
+ 6),
1206 EXTRACT_BE_U_2(p
+ 8)));
1210 * Unknown option; dump it as raw bytes now if we're
1211 * not going to do so below.
1213 if (ndo
->ndo_vflag
< 2)
1214 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2);
1217 if (ndo
->ndo_vflag
> 1)
1218 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2); /* exclude TLV header */
1223 ND_PRINT((ndo
, "[|ip6cp]"));
1228 /* CCP config options */
1230 print_ccp_config_options(netdissect_options
*ndo
,
1231 const u_char
*p
, int length
)
1243 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u (length bogus, should be >= 2)",
1244 tok2str(ccpconfopts_values
, "Unknown", opt
),
1250 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u",
1251 tok2str(ccpconfopts_values
, "Unknown", opt
),
1256 case CCPOPT_BSDCOMP
:
1258 ND_PRINT((ndo
, " (length bogus, should be >= 3)"));
1262 ND_PRINT((ndo
, ": Version: %u, Dictionary Bits: %u",
1263 p
[2] >> 5, p
[2] & 0x1f));
1267 ND_PRINT((ndo
, " (length bogus, should be >= 4)"));
1271 ND_PRINT((ndo
, ": Features: %u, PxP: %s, History: %u, #CTX-ID: %u",
1273 (p
[2] & 0x20) ? "Enabled" : "Disabled",
1274 p
[2] & 0x1f, p
[3]));
1276 case CCPOPT_DEFLATE
:
1278 ND_PRINT((ndo
, " (length bogus, should be >= 4)"));
1282 ND_PRINT((ndo
, ": Window: %uK, Method: %s (0x%x), MBZ: %u, CHK: %u",
1284 ((p
[2] & 0x0f) == 8) ? "zlib" : "unknown",
1285 p
[2] & 0x0f, (p
[3] & 0xfc) >> 2, p
[3] & 0x03));
1288 /* XXX: to be supported */
1295 case CCPOPT_STACLZS
:
1306 * Unknown option; dump it as raw bytes now if we're
1307 * not going to do so below.
1309 if (ndo
->ndo_vflag
< 2)
1310 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2);
1313 if (ndo
->ndo_vflag
> 1)
1314 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2); /* exclude TLV header */
1319 ND_PRINT((ndo
, "[|ccp]"));
1323 /* BACP config options */
1325 print_bacp_config_options(netdissect_options
*ndo
,
1326 const u_char
*p
, int length
)
1338 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u (length bogus, should be >= 2)",
1339 tok2str(bacconfopts_values
, "Unknown", opt
),
1345 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u",
1346 tok2str(bacconfopts_values
, "Unknown", opt
),
1353 ND_PRINT((ndo
, " (length bogus, should be = 6)"));
1357 ND_PRINT((ndo
, ": Magic-Num 0x%08x", EXTRACT_BE_U_4(p
+ 2)));
1361 * Unknown option; dump it as raw bytes now if we're
1362 * not going to do so below.
1364 if (ndo
->ndo_vflag
< 2)
1365 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2);
1368 if (ndo
->ndo_vflag
> 1)
1369 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2); /* exclude TLV header */
1374 ND_PRINT((ndo
, "[|bacp]"));
1379 ppp_hdlc(netdissect_options
*ndo
,
1380 const u_char
*p
, int length
)
1390 b
= (u_char
*)malloc(length
);
1395 * Unescape all the data into a temporary, private, buffer.
1396 * Do this so that we dont overwrite the original packet
1399 for (s
= p
, t
= b
, i
= length
; i
> 0 && ND_TTEST(*s
); i
--) {
1403 if (i
<= 1 || !ND_TTEST(*s
))
1406 c
= EXTRACT_U_1(s
) ^ 0x20;
1412 se
= ndo
->ndo_snapend
;
1413 ndo
->ndo_snapend
= t
;
1416 /* now lets guess about the payload codepoint format */
1419 proto
= *b
; /* start with a one-octet codepoint guess */
1423 ip_print(ndo
, b
+ 1, length
- 1);
1426 ip6_print(ndo
, b
+ 1, length
- 1);
1428 default: /* no luck - try next guess */
1434 proto
= EXTRACT_BE_U_2(b
); /* next guess - load two octets */
1437 case (PPP_ADDRESS
<< 8 | PPP_CONTROL
): /* looks like a PPP frame */
1440 proto
= EXTRACT_BE_U_2(b
+ 2); /* load the PPP proto-id */
1441 handle_ppp(ndo
, proto
, b
+ 4, length
- 4);
1443 default: /* last guess - proto must be a PPP proto-id */
1444 handle_ppp(ndo
, proto
, b
+ 2, length
- 2);
1449 ndo
->ndo_snapend
= se
;
1454 ndo
->ndo_snapend
= se
;
1456 ND_PRINT((ndo
, "[|ppp]"));
1462 handle_ppp(netdissect_options
*ndo
,
1463 u_int proto
, const u_char
*p
, int length
)
1465 if ((proto
& 0xff00) == 0x7e00) { /* is this an escape code ? */
1466 ppp_hdlc(ndo
, p
- 1, length
);
1471 case PPP_LCP
: /* fall through */
1478 handle_ctrl_proto(ndo
, proto
, p
, length
);
1481 handle_mlppp(ndo
, p
, length
);
1484 handle_chap(ndo
, p
, length
);
1487 handle_pap(ndo
, p
, length
);
1489 case PPP_BAP
: /* XXX: not yet completed */
1490 handle_bap(ndo
, p
, length
);
1492 case ETHERTYPE_IP
: /*XXX*/
1495 ip_print(ndo
, p
, length
);
1497 case ETHERTYPE_IPV6
: /*XXX*/
1499 ip6_print(ndo
, p
, length
);
1501 case ETHERTYPE_IPX
: /*XXX*/
1503 ipx_print(ndo
, p
, length
);
1506 isoclns_print(ndo
, p
, length
);
1508 case PPP_MPLS_UCAST
:
1509 case PPP_MPLS_MCAST
:
1510 mpls_print(ndo
, p
, length
);
1513 ND_PRINT((ndo
, "compressed PPP data"));
1516 ND_PRINT((ndo
, "%s ", tok2str(ppptype2str
, "unknown PPP protocol (0x%04x)", proto
)));
1517 print_unknown_data(ndo
, p
, "\n\t", length
);
1522 /* Standard PPP printer */
1524 ppp_print(netdissect_options
*ndo
,
1525 register const u_char
*p
, u_int length
)
1527 u_int proto
,ppp_header
;
1528 u_int olen
= length
; /* _o_riginal length */
1532 * Here, we assume that p points to the Address and Control
1533 * field (if they present).
1538 ppp_header
= EXTRACT_BE_U_2(p
);
1540 switch(ppp_header
) {
1541 case (PPP_WITHDIRECTION_IN
<< 8 | PPP_CONTROL
):
1542 if (ndo
->ndo_eflag
) ND_PRINT((ndo
, "In "));
1547 case (PPP_WITHDIRECTION_OUT
<< 8 | PPP_CONTROL
):
1548 if (ndo
->ndo_eflag
) ND_PRINT((ndo
, "Out "));
1553 case (PPP_ADDRESS
<< 8 | PPP_CONTROL
):
1554 p
+= 2; /* ACFC not used */
1567 proto
= *p
; /* PFC is used */
1573 proto
= EXTRACT_BE_U_2(p
);
1580 ND_PRINT((ndo
, "%s (0x%04x), length %u: ",
1581 tok2str(ppptype2str
, "unknown", proto
),
1585 handle_ppp(ndo
, proto
, p
, length
);
1588 ND_PRINT((ndo
, "[|ppp]"));
1593 /* PPP I/F printer */
1595 ppp_if_print(netdissect_options
*ndo
,
1596 const struct pcap_pkthdr
*h
, register const u_char
*p
)
1598 register u_int length
= h
->len
;
1599 register u_int caplen
= h
->caplen
;
1601 if (caplen
< PPP_HDRLEN
) {
1602 ND_PRINT((ndo
, "[|ppp]"));
1608 * XXX: seems to assume that there are 2 octets prepended to an
1609 * actual PPP frame. The 1st octet looks like Input/Output flag
1610 * while 2nd octet is unknown, at least to me
1611 * (mshindo@mshindo.net).
1613 * That was what the original tcpdump code did.
1615 * FreeBSD's "if_ppp.c" *does* set the first octet to 1 for outbound
1616 * packets and 0 for inbound packets - but only if the
1617 * protocol field has the 0x8000 bit set (i.e., it's a network
1618 * control protocol); it does so before running the packet through
1619 * "bpf_filter" to see if it should be discarded, and to see
1620 * if we should update the time we sent the most recent packet...
1622 * ...but it puts the original address field back after doing
1625 * NetBSD's "if_ppp.c" doesn't set the first octet in that fashion.
1627 * I don't know if any PPP implementation handed up to a BPF
1628 * device packets with the first octet being 1 for outbound and
1629 * 0 for inbound packets, so I (guy@alum.mit.edu) don't know
1630 * whether that ever needs to be checked or not.
1632 * Note that NetBSD has a DLT_PPP_SERIAL, which it uses for PPP,
1633 * and its tcpdump appears to assume that the frame always
1634 * begins with an address field and a control field, and that
1635 * the address field might be 0x0f or 0x8f, for Cisco
1636 * point-to-point with HDLC framing as per section 4.3.1 of RFC
1637 * 1547, as well as 0xff, for PPP in HDLC-like framing as per
1640 * (Is the Cisco framing in question what DLT_C_HDLC, in
1644 ND_PRINT((ndo
, "%c %4d %02x ", p
[0] ? 'O' : 'I', length
, p
[1]));
1647 ppp_print(ndo
, p
, length
);
1653 * PPP I/F printer to use if we know that RFC 1662-style PPP in HDLC-like
1654 * framing, or Cisco PPP with HDLC framing as per section 4.3.1 of RFC 1547,
1655 * is being used (i.e., we don't check for PPP_ADDRESS and PPP_CONTROL,
1656 * discard them *if* those are the first two octets, and parse the remaining
1657 * packet as a PPP packet, as "ppp_print()" does).
1659 * This handles, for example, DLT_PPP_SERIAL in NetBSD.
1662 ppp_hdlc_if_print(netdissect_options
*ndo
,
1663 const struct pcap_pkthdr
*h
, register const u_char
*p
)
1665 register u_int length
= h
->len
;
1666 register u_int caplen
= h
->caplen
;
1671 ND_PRINT((ndo
, "[|ppp]"));
1679 ND_PRINT((ndo
, "[|ppp]"));
1684 ND_PRINT((ndo
, "%02x %02x %d ", p
[0], p
[1], length
));
1689 proto
= EXTRACT_BE_U_2(p
);
1693 ND_PRINT((ndo
, "%s: ", tok2str(ppptype2str
, "unknown PPP protocol (0x%04x)", proto
)));
1695 handle_ppp(ndo
, proto
, p
, length
);
1700 return (chdlc_if_print(ndo
, h
, p
));
1704 ND_PRINT((ndo
, "[|ppp]"));
1709 ND_PRINT((ndo
, "%02x %02x %d ", p
[0], p
[1], length
));
1714 * XXX - NetBSD's "ppp_netbsd_serial_if_print()" treats
1715 * the next two octets as an Ethernet type; does that
1718 ND_PRINT((ndo
, "unknown addr %02x; ctrl %02x", p
[0], p
[1]));
1725 #define PPP_BSDI_HDRLEN 24
1727 /* BSD/OS specific PPP printer */
1729 ppp_bsdos_if_print(netdissect_options
*ndo _U_
,
1730 const struct pcap_pkthdr
*h _U_
, register const u_char
*p _U_
)
1732 register int hdrlength
;
1734 register u_int length
= h
->len
;
1735 register u_int caplen
= h
->caplen
;
1740 if (caplen
< PPP_BSDI_HDRLEN
) {
1741 ND_PRINT((ndo
, "[|ppp]"));
1748 if (p
[0] == PPP_ADDRESS
&& p
[1] == PPP_CONTROL
) {
1750 ND_PRINT((ndo
, "%02x %02x ", p
[0], p
[1]));
1756 ND_PRINT((ndo
, "%d ", length
));
1757 /* Retrieve the protocol type */
1759 /* Compressed protocol field */
1762 ND_PRINT((ndo
, "%02x ", ptype
));
1766 /* Un-compressed protocol field */
1767 ptype
= EXTRACT_BE_U_2(p
);
1769 ND_PRINT((ndo
, "%04x ", ptype
));
1776 ND_PRINT((ndo
, "%c ", p
[SLC_DIR
] ? 'O' : 'I'));
1778 /* link level header */
1779 struct ppp_header
*ph
;
1781 q
= p
+ SLC_BPFHDRLEN
;
1782 ph
= (struct ppp_header
*)q
;
1783 if (ph
->phdr_addr
== PPP_ADDRESS
1784 && ph
->phdr_ctl
== PPP_CONTROL
) {
1786 ND_PRINT((ndo
, "%02x %02x ", q
[0], q
[1]));
1787 ptype
= EXTRACT_BE_U_2(&ph
->phdr_type
);
1788 if (ndo
->ndo_eflag
&& (ptype
== PPP_VJC
|| ptype
== PPP_VJNC
)) {
1789 ND_PRINT((ndo
, "%s ", tok2str(ppptype2str
,
1790 "proto-#%d", ptype
)));
1793 if (ndo
->ndo_eflag
) {
1794 ND_PRINT((ndo
, "LLH=["));
1795 for (i
= 0; i
< p
[SLC_LLHL
]; i
++)
1796 ND_PRINT((ndo
, "%02x", q
[i
]));
1797 ND_PRINT((ndo
, "] "));
1802 ND_PRINT((ndo
, "%d ", length
));
1804 q
= p
+ SLC_BPFHDRLEN
+ p
[SLC_LLHL
];
1808 ptype
= vjc_print(ndo
, q
, ptype
);
1809 hdrlength
= PPP_BSDI_HDRLEN
;
1813 ip_print(ndo
, p
, length
);
1816 ip6_print(ndo
, p
, length
);
1818 case PPP_MPLS_UCAST
:
1819 case PPP_MPLS_MCAST
:
1820 mpls_print(ndo
, p
, length
);
1825 ptype
= vjc_print(ndo
, q
, ptype
);
1826 hdrlength
= PPP_BSDI_HDRLEN
;
1830 ip_print(ndo
, p
, length
);
1833 ip6_print(ndo
, p
, length
);
1835 case PPP_MPLS_UCAST
:
1836 case PPP_MPLS_MCAST
:
1837 mpls_print(ndo
, p
, length
);
1842 if (ndo
->ndo_eflag
) {
1843 ND_PRINT((ndo
, "CH=["));
1844 for (i
= 0; i
< p
[SLC_LLHL
]; i
++)
1845 ND_PRINT((ndo
, "%02x", q
[i
]));
1846 ND_PRINT((ndo
, "] "));
1852 hdrlength
= PPP_BSDI_HDRLEN
;
1855 length
-= hdrlength
;
1860 ip_print(p
, length
);
1863 ip6_print(ndo
, p
, length
);
1865 case PPP_MPLS_UCAST
:
1866 case PPP_MPLS_MCAST
:
1867 mpls_print(ndo
, p
, length
);
1870 ND_PRINT((ndo
, "%s ", tok2str(ppptype2str
, "unknown PPP protocol (0x%04x)", ptype
)));
1876 #endif /* __bsdi__ */
1883 * c-style: whitesmith