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
32 #include <sys/cdefs.h>
34 __RCSID("$NetBSD: print-ppp.c,v 1.6 2015/03/31 21:59:35 christos Exp $");
37 #define NETDISSECT_REWORKED
42 #include <tcpdump-stdinc.h>
45 #include <net/slcompress.h>
46 #include <net/if_ppp.h>
51 #include "interface.h"
53 #include "addrtoname.h"
56 #include "ethertype.h"
60 * The following constatns are defined by IANA. Please refer to
61 * http://www.isi.edu/in-notes/iana/assignments/ppp-numbers
62 * for the up-to-date information.
65 /* Protocol Codes defined in ppp.h */
67 static const struct tok ppptype2str
[] = {
71 { PPP_DECNET
, "DECNET" },
72 { PPP_APPLE
, "APPLE" },
74 { PPP_VJC
, "VJC IP" },
75 { PPP_VJNC
, "VJNC IP" },
76 { PPP_BRPDU
, "BRPDU" },
78 { PPP_VINES
, "VINES" },
79 { PPP_MPLS_UCAST
, "MPLS" },
80 { PPP_MPLS_MCAST
, "MPLS" },
81 { PPP_COMP
, "Compressed"},
85 { PPP_HELLO
, "HELLO" },
86 { PPP_LUXCOM
, "LUXCOM" },
89 { PPP_OSICP
, "OSICP" },
91 { PPP_DECNETCP
, "DECNETCP" },
92 { PPP_APPLECP
, "APPLECP" },
93 { PPP_IPXCP
, "IPXCP" },
94 { PPP_STIICP
, "STIICP" },
95 { PPP_VINESCP
, "VINESCP" },
96 { PPP_IPV6CP
, "IP6CP" },
97 { PPP_MPLSCP
, "MPLSCP" },
102 { PPP_CHAP
, "CHAP" },
104 { PPP_SPAP
, "SPAP" },
105 { PPP_SPAP_OLD
, "Old-SPAP" },
106 { PPP_BACP
, "BACP" },
108 { PPP_MPCP
, "MLPPP-CP" },
113 /* Control Protocols (LCP/IPCP/CCP etc.) Codes defined in RFC 1661 */
115 #define CPCODES_VEXT 0 /* Vendor-Specific (RFC2153) */
116 #define CPCODES_CONF_REQ 1 /* Configure-Request */
117 #define CPCODES_CONF_ACK 2 /* Configure-Ack */
118 #define CPCODES_CONF_NAK 3 /* Configure-Nak */
119 #define CPCODES_CONF_REJ 4 /* Configure-Reject */
120 #define CPCODES_TERM_REQ 5 /* Terminate-Request */
121 #define CPCODES_TERM_ACK 6 /* Terminate-Ack */
122 #define CPCODES_CODE_REJ 7 /* Code-Reject */
123 #define CPCODES_PROT_REJ 8 /* Protocol-Reject (LCP only) */
124 #define CPCODES_ECHO_REQ 9 /* Echo-Request (LCP only) */
125 #define CPCODES_ECHO_RPL 10 /* Echo-Reply (LCP only) */
126 #define CPCODES_DISC_REQ 11 /* Discard-Request (LCP only) */
127 #define CPCODES_ID 12 /* Identification (LCP only) RFC1570 */
128 #define CPCODES_TIME_REM 13 /* Time-Remaining (LCP only) RFC1570 */
129 #define CPCODES_RESET_REQ 14 /* Reset-Request (CCP only) RFC1962 */
130 #define CPCODES_RESET_REP 15 /* Reset-Reply (CCP only) */
132 static const struct tok cpcodes
[] = {
133 {CPCODES_VEXT
, "Vendor-Extension"}, /* RFC2153 */
134 {CPCODES_CONF_REQ
, "Conf-Request"},
135 {CPCODES_CONF_ACK
, "Conf-Ack"},
136 {CPCODES_CONF_NAK
, "Conf-Nack"},
137 {CPCODES_CONF_REJ
, "Conf-Reject"},
138 {CPCODES_TERM_REQ
, "Term-Request"},
139 {CPCODES_TERM_ACK
, "Term-Ack"},
140 {CPCODES_CODE_REJ
, "Code-Reject"},
141 {CPCODES_PROT_REJ
, "Prot-Reject"},
142 {CPCODES_ECHO_REQ
, "Echo-Request"},
143 {CPCODES_ECHO_RPL
, "Echo-Reply"},
144 {CPCODES_DISC_REQ
, "Disc-Req"},
145 {CPCODES_ID
, "Ident"}, /* RFC1570 */
146 {CPCODES_TIME_REM
, "Time-Rem"}, /* RFC1570 */
147 {CPCODES_RESET_REQ
, "Reset-Req"}, /* RFC1962 */
148 {CPCODES_RESET_REP
, "Reset-Ack"}, /* RFC1962 */
152 /* LCP Config Options */
154 #define LCPOPT_VEXT 0
156 #define LCPOPT_ACCM 2
160 #define LCPOPT_DEP6 6
162 #define LCPOPT_ACFC 8
163 #define LCPOPT_FCSALT 9
164 #define LCPOPT_SDP 10
165 #define LCPOPT_NUMMODE 11
166 #define LCPOPT_DEP12 12
167 #define LCPOPT_CBACK 13
168 #define LCPOPT_DEP14 14
169 #define LCPOPT_DEP15 15
170 #define LCPOPT_DEP16 16
171 #define LCPOPT_MLMRRU 17
172 #define LCPOPT_MLSSNHF 18
173 #define LCPOPT_MLED 19
174 #define LCPOPT_PROP 20
175 #define LCPOPT_DCEID 21
176 #define LCPOPT_MPP 22
178 #define LCPOPT_LCPAOPT 24
179 #define LCPOPT_COBS 25
181 #define LCPOPT_MLHF 27
182 #define LCPOPT_I18N 28
183 #define LCPOPT_SDLOS 29
184 #define LCPOPT_PPPMUX 30
186 #define LCPOPT_MIN LCPOPT_VEXT
187 #define LCPOPT_MAX LCPOPT_PPPMUX
189 static const char *lcpconfopts
[] = {
190 "Vend-Ext", /* (0) */
193 "Auth-Prot", /* (3) */
194 "Qual-Prot", /* (4) */
195 "Magic-Num", /* (5) */
196 "deprecated(6)", /* used to be a Quality Protocol */
201 "Num-Mode", /* (11) */
202 "deprecated(12)", /* used to be a Multi-Link-Procedure*/
203 "Call-Back", /* (13) */
204 "deprecated(14)", /* used to be a Connect-Time */
205 "deprecated(15)", /* used to be a Compund-Frames */
206 "deprecated(16)", /* used to be a Nominal-Data-Encap */
208 "12-Bit seq #", /* (18) */
209 "End-Disc", /* (19) */
210 "Proprietary", /* (20) */
213 "Link-Disc", /* (23) */
214 "LCP-Auth-Opt", /* (24) */
216 "Prefix-elision", /* (26) */
217 "Multilink-header-Form",/* (27) */
219 "SDL-over-SONET/SDH", /* (29) */
220 "PPP-Muxing", /* (30) */
223 /* ECP - to be supported */
225 /* CCP Config Options */
227 #define CCPOPT_OUI 0 /* RFC1962 */
228 #define CCPOPT_PRED1 1 /* RFC1962 */
229 #define CCPOPT_PRED2 2 /* RFC1962 */
230 #define CCPOPT_PJUMP 3 /* RFC1962 */
231 /* 4-15 unassigned */
232 #define CCPOPT_HPPPC 16 /* RFC1962 */
233 #define CCPOPT_STACLZS 17 /* RFC1974 */
234 #define CCPOPT_MPPC 18 /* RFC2118 */
235 #define CCPOPT_GFZA 19 /* RFC1962 */
236 #define CCPOPT_V42BIS 20 /* RFC1962 */
237 #define CCPOPT_BSDCOMP 21 /* RFC1977 */
239 #define CCPOPT_LZSDCP 23 /* RFC1967 */
240 #define CCPOPT_MVRCA 24 /* RFC1975 */
241 #define CCPOPT_DEC 25 /* RFC1976 */
242 #define CCPOPT_DEFLATE 26 /* RFC1979 */
243 /* 27-254 unassigned */
244 #define CCPOPT_RESV 255 /* RFC1962 */
246 static const struct tok ccpconfopts_values
[] = {
247 { CCPOPT_OUI
, "OUI" },
248 { CCPOPT_PRED1
, "Pred-1" },
249 { CCPOPT_PRED2
, "Pred-2" },
250 { CCPOPT_PJUMP
, "Puddle" },
251 { CCPOPT_HPPPC
, "HP-PPC" },
252 { CCPOPT_STACLZS
, "Stac-LZS" },
253 { CCPOPT_MPPC
, "MPPC" },
254 { CCPOPT_GFZA
, "Gand-FZA" },
255 { CCPOPT_V42BIS
, "V.42bis" },
256 { CCPOPT_BSDCOMP
, "BSD-Comp" },
257 { CCPOPT_LZSDCP
, "LZS-DCP" },
258 { CCPOPT_MVRCA
, "MVRCA" },
259 { CCPOPT_DEC
, "DEC" },
260 { CCPOPT_DEFLATE
, "Deflate" },
261 { CCPOPT_RESV
, "Reserved"},
265 /* BACP Config Options */
267 #define BACPOPT_FPEER 1 /* RFC2125 */
269 static const struct tok bacconfopts_values
[] = {
270 { BACPOPT_FPEER
, "Favored-Peer" },
275 /* SDCP - to be supported */
277 /* IPCP Config Options */
278 #define IPCPOPT_2ADDR 1 /* RFC1172, RFC1332 (deprecated) */
279 #define IPCPOPT_IPCOMP 2 /* RFC1332 */
280 #define IPCPOPT_ADDR 3 /* RFC1332 */
281 #define IPCPOPT_MOBILE4 4 /* RFC2290 */
282 #define IPCPOPT_PRIDNS 129 /* RFC1877 */
283 #define IPCPOPT_PRINBNS 130 /* RFC1877 */
284 #define IPCPOPT_SECDNS 131 /* RFC1877 */
285 #define IPCPOPT_SECNBNS 132 /* RFC1877 */
287 static const struct tok ipcpopt_values
[] = {
288 { IPCPOPT_2ADDR
, "IP-Addrs" },
289 { IPCPOPT_IPCOMP
, "IP-Comp" },
290 { IPCPOPT_ADDR
, "IP-Addr" },
291 { IPCPOPT_MOBILE4
, "Home-Addr" },
292 { IPCPOPT_PRIDNS
, "Pri-DNS" },
293 { IPCPOPT_PRINBNS
, "Pri-NBNS" },
294 { IPCPOPT_SECDNS
, "Sec-DNS" },
295 { IPCPOPT_SECNBNS
, "Sec-NBNS" },
299 #define IPCPOPT_IPCOMP_HDRCOMP 0x61 /* rfc3544 */
300 #define IPCPOPT_IPCOMP_MINLEN 14
302 static const struct tok ipcpopt_compproto_values
[] = {
303 { PPP_VJC
, "VJ-Comp" },
304 { IPCPOPT_IPCOMP_HDRCOMP
, "IP Header Compression" },
308 static const struct tok ipcpopt_compproto_subopt_values
[] = {
309 { 1, "RTP-Compression" },
310 { 2, "Enhanced RTP-Compression" },
314 /* IP6CP Config Options */
317 static const struct tok ip6cpopt_values
[] = {
318 { IP6CP_IFID
, "Interface-ID" },
322 /* ATCP - to be supported */
323 /* OSINLCP - to be supported */
324 /* BVCP - to be supported */
325 /* BCP - to be supported */
326 /* IPXCP - to be supported */
327 /* MPLSCP - to be supported */
329 /* Auth Algorithms */
331 /* 0-4 Reserved (RFC1994) */
332 #define AUTHALG_CHAPMD5 5 /* RFC1994 */
333 #define AUTHALG_MSCHAP1 128 /* RFC2433 */
334 #define AUTHALG_MSCHAP2 129 /* RFC2795 */
336 static const struct tok authalg_values
[] = {
337 { AUTHALG_CHAPMD5
, "MD5" },
338 { AUTHALG_MSCHAP1
, "MS-CHAPv1" },
339 { AUTHALG_MSCHAP2
, "MS-CHAPv2" },
343 /* FCS Alternatives - to be supported */
345 /* Multilink Endpoint Discriminator (RFC1717) */
346 #define MEDCLASS_NULL 0 /* Null Class */
347 #define MEDCLASS_LOCAL 1 /* Locally Assigned */
348 #define MEDCLASS_IPV4 2 /* Internet Protocol (IPv4) */
349 #define MEDCLASS_MAC 3 /* IEEE 802.1 global MAC address */
350 #define MEDCLASS_MNB 4 /* PPP Magic Number Block */
351 #define MEDCLASS_PSNDN 5 /* Public Switched Network Director Number */
353 /* PPP LCP Callback */
354 #define CALLBACK_AUTH 0 /* Location determined by user auth */
355 #define CALLBACK_DSTR 1 /* Dialing string */
356 #define CALLBACK_LID 2 /* Location identifier */
357 #define CALLBACK_E164 3 /* E.164 number */
358 #define CALLBACK_X500 4 /* X.500 distinguished name */
359 #define CALLBACK_CBCP 6 /* Location is determined during CBCP nego */
361 static const struct tok ppp_callback_values
[] = {
362 { CALLBACK_AUTH
, "UserAuth" },
363 { CALLBACK_DSTR
, "DialString" },
364 { CALLBACK_LID
, "LocalID" },
365 { CALLBACK_E164
, "E.164" },
366 { CALLBACK_X500
, "X.500" },
367 { CALLBACK_CBCP
, "CBCP" },
378 static const struct tok chapcode_values
[] = {
379 { CHAP_CHAL
, "Challenge" },
380 { CHAP_RESP
, "Response" },
381 { CHAP_SUCC
, "Success" },
382 { CHAP_FAIL
, "Fail" },
392 static const struct tok papcode_values
[] = {
393 { PAP_AREQ
, "Auth-Req" },
394 { PAP_AACK
, "Auth-ACK" },
395 { PAP_ANAK
, "Auth-NACK" },
400 #define BAP_CALLREQ 1
401 #define BAP_CALLRES 2
409 static int print_lcp_config_options(netdissect_options
*, const u_char
*p
, int);
410 static int print_ipcp_config_options(netdissect_options
*, const u_char
*p
, int);
411 static int print_ip6cp_config_options(netdissect_options
*, const u_char
*p
, int);
412 static int print_ccp_config_options(netdissect_options
*, const u_char
*p
, int);
413 static int print_bacp_config_options(netdissect_options
*, const u_char
*p
, int);
414 static void handle_ppp(netdissect_options
*, u_int proto
, const u_char
*p
, int length
);
416 /* generic Control Protocol (e.g. LCP, IPCP, CCP, etc.) handler */
418 handle_ctrl_proto(netdissect_options
*ndo
,
419 u_int proto
, const u_char
*pptr
, int length
)
423 int (*pfunc
)(netdissect_options
*, const u_char
*, int);
429 typestr
= tok2str(ppptype2str
, "unknown ctrl-proto (0x%04x)", proto
);
430 ND_PRINT((ndo
, "%s, ", typestr
));
432 if (length
< 4) /* FIXME weak boundary checking */
434 ND_TCHECK2(*tptr
, 2);
438 ND_PRINT((ndo
, "%s (0x%02x), id %u, length %u",
439 tok2str(cpcodes
, "Unknown Opcode",code
),
448 return; /* there may be a NULL confreq etc. */
450 ND_TCHECK2(*tptr
, 2);
451 len
= EXTRACT_16BITS(tptr
);
454 ND_PRINT((ndo
, "\n\tencoded length %u (=Option(s) length %u)", len
, len
- 4));
456 if (ndo
->ndo_vflag
> 1)
457 print_unknown_data(ndo
, pptr
- 2, "\n\t", 6);
464 ND_TCHECK2(*tptr
, 4);
465 ND_PRINT((ndo
, "\n\t Magic-Num 0x%08x", EXTRACT_32BITS(tptr
)));
467 ND_TCHECK2(*tptr
, 3);
468 ND_PRINT((ndo
, " Vendor: %s (%u)",
469 tok2str(oui_values
,"Unknown",EXTRACT_24BITS(tptr
)),
470 EXTRACT_24BITS(tptr
)));
471 /* XXX: need to decode Kind and Value(s)? */
473 case CPCODES_CONF_REQ
:
474 case CPCODES_CONF_ACK
:
475 case CPCODES_CONF_NAK
:
476 case CPCODES_CONF_REJ
:
477 x
= len
- 4; /* Code(1), Identifier(1) and Length(2) */
481 pfunc
= print_lcp_config_options
;
484 pfunc
= print_ipcp_config_options
;
487 pfunc
= print_ip6cp_config_options
;
490 pfunc
= print_ccp_config_options
;
493 pfunc
= print_bacp_config_options
;
497 * No print routine for the options for
504 if (pfunc
== NULL
) /* catch the above null pointer if unknown CP */
507 if ((j
= (*pfunc
)(ndo
, tptr
, len
)) == 0)
514 case CPCODES_TERM_REQ
:
515 case CPCODES_TERM_ACK
:
516 /* XXX: need to decode Data? */
518 case CPCODES_CODE_REJ
:
519 /* XXX: need to decode Rejected-Packet? */
521 case CPCODES_PROT_REJ
:
524 ND_TCHECK2(*tptr
, 2);
525 ND_PRINT((ndo
, "\n\t Rejected %s Protocol (0x%04x)",
526 tok2str(ppptype2str
,"unknown", EXTRACT_16BITS(tptr
)),
527 EXTRACT_16BITS(tptr
)));
528 /* XXX: need to decode Rejected-Information? - hexdump for now */
530 ND_PRINT((ndo
, "\n\t Rejected Packet"));
531 print_unknown_data(ndo
, tptr
+ 2, "\n\t ", len
- 2);
534 case CPCODES_ECHO_REQ
:
535 case CPCODES_ECHO_RPL
:
536 case CPCODES_DISC_REQ
:
539 ND_TCHECK2(*tptr
, 4);
540 ND_PRINT((ndo
, "\n\t Magic-Num 0x%08x", EXTRACT_32BITS(tptr
)));
541 /* XXX: need to decode Data? - hexdump for now */
543 ND_PRINT((ndo
, "\n\t -----trailing data-----"));
544 ND_TCHECK2(tptr
[4], len
- 8);
545 print_unknown_data(ndo
, tptr
+ 4, "\n\t ", len
- 8);
551 ND_TCHECK2(*tptr
, 4);
552 ND_PRINT((ndo
, "\n\t Magic-Num 0x%08x", EXTRACT_32BITS(tptr
)));
553 /* RFC 1661 says this is intended to be human readable */
555 ND_PRINT((ndo
, "\n\t Message\n\t "));
556 if (fn_printn(ndo
, tptr
+ 4, len
- 4, ndo
->ndo_snapend
))
560 case CPCODES_TIME_REM
:
563 ND_TCHECK2(*tptr
, 4);
564 ND_PRINT((ndo
, "\n\t Magic-Num 0x%08x", EXTRACT_32BITS(tptr
)));
565 ND_TCHECK2(*(tptr
+ 4), 4);
566 ND_PRINT((ndo
, ", Seconds-Remaining %us", EXTRACT_32BITS(tptr
+ 4)));
567 /* XXX: need to decode Message? */
570 /* XXX this is dirty but we do not get the
571 * original pointer passed to the begin
573 if (ndo
->ndo_vflag
<= 1)
574 print_unknown_data(ndo
, pptr
- 2, "\n\t ", length
+ 2);
580 ND_PRINT((ndo
, "[|%s]", typestr
));
583 /* LCP config options */
585 print_lcp_config_options(netdissect_options
*ndo
,
586 const u_char
*p
, int length
)
598 if ((opt
>= LCPOPT_MIN
) && (opt
<= LCPOPT_MAX
))
599 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u (length bogus, should be >= 2)",
600 lcpconfopts
[opt
], opt
, len
));
602 ND_PRINT((ndo
, "\n\tunknown LCP option 0x%02x", opt
));
605 if ((opt
>= LCPOPT_MIN
) && (opt
<= LCPOPT_MAX
))
606 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u", lcpconfopts
[opt
], opt
, len
));
608 ND_PRINT((ndo
, "\n\tunknown LCP option 0x%02x", opt
));
615 ND_PRINT((ndo
, " (length bogus, should be >= 6)"));
618 ND_TCHECK2(*(p
+ 2), 3);
619 ND_PRINT((ndo
, ": Vendor: %s (%u)",
620 tok2str(oui_values
,"Unknown",EXTRACT_24BITS(p
+2)),
621 EXTRACT_24BITS(p
+ 2)));
624 ND_PRINT((ndo
, ", kind: 0x%02x", p
[5]));
625 ND_PRINT((ndo
, ", Value: 0x"));
626 for (i
= 0; i
< len
- 6; i
++) {
628 ND_PRINT((ndo
, "%02x", p
[6 + i
]));
634 ND_PRINT((ndo
, " (length bogus, should be = 4)"));
637 ND_TCHECK2(*(p
+ 2), 2);
638 ND_PRINT((ndo
, ": %u", EXTRACT_16BITS(p
+ 2)));
642 ND_PRINT((ndo
, " (length bogus, should be = 6)"));
645 ND_TCHECK2(*(p
+ 2), 4);
646 ND_PRINT((ndo
, ": 0x%08x", EXTRACT_32BITS(p
+ 2)));
650 ND_PRINT((ndo
, " (length bogus, should be >= 4)"));
653 ND_TCHECK2(*(p
+ 2), 2);
654 ND_PRINT((ndo
, ": %s", tok2str(ppptype2str
, "Unknown Auth Proto (0x04x)", EXTRACT_16BITS(p
+ 2))));
656 switch (EXTRACT_16BITS(p
+2)) {
659 ND_PRINT((ndo
, ", %s", tok2str(authalg_values
, "Unknown Auth Alg %u", p
[4])));
661 case PPP_PAP
: /* fall through */
667 print_unknown_data(ndo
, p
, "\n\t", len
);
672 ND_PRINT((ndo
, " (length bogus, should be >= 4)"));
675 ND_TCHECK2(*(p
+ 2), 2);
676 if (EXTRACT_16BITS(p
+2) == PPP_LQM
)
677 ND_PRINT((ndo
, ": LQR"));
679 ND_PRINT((ndo
, ": unknown"));
683 ND_PRINT((ndo
, " (length bogus, should be = 6)"));
686 ND_TCHECK2(*(p
+ 2), 4);
687 ND_PRINT((ndo
, ": 0x%08x", EXTRACT_32BITS(p
+ 2)));
695 ND_PRINT((ndo
, " (length bogus, should be = 4)"));
698 ND_TCHECK2(*(p
+ 2), 2);
699 ND_PRINT((ndo
, ": 0x%04x", EXTRACT_16BITS(p
+ 2)));
703 ND_PRINT((ndo
, " (length bogus, should be >= 3)"));
706 ND_PRINT((ndo
, ": "));
708 ND_PRINT((ndo
, ": Callback Operation %s (%u)",
709 tok2str(ppp_callback_values
, "Unknown", p
[2]),
714 ND_PRINT((ndo
, " (length bogus, should be = 4)"));
717 ND_TCHECK2(*(p
+ 2), 2);
718 ND_PRINT((ndo
, ": %u", EXTRACT_16BITS(p
+ 2)));
722 ND_PRINT((ndo
, " (length bogus, should be >= 3)"));
726 switch (p
[2]) { /* class */
728 ND_PRINT((ndo
, ": Null"));
731 ND_PRINT((ndo
, ": Local")); /* XXX */
735 ND_PRINT((ndo
, " (length bogus, should be = 7)"));
738 ND_TCHECK2(*(p
+ 3), 4);
739 ND_PRINT((ndo
, ": IPv4 %s", ipaddr_string(ndo
, p
+ 3)));
743 ND_PRINT((ndo
, " (length bogus, should be = 9)"));
746 ND_TCHECK2(*(p
+ 3), 6);
747 ND_PRINT((ndo
, ": MAC %s", etheraddr_string(ndo
, p
+ 3)));
750 ND_PRINT((ndo
, ": Magic-Num-Block")); /* XXX */
753 ND_PRINT((ndo
, ": PSNDN")); /* XXX */
756 ND_PRINT((ndo
, ": Unknown class %u", p
[2]));
761 /* XXX: to be supported */
786 * Unknown option; dump it as raw bytes now if we're
787 * not going to do so below.
789 if (ndo
->ndo_vflag
< 2)
790 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2);
794 if (ndo
->ndo_vflag
> 1)
795 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2); /* exclude TLV header */
800 ND_PRINT((ndo
, "[|lcp]"));
805 static const struct tok ppp_ml_flag_values
[] = {
812 handle_mlppp(netdissect_options
*ndo
,
813 const u_char
*p
, int length
)
816 ND_PRINT((ndo
, "MLPPP, "));
818 ND_PRINT((ndo
, "seq 0x%03x, Flags [%s], length %u",
819 (EXTRACT_16BITS(p
))&0x0fff, /* only support 12-Bit sequence space for now */
820 bittok2str(ppp_ml_flag_values
, "none", *p
& 0xc0),
826 handle_chap(netdissect_options
*ndo
,
827 const u_char
*p
, int length
)
830 int val_size
, name_size
, msg_size
;
836 ND_PRINT((ndo
, "[|chap]"));
838 } else if (length
< 4) {
840 ND_PRINT((ndo
, "[|chap 0x%02x]", *p
));
846 ND_PRINT((ndo
, "CHAP, %s (0x%02x)",
847 tok2str(chapcode_values
,"unknown",code
),
852 ND_PRINT((ndo
, ", id %u", *p
)); /* ID */
856 len
= EXTRACT_16BITS(p
);
860 * Note that this is a generic CHAP decoding routine. Since we
861 * don't know which flavor of CHAP (i.e. CHAP-MD5, MS-CHAPv1,
862 * MS-CHAPv2) is used at this point, we can't decode packet
863 * specifically to each algorithms. Instead, we simply decode
864 * the GCD (Gratest Common Denominator) for all algorithms.
869 if (length
- (p
- p0
) < 1)
872 val_size
= *p
; /* value size */
874 if (length
- (p
- p0
) < val_size
)
876 ND_PRINT((ndo
, ", Value "));
877 for (i
= 0; i
< val_size
; i
++) {
879 ND_PRINT((ndo
, "%02x", *p
++));
881 name_size
= len
- (p
- p0
);
882 ND_PRINT((ndo
, ", Name "));
883 for (i
= 0; i
< name_size
; i
++) {
885 safeputchar(ndo
, *p
++);
890 msg_size
= len
- (p
- p0
);
891 ND_PRINT((ndo
, ", Msg "));
892 for (i
= 0; i
< msg_size
; i
++) {
894 safeputchar(ndo
, *p
++);
901 ND_PRINT((ndo
, "[|chap]"));
904 /* PAP (see RFC 1334) */
906 handle_pap(netdissect_options
*ndo
,
907 const u_char
*p
, int length
)
910 int peerid_len
, passwd_len
, msg_len
;
916 ND_PRINT((ndo
, "[|pap]"));
918 } else if (length
< 4) {
920 ND_PRINT((ndo
, "[|pap 0x%02x]", *p
));
926 ND_PRINT((ndo
, "PAP, %s (0x%02x)",
927 tok2str(papcode_values
, "unknown", code
),
932 ND_PRINT((ndo
, ", id %u", *p
)); /* ID */
936 len
= EXTRACT_16BITS(p
);
939 if ((int)len
> length
) {
940 ND_PRINT((ndo
, ", length %u > packet size", len
));
944 if (length
< (p
- p0
)) {
945 ND_PRINT((ndo
, ", length %u < PAP header length", length
));
951 if (length
- (p
- p0
) < 1)
954 peerid_len
= *p
; /* Peer-ID Length */
956 if (length
- (p
- p0
) < peerid_len
)
958 ND_PRINT((ndo
, ", Peer "));
959 for (i
= 0; i
< peerid_len
; i
++) {
961 safeputchar(ndo
, *p
++);
964 if (length
- (p
- p0
) < 1)
967 passwd_len
= *p
; /* Password Length */
969 if (length
- (p
- p0
) < passwd_len
)
971 ND_PRINT((ndo
, ", Name "));
972 for (i
= 0; i
< passwd_len
; i
++) {
974 safeputchar(ndo
, *p
++);
979 if (length
- (p
- p0
) < 1)
982 msg_len
= *p
; /* Msg-Length */
984 if (length
- (p
- p0
) < msg_len
)
986 ND_PRINT((ndo
, ", Msg "));
987 for (i
= 0; i
< msg_len
; i
++) {
989 safeputchar(ndo
, *p
++);
996 ND_PRINT((ndo
, "[|pap]"));
1001 handle_bap(netdissect_options
*ndo _U_
,
1002 const u_char
*p _U_
, int length _U_
)
1004 /* XXX: to be supported!! */
1008 /* IPCP config options */
1010 print_ipcp_config_options(netdissect_options
*ndo
,
1011 const u_char
*p
, int length
)
1014 u_int compproto
, ipcomp_subopttotallen
, ipcomp_subopt
, ipcomp_suboptlen
;
1024 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u (length bogus, should be >= 2)",
1025 tok2str(ipcpopt_values
,"unknown",opt
),
1031 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u",
1032 tok2str(ipcpopt_values
,"unknown",opt
),
1037 case IPCPOPT_2ADDR
: /* deprecated */
1039 ND_PRINT((ndo
, " (length bogus, should be = 10)"));
1042 ND_TCHECK2(*(p
+ 6), 4);
1043 ND_PRINT((ndo
, ": src %s, dst %s",
1044 ipaddr_string(ndo
, p
+ 2),
1045 ipaddr_string(ndo
, p
+ 6)));
1047 case IPCPOPT_IPCOMP
:
1049 ND_PRINT((ndo
, " (length bogus, should be >= 4)"));
1052 ND_TCHECK2(*(p
+ 2), 2);
1053 compproto
= EXTRACT_16BITS(p
+2);
1055 ND_PRINT((ndo
, ": %s (0x%02x):",
1056 tok2str(ipcpopt_compproto_values
, "Unknown", compproto
),
1059 switch (compproto
) {
1061 /* XXX: VJ-Comp parameters should be decoded */
1063 case IPCPOPT_IPCOMP_HDRCOMP
:
1064 if (len
< IPCPOPT_IPCOMP_MINLEN
) {
1065 ND_PRINT((ndo
, " (length bogus, should be >= %u)",
1066 IPCPOPT_IPCOMP_MINLEN
));
1070 ND_TCHECK2(*(p
+ 2), IPCPOPT_IPCOMP_MINLEN
);
1071 ND_PRINT((ndo
, "\n\t TCP Space %u, non-TCP Space %u" \
1072 ", maxPeriod %u, maxTime %u, maxHdr %u",
1073 EXTRACT_16BITS(p
+4),
1074 EXTRACT_16BITS(p
+6),
1075 EXTRACT_16BITS(p
+8),
1076 EXTRACT_16BITS(p
+10),
1077 EXTRACT_16BITS(p
+12)));
1079 /* suboptions present ? */
1080 if (len
> IPCPOPT_IPCOMP_MINLEN
) {
1081 ipcomp_subopttotallen
= len
- IPCPOPT_IPCOMP_MINLEN
;
1082 p
+= IPCPOPT_IPCOMP_MINLEN
;
1084 ND_PRINT((ndo
, "\n\t Suboptions, length %u", ipcomp_subopttotallen
));
1086 while (ipcomp_subopttotallen
>= 2) {
1089 ipcomp_suboptlen
= *(p
+1);
1092 if (ipcomp_subopt
== 0 ||
1093 ipcomp_suboptlen
== 0 )
1096 /* XXX: just display the suboptions for now */
1097 ND_PRINT((ndo
, "\n\t\t%s Suboption #%u, length %u",
1098 tok2str(ipcpopt_compproto_subopt_values
,
1104 ipcomp_subopttotallen
-= ipcomp_suboptlen
;
1105 p
+= ipcomp_suboptlen
;
1114 case IPCPOPT_ADDR
: /* those options share the same format - fall through */
1115 case IPCPOPT_MOBILE4
:
1116 case IPCPOPT_PRIDNS
:
1117 case IPCPOPT_PRINBNS
:
1118 case IPCPOPT_SECDNS
:
1119 case IPCPOPT_SECNBNS
:
1121 ND_PRINT((ndo
, " (length bogus, should be = 6)"));
1124 ND_TCHECK2(*(p
+ 2), 4);
1125 ND_PRINT((ndo
, ": %s", ipaddr_string(ndo
, p
+ 2)));
1129 * Unknown option; dump it as raw bytes now if we're
1130 * not going to do so below.
1132 if (ndo
->ndo_vflag
< 2)
1133 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2);
1136 if (ndo
->ndo_vflag
> 1)
1137 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2); /* exclude TLV header */
1141 ND_PRINT((ndo
, "[|ipcp]"));
1145 /* IP6CP config options */
1147 print_ip6cp_config_options(netdissect_options
*ndo
,
1148 const u_char
*p
, int length
)
1160 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u (length bogus, should be >= 2)",
1161 tok2str(ip6cpopt_values
,"unknown",opt
),
1167 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u",
1168 tok2str(ip6cpopt_values
,"unknown",opt
),
1175 ND_PRINT((ndo
, " (length bogus, should be = 10)"));
1178 ND_TCHECK2(*(p
+ 2), 8);
1179 ND_PRINT((ndo
, ": %04x:%04x:%04x:%04x",
1180 EXTRACT_16BITS(p
+ 2),
1181 EXTRACT_16BITS(p
+ 4),
1182 EXTRACT_16BITS(p
+ 6),
1183 EXTRACT_16BITS(p
+ 8)));
1187 * Unknown option; dump it as raw bytes now if we're
1188 * not going to do so below.
1190 if (ndo
->ndo_vflag
< 2)
1191 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2);
1194 if (ndo
->ndo_vflag
> 1)
1195 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2); /* exclude TLV header */
1200 ND_PRINT((ndo
, "[|ip6cp]"));
1205 /* CCP config options */
1207 print_ccp_config_options(netdissect_options
*ndo
,
1208 const u_char
*p
, int length
)
1220 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u (length bogus, should be >= 2)",
1221 tok2str(ccpconfopts_values
, "Unknown", opt
),
1227 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u",
1228 tok2str(ccpconfopts_values
, "Unknown", opt
),
1233 case CCPOPT_BSDCOMP
:
1235 ND_PRINT((ndo
, " (length bogus, should be >= 3)"));
1238 ND_TCHECK2(*(p
+ 2), 1);
1239 ND_PRINT((ndo
, ": Version: %u, Dictionary Bits: %u",
1240 p
[2] >> 5, p
[2] & 0x1f));
1244 ND_PRINT((ndo
, " (length bogus, should be >= 4)"));
1247 ND_TCHECK2(*(p
+ 2), 1);
1248 ND_PRINT((ndo
, ": Features: %u, PxP: %s, History: %u, #CTX-ID: %u",
1250 (p
[2] & 0x20) ? "Enabled" : "Disabled",
1251 p
[2] & 0x1f, p
[3]));
1253 case CCPOPT_DEFLATE
:
1255 ND_PRINT((ndo
, " (length bogus, should be >= 4)"));
1258 ND_TCHECK2(*(p
+ 2), 1);
1259 ND_PRINT((ndo
, ": Window: %uK, Method: %s (0x%x), MBZ: %u, CHK: %u",
1261 ((p
[2] & 0x0f) == 8) ? "zlib" : "unkown",
1262 p
[2] & 0x0f, (p
[3] & 0xfc) >> 2, p
[3] & 0x03));
1265 /* XXX: to be supported */
1272 case CCPOPT_STACLZS
:
1283 * Unknown option; dump it as raw bytes now if we're
1284 * not going to do so below.
1286 if (ndo
->ndo_vflag
< 2)
1287 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2);
1290 if (ndo
->ndo_vflag
> 1)
1291 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2); /* exclude TLV header */
1296 ND_PRINT((ndo
, "[|ccp]"));
1300 /* BACP config options */
1302 print_bacp_config_options(netdissect_options
*ndo
,
1303 const u_char
*p
, int length
)
1315 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u (length bogus, should be >= 2)",
1316 tok2str(bacconfopts_values
, "Unknown", opt
),
1322 ND_PRINT((ndo
, "\n\t %s Option (0x%02x), length %u",
1323 tok2str(bacconfopts_values
, "Unknown", opt
),
1330 ND_PRINT((ndo
, " (length bogus, should be = 6)"));
1333 ND_TCHECK2(*(p
+ 2), 4);
1334 ND_PRINT((ndo
, ": Magic-Num 0x%08x", EXTRACT_32BITS(p
+ 2)));
1338 * Unknown option; dump it as raw bytes now if we're
1339 * not going to do so below.
1341 if (ndo
->ndo_vflag
< 2)
1342 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2);
1345 if (ndo
->ndo_vflag
> 1)
1346 print_unknown_data(ndo
, &p
[2], "\n\t ", len
- 2); /* exclude TLV header */
1351 ND_PRINT((ndo
, "[|bacp]"));
1356 ppp_hdlc(netdissect_options
*ndo
,
1357 const u_char
*p
, int length
)
1367 b
= (u_char
*)malloc(length
);
1372 * Unescape all the data into a temporary, private, buffer.
1373 * Do this so that we dont overwrite the original packet
1376 for (s
= p
, t
= b
, i
= length
; i
> 0 && ND_TTEST(*s
); i
--) {
1379 if (i
<= 1 || !ND_TTEST(*s
))
1387 se
= ndo
->ndo_snapend
;
1388 ndo
->ndo_snapend
= t
;
1391 /* now lets guess about the payload codepoint format */
1394 proto
= *b
; /* start with a one-octet codepoint guess */
1398 ip_print(ndo
, b
+ 1, length
- 1);
1401 ip6_print(ndo
, b
+ 1, length
- 1);
1403 default: /* no luck - try next guess */
1409 proto
= EXTRACT_16BITS(b
); /* next guess - load two octets */
1412 case (PPP_ADDRESS
<< 8 | PPP_CONTROL
): /* looks like a PPP frame */
1415 proto
= EXTRACT_16BITS(b
+2); /* load the PPP proto-id */
1416 handle_ppp(ndo
, proto
, b
+ 4, length
- 4);
1418 default: /* last guess - proto must be a PPP proto-id */
1419 handle_ppp(ndo
, proto
, b
+ 2, length
- 2);
1424 ndo
->ndo_snapend
= se
;
1429 ndo
->ndo_snapend
= se
;
1431 ND_PRINT((ndo
, "[|ppp]"));
1437 handle_ppp(netdissect_options
*ndo
,
1438 u_int proto
, const u_char
*p
, int length
)
1440 if ((proto
& 0xff00) == 0x7e00) { /* is this an escape code ? */
1441 ppp_hdlc(ndo
, p
- 1, length
);
1446 case PPP_LCP
: /* fall through */
1453 handle_ctrl_proto(ndo
, proto
, p
, length
);
1456 handle_mlppp(ndo
, p
, length
);
1459 handle_chap(ndo
, p
, length
);
1462 handle_pap(ndo
, p
, length
);
1464 case PPP_BAP
: /* XXX: not yet completed */
1465 handle_bap(ndo
, p
, length
);
1467 case ETHERTYPE_IP
: /*XXX*/
1470 ip_print(ndo
, p
, length
);
1472 case ETHERTYPE_IPV6
: /*XXX*/
1474 ip6_print(ndo
, p
, length
);
1476 case ETHERTYPE_IPX
: /*XXX*/
1478 ipx_print(ndo
, p
, length
);
1481 isoclns_print(ndo
, p
, length
, length
);
1483 case PPP_MPLS_UCAST
:
1484 case PPP_MPLS_MCAST
:
1485 mpls_print(ndo
, p
, length
);
1488 ND_PRINT((ndo
, "compressed PPP data"));
1491 ND_PRINT((ndo
, "%s ", tok2str(ppptype2str
, "unknown PPP protocol (0x%04x)", proto
)));
1492 print_unknown_data(ndo
, p
, "\n\t", length
);
1497 /* Standard PPP printer */
1499 ppp_print(netdissect_options
*ndo
,
1500 register const u_char
*p
, u_int length
)
1502 u_int proto
,ppp_header
;
1503 u_int olen
= length
; /* _o_riginal length */
1507 * Here, we assume that p points to the Address and Control
1508 * field (if they present).
1513 ppp_header
= EXTRACT_16BITS(p
);
1515 switch(ppp_header
) {
1516 case (PPP_WITHDIRECTION_IN
<< 8 | PPP_CONTROL
):
1517 if (ndo
->ndo_eflag
) ND_PRINT((ndo
, "In "));
1522 case (PPP_WITHDIRECTION_OUT
<< 8 | PPP_CONTROL
):
1523 if (ndo
->ndo_eflag
) ND_PRINT((ndo
, "Out "));
1528 case (PPP_ADDRESS
<< 8 | PPP_CONTROL
):
1529 p
+= 2; /* ACFC not used */
1542 proto
= *p
; /* PFC is used */
1548 proto
= EXTRACT_16BITS(p
);
1555 ND_PRINT((ndo
, "%s (0x%04x), length %u: ",
1556 tok2str(ppptype2str
, "unknown", proto
),
1560 handle_ppp(ndo
, proto
, p
, length
);
1563 ND_PRINT((ndo
, "[|ppp]"));
1568 /* PPP I/F printer */
1570 ppp_if_print(netdissect_options
*ndo
,
1571 const struct pcap_pkthdr
*h
, register const u_char
*p
)
1573 register u_int length
= h
->len
;
1574 register u_int caplen
= h
->caplen
;
1576 if (caplen
< PPP_HDRLEN
) {
1577 ND_PRINT((ndo
, "[|ppp]"));
1583 * XXX: seems to assume that there are 2 octets prepended to an
1584 * actual PPP frame. The 1st octet looks like Input/Output flag
1585 * while 2nd octet is unknown, at least to me
1586 * (mshindo@mshindo.net).
1588 * That was what the original tcpdump code did.
1590 * FreeBSD's "if_ppp.c" *does* set the first octet to 1 for outbound
1591 * packets and 0 for inbound packets - but only if the
1592 * protocol field has the 0x8000 bit set (i.e., it's a network
1593 * control protocol); it does so before running the packet through
1594 * "bpf_filter" to see if it should be discarded, and to see
1595 * if we should update the time we sent the most recent packet...
1597 * ...but it puts the original address field back after doing
1600 * NetBSD's "if_ppp.c" doesn't set the first octet in that fashion.
1602 * I don't know if any PPP implementation handed up to a BPF
1603 * device packets with the first octet being 1 for outbound and
1604 * 0 for inbound packets, so I (guy@alum.mit.edu) don't know
1605 * whether that ever needs to be checked or not.
1607 * Note that NetBSD has a DLT_PPP_SERIAL, which it uses for PPP,
1608 * and its tcpdump appears to assume that the frame always
1609 * begins with an address field and a control field, and that
1610 * the address field might be 0x0f or 0x8f, for Cisco
1611 * point-to-point with HDLC framing as per section 4.3.1 of RFC
1612 * 1547, as well as 0xff, for PPP in HDLC-like framing as per
1615 * (Is the Cisco framing in question what DLT_C_HDLC, in
1619 ND_PRINT((ndo
, "%c %4d %02x ", p
[0] ? 'O' : 'I', length
, p
[1]));
1622 ppp_print(ndo
, p
, length
);
1628 * PPP I/F printer to use if we know that RFC 1662-style PPP in HDLC-like
1629 * framing, or Cisco PPP with HDLC framing as per section 4.3.1 of RFC 1547,
1630 * is being used (i.e., we don't check for PPP_ADDRESS and PPP_CONTROL,
1631 * discard them *if* those are the first two octets, and parse the remaining
1632 * packet as a PPP packet, as "ppp_print()" does).
1634 * This handles, for example, DLT_PPP_SERIAL in NetBSD.
1637 ppp_hdlc_if_print(netdissect_options
*ndo
,
1638 const struct pcap_pkthdr
*h
, register const u_char
*p
)
1640 register u_int length
= h
->len
;
1641 register u_int caplen
= h
->caplen
;
1646 ND_PRINT((ndo
, "[|ppp]"));
1654 ND_PRINT((ndo
, "[|ppp]"));
1659 ND_PRINT((ndo
, "%02x %02x %d ", p
[0], p
[1], length
));
1664 proto
= EXTRACT_16BITS(p
);
1668 ND_PRINT((ndo
, "%s: ", tok2str(ppptype2str
, "unknown PPP protocol (0x%04x)", proto
)));
1670 handle_ppp(ndo
, proto
, p
, length
);
1675 return (chdlc_if_print(ndo
, h
, p
));
1679 ND_PRINT((ndo
, "%02x %02x %d ", p
[0], p
[1], length
));
1684 * XXX - NetBSD's "ppp_netbsd_serial_if_print()" treats
1685 * the next two octets as an Ethernet type; does that
1688 ND_PRINT((ndo
, "unknown addr %02x; ctrl %02x", p
[0], p
[1]));
1695 #define PPP_BSDI_HDRLEN 24
1697 /* BSD/OS specific PPP printer */
1699 ppp_bsdos_if_print(netdissect_options
*ndo _U_
,
1700 const struct pcap_pkthdr
*h _U_
, register const u_char
*p _U_
)
1702 register int hdrlength
;
1704 register u_int length
= h
->len
;
1705 register u_int caplen
= h
->caplen
;
1710 if (caplen
< PPP_BSDI_HDRLEN
) {
1711 ND_PRINT((ndo
, "[|ppp]"));
1718 if (p
[0] == PPP_ADDRESS
&& p
[1] == PPP_CONTROL
) {
1720 ND_PRINT((ndo
, "%02x %02x ", p
[0], p
[1]));
1726 ND_PRINT((ndo
, "%d ", length
));
1727 /* Retrieve the protocol type */
1729 /* Compressed protocol field */
1732 ND_PRINT((ndo
, "%02x ", ptype
));
1736 /* Un-compressed protocol field */
1737 ptype
= EXTRACT_16BITS(p
);
1739 ND_PRINT((ndo
, "%04x ", ptype
));
1746 ND_PRINT((ndo
, "%c ", p
[SLC_DIR
] ? 'O' : 'I'));
1748 /* link level header */
1749 struct ppp_header
*ph
;
1751 q
= p
+ SLC_BPFHDRLEN
;
1752 ph
= (struct ppp_header
*)q
;
1753 if (ph
->phdr_addr
== PPP_ADDRESS
1754 && ph
->phdr_ctl
== PPP_CONTROL
) {
1756 ND_PRINT((ndo
, "%02x %02x ", q
[0], q
[1]));
1757 ptype
= EXTRACT_16BITS(&ph
->phdr_type
);
1758 if (ndo
->ndo_eflag
&& (ptype
== PPP_VJC
|| ptype
== PPP_VJNC
)) {
1759 ND_PRINT((ndo
, "%s ", tok2str(ppptype2str
,
1760 "proto-#%d", ptype
)));
1763 if (ndo
->ndo_eflag
) {
1764 ND_PRINT((ndo
, "LLH=["));
1765 for (i
= 0; i
< p
[SLC_LLHL
]; i
++)
1766 ND_PRINT((ndo
, "%02x", q
[i
]));
1767 ND_PRINT((ndo
, "] "));
1772 ND_PRINT((ndo
, "%d ", length
));
1774 q
= p
+ SLC_BPFHDRLEN
+ p
[SLC_LLHL
];
1778 ptype
= vjc_print(ndo
, q
, ptype
);
1779 hdrlength
= PPP_BSDI_HDRLEN
;
1783 ip_print(ndo
, p
, length
);
1786 ip6_print(ndo
, p
, length
);
1788 case PPP_MPLS_UCAST
:
1789 case PPP_MPLS_MCAST
:
1790 mpls_print(ndo
, p
, length
);
1795 ptype
= vjc_print(ndo
, q
, ptype
);
1796 hdrlength
= PPP_BSDI_HDRLEN
;
1800 ip_print(ndo
, p
, length
);
1803 ip6_print(ndo
, p
, length
);
1805 case PPP_MPLS_UCAST
:
1806 case PPP_MPLS_MCAST
:
1807 mpls_print(ndo
, p
, length
);
1812 if (ndo
->ndo_eflag
) {
1813 ND_PRINT((ndo
, "CH=["));
1814 for (i
= 0; i
< p
[SLC_LLHL
]; i
++)
1815 ND_PRINT((ndo
, "%02x", q
[i
]));
1816 ND_PRINT((ndo
, "] "));
1822 hdrlength
= PPP_BSDI_HDRLEN
;
1825 length
-= hdrlength
;
1830 ip_print(p
, length
);
1833 ip6_print(ndo
, p
, length
);
1835 case PPP_MPLS_UCAST
:
1836 case PPP_MPLS_MCAST
:
1837 mpls_print(ndo
, p
, length
);
1840 ND_PRINT((ndo
, "%s ", tok2str(ppptype2str
, "unknown PPP protocol (0x%04x)", ptype
)));
1846 #endif /* __bsdi__ */
1853 * c-style: whitesmith