]> The Tcpdump Group git mirrors - tcpdump/blob - print-juniper.c
juniper: fix some block diagrams in comments. [skip ci]
[tcpdump] / print-juniper.c
1 /* NetBSD: print-juniper.c,v 1.2 2007/07/24 11:53:45 drochner Exp */
2
3 /*
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that: (1) source code
6 * distributions retain the above copyright notice and this paragraph
7 * in its entirety, and (2) distributions including binary code include
8 * the above copyright notice and this paragraph in its entirety in
9 * the documentation or other materials provided with the distribution.
10 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
11 * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
12 * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
13 * FOR A PARTICULAR PURPOSE.
14 *
15 * Original code by Hannes Gredler (hannes@gredler.at)
16 */
17
18 /* \summary: DLT_JUNIPER_* printers */
19
20 #ifndef lint
21 #else
22 __RCSID("NetBSD: print-juniper.c,v 1.3 2007/07/25 06:31:32 dogcow Exp ");
23 #endif
24
25 #include <config.h>
26
27 #include "netdissect-stdinc.h"
28
29 #include <string.h>
30
31 #define ND_LONGJMP_FROM_TCHECK
32 #include "netdissect.h"
33 #include "addrtoname.h"
34 #include "extract.h"
35 #include "ppp.h"
36 #include "llc.h"
37 #include "nlpid.h"
38 #include "ethertype.h"
39 #include "atm.h"
40
41 /*
42 * If none of the Juniper DLT_s are defined, there's nothing to do.
43 */
44 #if defined(DLT_JUNIPER_GGSN) || defined(DLT_JUNIPER_ES) || \
45 defined(DLT_JUNIPER_MONITOR) || defined(DLT_JUNIPER_SERVICES) || \
46 defined(DLT_JUNIPER_PPPOE) || defined(DLT_JUNIPER_ETHER) || \
47 defined(DLT_JUNIPER_PPP) || defined(DLT_JUNIPER_FRELAY) || \
48 defined(DLT_JUNIPER_CHDLC) || defined(DLT_JUNIPER_PPPOE_ATM) || \
49 defined(DLT_JUNIPER_MLPPP) || defined(DLT_JUNIPER_MFR) || \
50 defined(DLT_JUNIPER_MLFR) || defined(DLT_JUNIPER_ATM1) || \
51 defined(DLT_JUNIPER_ATM2)
52 #define JUNIPER_BPF_OUT 0 /* Outgoing packet */
53 #define JUNIPER_BPF_IN 1 /* Incoming packet */
54 #define JUNIPER_BPF_PKT_IN 0x1 /* Incoming packet */
55 #define JUNIPER_BPF_NO_L2 0x2 /* L2 header stripped */
56 #define JUNIPER_BPF_IIF 0x4 /* IIF is valid */
57 #define JUNIPER_BPF_FILTER 0x40 /* BPF filtering is supported */
58 #define JUNIPER_BPF_EXT 0x80 /* extensions present */
59 #define JUNIPER_MGC_NUMBER 0x4d4743 /* = "MGC" */
60
61 #define JUNIPER_LSQ_COOKIE_RE (1 << 3)
62 #define JUNIPER_LSQ_COOKIE_DIR (1 << 2)
63 #define JUNIPER_LSQ_L3_PROTO_SHIFT 4
64 #define JUNIPER_LSQ_L3_PROTO_MASK (0x17 << JUNIPER_LSQ_L3_PROTO_SHIFT)
65 #define JUNIPER_LSQ_L3_PROTO_IPV4 (0 << JUNIPER_LSQ_L3_PROTO_SHIFT)
66 #define JUNIPER_LSQ_L3_PROTO_IPV6 (1 << JUNIPER_LSQ_L3_PROTO_SHIFT)
67 #define JUNIPER_LSQ_L3_PROTO_MPLS (2 << JUNIPER_LSQ_L3_PROTO_SHIFT)
68 #define JUNIPER_LSQ_L3_PROTO_ISO (3 << JUNIPER_LSQ_L3_PROTO_SHIFT)
69 #define AS_PIC_COOKIE_LEN 8
70
71 #define JUNIPER_IPSEC_O_ESP_ENCRYPT_ESP_AUTHEN_TYPE 1
72 #define JUNIPER_IPSEC_O_ESP_ENCRYPT_AH_AUTHEN_TYPE 2
73 #define JUNIPER_IPSEC_O_ESP_AUTHENTICATION_TYPE 3
74 #define JUNIPER_IPSEC_O_AH_AUTHENTICATION_TYPE 4
75 #define JUNIPER_IPSEC_O_ESP_ENCRYPTION_TYPE 5
76
77 #ifdef DLT_JUNIPER_ES
78 static const struct tok juniper_ipsec_type_values[] = {
79 { JUNIPER_IPSEC_O_ESP_ENCRYPT_ESP_AUTHEN_TYPE, "ESP ENCR-AUTH" },
80 { JUNIPER_IPSEC_O_ESP_ENCRYPT_AH_AUTHEN_TYPE, "ESP ENCR-AH AUTH" },
81 { JUNIPER_IPSEC_O_ESP_AUTHENTICATION_TYPE, "ESP AUTH" },
82 { JUNIPER_IPSEC_O_AH_AUTHENTICATION_TYPE, "AH AUTH" },
83 { JUNIPER_IPSEC_O_ESP_ENCRYPTION_TYPE, "ESP ENCR" },
84 { 0, NULL}
85 };
86 #endif
87
88 static const struct tok juniper_direction_values[] = {
89 { JUNIPER_BPF_IN, "In"},
90 { JUNIPER_BPF_OUT, "Out"},
91 { 0, NULL}
92 };
93
94 /* codepoints for encoding extensions to a .pcap file */
95 enum {
96 JUNIPER_EXT_TLV_IFD_IDX = 1,
97 JUNIPER_EXT_TLV_IFD_NAME = 2,
98 JUNIPER_EXT_TLV_IFD_MEDIATYPE = 3,
99 JUNIPER_EXT_TLV_IFL_IDX = 4,
100 JUNIPER_EXT_TLV_IFL_UNIT = 5,
101 JUNIPER_EXT_TLV_IFL_ENCAPS = 6,
102 JUNIPER_EXT_TLV_TTP_IFD_MEDIATYPE = 7,
103 JUNIPER_EXT_TLV_TTP_IFL_ENCAPS = 8
104 };
105
106 /* 1 byte type and 1-byte length */
107 #define JUNIPER_EXT_TLV_OVERHEAD 2U
108
109 static const struct tok jnx_ext_tlv_values[] = {
110 { JUNIPER_EXT_TLV_IFD_IDX, "Device Interface Index" },
111 { JUNIPER_EXT_TLV_IFD_NAME,"Device Interface Name" },
112 { JUNIPER_EXT_TLV_IFD_MEDIATYPE, "Device Media Type" },
113 { JUNIPER_EXT_TLV_IFL_IDX, "Logical Interface Index" },
114 { JUNIPER_EXT_TLV_IFL_UNIT,"Logical Unit Number" },
115 { JUNIPER_EXT_TLV_IFL_ENCAPS, "Logical Interface Encapsulation" },
116 { JUNIPER_EXT_TLV_TTP_IFD_MEDIATYPE, "TTP derived Device Media Type" },
117 { JUNIPER_EXT_TLV_TTP_IFL_ENCAPS, "TTP derived Logical Interface Encapsulation" },
118 { 0, NULL }
119 };
120
121 static const struct tok jnx_flag_values[] = {
122 { JUNIPER_BPF_EXT, "Ext" },
123 { JUNIPER_BPF_FILTER, "Filter" },
124 { JUNIPER_BPF_IIF, "IIF" },
125 { JUNIPER_BPF_NO_L2, "no-L2" },
126 { JUNIPER_BPF_PKT_IN, "In" },
127 { 0, NULL }
128 };
129
130 #define JUNIPER_IFML_ETHER 1
131 #define JUNIPER_IFML_FDDI 2
132 #define JUNIPER_IFML_TOKENRING 3
133 #define JUNIPER_IFML_PPP 4
134 #define JUNIPER_IFML_FRAMERELAY 5
135 #define JUNIPER_IFML_CISCOHDLC 6
136 #define JUNIPER_IFML_SMDSDXI 7
137 #define JUNIPER_IFML_ATMPVC 8
138 #define JUNIPER_IFML_PPP_CCC 9
139 #define JUNIPER_IFML_FRAMERELAY_CCC 10
140 #define JUNIPER_IFML_IPIP 11
141 #define JUNIPER_IFML_GRE 12
142 #define JUNIPER_IFML_PIM 13
143 #define JUNIPER_IFML_PIMD 14
144 #define JUNIPER_IFML_CISCOHDLC_CCC 15
145 #define JUNIPER_IFML_VLAN_CCC 16
146 #define JUNIPER_IFML_MLPPP 17
147 #define JUNIPER_IFML_MLFR 18
148 #define JUNIPER_IFML_ML 19
149 #define JUNIPER_IFML_LSI 20
150 #define JUNIPER_IFML_DFE 21
151 #define JUNIPER_IFML_ATM_CELLRELAY_CCC 22
152 #define JUNIPER_IFML_CRYPTO 23
153 #define JUNIPER_IFML_GGSN 24
154 #define JUNIPER_IFML_LSI_PPP 25
155 #define JUNIPER_IFML_LSI_CISCOHDLC 26
156 #define JUNIPER_IFML_PPP_TCC 27
157 #define JUNIPER_IFML_FRAMERELAY_TCC 28
158 #define JUNIPER_IFML_CISCOHDLC_TCC 29
159 #define JUNIPER_IFML_ETHERNET_CCC 30
160 #define JUNIPER_IFML_VT 31
161 #define JUNIPER_IFML_EXTENDED_VLAN_CCC 32
162 #define JUNIPER_IFML_ETHER_OVER_ATM 33
163 #define JUNIPER_IFML_MONITOR 34
164 #define JUNIPER_IFML_ETHERNET_TCC 35
165 #define JUNIPER_IFML_VLAN_TCC 36
166 #define JUNIPER_IFML_EXTENDED_VLAN_TCC 37
167 #define JUNIPER_IFML_CONTROLLER 38
168 #define JUNIPER_IFML_MFR 39
169 #define JUNIPER_IFML_LS 40
170 #define JUNIPER_IFML_ETHERNET_VPLS 41
171 #define JUNIPER_IFML_ETHERNET_VLAN_VPLS 42
172 #define JUNIPER_IFML_ETHERNET_EXTENDED_VLAN_VPLS 43
173 #define JUNIPER_IFML_LT 44
174 #define JUNIPER_IFML_SERVICES 45
175 #define JUNIPER_IFML_ETHER_VPLS_OVER_ATM 46
176 #define JUNIPER_IFML_FR_PORT_CCC 47
177 #define JUNIPER_IFML_FRAMERELAY_EXT_CCC 48
178 #define JUNIPER_IFML_FRAMERELAY_EXT_TCC 49
179 #define JUNIPER_IFML_FRAMERELAY_FLEX 50
180 #define JUNIPER_IFML_GGSNI 51
181 #define JUNIPER_IFML_ETHERNET_FLEX 52
182 #define JUNIPER_IFML_COLLECTOR 53
183 #define JUNIPER_IFML_AGGREGATOR 54
184 #define JUNIPER_IFML_LAPD 55
185 #define JUNIPER_IFML_PPPOE 56
186 #define JUNIPER_IFML_PPP_SUBORDINATE 57
187 #define JUNIPER_IFML_CISCOHDLC_SUBORDINATE 58
188 #define JUNIPER_IFML_DFC 59
189 #define JUNIPER_IFML_PICPEER 60
190
191 static const struct tok juniper_ifmt_values[] = {
192 { JUNIPER_IFML_ETHER, "Ethernet" },
193 { JUNIPER_IFML_FDDI, "FDDI" },
194 { JUNIPER_IFML_TOKENRING, "Token-Ring" },
195 { JUNIPER_IFML_PPP, "PPP" },
196 { JUNIPER_IFML_PPP_SUBORDINATE, "PPP-Subordinate" },
197 { JUNIPER_IFML_FRAMERELAY, "Frame-Relay" },
198 { JUNIPER_IFML_CISCOHDLC, "Cisco-HDLC" },
199 { JUNIPER_IFML_SMDSDXI, "SMDS-DXI" },
200 { JUNIPER_IFML_ATMPVC, "ATM-PVC" },
201 { JUNIPER_IFML_PPP_CCC, "PPP-CCC" },
202 { JUNIPER_IFML_FRAMERELAY_CCC, "Frame-Relay-CCC" },
203 { JUNIPER_IFML_FRAMERELAY_EXT_CCC, "Extended FR-CCC" },
204 { JUNIPER_IFML_IPIP, "IP-over-IP" },
205 { JUNIPER_IFML_GRE, "GRE" },
206 { JUNIPER_IFML_PIM, "PIM-Encapsulator" },
207 { JUNIPER_IFML_PIMD, "PIM-Decapsulator" },
208 { JUNIPER_IFML_CISCOHDLC_CCC, "Cisco-HDLC-CCC" },
209 { JUNIPER_IFML_VLAN_CCC, "VLAN-CCC" },
210 { JUNIPER_IFML_EXTENDED_VLAN_CCC, "Extended-VLAN-CCC" },
211 { JUNIPER_IFML_MLPPP, "Multilink-PPP" },
212 { JUNIPER_IFML_MLFR, "Multilink-FR" },
213 { JUNIPER_IFML_MFR, "Multilink-FR-UNI-NNI" },
214 { JUNIPER_IFML_ML, "Multilink" },
215 { JUNIPER_IFML_LS, "LinkService" },
216 { JUNIPER_IFML_LSI, "LSI" },
217 { JUNIPER_IFML_ATM_CELLRELAY_CCC, "ATM-CCC-Cell-Relay" },
218 { JUNIPER_IFML_CRYPTO, "IPSEC-over-IP" },
219 { JUNIPER_IFML_GGSN, "GGSN" },
220 { JUNIPER_IFML_PPP_TCC, "PPP-TCC" },
221 { JUNIPER_IFML_FRAMERELAY_TCC, "Frame-Relay-TCC" },
222 { JUNIPER_IFML_FRAMERELAY_EXT_TCC, "Extended FR-TCC" },
223 { JUNIPER_IFML_CISCOHDLC_TCC, "Cisco-HDLC-TCC" },
224 { JUNIPER_IFML_ETHERNET_CCC, "Ethernet-CCC" },
225 { JUNIPER_IFML_VT, "VPN-Loopback-tunnel" },
226 { JUNIPER_IFML_ETHER_OVER_ATM, "Ethernet-over-ATM" },
227 { JUNIPER_IFML_ETHER_VPLS_OVER_ATM, "Ethernet-VPLS-over-ATM" },
228 { JUNIPER_IFML_MONITOR, "Monitor" },
229 { JUNIPER_IFML_ETHERNET_TCC, "Ethernet-TCC" },
230 { JUNIPER_IFML_VLAN_TCC, "VLAN-TCC" },
231 { JUNIPER_IFML_EXTENDED_VLAN_TCC, "Extended-VLAN-TCC" },
232 { JUNIPER_IFML_CONTROLLER, "Controller" },
233 { JUNIPER_IFML_ETHERNET_VPLS, "VPLS" },
234 { JUNIPER_IFML_ETHERNET_VLAN_VPLS, "VLAN-VPLS" },
235 { JUNIPER_IFML_ETHERNET_EXTENDED_VLAN_VPLS, "Extended-VLAN-VPLS" },
236 { JUNIPER_IFML_LT, "Logical-tunnel" },
237 { JUNIPER_IFML_SERVICES, "General-Services" },
238 { JUNIPER_IFML_PPPOE, "PPPoE" },
239 { JUNIPER_IFML_ETHERNET_FLEX, "Flexible-Ethernet-Services" },
240 { JUNIPER_IFML_FRAMERELAY_FLEX, "Flexible-FrameRelay" },
241 { JUNIPER_IFML_COLLECTOR, "Flow-collection" },
242 { JUNIPER_IFML_PICPEER, "PIC Peer" },
243 { JUNIPER_IFML_DFC, "Dynamic-Flow-Capture" },
244 {0, NULL}
245 };
246
247 #define JUNIPER_IFLE_ATM_SNAP 2
248 #define JUNIPER_IFLE_ATM_NLPID 3
249 #define JUNIPER_IFLE_ATM_VCMUX 4
250 #define JUNIPER_IFLE_ATM_LLC 5
251 #define JUNIPER_IFLE_ATM_PPP_VCMUX 6
252 #define JUNIPER_IFLE_ATM_PPP_LLC 7
253 #define JUNIPER_IFLE_ATM_PPP_FUNI 8
254 #define JUNIPER_IFLE_ATM_CCC 9
255 #define JUNIPER_IFLE_FR_NLPID 10
256 #define JUNIPER_IFLE_FR_SNAP 11
257 #define JUNIPER_IFLE_FR_PPP 12
258 #define JUNIPER_IFLE_FR_CCC 13
259 #define JUNIPER_IFLE_ENET2 14
260 #define JUNIPER_IFLE_IEEE8023_SNAP 15
261 #define JUNIPER_IFLE_IEEE8023_LLC 16
262 #define JUNIPER_IFLE_PPP 17
263 #define JUNIPER_IFLE_CISCOHDLC 18
264 #define JUNIPER_IFLE_PPP_CCC 19
265 #define JUNIPER_IFLE_IPIP_NULL 20
266 #define JUNIPER_IFLE_PIM_NULL 21
267 #define JUNIPER_IFLE_GRE_NULL 22
268 #define JUNIPER_IFLE_GRE_PPP 23
269 #define JUNIPER_IFLE_PIMD_DECAPS 24
270 #define JUNIPER_IFLE_CISCOHDLC_CCC 25
271 #define JUNIPER_IFLE_ATM_CISCO_NLPID 26
272 #define JUNIPER_IFLE_VLAN_CCC 27
273 #define JUNIPER_IFLE_MLPPP 28
274 #define JUNIPER_IFLE_MLFR 29
275 #define JUNIPER_IFLE_LSI_NULL 30
276 #define JUNIPER_IFLE_AGGREGATE_UNUSED 31
277 #define JUNIPER_IFLE_ATM_CELLRELAY_CCC 32
278 #define JUNIPER_IFLE_CRYPTO 33
279 #define JUNIPER_IFLE_GGSN 34
280 #define JUNIPER_IFLE_ATM_TCC 35
281 #define JUNIPER_IFLE_FR_TCC 36
282 #define JUNIPER_IFLE_PPP_TCC 37
283 #define JUNIPER_IFLE_CISCOHDLC_TCC 38
284 #define JUNIPER_IFLE_ETHERNET_CCC 39
285 #define JUNIPER_IFLE_VT 40
286 #define JUNIPER_IFLE_ATM_EOA_LLC 41
287 #define JUNIPER_IFLE_EXTENDED_VLAN_CCC 42
288 #define JUNIPER_IFLE_ATM_SNAP_TCC 43
289 #define JUNIPER_IFLE_MONITOR 44
290 #define JUNIPER_IFLE_ETHERNET_TCC 45
291 #define JUNIPER_IFLE_VLAN_TCC 46
292 #define JUNIPER_IFLE_EXTENDED_VLAN_TCC 47
293 #define JUNIPER_IFLE_MFR 48
294 #define JUNIPER_IFLE_ETHERNET_VPLS 49
295 #define JUNIPER_IFLE_ETHERNET_VLAN_VPLS 50
296 #define JUNIPER_IFLE_ETHERNET_EXTENDED_VLAN_VPLS 51
297 #define JUNIPER_IFLE_SERVICES 52
298 #define JUNIPER_IFLE_ATM_ETHER_VPLS_ATM_LLC 53
299 #define JUNIPER_IFLE_FR_PORT_CCC 54
300 #define JUNIPER_IFLE_ATM_MLPPP_LLC 55
301 #define JUNIPER_IFLE_ATM_EOA_CCC 56
302 #define JUNIPER_IFLE_LT_VLAN 57
303 #define JUNIPER_IFLE_COLLECTOR 58
304 #define JUNIPER_IFLE_AGGREGATOR 59
305 #define JUNIPER_IFLE_LAPD 60
306 #define JUNIPER_IFLE_ATM_PPPOE_LLC 61
307 #define JUNIPER_IFLE_ETHERNET_PPPOE 62
308 #define JUNIPER_IFLE_PPPOE 63
309 #define JUNIPER_IFLE_PPP_SUBORDINATE 64
310 #define JUNIPER_IFLE_CISCOHDLC_SUBORDINATE 65
311 #define JUNIPER_IFLE_DFC 66
312 #define JUNIPER_IFLE_PICPEER 67
313
314 static const struct tok juniper_ifle_values[] = {
315 { JUNIPER_IFLE_AGGREGATOR, "Aggregator" },
316 { JUNIPER_IFLE_ATM_CCC, "CCC over ATM" },
317 { JUNIPER_IFLE_ATM_CELLRELAY_CCC, "ATM CCC Cell Relay" },
318 { JUNIPER_IFLE_ATM_CISCO_NLPID, "CISCO compatible NLPID" },
319 { JUNIPER_IFLE_ATM_EOA_CCC, "Ethernet over ATM CCC" },
320 { JUNIPER_IFLE_ATM_EOA_LLC, "Ethernet over ATM LLC" },
321 { JUNIPER_IFLE_ATM_ETHER_VPLS_ATM_LLC, "Ethernet VPLS over ATM LLC" },
322 { JUNIPER_IFLE_ATM_LLC, "ATM LLC" },
323 { JUNIPER_IFLE_ATM_MLPPP_LLC, "MLPPP over ATM LLC" },
324 { JUNIPER_IFLE_ATM_NLPID, "ATM NLPID" },
325 { JUNIPER_IFLE_ATM_PPPOE_LLC, "PPPoE over ATM LLC" },
326 { JUNIPER_IFLE_ATM_PPP_FUNI, "PPP over FUNI" },
327 { JUNIPER_IFLE_ATM_PPP_LLC, "PPP over ATM LLC" },
328 { JUNIPER_IFLE_ATM_PPP_VCMUX, "PPP over ATM VCMUX" },
329 { JUNIPER_IFLE_ATM_SNAP, "ATM SNAP" },
330 { JUNIPER_IFLE_ATM_SNAP_TCC, "ATM SNAP TCC" },
331 { JUNIPER_IFLE_ATM_TCC, "ATM VCMUX TCC" },
332 { JUNIPER_IFLE_ATM_VCMUX, "ATM VCMUX" },
333 { JUNIPER_IFLE_CISCOHDLC, "C-HDLC" },
334 { JUNIPER_IFLE_CISCOHDLC_CCC, "C-HDLC CCC" },
335 { JUNIPER_IFLE_CISCOHDLC_SUBORDINATE, "C-HDLC via dialer" },
336 { JUNIPER_IFLE_CISCOHDLC_TCC, "C-HDLC TCC" },
337 { JUNIPER_IFLE_COLLECTOR, "Collector" },
338 { JUNIPER_IFLE_CRYPTO, "Crypto" },
339 { JUNIPER_IFLE_ENET2, "Ethernet" },
340 { JUNIPER_IFLE_ETHERNET_CCC, "Ethernet CCC" },
341 { JUNIPER_IFLE_ETHERNET_EXTENDED_VLAN_VPLS, "Extended VLAN VPLS" },
342 { JUNIPER_IFLE_ETHERNET_PPPOE, "PPPoE over Ethernet" },
343 { JUNIPER_IFLE_ETHERNET_TCC, "Ethernet TCC" },
344 { JUNIPER_IFLE_ETHERNET_VLAN_VPLS, "VLAN VPLS" },
345 { JUNIPER_IFLE_ETHERNET_VPLS, "VPLS" },
346 { JUNIPER_IFLE_EXTENDED_VLAN_CCC, "Extended VLAN CCC" },
347 { JUNIPER_IFLE_EXTENDED_VLAN_TCC, "Extended VLAN TCC" },
348 { JUNIPER_IFLE_FR_CCC, "FR CCC" },
349 { JUNIPER_IFLE_FR_NLPID, "FR NLPID" },
350 { JUNIPER_IFLE_FR_PORT_CCC, "FR CCC" },
351 { JUNIPER_IFLE_FR_PPP, "FR PPP" },
352 { JUNIPER_IFLE_FR_SNAP, "FR SNAP" },
353 { JUNIPER_IFLE_FR_TCC, "FR TCC" },
354 { JUNIPER_IFLE_GGSN, "GGSN" },
355 { JUNIPER_IFLE_GRE_NULL, "GRE NULL" },
356 { JUNIPER_IFLE_GRE_PPP, "PPP over GRE" },
357 { JUNIPER_IFLE_IPIP_NULL, "IPIP" },
358 { JUNIPER_IFLE_LAPD, "LAPD" },
359 { JUNIPER_IFLE_LSI_NULL, "LSI Null" },
360 { JUNIPER_IFLE_LT_VLAN, "LT VLAN" },
361 { JUNIPER_IFLE_MFR, "MFR" },
362 { JUNIPER_IFLE_MLFR, "MLFR" },
363 { JUNIPER_IFLE_MLPPP, "MLPPP" },
364 { JUNIPER_IFLE_MONITOR, "Monitor" },
365 { JUNIPER_IFLE_PIMD_DECAPS, "PIMd" },
366 { JUNIPER_IFLE_PIM_NULL, "PIM Null" },
367 { JUNIPER_IFLE_PPP, "PPP" },
368 { JUNIPER_IFLE_PPPOE, "PPPoE" },
369 { JUNIPER_IFLE_PPP_CCC, "PPP CCC" },
370 { JUNIPER_IFLE_PPP_SUBORDINATE, "" },
371 { JUNIPER_IFLE_PPP_TCC, "PPP TCC" },
372 { JUNIPER_IFLE_SERVICES, "General Services" },
373 { JUNIPER_IFLE_VLAN_CCC, "VLAN CCC" },
374 { JUNIPER_IFLE_VLAN_TCC, "VLAN TCC" },
375 { JUNIPER_IFLE_VT, "VT" },
376 {0, NULL}
377 };
378
379 struct juniper_cookie_table_t {
380 uint32_t pictype; /* pic type */
381 uint8_t cookie_len; /* cookie len */
382 const char *s; /* pic name */
383 };
384
385 static const struct juniper_cookie_table_t juniper_cookie_table[] = {
386 #ifdef DLT_JUNIPER_ATM1
387 { DLT_JUNIPER_ATM1, 4, "ATM1"},
388 #endif
389 #ifdef DLT_JUNIPER_ATM2
390 { DLT_JUNIPER_ATM2, 8, "ATM2"},
391 #endif
392 #ifdef DLT_JUNIPER_MLPPP
393 { DLT_JUNIPER_MLPPP, 2, "MLPPP"},
394 #endif
395 #ifdef DLT_JUNIPER_MLFR
396 { DLT_JUNIPER_MLFR, 2, "MLFR"},
397 #endif
398 #ifdef DLT_JUNIPER_MFR
399 { DLT_JUNIPER_MFR, 4, "MFR"},
400 #endif
401 #ifdef DLT_JUNIPER_PPPOE
402 { DLT_JUNIPER_PPPOE, 0, "PPPoE"},
403 #endif
404 #ifdef DLT_JUNIPER_PPPOE_ATM
405 { DLT_JUNIPER_PPPOE_ATM, 0, "PPPoE ATM"},
406 #endif
407 #ifdef DLT_JUNIPER_GGSN
408 { DLT_JUNIPER_GGSN, 8, "GGSN"},
409 #endif
410 #ifdef DLT_JUNIPER_MONITOR
411 { DLT_JUNIPER_MONITOR, 8, "MONITOR"},
412 #endif
413 #ifdef DLT_JUNIPER_SERVICES
414 { DLT_JUNIPER_SERVICES, 8, "AS"},
415 #endif
416 #ifdef DLT_JUNIPER_ES
417 { DLT_JUNIPER_ES, 0, "ES"},
418 #endif
419 { 0, 0, NULL }
420 };
421
422 struct juniper_l2info_t {
423 uint32_t length;
424 uint32_t caplen;
425 uint32_t pictype;
426 uint8_t direction;
427 u_int header_len;
428 uint8_t cookie_len;
429 uint8_t cookie_type;
430 uint8_t cookie[8];
431 u_int bundle;
432 uint16_t proto;
433 uint8_t flags;
434 };
435
436 #define LS_COOKIE_ID 0x54
437 #define AS_COOKIE_ID 0x47
438 #define LS_MLFR_COOKIE_LEN 4
439 #define ML_MLFR_COOKIE_LEN 2
440 #define LS_MFR_COOKIE_LEN 6
441 #define ATM1_COOKIE_LEN 4
442 #define ATM2_COOKIE_LEN 8
443
444 #define ATM2_PKT_TYPE_MASK 0x70
445 #define ATM2_GAP_COUNT_MASK 0x3F
446
447 #define JUNIPER_PROTO_NULL 1
448 #define JUNIPER_PROTO_IPV4 2
449 #define JUNIPER_PROTO_IPV6 6
450
451 #define MFR_BE_MASK 0xc0
452
453 #ifdef DLT_JUNIPER_GGSN
454 static const struct tok juniper_protocol_values[] = {
455 { JUNIPER_PROTO_NULL, "Null" },
456 { JUNIPER_PROTO_IPV4, "IPv4" },
457 { JUNIPER_PROTO_IPV6, "IPv6" },
458 { 0, NULL}
459 };
460 #endif
461
462 static int ip_heuristic_guess(netdissect_options *, const u_char *, u_int);
463 #ifdef DLT_JUNIPER_ATM2
464 static int juniper_ppp_heuristic_guess(netdissect_options *, const u_char *, u_int);
465 #endif
466 static int juniper_parse_header(netdissect_options *, const u_char *, const struct pcap_pkthdr *, struct juniper_l2info_t *);
467
468 #ifdef DLT_JUNIPER_GGSN
469 void
470 juniper_ggsn_if_print(netdissect_options *ndo,
471 const struct pcap_pkthdr *h, const u_char *p)
472 {
473 struct juniper_l2info_t l2info;
474 struct juniper_ggsn_header {
475 nd_uint8_t svc_id;
476 nd_uint8_t flags_len;
477 nd_uint8_t proto;
478 nd_uint8_t flags;
479 nd_uint16_t vlan_id;
480 nd_byte res[2];
481 };
482 const struct juniper_ggsn_header *gh;
483 uint8_t proto;
484
485 ndo->ndo_protocol = "juniper_ggsn";
486 memset(&l2info, 0, sizeof(l2info));
487 l2info.pictype = DLT_JUNIPER_GGSN;
488 if (juniper_parse_header(ndo, p, h, &l2info) == 0) {
489 ndo->ndo_ll_hdr_len += l2info.header_len;
490 return;
491 }
492
493 p+=l2info.header_len;
494 gh = (struct juniper_ggsn_header *)&l2info.cookie;
495
496 /* use EXTRACT_, not GET_ (not packet buffer pointer) */
497 proto = EXTRACT_U_1(gh->proto);
498 if (ndo->ndo_eflag) {
499 ND_PRINT("proto %s (%u), vlan %u: ",
500 tok2str(juniper_protocol_values,"Unknown",proto),
501 proto,
502 EXTRACT_BE_U_2(gh->vlan_id));
503 }
504
505 switch (proto) {
506 case JUNIPER_PROTO_IPV4:
507 ip_print(ndo, p, l2info.length);
508 break;
509 case JUNIPER_PROTO_IPV6:
510 ip6_print(ndo, p, l2info.length);
511 break;
512 default:
513 if (!ndo->ndo_eflag)
514 ND_PRINT("unknown GGSN proto (%u)", proto);
515 }
516
517 ndo->ndo_ll_hdr_len += l2info.header_len;
518 }
519 #endif
520
521 #ifdef DLT_JUNIPER_ES
522 void
523 juniper_es_if_print(netdissect_options *ndo,
524 const struct pcap_pkthdr *h, const u_char *p)
525 {
526 struct juniper_l2info_t l2info;
527 struct juniper_ipsec_header {
528 nd_uint16_t sa_index;
529 nd_uint8_t ttl;
530 nd_uint8_t type;
531 nd_uint32_t spi;
532 nd_ipv4 src_ip;
533 nd_ipv4 dst_ip;
534 };
535 u_int rewrite_len,es_type_bundle;
536 const struct juniper_ipsec_header *ih;
537
538 ndo->ndo_protocol = "juniper_es";
539 memset(&l2info, 0, sizeof(l2info));
540 l2info.pictype = DLT_JUNIPER_ES;
541 if (juniper_parse_header(ndo, p, h, &l2info) == 0) {
542 ndo->ndo_ll_hdr_len += l2info.header_len;
543 return;
544 }
545
546 p+=l2info.header_len;
547 ih = (const struct juniper_ipsec_header *)p;
548
549 ND_TCHECK_SIZE(ih);
550 switch (GET_U_1(ih->type)) {
551 case JUNIPER_IPSEC_O_ESP_ENCRYPT_ESP_AUTHEN_TYPE:
552 case JUNIPER_IPSEC_O_ESP_ENCRYPT_AH_AUTHEN_TYPE:
553 rewrite_len = 0;
554 es_type_bundle = 1;
555 break;
556 case JUNIPER_IPSEC_O_ESP_AUTHENTICATION_TYPE:
557 case JUNIPER_IPSEC_O_AH_AUTHENTICATION_TYPE:
558 case JUNIPER_IPSEC_O_ESP_ENCRYPTION_TYPE:
559 rewrite_len = 16;
560 es_type_bundle = 0;
561 break;
562 default:
563 ND_PRINT("ES Invalid type %u, length %u",
564 GET_U_1(ih->type),
565 l2info.length);
566 ndo->ndo_ll_hdr_len += l2info.header_len;
567 return;
568 }
569
570 l2info.length-=rewrite_len;
571 p+=rewrite_len;
572
573 if (ndo->ndo_eflag) {
574 if (!es_type_bundle) {
575 ND_PRINT("ES SA, index %u, ttl %u type %s (%u), spi %u, Tunnel %s > %s, length %u\n",
576 GET_BE_U_2(ih->sa_index),
577 GET_U_1(ih->ttl),
578 tok2str(juniper_ipsec_type_values,"Unknown",GET_U_1(ih->type)),
579 GET_U_1(ih->type),
580 GET_BE_U_4(ih->spi),
581 GET_IPADDR_STRING(ih->src_ip),
582 GET_IPADDR_STRING(ih->dst_ip),
583 l2info.length);
584 } else {
585 ND_PRINT("ES SA, index %u, ttl %u type %s (%u), length %u\n",
586 GET_BE_U_2(ih->sa_index),
587 GET_U_1(ih->ttl),
588 tok2str(juniper_ipsec_type_values,"Unknown",GET_U_1(ih->type)),
589 GET_U_1(ih->type),
590 l2info.length);
591 }
592 }
593
594 ip_print(ndo, p, l2info.length);
595 ndo->ndo_ll_hdr_len += l2info.header_len;
596 }
597 #endif
598
599 #ifdef DLT_JUNIPER_MONITOR
600 void
601 juniper_monitor_if_print(netdissect_options *ndo,
602 const struct pcap_pkthdr *h, const u_char *p)
603 {
604 struct juniper_l2info_t l2info;
605 struct juniper_monitor_header {
606 nd_uint8_t pkt_type;
607 nd_byte padding;
608 nd_uint16_t iif;
609 nd_uint32_t service_id;
610 };
611 const struct juniper_monitor_header *mh;
612
613 ndo->ndo_protocol = "juniper_monitor";
614 memset(&l2info, 0, sizeof(l2info));
615 l2info.pictype = DLT_JUNIPER_MONITOR;
616 if (juniper_parse_header(ndo, p, h, &l2info) == 0) {
617 ndo->ndo_ll_hdr_len += l2info.header_len;
618 return;
619 }
620
621 p+=l2info.header_len;
622 mh = (const struct juniper_monitor_header *)p;
623
624 ND_TCHECK_SIZE(mh);
625 if (ndo->ndo_eflag)
626 ND_PRINT("service-id %u, iif %u, pkt-type %u: ",
627 GET_BE_U_4(mh->service_id),
628 GET_BE_U_2(mh->iif),
629 GET_U_1(mh->pkt_type));
630
631 /* no proto field - lets guess by first byte of IP header*/
632 ip_heuristic_guess (ndo, p, l2info.length);
633
634 ndo->ndo_ll_hdr_len += l2info.header_len;
635 }
636 #endif
637
638 #ifdef DLT_JUNIPER_SERVICES
639 void
640 juniper_services_if_print(netdissect_options *ndo,
641 const struct pcap_pkthdr *h, const u_char *p)
642 {
643 struct juniper_l2info_t l2info;
644 struct juniper_services_header {
645 nd_uint8_t svc_id;
646 nd_uint8_t flags_len;
647 nd_uint16_t svc_set_id;
648 nd_byte pad;
649 nd_uint24_t dir_iif;
650 };
651 const struct juniper_services_header *sh;
652
653 ndo->ndo_protocol = "juniper_services";
654 memset(&l2info, 0, sizeof(l2info));
655 l2info.pictype = DLT_JUNIPER_SERVICES;
656 if (juniper_parse_header(ndo, p, h, &l2info) == 0) {
657 ndo->ndo_ll_hdr_len += l2info.header_len;
658 return;
659 }
660
661 p+=l2info.header_len;
662 sh = (const struct juniper_services_header *)p;
663
664 ND_TCHECK_SIZE(sh);
665 if (ndo->ndo_eflag)
666 ND_PRINT("service-id %u flags 0x%02x service-set-id 0x%04x iif %u: ",
667 GET_U_1(sh->svc_id),
668 GET_U_1(sh->flags_len),
669 GET_BE_U_2(sh->svc_set_id),
670 GET_BE_U_3(sh->dir_iif));
671
672 /* no proto field - lets guess by first byte of IP header*/
673 ip_heuristic_guess (ndo, p, l2info.length);
674
675 ndo->ndo_ll_hdr_len += l2info.header_len;
676 }
677 #endif
678
679 #ifdef DLT_JUNIPER_PPPOE
680 void
681 juniper_pppoe_if_print(netdissect_options *ndo,
682 const struct pcap_pkthdr *h, const u_char *p)
683 {
684 struct juniper_l2info_t l2info;
685
686 ndo->ndo_protocol = "juniper_pppoe";
687 memset(&l2info, 0, sizeof(l2info));
688 l2info.pictype = DLT_JUNIPER_PPPOE;
689 if (juniper_parse_header(ndo, p, h, &l2info) == 0) {
690 ndo->ndo_ll_hdr_len += l2info.header_len;
691 return;
692 }
693
694 p+=l2info.header_len;
695 /* this DLT contains nothing but raw ethernet frames */
696 ether_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL);
697 ndo->ndo_ll_hdr_len += l2info.header_len;
698 }
699 #endif
700
701 #ifdef DLT_JUNIPER_ETHER
702 void
703 juniper_ether_if_print(netdissect_options *ndo,
704 const struct pcap_pkthdr *h, const u_char *p)
705 {
706 struct juniper_l2info_t l2info;
707
708 ndo->ndo_protocol = "juniper_ether";
709 memset(&l2info, 0, sizeof(l2info));
710 l2info.pictype = DLT_JUNIPER_ETHER;
711 if (juniper_parse_header(ndo, p, h, &l2info) == 0) {
712 ndo->ndo_ll_hdr_len += l2info.header_len;
713 return;
714 }
715
716 p+=l2info.header_len;
717 /* this DLT contains nothing but raw Ethernet frames */
718 ndo->ndo_ll_hdr_len +=
719 l2info.header_len +
720 ether_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL);
721 }
722 #endif
723
724 #ifdef DLT_JUNIPER_PPP
725 void
726 juniper_ppp_if_print(netdissect_options *ndo,
727 const struct pcap_pkthdr *h, const u_char *p)
728 {
729 struct juniper_l2info_t l2info;
730
731 ndo->ndo_protocol = "juniper_ppp";
732 memset(&l2info, 0, sizeof(l2info));
733 l2info.pictype = DLT_JUNIPER_PPP;
734 if (juniper_parse_header(ndo, p, h, &l2info) == 0) {
735 ndo->ndo_ll_hdr_len += l2info.header_len;
736 return;
737 }
738
739 p+=l2info.header_len;
740 /* this DLT contains nothing but raw ppp frames */
741 ppp_print(ndo, p, l2info.length);
742 ndo->ndo_ll_hdr_len += l2info.header_len;
743 }
744 #endif
745
746 #ifdef DLT_JUNIPER_FRELAY
747 void
748 juniper_frelay_if_print(netdissect_options *ndo,
749 const struct pcap_pkthdr *h, const u_char *p)
750 {
751 struct juniper_l2info_t l2info;
752
753 ndo->ndo_protocol = "juniper_frelay";
754 memset(&l2info, 0, sizeof(l2info));
755 l2info.pictype = DLT_JUNIPER_FRELAY;
756 if (juniper_parse_header(ndo, p, h, &l2info) == 0) {
757 ndo->ndo_ll_hdr_len += l2info.header_len;
758 return;
759 }
760
761 p+=l2info.header_len;
762 /* this DLT contains nothing but raw frame-relay frames */
763 fr_print(ndo, p, l2info.length);
764 ndo->ndo_ll_hdr_len += l2info.header_len;
765 }
766 #endif
767
768 #ifdef DLT_JUNIPER_CHDLC
769 void
770 juniper_chdlc_if_print(netdissect_options *ndo,
771 const struct pcap_pkthdr *h, const u_char *p)
772 {
773 struct juniper_l2info_t l2info;
774
775 ndo->ndo_protocol = "juniper_chdlc";
776 memset(&l2info, 0, sizeof(l2info));
777 l2info.pictype = DLT_JUNIPER_CHDLC;
778 if (juniper_parse_header(ndo, p, h, &l2info) == 0) {
779 ndo->ndo_ll_hdr_len += l2info.header_len;
780 return;
781 }
782
783 p+=l2info.header_len;
784 /* this DLT contains nothing but raw c-hdlc frames */
785 chdlc_print(ndo, p, l2info.length);
786 ndo->ndo_ll_hdr_len += l2info.header_len;
787 }
788 #endif
789
790 #ifdef DLT_JUNIPER_PPPOE_ATM
791 void
792 juniper_pppoe_atm_if_print(netdissect_options *ndo,
793 const struct pcap_pkthdr *h, const u_char *p)
794 {
795 struct juniper_l2info_t l2info;
796 uint16_t extracted_ethertype;
797
798 ndo->ndo_protocol = "juniper_pppoe_atm";
799 memset(&l2info, 0, sizeof(l2info));
800 l2info.pictype = DLT_JUNIPER_PPPOE_ATM;
801 if (juniper_parse_header(ndo, p, h, &l2info) == 0) {
802 ndo->ndo_ll_hdr_len += l2info.header_len;
803 return;
804 }
805
806 p+=l2info.header_len;
807
808 extracted_ethertype = GET_BE_U_2(p);
809 /* this DLT contains nothing but raw PPPoE frames,
810 * prepended with a type field*/
811 if (ethertype_print(ndo, extracted_ethertype,
812 p+ETHERTYPE_LEN,
813 l2info.length-ETHERTYPE_LEN,
814 l2info.caplen-ETHERTYPE_LEN,
815 NULL, NULL) == 0)
816 /* ether_type not known, probably it wasn't one */
817 ND_PRINT("unknown ethertype 0x%04x", extracted_ethertype);
818
819 ndo->ndo_ll_hdr_len += l2info.header_len;
820 }
821 #endif
822
823 #ifdef DLT_JUNIPER_MLPPP
824 void
825 juniper_mlppp_if_print(netdissect_options *ndo,
826 const struct pcap_pkthdr *h, const u_char *p)
827 {
828 struct juniper_l2info_t l2info;
829
830 ndo->ndo_protocol = "juniper_mlppp";
831 memset(&l2info, 0, sizeof(l2info));
832 l2info.pictype = DLT_JUNIPER_MLPPP;
833 if (juniper_parse_header(ndo, p, h, &l2info) == 0) {
834 ndo->ndo_ll_hdr_len += l2info.header_len;
835 return;
836 }
837
838 /* suppress Bundle-ID if frame was captured on a child-link
839 * best indicator if the cookie looks like a proto */
840 if (ndo->ndo_eflag &&
841 /* use EXTRACT_, not GET_ (not packet buffer pointer) */
842 EXTRACT_BE_U_2(&l2info.cookie) != PPP_OSI &&
843 /* use EXTRACT_, not GET_ (not packet buffer pointer) */
844 EXTRACT_BE_U_2(&l2info.cookie) != (PPP_ADDRESS << 8 | PPP_CONTROL))
845 ND_PRINT("Bundle-ID %u: ", l2info.bundle);
846
847 p+=l2info.header_len;
848
849 /* first try the LSQ protos */
850 switch(l2info.proto) {
851 case JUNIPER_LSQ_L3_PROTO_IPV4:
852 /* IP traffic going to the RE would not have a cookie
853 * -> this must be incoming IS-IS over PPP
854 */
855 if (l2info.cookie[4] == (JUNIPER_LSQ_COOKIE_RE|JUNIPER_LSQ_COOKIE_DIR))
856 ppp_print(ndo, p, l2info.length);
857 else
858 ip_print(ndo, p, l2info.length);
859 ndo->ndo_ll_hdr_len += l2info.header_len;
860 return;
861 case JUNIPER_LSQ_L3_PROTO_IPV6:
862 ip6_print(ndo, p,l2info.length);
863 ndo->ndo_ll_hdr_len += l2info.header_len;
864 return;
865 case JUNIPER_LSQ_L3_PROTO_MPLS:
866 mpls_print(ndo, p, l2info.length);
867 ndo->ndo_ll_hdr_len += l2info.header_len;
868 return;
869 case JUNIPER_LSQ_L3_PROTO_ISO:
870 isoclns_print(ndo, p, l2info.length);
871 ndo->ndo_ll_hdr_len += l2info.header_len;
872 return;
873 default:
874 break;
875 }
876
877 /* zero length cookie ? */
878 /* use EXTRACT_, not GET_ (not packet buffer pointer) */
879 switch (EXTRACT_BE_U_2(&l2info.cookie)) {
880 case PPP_OSI:
881 ppp_print(ndo, p - 2, l2info.length + 2);
882 break;
883 case (PPP_ADDRESS << 8 | PPP_CONTROL): /* fall through */
884 default:
885 ppp_print(ndo, p, l2info.length);
886 break;
887 }
888
889 ndo->ndo_ll_hdr_len += l2info.header_len;
890 }
891 #endif
892
893
894 #ifdef DLT_JUNIPER_MFR
895 void
896 juniper_mfr_if_print(netdissect_options *ndo,
897 const struct pcap_pkthdr *h, const u_char *p)
898 {
899 struct juniper_l2info_t l2info;
900
901 ndo->ndo_protocol = "juniper_mfr";
902 memset(&l2info, 0, sizeof(l2info));
903 l2info.pictype = DLT_JUNIPER_MFR;
904 if (juniper_parse_header(ndo, p, h, &l2info) == 0) {
905 ndo->ndo_ll_hdr_len += l2info.header_len;
906 return;
907 }
908
909 p+=l2info.header_len;
910
911 /* child-link ? */
912 if (l2info.cookie_len == 0) {
913 mfr_print(ndo, p, l2info.length);
914 ndo->ndo_ll_hdr_len += l2info.header_len;
915 return;
916 }
917
918 /* first try the LSQ protos */
919 if (l2info.cookie_len == AS_PIC_COOKIE_LEN) {
920 switch(l2info.proto) {
921 case JUNIPER_LSQ_L3_PROTO_IPV4:
922 ip_print(ndo, p, l2info.length);
923 ndo->ndo_ll_hdr_len += l2info.header_len;
924 return;
925 case JUNIPER_LSQ_L3_PROTO_IPV6:
926 ip6_print(ndo, p,l2info.length);
927 ndo->ndo_ll_hdr_len += l2info.header_len;
928 return;
929 case JUNIPER_LSQ_L3_PROTO_MPLS:
930 mpls_print(ndo, p, l2info.length);
931 ndo->ndo_ll_hdr_len += l2info.header_len;
932 return;
933 case JUNIPER_LSQ_L3_PROTO_ISO:
934 isoclns_print(ndo, p, l2info.length);
935 ndo->ndo_ll_hdr_len += l2info.header_len;
936 return;
937 default:
938 break;
939 }
940 ndo->ndo_ll_hdr_len += l2info.header_len;
941 return;
942 }
943
944 /* suppress Bundle-ID if frame was captured on a child-link */
945 /* use EXTRACT_, not GET_ (not packet buffer pointer) */
946 if (ndo->ndo_eflag && EXTRACT_BE_U_4(l2info.cookie) != 1)
947 ND_PRINT("Bundle-ID %u, ", l2info.bundle);
948 switch (l2info.proto) {
949 case (LLCSAP_ISONS<<8 | LLCSAP_ISONS):
950 /* At least one byte is required */
951 ND_TCHECK_1(p);
952 isoclns_print(ndo, p + 1, l2info.length - 1);
953 break;
954 case (LLC_UI<<8 | NLPID_Q933):
955 case (LLC_UI<<8 | NLPID_IP):
956 case (LLC_UI<<8 | NLPID_IP6):
957 /* pass IP{4,6} to the OSI layer for proper link-layer printing */
958 isoclns_print(ndo, p - 1, l2info.length + 1);
959 break;
960 default:
961 ND_PRINT("unknown protocol 0x%04x, length %u", l2info.proto, l2info.length);
962 }
963
964 ndo->ndo_ll_hdr_len += l2info.header_len;
965 }
966 #endif
967
968 #ifdef DLT_JUNIPER_MLFR
969 void
970 juniper_mlfr_if_print(netdissect_options *ndo,
971 const struct pcap_pkthdr *h, const u_char *p)
972 {
973 struct juniper_l2info_t l2info;
974
975 ndo->ndo_protocol = "juniper_mlfr";
976 memset(&l2info, 0, sizeof(l2info));
977 l2info.pictype = DLT_JUNIPER_MLFR;
978 if (juniper_parse_header(ndo, p, h, &l2info) == 0) {
979 ndo->ndo_ll_hdr_len += l2info.header_len;
980 return;
981 }
982
983 p+=l2info.header_len;
984
985 /* suppress Bundle-ID if frame was captured on a child-link */
986 /* use EXTRACT_, not GET_ (not packet buffer pointer) */
987 if (ndo->ndo_eflag && EXTRACT_BE_U_4(l2info.cookie) != 1)
988 ND_PRINT("Bundle-ID %u, ", l2info.bundle);
989 switch (l2info.proto) {
990 case (LLC_UI):
991 case (LLC_UI<<8):
992 isoclns_print(ndo, p, l2info.length);
993 break;
994 case (LLC_UI<<8 | NLPID_Q933):
995 case (LLC_UI<<8 | NLPID_IP):
996 case (LLC_UI<<8 | NLPID_IP6):
997 /* pass IP{4,6} to the OSI layer for proper link-layer printing */
998 isoclns_print(ndo, p - 1, l2info.length + 1);
999 break;
1000 default:
1001 ND_PRINT("unknown protocol 0x%04x, length %u", l2info.proto, l2info.length);
1002 }
1003
1004 ndo->ndo_ll_hdr_len += l2info.header_len;
1005 }
1006 #endif
1007
1008 /*
1009 * ATM1 PIC cookie format
1010 *
1011 * +-----+-------------------------+-------------------------------+
1012 * |fmtid| vc index | channel ID |
1013 * +-----+-------------------------+-------------------------------+
1014 */
1015
1016 #ifdef DLT_JUNIPER_ATM1
1017 void
1018 juniper_atm1_if_print(netdissect_options *ndo,
1019 const struct pcap_pkthdr *h, const u_char *p)
1020 {
1021 int llc_hdrlen;
1022
1023 struct juniper_l2info_t l2info;
1024
1025 ndo->ndo_protocol = "juniper_atm1";
1026 memset(&l2info, 0, sizeof(l2info));
1027 l2info.pictype = DLT_JUNIPER_ATM1;
1028 if (juniper_parse_header(ndo, p, h, &l2info) == 0) {
1029 ndo->ndo_ll_hdr_len += l2info.header_len;
1030 return;
1031 }
1032
1033 p+=l2info.header_len;
1034
1035 if (l2info.cookie[0] == 0x80) { /* OAM cell ? */
1036 oam_print(ndo, p, l2info.length, ATM_OAM_NOHEC);
1037 ndo->ndo_ll_hdr_len += l2info.header_len;
1038 return;
1039 }
1040
1041 if (GET_BE_U_3(p) == 0xfefe03 || /* NLPID encaps ? */
1042 GET_BE_U_3(p) == 0xaaaa03) { /* SNAP encaps ? */
1043
1044 llc_hdrlen = llc_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL);
1045 if (llc_hdrlen > 0) {
1046 ndo->ndo_ll_hdr_len += l2info.header_len;
1047 return;
1048 }
1049 }
1050
1051 if (GET_U_1(p) == 0x03) { /* Cisco style NLPID encaps ? */
1052 /* At least one byte is required */
1053 ND_TCHECK_1(p);
1054 isoclns_print(ndo, p + 1, l2info.length - 1);
1055 /* FIXME check if frame was recognized */
1056 ndo->ndo_ll_hdr_len += l2info.header_len;
1057 return;
1058 }
1059
1060 if (ip_heuristic_guess(ndo, p, l2info.length) != 0) { /* last try - vcmux encaps ? */
1061 ndo->ndo_ll_hdr_len += l2info.header_len;
1062 return;
1063 }
1064
1065 ndo->ndo_ll_hdr_len += l2info.header_len;
1066 }
1067 #endif
1068
1069 /*
1070 * ATM2 PIC cookie format
1071 *
1072 * +-------------------------------+---------+---+-----+-----------+
1073 * | channel ID |reserved |AAL| CCRQ| gap count |
1074 * +-------------------------------+---------+---+-----+-----------+
1075 */
1076
1077 #ifdef DLT_JUNIPER_ATM2
1078 void
1079 juniper_atm2_if_print(netdissect_options *ndo,
1080 const struct pcap_pkthdr *h, const u_char *p)
1081 {
1082 int llc_hdrlen;
1083
1084 struct juniper_l2info_t l2info;
1085
1086 ndo->ndo_protocol = "juniper_atm2";
1087 memset(&l2info, 0, sizeof(l2info));
1088 l2info.pictype = DLT_JUNIPER_ATM2;
1089 if (juniper_parse_header(ndo, p, h, &l2info) == 0) {
1090 ndo->ndo_ll_hdr_len += l2info.header_len;
1091 return;
1092 }
1093
1094 p+=l2info.header_len;
1095
1096 if (l2info.cookie[7] & ATM2_PKT_TYPE_MASK) { /* OAM cell ? */
1097 oam_print(ndo, p, l2info.length, ATM_OAM_NOHEC);
1098 ndo->ndo_ll_hdr_len += l2info.header_len;
1099 return;
1100 }
1101
1102 if (GET_BE_U_3(p) == 0xfefe03 || /* NLPID encaps ? */
1103 GET_BE_U_3(p) == 0xaaaa03) { /* SNAP encaps ? */
1104
1105 llc_hdrlen = llc_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL);
1106 if (llc_hdrlen > 0) {
1107 ndo->ndo_ll_hdr_len += l2info.header_len;
1108 return;
1109 }
1110 }
1111
1112 if (l2info.direction != JUNIPER_BPF_PKT_IN && /* ether-over-1483 encaps ? */
1113 /* use EXTRACT_, not GET_ (not packet buffer pointer) */
1114 (EXTRACT_BE_U_4(l2info.cookie) & ATM2_GAP_COUNT_MASK)) {
1115 ether_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL);
1116 ndo->ndo_ll_hdr_len += l2info.header_len;
1117 return;
1118 }
1119
1120 if (GET_U_1(p) == 0x03) { /* Cisco style NLPID encaps ? */
1121 /* At least one byte is required */
1122 ND_TCHECK_1(p);
1123 isoclns_print(ndo, p + 1, l2info.length - 1);
1124 /* FIXME check if frame was recognized */
1125 ndo->ndo_ll_hdr_len += l2info.header_len;
1126 return;
1127 }
1128
1129 if(juniper_ppp_heuristic_guess(ndo, p, l2info.length) != 0) { /* PPPoA vcmux encaps ? */
1130 ndo->ndo_ll_hdr_len += l2info.header_len;
1131 return;
1132 }
1133
1134 if (ip_heuristic_guess(ndo, p, l2info.length) != 0) { /* last try - vcmux encaps ? */
1135 ndo->ndo_ll_hdr_len += l2info.header_len;
1136 return;
1137 }
1138
1139 ndo->ndo_ll_hdr_len += l2info.header_len;
1140 }
1141
1142 /* try to guess, based on all PPP protos that are supported in
1143 * a juniper router if the payload data is encapsulated using PPP */
1144 static int
1145 juniper_ppp_heuristic_guess(netdissect_options *ndo,
1146 const u_char *p, u_int length)
1147 {
1148 switch(GET_BE_U_2(p)) {
1149 case PPP_IP :
1150 case PPP_OSI :
1151 case PPP_MPLS_UCAST :
1152 case PPP_MPLS_MCAST :
1153 case PPP_IPCP :
1154 case PPP_OSICP :
1155 case PPP_MPLSCP :
1156 case PPP_LCP :
1157 case PPP_PAP :
1158 case PPP_CHAP :
1159 case PPP_ML :
1160 case PPP_IPV6 :
1161 case PPP_IPV6CP :
1162 ppp_print(ndo, p, length);
1163 break;
1164
1165 default:
1166 return 0; /* did not find a ppp header */
1167 }
1168 return 1; /* we printed a ppp packet */
1169 }
1170 #endif
1171
1172 static int
1173 ip_heuristic_guess(netdissect_options *ndo,
1174 const u_char *p, u_int length)
1175 {
1176 switch(GET_U_1(p)) {
1177 case 0x45:
1178 case 0x46:
1179 case 0x47:
1180 case 0x48:
1181 case 0x49:
1182 case 0x4a:
1183 case 0x4b:
1184 case 0x4c:
1185 case 0x4d:
1186 case 0x4e:
1187 case 0x4f:
1188 ip_print(ndo, p, length);
1189 break;
1190 case 0x60:
1191 case 0x61:
1192 case 0x62:
1193 case 0x63:
1194 case 0x64:
1195 case 0x65:
1196 case 0x66:
1197 case 0x67:
1198 case 0x68:
1199 case 0x69:
1200 case 0x6a:
1201 case 0x6b:
1202 case 0x6c:
1203 case 0x6d:
1204 case 0x6e:
1205 case 0x6f:
1206 ip6_print(ndo, p, length);
1207 break;
1208 default:
1209 return 0; /* did not find a ip header */
1210 }
1211 return 1; /* we printed an v4/v6 packet */
1212 }
1213
1214 static int
1215 juniper_read_tlv_value(netdissect_options *ndo,
1216 const u_char *p, u_int tlv_type, u_int tlv_len)
1217 {
1218 int tlv_value;
1219
1220 /* TLVs < 128 are little endian encoded */
1221 if (tlv_type < 128) {
1222 switch (tlv_len) {
1223 case 1:
1224 tlv_value = GET_U_1(p);
1225 break;
1226 case 2:
1227 tlv_value = GET_LE_U_2(p);
1228 break;
1229 case 3:
1230 tlv_value = GET_LE_U_3(p);
1231 break;
1232 case 4:
1233 tlv_value = GET_LE_U_4(p);
1234 break;
1235 default:
1236 tlv_value = -1;
1237 break;
1238 }
1239 } else {
1240 /* TLVs >= 128 are big endian encoded */
1241 switch (tlv_len) {
1242 case 1:
1243 tlv_value = GET_U_1(p);
1244 break;
1245 case 2:
1246 tlv_value = GET_BE_U_2(p);
1247 break;
1248 case 3:
1249 tlv_value = GET_BE_U_3(p);
1250 break;
1251 case 4:
1252 tlv_value = GET_BE_U_4(p);
1253 break;
1254 default:
1255 tlv_value = -1;
1256 break;
1257 }
1258 }
1259 return tlv_value;
1260 }
1261
1262 static int
1263 juniper_parse_header(netdissect_options *ndo,
1264 const u_char *p, const struct pcap_pkthdr *h, struct juniper_l2info_t *l2info)
1265 {
1266 const struct juniper_cookie_table_t *lp;
1267 u_int idx, extension_length, jnx_header_len = 0;
1268 uint8_t tlv_type,tlv_len;
1269 #ifdef DLT_JUNIPER_ATM2
1270 uint32_t control_word;
1271 #endif
1272 int tlv_value;
1273 const u_char *tptr;
1274
1275
1276 l2info->header_len = 0;
1277 l2info->cookie_len = 0;
1278 l2info->proto = 0;
1279
1280
1281 l2info->length = h->len;
1282 l2info->caplen = h->caplen;
1283 l2info->flags = GET_U_1(p + 3);
1284 l2info->direction = GET_U_1(p + 3) & JUNIPER_BPF_PKT_IN;
1285
1286 if (GET_BE_U_3(p) != JUNIPER_MGC_NUMBER) { /* magic number found ? */
1287 ND_PRINT("no magic-number found!");
1288 return 0;
1289 }
1290
1291 if (ndo->ndo_eflag) /* print direction */
1292 ND_PRINT("%3s ", tok2str(juniper_direction_values, "---", l2info->direction));
1293
1294 /* magic number + flags */
1295 jnx_header_len = 4;
1296
1297 if (ndo->ndo_vflag > 1)
1298 ND_PRINT("\n\tJuniper PCAP Flags [%s]",
1299 bittok2str(jnx_flag_values, "none", l2info->flags));
1300
1301 /* extensions present ? - calculate how much bytes to skip */
1302 if ((l2info->flags & JUNIPER_BPF_EXT ) == JUNIPER_BPF_EXT ) {
1303
1304 tptr = p+jnx_header_len;
1305
1306 /* ok to read extension length ? */
1307 extension_length = GET_BE_U_2(tptr);
1308 jnx_header_len += 2;
1309 tptr +=2;
1310
1311 /* nail up the total length -
1312 * just in case something goes wrong
1313 * with TLV parsing */
1314 jnx_header_len += extension_length;
1315
1316 if (ndo->ndo_vflag > 1)
1317 ND_PRINT(", PCAP Extension(s) total length %u", extension_length);
1318
1319 ND_TCHECK_LEN(tptr, extension_length);
1320 while (extension_length > JUNIPER_EXT_TLV_OVERHEAD) {
1321 tlv_type = GET_U_1(tptr);
1322 tptr++;
1323 tlv_len = GET_U_1(tptr);
1324 tptr++;
1325 tlv_value = 0;
1326
1327 /* sanity checks */
1328 if (tlv_type == 0 || tlv_len == 0)
1329 break;
1330 ND_ICHECK_U(extension_length, <,
1331 tlv_len + JUNIPER_EXT_TLV_OVERHEAD);
1332
1333 if (ndo->ndo_vflag > 1)
1334 ND_PRINT("\n\t %s Extension TLV #%u, length %u, value ",
1335 tok2str(jnx_ext_tlv_values,"Unknown",tlv_type),
1336 tlv_type,
1337 tlv_len);
1338
1339 tlv_value = juniper_read_tlv_value(ndo, tptr, tlv_type, tlv_len);
1340 switch (tlv_type) {
1341 case JUNIPER_EXT_TLV_IFD_NAME:
1342 /* FIXME */
1343 break;
1344 case JUNIPER_EXT_TLV_IFD_MEDIATYPE:
1345 case JUNIPER_EXT_TLV_TTP_IFD_MEDIATYPE:
1346 if (tlv_value != -1) {
1347 if (ndo->ndo_vflag > 1)
1348 ND_PRINT("%s (%u)",
1349 tok2str(juniper_ifmt_values, "Unknown", tlv_value),
1350 tlv_value);
1351 }
1352 break;
1353 case JUNIPER_EXT_TLV_IFL_ENCAPS:
1354 case JUNIPER_EXT_TLV_TTP_IFL_ENCAPS:
1355 if (tlv_value != -1) {
1356 if (ndo->ndo_vflag > 1)
1357 ND_PRINT("%s (%u)",
1358 tok2str(juniper_ifle_values, "Unknown", tlv_value),
1359 tlv_value);
1360 }
1361 break;
1362 case JUNIPER_EXT_TLV_IFL_IDX: /* fall through */
1363 case JUNIPER_EXT_TLV_IFL_UNIT:
1364 case JUNIPER_EXT_TLV_IFD_IDX:
1365 default:
1366 if (tlv_value != -1) {
1367 if (ndo->ndo_vflag > 1)
1368 ND_PRINT("%u", tlv_value);
1369 }
1370 break;
1371 }
1372
1373 tptr+=tlv_len;
1374 extension_length -= tlv_len+JUNIPER_EXT_TLV_OVERHEAD;
1375 }
1376
1377 if (ndo->ndo_vflag > 1)
1378 ND_PRINT("\n\t-----original packet-----\n\t");
1379 }
1380
1381 if ((l2info->flags & JUNIPER_BPF_NO_L2 ) == JUNIPER_BPF_NO_L2 ) {
1382 if (ndo->ndo_eflag)
1383 ND_PRINT("no-L2-hdr, ");
1384
1385 /* there is no link-layer present -
1386 * perform the v4/v6 heuristics
1387 * to figure out what it is
1388 */
1389 ND_TCHECK_1(p + (jnx_header_len + 4));
1390 if (ip_heuristic_guess(ndo, p + jnx_header_len + 4,
1391 l2info->length - (jnx_header_len + 4)) == 0)
1392 ND_PRINT("no IP-hdr found!");
1393
1394 l2info->header_len=jnx_header_len+4;
1395 return 0; /* stop parsing the output further */
1396
1397 }
1398 l2info->header_len = jnx_header_len;
1399 p+=l2info->header_len;
1400 l2info->length -= l2info->header_len;
1401 l2info->caplen -= l2info->header_len;
1402
1403 /* search through the cookie table for one matching our PIC type */
1404 lp = NULL;
1405 for (const struct juniper_cookie_table_t *table_lp = juniper_cookie_table;
1406 table_lp->s != NULL; table_lp++) {
1407 if (table_lp->pictype == l2info->pictype) {
1408 lp = table_lp;
1409 break;
1410 }
1411 }
1412
1413 /* If we found one matching our PIC type, copy its values */
1414 if (lp != NULL) {
1415 l2info->cookie_len += lp->cookie_len;
1416
1417 switch (GET_U_1(p)) {
1418 case LS_COOKIE_ID:
1419 l2info->cookie_type = LS_COOKIE_ID;
1420 l2info->cookie_len += 2;
1421 break;
1422 case AS_COOKIE_ID:
1423 l2info->cookie_type = AS_COOKIE_ID;
1424 l2info->cookie_len = 8;
1425 break;
1426
1427 default:
1428 l2info->bundle = l2info->cookie[0];
1429 break;
1430 }
1431
1432
1433 #ifdef DLT_JUNIPER_MFR
1434 /* MFR child links don't carry cookies */
1435 if (l2info->pictype == DLT_JUNIPER_MFR &&
1436 (GET_U_1(p) & MFR_BE_MASK) == MFR_BE_MASK) {
1437 l2info->cookie_len = 0;
1438 }
1439 #endif
1440
1441 l2info->header_len += l2info->cookie_len;
1442 l2info->length -= l2info->cookie_len;
1443 l2info->caplen -= l2info->cookie_len;
1444
1445 if (ndo->ndo_eflag)
1446 ND_PRINT("%s-PIC, cookie-len %u",
1447 lp->s,
1448 l2info->cookie_len);
1449
1450 if (l2info->cookie_len > 8) {
1451 nd_print_invalid(ndo);
1452 return 0;
1453 }
1454
1455 if (l2info->cookie_len > 0) {
1456 ND_TCHECK_LEN(p, l2info->cookie_len);
1457 if (ndo->ndo_eflag)
1458 ND_PRINT(", cookie 0x");
1459 for (idx = 0; idx < l2info->cookie_len; idx++) {
1460 l2info->cookie[idx] = GET_U_1(p + idx); /* copy cookie data */
1461 if (ndo->ndo_eflag) ND_PRINT("%02x", GET_U_1(p + idx));
1462 }
1463 }
1464
1465 if (ndo->ndo_eflag) ND_PRINT(": "); /* print demarc b/w L2/L3*/
1466
1467
1468 l2info->proto = GET_BE_U_2(p + l2info->cookie_len);
1469 }
1470 p+=l2info->cookie_len;
1471
1472 /* DLT_ specific parsing */
1473 switch(l2info->pictype) {
1474 #ifdef DLT_JUNIPER_MLPPP
1475 case DLT_JUNIPER_MLPPP:
1476 switch (l2info->cookie_type) {
1477 case LS_COOKIE_ID:
1478 l2info->bundle = l2info->cookie[1];
1479 break;
1480 case AS_COOKIE_ID:
1481 /* use EXTRACT_, not GET_ (not packet buffer pointer) */
1482 l2info->bundle = (EXTRACT_BE_U_2(&l2info->cookie[6])>>3)&0xfff;
1483 l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK;
1484 break;
1485 default:
1486 l2info->bundle = l2info->cookie[0];
1487 break;
1488 }
1489 break;
1490 #endif
1491 #ifdef DLT_JUNIPER_MLFR
1492 case DLT_JUNIPER_MLFR:
1493 switch (l2info->cookie_type) {
1494 case LS_COOKIE_ID:
1495 l2info->bundle = l2info->cookie[1];
1496 l2info->proto = GET_BE_U_2(p);
1497 l2info->header_len += 2;
1498 l2info->length -= 2;
1499 l2info->caplen -= 2;
1500 break;
1501 case AS_COOKIE_ID:
1502 /* use EXTRACT_, not GET_ (not packet buffer pointer) */
1503 l2info->bundle = (EXTRACT_BE_U_2(&l2info->cookie[6])>>3)&0xfff;
1504 l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK;
1505 break;
1506 default:
1507 l2info->bundle = l2info->cookie[0];
1508 l2info->header_len += 2;
1509 l2info->length -= 2;
1510 l2info->caplen -= 2;
1511 break;
1512 }
1513 break;
1514 #endif
1515 #ifdef DLT_JUNIPER_MFR
1516 case DLT_JUNIPER_MFR:
1517 switch (l2info->cookie_type) {
1518 case LS_COOKIE_ID:
1519 l2info->bundle = l2info->cookie[1];
1520 l2info->proto = GET_BE_U_2(p);
1521 l2info->header_len += 2;
1522 l2info->length -= 2;
1523 l2info->caplen -= 2;
1524 break;
1525 case AS_COOKIE_ID:
1526 /* use EXTRACT_, not GET_ (not packet buffer pointer) */
1527 l2info->bundle = (EXTRACT_BE_U_2(&l2info->cookie[6])>>3)&0xfff;
1528 l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK;
1529 break;
1530 default:
1531 l2info->bundle = l2info->cookie[0];
1532 break;
1533 }
1534 break;
1535 #endif
1536 #ifdef DLT_JUNIPER_ATM2
1537 case DLT_JUNIPER_ATM2:
1538 ND_TCHECK_4(p);
1539 /* ATM cell relay control word present ? */
1540 if (l2info->cookie[7] & ATM2_PKT_TYPE_MASK) {
1541 control_word = GET_BE_U_4(p);
1542 /* some control word heuristics */
1543 switch(control_word) {
1544 case 0: /* zero control word */
1545 case 0x08000000: /* < JUNOS 7.4 control-word */
1546 case 0x08380000: /* cntl word plus cell length (56) >= JUNOS 7.4*/
1547 l2info->header_len += 4;
1548 break;
1549 default:
1550 break;
1551 }
1552
1553 if (ndo->ndo_eflag)
1554 ND_PRINT("control-word 0x%08x ", control_word);
1555 }
1556 break;
1557 #endif
1558 #ifdef DLT_JUNIPER_ES
1559 case DLT_JUNIPER_ES:
1560 break;
1561 #endif
1562 #ifdef DLT_JUNIPER_GGSN
1563 case DLT_JUNIPER_GGSN:
1564 break;
1565 #endif
1566 #ifdef DLT_JUNIPER_SERVICES
1567 case DLT_JUNIPER_SERVICES:
1568 break;
1569 #endif
1570 #ifdef DLT_JUNIPER_ATM1
1571 case DLT_JUNIPER_ATM1:
1572 break;
1573 #endif
1574 #ifdef DLT_JUNIPER_PPP
1575 case DLT_JUNIPER_PPP:
1576 break;
1577 #endif
1578 #ifdef DLT_JUNIPER_CHDLC
1579 case DLT_JUNIPER_CHDLC:
1580 break;
1581 #endif
1582 #ifdef DLT_JUNIPER_ETHER
1583 case DLT_JUNIPER_ETHER:
1584 break;
1585 #endif
1586 #ifdef DLT_JUNIPER_FRELAY
1587 case DLT_JUNIPER_FRELAY:
1588 break;
1589 #endif
1590 #ifdef DLT_JUNIPER_MONITOR
1591 case DLT_JUNIPER_MONITOR:
1592 break;
1593 #endif
1594 #ifdef DLT_JUNIPER_PPPOE
1595 case DLT_JUNIPER_PPPOE:
1596 break;
1597 #endif
1598 #ifdef DLT_JUNIPER_PPPOE_ATM
1599 case DLT_JUNIPER_PPPOE_ATM:
1600 break;
1601 #endif
1602
1603 default:
1604 ND_PRINT("Unknown Juniper DLT_ type %u: ", l2info->pictype);
1605 break;
1606 }
1607
1608 if (ndo->ndo_eflag)
1609 ND_PRINT("hlen %u, proto 0x%04x, ", l2info->header_len, l2info->proto);
1610
1611 return 1; /* everything went ok so far. continue parsing */
1612 invalid:
1613 nd_print_invalid(ndo);
1614 return 0;
1615 }
1616 #endif /* defined(DLT_JUNIPER_GGSN) || defined(DLT_JUNIPER_ES) || \
1617 defined(DLT_JUNIPER_MONITOR) || defined(DLT_JUNIPER_SERVICES) || \
1618 defined(DLT_JUNIPER_PPPOE) || defined(DLT_JUNIPER_ETHER) || \
1619 defined(DLT_JUNIPER_PPP) || defined(DLT_JUNIPER_FRELAY) || \
1620 defined(DLT_JUNIPER_CHDLC) || defined(DLT_JUNIPER_PPPOE_ATM) || \
1621 defined(DLT_JUNIPER_MLPPP) || defined(DLT_JUNIPER_MFR) || \
1622 defined(DLT_JUNIPER_MLFR) || defined(DLT_JUNIPER_ATM1) || \
1623 defined(DLT_JUNIPER_ATM2) */