2 * Routines for Juniper Networks, Inc. packet disassembly
3 * Copyright 2005 Hannes Gredler <hannes@juniper.net>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
14 #include <epan/packet.h>
15 #include <epan/expert.h>
16 #include <epan/addr_resolv.h>
17 #include <epan/ppptypes.h>
18 #include <epan/etypes.h>
19 #include <epan/ipproto.h>
21 #include <wsutil/array.h>
22 #include "packet-juniper.h"
23 #include <epan/nlpid.h>
25 void proto_register_juniper(void);
26 void proto_reg_handoff_juniper(void);
28 #define JUNIPER_FLAG_PKT_OUT 0x00 /* Outgoing packet */
29 #define JUNIPER_FLAG_PKT_IN 0x01 /* Incoming packet */
30 #define JUNIPER_FLAG_NO_L2 0x02 /* L2 header stripped */
31 #define JUNIPER_FLAG_EXT 0x80 /* extensions present */
32 #define EXT_TLV_HEADER_SIZE 2
33 #define JUNIPER_ATM2_PKT_TYPE_MASK 0x70
34 #define JUNIPER_ATM2_GAP_COUNT_MASK 0x3F
35 #define JUNIPER_PCAP_MAGIC 0x4d4743
37 #define JUNIPER_PIC_ATM1 1
38 #define JUNIPER_PIC_ATM2 2
39 #define JUNIPER_PIC_MLPPP 3
40 #define JUNIPER_PIC_MLFR 4
42 #define JUNIPER_HDR_SNAP 0xaaaa03
43 #define JUNIPER_HDR_NLPID 0xfefe03
44 #define JUNIPER_HDR_LLC_UI 0x03
45 #define JUNIPER_HDR_PPP 0xff03
47 #define ML_PIC_COOKIE_LEN 2
48 #define LS_PIC_COOKIE_LEN 4
49 #define AS_PIC_COOKIE_LEN 8
51 #define GSP_SVC_REQ_APOLLO 0x40
52 #define GSP_SVC_REQ_LSQ 0x47
54 #define LSQ_COOKIE_RE 0x2
55 #define LSQ_COOKIE_DIR 0x1
56 #define LSQ_L3_PROTO_SHIFT 4
57 #define LSQ_L3_PROTO_MASK 0xf0
58 #define LSQ_L3_PROTO_IPV4 (0 << LSQ_L3_PROTO_SHIFT)
59 #define LSQ_L3_PROTO_IPV6 (1 << LSQ_L3_PROTO_SHIFT)
60 #define LSQ_L3_PROTO_MPLS (2 << LSQ_L3_PROTO_SHIFT)
61 #define LSQ_L3_PROTO_ISO (3 << LSQ_L3_PROTO_SHIFT)
63 #define EXT_TLV_IFD_IDX 1
64 #define EXT_TLV_IFD_NAME 2
65 #define EXT_TLV_IFD_MEDIATYPE 3
66 #define EXT_TLV_IFL_IDX 4
67 #define EXT_TLV_IFL_UNIT 5
68 #define EXT_TLV_IFL_ENCAPS 6
69 #define EXT_TLV_TTP_IFD_MEDIATYPE 7
70 #define EXT_TLV_TTP_IFL_ENCAPS 8
72 /* VN related defines */
73 #define VN_TLV_HDR_SIZE 2
74 #define VN_FLAG_ALERT 0x00000002
75 #define VN_FLAG_DROP 0x00000004
76 #define VN_FLAG_DENY 0x00000008
77 #define VN_FLAG_LOG 0x00000010
78 #define VN_FLAG_PASS 0x00000020
79 #define VN_FLAG_REJECT 0x00000040
80 #define VN_FLAG_MIRROR 0x00000080
81 #define VN_FLAG_DIRECTION 0x40000000
82 #define VN_FLAG_MASK 0xFFFFFFFF
91 static const value_string ext_tlv_vals
[] = {
92 { EXT_TLV_IFD_IDX
, "Device Interface Index" },
93 { EXT_TLV_IFD_NAME
, "Device Interface Name" },
94 { EXT_TLV_IFD_MEDIATYPE
, "Device Media Type" },
95 { EXT_TLV_IFL_IDX
, "Logical Interface Index" },
96 { EXT_TLV_IFL_UNIT
, "Logical Unit Number" },
97 { EXT_TLV_IFL_ENCAPS
, "Logical Interface Encapsulation" },
98 { EXT_TLV_TTP_IFD_MEDIATYPE
, "TTP derived Device Media Type" },
99 { EXT_TLV_TTP_IFL_ENCAPS
, "TTP derived Logical Interface Encapsulation" },
103 static const value_string juniper_direction_vals
[] = {
104 {JUNIPER_FLAG_PKT_OUT
, "Out"},
105 {JUNIPER_FLAG_PKT_IN
, "In"},
109 static const value_string juniper_l2hdr_presence_vals
[] = {
115 #define JUNIPER_IFML_ETHER 1
116 #define JUNIPER_IFML_FDDI 2
117 #define JUNIPER_IFML_TOKENRING 3
118 #define JUNIPER_IFML_PPP 4
119 #define JUNIPER_IFML_FRAMERELAY 5
120 #define JUNIPER_IFML_CISCOHDLC 6
121 #define JUNIPER_IFML_SMDSDXI 7
122 #define JUNIPER_IFML_ATMPVC 8
123 #define JUNIPER_IFML_PPP_CCC 9
124 #define JUNIPER_IFML_FRAMERELAY_CCC 10
125 #define JUNIPER_IFML_IPIP 11
126 #define JUNIPER_IFML_GRE 12
127 #define JUNIPER_IFML_PIM 13
128 #define JUNIPER_IFML_PIMD 14
129 #define JUNIPER_IFML_CISCOHDLC_CCC 15
130 #define JUNIPER_IFML_VLAN_CCC 16
131 #define JUNIPER_IFML_MLPPP 17
132 #define JUNIPER_IFML_MLFR 18
133 #define JUNIPER_IFML_ML 19
134 #define JUNIPER_IFML_LSI 20
135 #define JUNIPER_IFML_DFE 21
136 #define JUNIPER_IFML_ATM_CELLRELAY_CCC 22
137 #define JUNIPER_IFML_CRYPTO 23
138 #define JUNIPER_IFML_GGSN 24
139 #define JUNIPER_IFML_LSI_PPP 25
140 #define JUNIPER_IFML_LSI_CISCOHDLC 26
141 #define JUNIPER_IFML_PPP_TCC 27
142 #define JUNIPER_IFML_FRAMERELAY_TCC 28
143 #define JUNIPER_IFML_CISCOHDLC_TCC 29
144 #define JUNIPER_IFML_ETHERNET_CCC 30
145 #define JUNIPER_IFML_VT 31
146 #define JUNIPER_IFML_EXTENDED_VLAN_CCC 32
147 #define JUNIPER_IFML_ETHER_OVER_ATM 33
148 #define JUNIPER_IFML_MONITOR 34
149 #define JUNIPER_IFML_ETHERNET_TCC 35
150 #define JUNIPER_IFML_VLAN_TCC 36
151 #define JUNIPER_IFML_EXTENDED_VLAN_TCC 37
152 #define JUNIPER_IFML_CONTROLLER 38
153 #define JUNIPER_IFML_MFR 39
154 #define JUNIPER_IFML_LS 40
155 #define JUNIPER_IFML_ETHERNET_VPLS 41
156 #define JUNIPER_IFML_ETHERNET_VLAN_VPLS 42
157 #define JUNIPER_IFML_ETHERNET_EXTENDED_VLAN_VPLS 43
158 #define JUNIPER_IFML_LT 44
159 #define JUNIPER_IFML_SERVICES 45
160 #define JUNIPER_IFML_ETHER_VPLS_OVER_ATM 46
161 #define JUNIPER_IFML_FR_PORT_CCC 47
162 #define JUNIPER_IFML_FRAMERELAY_EXT_CCC 48
163 #define JUNIPER_IFML_FRAMERELAY_EXT_TCC 49
164 #define JUNIPER_IFML_FRAMERELAY_FLEX 50
165 #define JUNIPER_IFML_GGSNI 51
166 #define JUNIPER_IFML_ETHERNET_FLEX 52
167 #define JUNIPER_IFML_COLLECTOR 53
168 #define JUNIPER_IFML_AGGREGATOR 54
169 #define JUNIPER_IFML_LAPD 55
170 #define JUNIPER_IFML_PPPOE 56
171 #define JUNIPER_IFML_PPP_SUBORDINATE 57
172 #define JUNIPER_IFML_CISCOHDLC_SUBORDINATE 58
173 #define JUNIPER_IFML_DFC 59
174 #define JUNIPER_IFML_PICPEER 60
176 static const value_string juniper_ifmt_vals
[] = {
177 { JUNIPER_IFML_ETHER
, "Ethernet" },
178 { JUNIPER_IFML_FDDI
, "FDDI" },
179 { JUNIPER_IFML_TOKENRING
, "Token-Ring" },
180 { JUNIPER_IFML_PPP
, "PPP" },
181 { JUNIPER_IFML_PPP_SUBORDINATE
, "PPP-Subordinate" },
182 { JUNIPER_IFML_FRAMERELAY
, "Frame-Relay" },
183 { JUNIPER_IFML_CISCOHDLC
, "Cisco-HDLC" },
184 { JUNIPER_IFML_SMDSDXI
, "SMDS-DXI" },
185 { JUNIPER_IFML_ATMPVC
, "ATM-PVC" },
186 { JUNIPER_IFML_PPP_CCC
, "PPP-CCC" },
187 { JUNIPER_IFML_FRAMERELAY_CCC
, "Frame-Relay-CCC" },
188 { JUNIPER_IFML_FRAMERELAY_EXT_CCC
, "Extended FR-CCC" },
189 { JUNIPER_IFML_IPIP
, "IP-over-IP" },
190 { JUNIPER_IFML_GRE
, "GRE" },
191 { JUNIPER_IFML_PIM
, "PIM-Encapsulator" },
192 { JUNIPER_IFML_PIMD
, "PIM-Decapsulator" },
193 { JUNIPER_IFML_CISCOHDLC_CCC
, "Cisco-HDLC-CCC" },
194 { JUNIPER_IFML_VLAN_CCC
, "VLAN-CCC" },
195 { JUNIPER_IFML_EXTENDED_VLAN_CCC
, "Extended-VLAN-CCC" },
196 { JUNIPER_IFML_MLPPP
, "Multilink-PPP" },
197 { JUNIPER_IFML_MLFR
, "Multilink-FR" },
198 { JUNIPER_IFML_MFR
, "Multilink-FR-UNI-NNI" },
199 { JUNIPER_IFML_ML
, "Multilink" },
200 { JUNIPER_IFML_LS
, "LinkService" },
201 { JUNIPER_IFML_LSI
, "LSI" },
202 { JUNIPER_IFML_ATM_CELLRELAY_CCC
, "ATM-CCC-Cell-Relay" },
203 { JUNIPER_IFML_CRYPTO
, "IPSEC-over-IP" },
204 { JUNIPER_IFML_GGSN
, "GGSN" },
205 { JUNIPER_IFML_PPP_TCC
, "PPP-TCC" },
206 { JUNIPER_IFML_FRAMERELAY_TCC
, "Frame-Relay-TCC" },
207 { JUNIPER_IFML_FRAMERELAY_EXT_TCC
, "Extended FR-TCC" },
208 { JUNIPER_IFML_CISCOHDLC_TCC
, "Cisco-HDLC-TCC" },
209 { JUNIPER_IFML_ETHERNET_CCC
, "Ethernet-CCC" },
210 { JUNIPER_IFML_VT
, "VPN-Loopback-tunnel" },
211 { JUNIPER_IFML_ETHER_OVER_ATM
, "Ethernet-over-ATM" },
212 { JUNIPER_IFML_ETHER_VPLS_OVER_ATM
, "Ethernet-VPLS-over-ATM" },
213 { JUNIPER_IFML_MONITOR
, "Monitor" },
214 { JUNIPER_IFML_ETHERNET_TCC
, "Ethernet-TCC" },
215 { JUNIPER_IFML_VLAN_TCC
, "VLAN-TCC" },
216 { JUNIPER_IFML_EXTENDED_VLAN_TCC
, "Extended-VLAN-TCC" },
217 { JUNIPER_IFML_CONTROLLER
, "Controller" },
218 { JUNIPER_IFML_ETHERNET_VPLS
, "VPLS" },
219 { JUNIPER_IFML_ETHERNET_VLAN_VPLS
, "VLAN-VPLS" },
220 { JUNIPER_IFML_ETHERNET_EXTENDED_VLAN_VPLS
, "Extended-VLAN-VPLS" },
221 { JUNIPER_IFML_LT
, "Logical-tunnel" },
222 { JUNIPER_IFML_SERVICES
, "General-Services" },
223 { JUNIPER_IFML_PPPOE
, "PPPoE" },
224 { JUNIPER_IFML_ETHERNET_FLEX
, "Flexible-Ethernet-Services" },
225 { JUNIPER_IFML_FRAMERELAY_FLEX
, "Flexible-FrameRelay" },
226 { JUNIPER_IFML_COLLECTOR
, "Flow-collection" },
227 { JUNIPER_IFML_PICPEER
, "PIC Peer" },
228 { JUNIPER_IFML_DFC
, "Dynamic-Flow-Capture" },
232 #define JUNIPER_IFLE_ATM_SNAP 2
233 #define JUNIPER_IFLE_ATM_NLPID 3
234 #define JUNIPER_IFLE_ATM_VCMUX 4
235 #define JUNIPER_IFLE_ATM_LLC 5
236 #define JUNIPER_IFLE_ATM_PPP_VCMUX 6
237 #define JUNIPER_IFLE_ATM_PPP_LLC 7
238 #define JUNIPER_IFLE_ATM_PPP_FUNI 8
239 #define JUNIPER_IFLE_ATM_CCC 9
240 #define JUNIPER_IFLE_FR_NLPID 10
241 #define JUNIPER_IFLE_FR_SNAP 11
242 #define JUNIPER_IFLE_FR_PPP 12
243 #define JUNIPER_IFLE_FR_CCC 13
244 #define JUNIPER_IFLE_ENET2 14
245 #define JUNIPER_IFLE_IEEE8023_SNAP 15
246 #define JUNIPER_IFLE_IEEE8023_LLC 16
247 #define JUNIPER_IFLE_PPP 17
248 #define JUNIPER_IFLE_CISCOHDLC 18
249 #define JUNIPER_IFLE_PPP_CCC 19
250 #define JUNIPER_IFLE_IPIP_NULL 20
251 #define JUNIPER_IFLE_PIM_NULL 21
252 #define JUNIPER_IFLE_GRE_NULL 22
253 #define JUNIPER_IFLE_GRE_PPP 23
254 #define JUNIPER_IFLE_PIMD_DECAPS 24
255 #define JUNIPER_IFLE_CISCOHDLC_CCC 25
256 #define JUNIPER_IFLE_ATM_CISCO_NLPID 26
257 #define JUNIPER_IFLE_VLAN_CCC 27
258 #define JUNIPER_IFLE_MLPPP 28
259 #define JUNIPER_IFLE_MLFR 29
260 #define JUNIPER_IFLE_LSI_NULL 30
261 #define JUNIPER_IFLE_AGGREGATE_UNUSED 31
262 #define JUNIPER_IFLE_ATM_CELLRELAY_CCC 32
263 #define JUNIPER_IFLE_CRYPTO 33
264 #define JUNIPER_IFLE_GGSN 34
265 #define JUNIPER_IFLE_ATM_TCC 35
266 #define JUNIPER_IFLE_FR_TCC 36
267 #define JUNIPER_IFLE_PPP_TCC 37
268 #define JUNIPER_IFLE_CISCOHDLC_TCC 38
269 #define JUNIPER_IFLE_ETHERNET_CCC 39
270 #define JUNIPER_IFLE_VT 40
271 #define JUNIPER_IFLE_ATM_EOA_LLC 41
272 #define JUNIPER_IFLE_EXTENDED_VLAN_CCC 42
273 #define JUNIPER_IFLE_ATM_SNAP_TCC 43
274 #define JUNIPER_IFLE_MONITOR 44
275 #define JUNIPER_IFLE_ETHERNET_TCC 45
276 #define JUNIPER_IFLE_VLAN_TCC 46
277 #define JUNIPER_IFLE_EXTENDED_VLAN_TCC 47
278 #define JUNIPER_IFLE_MFR 48
279 #define JUNIPER_IFLE_ETHERNET_VPLS 49
280 #define JUNIPER_IFLE_ETHERNET_VLAN_VPLS 50
281 #define JUNIPER_IFLE_ETHERNET_EXTENDED_VLAN_VPLS 51
282 #define JUNIPER_IFLE_SERVICES 52
283 #define JUNIPER_IFLE_ATM_ETHER_VPLS_ATM_LLC 53
284 #define JUNIPER_IFLE_FR_PORT_CCC 54
285 #define JUNIPER_IFLE_ATM_MLPPP_LLC 55
286 #define JUNIPER_IFLE_ATM_EOA_CCC 56
287 #define JUNIPER_IFLE_LT_VLAN 57
288 #define JUNIPER_IFLE_COLLECTOR 58
289 #define JUNIPER_IFLE_AGGREGATOR 59
290 #define JUNIPER_IFLE_LAPD 60
291 #define JUNIPER_IFLE_ATM_PPPOE_LLC 61
292 #define JUNIPER_IFLE_ETHERNET_PPPOE 62
293 #define JUNIPER_IFLE_PPPOE 63
294 #define JUNIPER_IFLE_PPP_SUBORDINATE 64
295 #define JUNIPER_IFLE_CISCOHDLC_SUBORDINATE 65
296 #define JUNIPER_IFLE_DFC 66
297 #define JUNIPER_IFLE_PICPEER 67
299 static const value_string juniper_ifle_vals
[] = {
300 { JUNIPER_IFLE_AGGREGATOR
, "Aggregator" },
301 { JUNIPER_IFLE_ATM_CCC
, "CCC over ATM" },
302 { JUNIPER_IFLE_ATM_CELLRELAY_CCC
, "ATM CCC Cell Relay" },
303 { JUNIPER_IFLE_ATM_CISCO_NLPID
, "CISCO compatible NLPID" },
304 { JUNIPER_IFLE_ATM_EOA_CCC
, "Ethernet over ATM CCC" },
305 { JUNIPER_IFLE_ATM_EOA_LLC
, "Ethernet over ATM LLC" },
306 { JUNIPER_IFLE_ATM_ETHER_VPLS_ATM_LLC
, "Ethernet VPLS over ATM LLC" },
307 { JUNIPER_IFLE_ATM_LLC
, "ATM LLC" },
308 { JUNIPER_IFLE_ATM_MLPPP_LLC
, "MLPPP over ATM LLC" },
309 { JUNIPER_IFLE_ATM_NLPID
, "ATM NLPID" },
310 { JUNIPER_IFLE_ATM_PPPOE_LLC
, "PPPoE over ATM LLC" },
311 { JUNIPER_IFLE_ATM_PPP_FUNI
, "PPP over FUNI" },
312 { JUNIPER_IFLE_ATM_PPP_LLC
, "PPP over ATM LLC" },
313 { JUNIPER_IFLE_ATM_PPP_VCMUX
, "PPP over ATM VCMUX" },
314 { JUNIPER_IFLE_ATM_SNAP
, "ATM SNAP" },
315 { JUNIPER_IFLE_ATM_SNAP_TCC
, "ATM SNAP TCC" },
316 { JUNIPER_IFLE_ATM_TCC
, "ATM VCMUX TCC" },
317 { JUNIPER_IFLE_ATM_VCMUX
, "ATM VCMUX" },
318 { JUNIPER_IFLE_CISCOHDLC
, "C-HDLC" },
319 { JUNIPER_IFLE_CISCOHDLC_CCC
, "C-HDLC CCC" },
320 { JUNIPER_IFLE_CISCOHDLC_SUBORDINATE
, "C-HDLC via dialer" },
321 { JUNIPER_IFLE_CISCOHDLC_TCC
, "C-HDLC TCC" },
322 { JUNIPER_IFLE_COLLECTOR
, "Collector" },
323 { JUNIPER_IFLE_CRYPTO
, "Crypto" },
324 { JUNIPER_IFLE_ENET2
, "Ethernet" },
325 { JUNIPER_IFLE_ETHERNET_CCC
, "Ethernet CCC" },
326 { JUNIPER_IFLE_ETHERNET_EXTENDED_VLAN_VPLS
, "Extended VLAN VPLS" },
327 { JUNIPER_IFLE_ETHERNET_PPPOE
, "PPPoE over Ethernet" },
328 { JUNIPER_IFLE_ETHERNET_TCC
, "Ethernet TCC" },
329 { JUNIPER_IFLE_ETHERNET_VLAN_VPLS
, "VLAN VPLS" },
330 { JUNIPER_IFLE_ETHERNET_VPLS
, "VPLS" },
331 { JUNIPER_IFLE_EXTENDED_VLAN_CCC
, "Extended VLAN CCC" },
332 { JUNIPER_IFLE_EXTENDED_VLAN_TCC
, "Extended VLAN TCC" },
333 { JUNIPER_IFLE_FR_CCC
, "FR CCC" },
334 { JUNIPER_IFLE_FR_NLPID
, "FR NLPID" },
335 { JUNIPER_IFLE_FR_PORT_CCC
, "FR Port CCC" },
336 { JUNIPER_IFLE_FR_PPP
, "FR PPP" },
337 { JUNIPER_IFLE_FR_SNAP
, "FR SNAP" },
338 { JUNIPER_IFLE_FR_TCC
, "FR TCC" },
339 { JUNIPER_IFLE_GGSN
, "GGSN" },
340 { JUNIPER_IFLE_GRE_NULL
, "GRE NULL" },
341 { JUNIPER_IFLE_GRE_PPP
, "PPP over GRE" },
342 { JUNIPER_IFLE_IPIP_NULL
, "IPIP" },
343 { JUNIPER_IFLE_LAPD
, "LAPD" },
344 { JUNIPER_IFLE_LSI_NULL
, "LSI Null" },
345 { JUNIPER_IFLE_LT_VLAN
, "LT VLAN" },
346 { JUNIPER_IFLE_MFR
, "MFR" },
347 { JUNIPER_IFLE_MLFR
, "MLFR" },
348 { JUNIPER_IFLE_MLPPP
, "MLPPP" },
349 { JUNIPER_IFLE_MONITOR
, "Monitor" },
350 { JUNIPER_IFLE_PIMD_DECAPS
, "PIMd" },
351 { JUNIPER_IFLE_PIM_NULL
, "PIM Null" },
352 { JUNIPER_IFLE_PPP
, "PPP" },
353 { JUNIPER_IFLE_PPPOE
, "PPPoE" },
354 { JUNIPER_IFLE_PPP_CCC
, "PPP CCC" },
355 { JUNIPER_IFLE_PPP_SUBORDINATE
, "" },
356 { JUNIPER_IFLE_PPP_TCC
, "PPP TCC" },
357 { JUNIPER_IFLE_SERVICES
, "General Services" },
358 { JUNIPER_IFLE_VLAN_CCC
, "VLAN CCC" },
359 { JUNIPER_IFLE_VLAN_TCC
, "VLAN TCC" },
360 { JUNIPER_IFLE_VT
, "VT" },
365 static int proto_juniper
;
367 static int hf_juniper_magic
;
368 static int hf_juniper_direction
;
369 static int hf_juniper_l2hdr_presence
;
370 static int hf_juniper_ext_total_len
;
371 static int hf_juniper_cookie_len
;
372 static int hf_juniper_atm1_cookie
;
373 static int hf_juniper_atm2_cookie
;
374 static int hf_juniper_mlpic_cookie
;
375 static int hf_juniper_lspic_cookie
;
376 static int hf_juniper_aspic_cookie
;
377 static int hf_juniper_vlan
;
378 static int hf_juniper_proto
;
379 static int hf_juniper_payload_type
;
380 static int hf_juniper_encap_type
;
381 static int hf_juniper_ext_ifd
;
382 static int hf_juniper_ext_ifl
;
383 static int hf_juniper_ext_unit
;
384 static int hf_juniper_ext_ifmt
;
385 static int hf_juniper_ext_ifle
;
386 static int hf_juniper_ext_ttp_ifmt
;
387 static int hf_juniper_ext_ttp_ifle
;
388 static int hf_juniper_unknown_data
;
390 static expert_field ei_juniper_no_magic
;
391 static expert_field ei_juniper_vn_incorrect_format
;
393 static int hf_juniper_vn_host_ip
;
394 static int hf_juniper_vn_src
;
395 static int hf_juniper_vn_dst
;
396 static int hf_juniper_vn_flags
;
397 static int hf_juniper_vn_flag_alert
;
398 static int hf_juniper_vn_flag_drop
;
399 static int hf_juniper_vn_flag_deny
;
400 static int hf_juniper_vn_flag_log
;
401 static int hf_juniper_vn_flag_pass
;
402 static int hf_juniper_vn_flag_reject
;
403 static int hf_juniper_vn_flag_mirror
;
404 static int hf_juniper_vn_flag_direction
;
406 static int hf_juniper_st_eth_dst
;
407 static int hf_juniper_st_eth_src
;
408 static int hf_juniper_st_eth_type
;
409 static int hf_juniper_st_ip_len
;
410 static int hf_juniper_st_ip_proto
;
411 static int hf_juniper_st_esp_spi
;
412 static int hf_juniper_st_esp_seq
;
414 static int ett_juniper
;
415 static int ett_juniper_vn_flags
;
416 static int ett_juniper_st_eth
;
417 static int ett_juniper_st_ip
;
418 static int ett_juniper_st_esp
;
419 static int ett_juniper_st_unknown
;
421 static dissector_table_t payload_table
;
423 static int dissect_juniper_payload_proto(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, proto_tree
*juniper_subtree
, unsigned proto
, unsigned offset
);
424 static void dissect_juniper_atm(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, uint16_t atm_pictype
);
425 static bool ppp_heuristic_guess(uint16_t proto
);
426 static unsigned ip_heuristic_guess(uint8_t ip_header_byte
);
427 static unsigned juniper_svc_cookie_len (uint64_t cookie
);
428 static unsigned juniper_svc_cookie_proto (uint64_t cookie
, uint16_t pictype
, uint8_t flags
);
430 static const value_string juniper_proto_vals
[] = {
431 {JUNIPER_PROTO_IP
, "IPv4"},
432 {JUNIPER_PROTO_MPLS_IP
, "MPLS->IPv4"},
433 {JUNIPER_PROTO_IP_MPLS
, "IPv4->MPLS"},
434 {JUNIPER_PROTO_IP6
, "IPv6"},
435 {JUNIPER_PROTO_MPLS_IP6
, "MPLS->IPv6"},
436 {JUNIPER_PROTO_IP6_MPLS
, "IPv6->MPLS"},
437 {JUNIPER_PROTO_PPP
, "PPP"},
438 {JUNIPER_PROTO_CLNP
, "CLNP"},
439 {JUNIPER_PROTO_MPLS_CLNP
, "MPLS->CLNP"},
440 {JUNIPER_PROTO_CLNP_MPLS
, "CLNP->MPLS"},
441 {JUNIPER_PROTO_ISO
, "OSI"},
442 {JUNIPER_PROTO_MPLS
, "MPLS"},
443 {JUNIPER_PROTO_LLC
, "LLC"},
444 {JUNIPER_PROTO_LLC_SNAP
, "LLC/SNAP"},
445 {JUNIPER_PROTO_ETHER
, "Ethernet"},
446 {JUNIPER_PROTO_OAM
, "ATM OAM Cell"},
447 {JUNIPER_PROTO_Q933
, "Q.933"},
448 {JUNIPER_PROTO_FRELAY
, "Frame-Relay"},
449 {JUNIPER_PROTO_CHDLC
, "C-HDLC"},
453 static int * const vn_flags
[] = {
454 &hf_juniper_vn_flag_direction
,
455 &hf_juniper_vn_flag_mirror
,
456 &hf_juniper_vn_flag_reject
,
457 &hf_juniper_vn_flag_pass
,
458 &hf_juniper_vn_flag_log
,
459 &hf_juniper_vn_flag_deny
,
460 &hf_juniper_vn_flag_drop
,
461 &hf_juniper_vn_flag_alert
,
465 /* return a TLV value based on TLV length and TLV type (host/network order) */
467 juniper_ext_get_tlv_value(tvbuff_t
*tvb
, unsigned tlv_type
, unsigned tlv_len
, unsigned offset
) {
471 if (tlv_type
< 128) {
472 /* TLVs < 128 are little-endian / host order encoded */
475 tlv_value
= tvb_get_uint8(tvb
, offset
);
478 tlv_value
= tvb_get_letohs(tvb
, offset
);
481 tlv_value
= tvb_get_letoh24(tvb
, offset
);
484 tlv_value
= tvb_get_letohl(tvb
, offset
);
491 /* TLVs >= 128 are big-endian / network order encoded */
494 tlv_value
= tvb_get_uint8(tvb
, offset
);
497 tlv_value
= tvb_get_ntohs(tvb
, offset
);
500 tlv_value
= tvb_get_ntoh24(tvb
, offset
);
503 tlv_value
= tvb_get_ntohl(tvb
, offset
);
513 /* generic juniper header dissector */
515 dissect_juniper_header(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, proto_tree
*juniper_subtree
, uint8_t *flags
)
517 proto_item
*tisub
, *magic_item
;
518 uint8_t proto
,ext_type
,ext_len
;
519 uint16_t ext_total_len
,ext_offset
=6,hdr_len
;
520 uint32_t magic_number
,ext_val
;
522 proto_tree
*juniper_ext_subtree
= NULL
, *juniper_ext_subtree_item
= NULL
;
524 magic_number
= tvb_get_ntoh24(tvb
, 0);
525 *flags
= tvb_get_uint8(tvb
, 3);
527 magic_item
= proto_tree_add_item(juniper_subtree
, hf_juniper_magic
, tvb
, 0, 3, ENC_BIG_ENDIAN
);
529 /* be liberal with magic-number detection -
530 * some older JUNOS releases (e.g. 6.4),
531 * which are still in the field do not generate magic-numbers */
532 if (magic_number
!= JUNIPER_PCAP_MAGIC
) {
533 expert_add_info(pinfo
, magic_item
, &ei_juniper_no_magic
);
537 proto_tree_add_item(juniper_subtree
, hf_juniper_direction
, tvb
, 3, 1, ENC_NA
);
539 proto_tree_add_item(juniper_subtree
, hf_juniper_l2hdr_presence
, tvb
, 3, 1, ENC_NA
);
541 /* calculate hdr_len before cookie, payload */
543 /* meta-info extensions (JUNOS >= 7.5) ? */
544 if ((*flags
& JUNIPER_FLAG_EXT
) == JUNIPER_FLAG_EXT
) {
545 ext_total_len
= tvb_get_ntohs(tvb
,4);
546 hdr_len
= 6 + ext_total_len
; /* MGC,flags,ext_total_len */
548 tisub
= proto_tree_add_uint (juniper_subtree
, hf_juniper_ext_total_len
, tvb
, 4, 2, ext_total_len
);
549 juniper_ext_subtree
= proto_item_add_subtree(tisub
, ett_juniper
);
551 while (ext_total_len
> EXT_TLV_HEADER_SIZE
) {
552 ext_type
= tvb_get_uint8(tvb
, ext_offset
);
553 ext_len
= tvb_get_uint8(tvb
, ext_offset
+1);
555 if (ext_len
== 0 || ext_len
> (ext_total_len
- EXT_TLV_HEADER_SIZE
)) /* a few sanity checks */
558 juniper_ext_subtree_item
= proto_tree_add_subtree_format(juniper_ext_subtree
, tvb
, ext_offset
, EXT_TLV_HEADER_SIZE
+ ext_len
,
559 ett_juniper
, &tisub
, "%s Extension TLV #%u, length: %u",
560 val_to_str_const(ext_type
, ext_tlv_vals
, "Unknown"),
564 ext_val
= juniper_ext_get_tlv_value(tvb
, ext_type
, ext_len
, ext_offset
+EXT_TLV_HEADER_SIZE
);
567 case EXT_TLV_IFD_MEDIATYPE
:
568 proto_tree_add_uint(juniper_ext_subtree_item
, hf_juniper_ext_ifmt
,
569 tvb
, ext_offset
+EXT_TLV_HEADER_SIZE
, ext_len
, ext_val
);
571 case EXT_TLV_TTP_IFD_MEDIATYPE
:
572 proto_tree_add_uint(juniper_ext_subtree_item
, hf_juniper_ext_ttp_ifmt
,
573 tvb
, ext_offset
+EXT_TLV_HEADER_SIZE
, ext_len
, ext_val
);
575 case EXT_TLV_IFL_ENCAPS
:
576 proto_tree_add_uint(juniper_ext_subtree_item
, hf_juniper_ext_ifle
,
577 tvb
, ext_offset
+EXT_TLV_HEADER_SIZE
, ext_len
, ext_val
);
579 case EXT_TLV_TTP_IFL_ENCAPS
:
580 proto_tree_add_uint(juniper_ext_subtree_item
, hf_juniper_ext_ttp_ifle
,
581 tvb
, ext_offset
+EXT_TLV_HEADER_SIZE
, ext_len
, ext_val
);
584 case EXT_TLV_IFL_IDX
:
585 proto_tree_add_uint(juniper_ext_subtree_item
, hf_juniper_ext_ifl
,
586 tvb
, ext_offset
+EXT_TLV_HEADER_SIZE
, ext_len
, ext_val
);
589 case EXT_TLV_IFL_UNIT
:
590 proto_tree_add_uint(juniper_ext_subtree_item
, hf_juniper_ext_unit
,
591 tvb
, ext_offset
+EXT_TLV_HEADER_SIZE
, ext_len
, ext_val
);
593 case EXT_TLV_IFD_IDX
:
594 proto_tree_add_uint(juniper_ext_subtree_item
, hf_juniper_ext_ifd
,
595 tvb
, ext_offset
+EXT_TLV_HEADER_SIZE
, ext_len
, ext_val
);
597 case EXT_TLV_IFD_NAME
: /* FIXME print ifname string - lets fall-through for now */
599 proto_item_append_text(tisub
, "Unknown");
603 ext_offset
+= EXT_TLV_HEADER_SIZE
+ ext_len
;
604 ext_total_len
-= EXT_TLV_HEADER_SIZE
+ ext_len
;
608 hdr_len
= 4; /* MGC,flags */
610 if ((*flags
& JUNIPER_FLAG_NO_L2
) == JUNIPER_FLAG_NO_L2
) { /* no link header present ? */
611 proto
= tvb_get_letohl(tvb
,hdr_len
); /* proto is stored in host-order */
612 dissect_juniper_payload_proto(tvb
, pinfo
, tree
, juniper_subtree
, proto
, hdr_len
+ 4);
616 return hdr_len
; /* bytes parsed */
620 /* print the payload protocol */
622 dissect_juniper_payload_proto(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
623 proto_tree
*juniper_subtree
, unsigned proto
, unsigned offset
)
628 ti
= proto_tree_add_uint(juniper_subtree
, hf_juniper_payload_type
, tvb
, offset
, 0, proto
);
629 proto_item_set_generated(ti
);
633 /* XXX - 0xa248 stands for ??? */
635 proto_tree_add_item(juniper_subtree
, hf_juniper_unknown_data
, tvb
, offset
, 4, ENC_NA
);
637 proto
= JUNIPER_PROTO_IP
;
644 proto_item_set_len(juniper_subtree
, offset
);
645 next_tvb
= tvb_new_subset_remaining(tvb
, offset
);
647 if (!dissector_try_uint(payload_table
, proto
, next_tvb
, pinfo
, tree
))
649 /* XXX - left in for posterity, dissection was never done */
650 /* case JUNIPER_PROTO_OAM: FIXME call OAM dissector without leading HEC byte */
652 call_data_dissector(next_tvb
, pinfo
, tree
);
660 dissect_juniper_mlfr(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
663 proto_tree
* juniper_subtree
;
667 uint64_t aspic_cookie
;
668 uint32_t lspic_cookie
;
669 uint16_t mlpic_cookie
;
670 unsigned proto
,cookie_len
;
672 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "Juniper MLFR");
673 col_clear(pinfo
->cinfo
, COL_INFO
);
677 juniper_subtree
= proto_tree_add_subtree(tree
, tvb
, offset
, 4, ett_juniper
, NULL
, "Juniper Multi-Link Frame-Relay (FRF.15)");
679 /* parse header, match mgc, extract flags and build first tree */
680 bytes_processed
= dissect_juniper_header(tvb
, pinfo
, tree
, juniper_subtree
, &flags
);
682 if(bytes_processed
== -1)
685 offset
+=bytes_processed
;
687 aspic_cookie
= tvb_get_ntoh64(tvb
,offset
);
688 proto
= juniper_svc_cookie_proto(aspic_cookie
, JUNIPER_PIC_MLFR
, flags
);
689 cookie_len
= juniper_svc_cookie_len(aspic_cookie
);
691 if (cookie_len
== AS_PIC_COOKIE_LEN
)
692 proto_tree_add_uint64(juniper_subtree
, hf_juniper_aspic_cookie
,
693 tvb
, offset
, AS_PIC_COOKIE_LEN
, aspic_cookie
);
694 if (cookie_len
== LS_PIC_COOKIE_LEN
) {
695 lspic_cookie
= tvb_get_ntohl(tvb
,offset
);
696 proto_tree_add_uint(juniper_subtree
, hf_juniper_lspic_cookie
,
697 tvb
, offset
, LS_PIC_COOKIE_LEN
, lspic_cookie
);
700 offset
+= cookie_len
;
702 mlpic_cookie
= tvb_get_ntohs(tvb
, offset
);
705 if (cookie_len
== AS_PIC_COOKIE_LEN
&&
706 proto
== JUNIPER_PROTO_UNKNOWN
&&
707 tvb_get_uint8(tvb
,offset
) == JUNIPER_HDR_LLC_UI
) {
709 proto
= JUNIPER_PROTO_ISO
;
713 if (cookie_len
== LS_PIC_COOKIE_LEN
) {
714 if ( tvb_get_ntohs(tvb
,offset
) == JUNIPER_HDR_LLC_UI
||
715 tvb_get_ntohs(tvb
,offset
) == (JUNIPER_HDR_LLC_UI
<<8)) {
721 if (cookie_len
== LS_PIC_COOKIE_LEN
&& tvb_get_uint8(tvb
,offset
) == JUNIPER_HDR_LLC_UI
) {
725 /* child link of an LS-PIC bundle ? */
726 if (cookie_len
== 0 && tvb_get_ntohs(tvb
,offset
+ML_PIC_COOKIE_LEN
) ==
727 (JUNIPER_HDR_LLC_UI
<<8 | NLPID_Q_933
)) {
728 cookie_len
= ML_PIC_COOKIE_LEN
;
729 proto_tree_add_uint(juniper_subtree
, hf_juniper_mlpic_cookie
,
730 tvb
, offset
, ML_PIC_COOKIE_LEN
, mlpic_cookie
);
732 proto
= JUNIPER_PROTO_Q933
;
735 /* child link of an ML-, LS-, AS-PIC bundle / ML-PIC bundle ? */
736 if (cookie_len
== 0) {
737 if (tvb_get_ntohs(tvb
,offset
+ML_PIC_COOKIE_LEN
) == JUNIPER_HDR_LLC_UI
||
738 tvb_get_ntohs(tvb
,offset
+ML_PIC_COOKIE_LEN
) == (JUNIPER_HDR_LLC_UI
<<8)) {
739 cookie_len
= ML_PIC_COOKIE_LEN
;
740 proto_tree_add_uint(juniper_subtree
, hf_juniper_mlpic_cookie
,
741 tvb
, offset
, ML_PIC_COOKIE_LEN
, mlpic_cookie
);
743 proto
= JUNIPER_PROTO_ISO
;
747 /* ML-PIC bundle ? */
748 if (cookie_len
== 0 && tvb_get_uint8(tvb
,offset
+ML_PIC_COOKIE_LEN
) == JUNIPER_HDR_LLC_UI
) {
749 cookie_len
= ML_PIC_COOKIE_LEN
;
750 proto_tree_add_uint(juniper_subtree
, hf_juniper_mlpic_cookie
,
751 tvb
, offset
, ML_PIC_COOKIE_LEN
, mlpic_cookie
);
753 proto
= JUNIPER_PROTO_ISO
;
756 ti
= proto_tree_add_uint(juniper_subtree
, hf_juniper_cookie_len
, tvb
, offset
, 0, cookie_len
);
757 proto_item_set_generated(ti
);
759 dissect_juniper_payload_proto(tvb
, pinfo
, tree
, juniper_subtree
, proto
, offset
);
761 return tvb_captured_length(tvb
);
766 /* MLPPP dissector */
768 dissect_juniper_mlppp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
771 proto_tree
* juniper_subtree
;
775 uint64_t aspic_cookie
;
776 uint32_t lspic_cookie
;
777 uint16_t mlpic_cookie
;
778 unsigned proto
,cookie_len
;
780 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "Juniper MLPPP");
781 col_clear(pinfo
->cinfo
, COL_INFO
);
785 juniper_subtree
= proto_tree_add_subtree(tree
, tvb
, offset
, 4, ett_juniper
, NULL
, "Juniper MLPPP");
787 /* parse header, match mgc, extract flags and build first tree */
788 bytes_processed
= dissect_juniper_header(tvb
, pinfo
, tree
, juniper_subtree
, &flags
);
790 if(bytes_processed
== -1)
793 offset
+=bytes_processed
;
795 aspic_cookie
= tvb_get_ntoh64(tvb
,offset
);
796 proto
= juniper_svc_cookie_proto(aspic_cookie
, JUNIPER_PIC_MLPPP
, flags
);
797 cookie_len
= juniper_svc_cookie_len(aspic_cookie
);
799 if (cookie_len
== AS_PIC_COOKIE_LEN
)
800 proto_tree_add_uint64(juniper_subtree
, hf_juniper_aspic_cookie
,
801 tvb
, offset
, AS_PIC_COOKIE_LEN
, aspic_cookie
);
802 if (cookie_len
== LS_PIC_COOKIE_LEN
) {
803 lspic_cookie
= tvb_get_ntohl(tvb
,offset
);
804 proto_tree_add_uint(juniper_subtree
, hf_juniper_lspic_cookie
,
805 tvb
, offset
, LS_PIC_COOKIE_LEN
, lspic_cookie
);
808 /* no cookie pattern identified - lets guess from now on */
810 /* child link of an LS-PIC bundle ? */
811 if (cookie_len
== 0 && tvb_get_ntohs(tvb
, offset
) == JUNIPER_HDR_PPP
) {
812 proto
= JUNIPER_PROTO_PPP
;
817 if (cookie_len
== 0 && ppp_heuristic_guess(tvb_get_ntohs(tvb
, offset
+2))) {
818 proto
= JUNIPER_PROTO_PPP
;
820 mlpic_cookie
= tvb_get_ntohs(tvb
, offset
);
821 proto_tree_add_uint(juniper_subtree
, hf_juniper_mlpic_cookie
,
822 tvb
, offset
, ML_PIC_COOKIE_LEN
, mlpic_cookie
);
825 /* child link of an ML-PIC bundle ? */
826 if (cookie_len
== 0 && ppp_heuristic_guess(tvb_get_ntohs(tvb
, offset
))) {
827 proto
= JUNIPER_PROTO_PPP
;
830 ti
= proto_tree_add_uint(juniper_subtree
, hf_juniper_cookie_len
, tvb
, offset
, 0, cookie_len
);
831 proto_item_set_generated(ti
);
832 offset
+= cookie_len
;
834 dissect_juniper_payload_proto(tvb
, pinfo
, tree
, juniper_subtree
, proto
, offset
);
836 return tvb_captured_length(tvb
);
840 /* PPPoE dissector */
842 dissect_juniper_pppoe(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
844 proto_tree
* juniper_subtree
;
849 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "Juniper PPPoE");
850 col_clear(pinfo
->cinfo
, COL_INFO
);
854 juniper_subtree
= proto_tree_add_subtree(tree
, tvb
, offset
, 4, ett_juniper
, NULL
, "Juniper PPPoE PIC");
856 /* parse header, match mgc, extract flags and build first tree */
857 bytes_processed
= dissect_juniper_header(tvb
, pinfo
, tree
, juniper_subtree
, &flags
);
859 if(bytes_processed
== -1)
862 offset
+=bytes_processed
;
864 dissect_juniper_payload_proto(tvb
, pinfo
, tree
, juniper_subtree
, JUNIPER_PROTO_ETHER
, offset
);
866 return tvb_captured_length(tvb
);
869 /* Ethernet dissector */
871 dissect_juniper_ether(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
873 proto_tree
* juniper_subtree
;
878 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "Juniper Ethernet");
879 col_clear(pinfo
->cinfo
, COL_INFO
);
883 juniper_subtree
= proto_tree_add_subtree(tree
, tvb
, offset
, 4, ett_juniper
, NULL
, "Juniper Ethernet");
885 /* parse header, match mgc, extract flags and build first tree */
886 bytes_processed
= dissect_juniper_header(tvb
, pinfo
, tree
, juniper_subtree
, &flags
);
888 if(bytes_processed
== -1)
891 offset
+=bytes_processed
;
893 dissect_juniper_payload_proto(tvb
, pinfo
, tree
, juniper_subtree
, JUNIPER_PROTO_ETHER
, offset
);
895 return tvb_captured_length(tvb
);
900 dissect_juniper_ppp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
902 proto_tree
* juniper_subtree
;
907 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "Juniper PPP");
908 col_clear(pinfo
->cinfo
, COL_INFO
);
912 juniper_subtree
= proto_tree_add_subtree(tree
, tvb
, offset
, 4, ett_juniper
, NULL
, "Juniper PPP");
914 /* parse header, match mgc, extract flags and build first tree */
915 bytes_processed
= dissect_juniper_header(tvb
, pinfo
, tree
, juniper_subtree
, &flags
);
917 if(bytes_processed
== -1)
920 offset
+=bytes_processed
;
922 dissect_juniper_payload_proto(tvb
, pinfo
, tree
, juniper_subtree
, JUNIPER_PROTO_PPP
, offset
+2);
924 return tvb_captured_length(tvb
);
927 /* Frame-Relay dissector */
929 dissect_juniper_frelay(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
931 proto_tree
* juniper_subtree
;
936 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "Juniper Frame-Relay");
937 col_clear(pinfo
->cinfo
, COL_INFO
);
941 juniper_subtree
= proto_tree_add_subtree(tree
, tvb
, offset
, 4, ett_juniper
, NULL
, "Juniper Frame-Relay");
943 /* parse header, match mgc, extract flags and build first tree */
944 bytes_processed
= dissect_juniper_header(tvb
, pinfo
, tree
, juniper_subtree
, &flags
);
946 if(bytes_processed
== -1)
949 offset
+=bytes_processed
;
951 dissect_juniper_payload_proto(tvb
, pinfo
, tree
, juniper_subtree
, JUNIPER_PROTO_FRELAY
, offset
);
953 return tvb_captured_length(tvb
);
956 /* C-HDLC dissector */
958 dissect_juniper_chdlc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
960 proto_tree
* juniper_subtree
;
965 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "Juniper C-HDLC");
966 col_clear(pinfo
->cinfo
, COL_INFO
);
968 juniper_subtree
= proto_tree_add_subtree(tree
, tvb
, offset
, 4, ett_juniper
, NULL
, "Juniper C-HDLC");
970 /* parse header, match mgc, extract flags and build first tree */
971 bytes_processed
= dissect_juniper_header(tvb
, pinfo
, tree
, juniper_subtree
, &flags
);
973 if(bytes_processed
== -1)
976 offset
+=bytes_processed
;
978 dissect_juniper_payload_proto(tvb
, pinfo
, tree
, juniper_subtree
, JUNIPER_PROTO_CHDLC
, offset
);
980 return tvb_captured_length(tvb
);
985 /* wrapper for passing the PIC type to the generic ATM dissector */
987 dissect_juniper_atm1(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
989 dissect_juniper_atm(tvb
,pinfo
,tree
, JUNIPER_PIC_ATM1
);
990 return tvb_captured_length(tvb
);
993 /* wrapper for passing the PIC type to the generic ATM dissector */
995 dissect_juniper_atm2(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
997 dissect_juniper_atm(tvb
,pinfo
,tree
, JUNIPER_PIC_ATM2
);
998 return tvb_captured_length(tvb
);
1001 /* generic ATM dissector */
1003 dissect_juniper_atm(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, uint16_t atm_pictype
)
1006 proto_tree
* juniper_subtree
;
1007 uint8_t next_proto
= JUNIPER_PROTO_UNKNOWN
,atm1_header_len
,atm2_header_len
,flags
;
1008 uint32_t cookie1
, proto
;
1010 unsigned offset
= 0;
1011 int bytes_processed
;
1014 col_clear(pinfo
->cinfo
, COL_INFO
);
1016 switch (atm_pictype
) {
1017 case JUNIPER_PIC_ATM1
:
1018 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "Juniper ATM1");
1019 juniper_subtree
= proto_tree_add_subtree(tree
, tvb
, 0, 0 , ett_juniper
, NULL
, "Juniper ATM1 PIC");
1021 case JUNIPER_PIC_ATM2
:
1022 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "Juniper ATM2");
1023 juniper_subtree
= proto_tree_add_subtree(tree
, tvb
, 0, 0 , ett_juniper
, NULL
, "Juniper ATM2 PIC");
1025 default: /* should not happen */
1026 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "Juniper ATM unknown");
1027 proto_tree_add_subtree(tree
, tvb
, 0, 0 , ett_juniper
, NULL
, "Juniper unknown ATM PIC");
1031 /* parse header, match mgc, extract flags and build first tree */
1032 bytes_processed
= dissect_juniper_header(tvb
, pinfo
, tree
, juniper_subtree
, &flags
);
1033 if(bytes_processed
== -1)
1036 offset
+=bytes_processed
;
1038 if ((flags
& JUNIPER_FLAG_NO_L2
) == JUNIPER_FLAG_NO_L2
) {
1039 atm1_header_len
= 4;
1040 atm2_header_len
= 4;
1043 atm1_header_len
= 4;
1044 atm2_header_len
= 8;
1047 cookie1
= tvb_get_ntohl(tvb
, offset
);
1048 cookie2
= tvb_get_ntoh64(tvb
, offset
);
1050 if (atm_pictype
== JUNIPER_PIC_ATM1
) {
1051 proto_tree_add_uint(juniper_subtree
, hf_juniper_atm1_cookie
, tvb
, offset
, 4, cookie1
);
1052 offset
+= atm1_header_len
;
1053 if ((cookie1
>> 24) == 0x80) /* OAM cell ? */
1054 next_proto
= JUNIPER_PROTO_OAM
;
1056 else { /* JUNIPER_PIC_ATM2 */
1057 proto_tree_add_uint64(juniper_subtree
, hf_juniper_atm2_cookie
, tvb
, offset
, 8, cookie2
);
1058 offset
+= atm2_header_len
;
1059 if (cookie2
& 0x70) /* OAM cell ? */
1060 next_proto
= JUNIPER_PROTO_OAM
;
1063 next_tvb
= tvb_new_subset_remaining(tvb
, offset
);
1065 if (next_proto
== JUNIPER_PROTO_OAM
) {
1066 dissect_juniper_payload_proto(tvb
, pinfo
, tree
, juniper_subtree
, JUNIPER_PROTO_OAM
, offset
);
1070 proto
= tvb_get_ntoh24(tvb
, offset
); /* first try: 24-Bit guess */
1072 if (proto
== JUNIPER_HDR_NLPID
) {
1074 * This begins with something that appears to be an LLC header for
1075 * OSI; is this LLC-multiplexed traffic?
1077 dissect_juniper_payload_proto(tvb
, pinfo
, tree
, juniper_subtree
, JUNIPER_PROTO_LLC
, offset
);
1081 if (proto
== JUNIPER_HDR_SNAP
) {
1083 * This begins with something that appears to be an LLC header for
1084 * SNAP; is this LLC-multiplexed traffic?
1086 dissect_juniper_payload_proto(tvb
, pinfo
, tree
, juniper_subtree
, JUNIPER_PROTO_LLC_SNAP
, offset
);
1090 if ((flags
& JUNIPER_FLAG_PKT_IN
) != JUNIPER_FLAG_PKT_IN
&& /* ether-over-1483 encaps ? */
1091 (cookie1
& JUNIPER_ATM2_GAP_COUNT_MASK
) &&
1092 atm_pictype
!= JUNIPER_PIC_ATM1
) {
1093 dissect_juniper_payload_proto(tvb
, pinfo
, tree
, juniper_subtree
, JUNIPER_PROTO_ETHER
, offset
);
1097 proto
= tvb_get_ntohs(tvb
, offset
); /* second try: 16-Bit guess */
1099 if ( ppp_heuristic_guess( (uint16_t) proto
) &&
1100 atm_pictype
!= JUNIPER_PIC_ATM1
) {
1102 * This begins with something that appears to be a PPP protocol
1103 * type; is this VC-multiplexed PPPoA?
1104 * That's not supported on ATM1 PICs.
1106 proto_tree_add_uint_format_value(juniper_subtree
, hf_juniper_encap_type
, tvb
, offset
, 0, 0, "VC-MUX");
1107 dissect_juniper_payload_proto(tvb
, pinfo
, tree
, juniper_subtree
, JUNIPER_PROTO_PPP
, offset
);
1111 proto
= tvb_get_uint8(tvb
, offset
); /* third try: 8-Bit guess */
1113 if ( proto
== JUNIPER_HDR_LLC_UI
) {
1115 * Cisco style NLPID encaps?
1116 * Is the 0x03 an LLC UI control field?
1118 proto_tree_add_uint_format_value(juniper_subtree
, hf_juniper_encap_type
, tvb
, offset
, 1, 1, "Cisco NLPID");
1119 dissect_juniper_payload_proto(tvb
, pinfo
, tree
, juniper_subtree
, JUNIPER_PROTO_ISO
, offset
+1);
1123 next_proto
= ip_heuristic_guess( (uint8_t) proto
);
1124 if (next_proto
!= JUNIPER_PROTO_UNKNOWN
) { /* last resort: VC-MUX encaps ? */
1126 * This begins with something that might be the first byte of
1127 * an IPv4 or IPv6 packet; is this VC-multiplexed IP?
1129 proto_tree_add_uint_format_value(juniper_subtree
, hf_juniper_encap_type
, tvb
, offset
, 0, 2, "VC-MUX");
1130 dissect_juniper_payload_proto(tvb
, pinfo
, tree
, juniper_subtree
, next_proto
, offset
);
1134 /* could not figure what it is */
1135 ti
= proto_tree_add_uint_format_value(juniper_subtree
, hf_juniper_payload_type
, tvb
, offset
, 0, 0xFFFF, "Unknown");
1136 proto_item_set_len(ti
, tvb_reported_length_remaining(tvb
, offset
));
1137 call_data_dissector(next_tvb
, pinfo
, tree
);
1141 static int dissect_juniper_ggsn(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
, void* data _U_
) {
1143 proto_tree
* juniper_subtree
;
1144 unsigned offset
= 0;
1145 int bytes_processed
;
1149 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "Juniper GGSN");
1150 col_clear(pinfo
->cinfo
, COL_INFO
);
1152 juniper_subtree
= proto_tree_add_subtree(tree
, tvb
, offset
, 4, ett_juniper
, NULL
, "Juniper GGSN");
1154 /* parse header, match mgc, extract flags and build first tree */
1155 bytes_processed
= dissect_juniper_header(tvb
, pinfo
, tree
, juniper_subtree
, &flags
);
1157 if(bytes_processed
== -1)
1160 offset
+=bytes_processed
;
1162 proto
= tvb_get_letohs(tvb
, offset
); /* fetch protocol */
1164 proto_tree_add_uint(juniper_subtree
, hf_juniper_proto
, tvb
, offset
, 2, proto
);
1165 proto_tree_add_item(juniper_subtree
, hf_juniper_vlan
, tvb
, offset
+2, 2, ENC_LITTLE_ENDIAN
);
1168 dissect_juniper_payload_proto(tvb
, pinfo
, tree
, juniper_subtree
, proto
, offset
);
1170 return tvb_captured_length(tvb
);
1173 static int dissect_juniper_vp(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
, void* data _U_
) {
1175 proto_tree
* juniper_subtree
;
1176 unsigned offset
= 0;
1177 int bytes_processed
;
1180 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "Juniper Voice PIC");
1181 col_clear(pinfo
->cinfo
, COL_INFO
);
1183 juniper_subtree
= proto_tree_add_subtree(tree
, tvb
, offset
, 4, ett_juniper
, NULL
, "Juniper Voice PIC");
1185 /* parse header, match mgc, extract flags and build first tree */
1186 bytes_processed
= dissect_juniper_header(tvb
, pinfo
, tree
, juniper_subtree
, &flags
);
1188 if(bytes_processed
== -1)
1191 offset
+=bytes_processed
;
1194 * Right know IPv4 is the only protocol we may encounter.
1195 * For the future there should be sufficient space in the 18-byte
1196 * empty header before payload starts.
1198 dissect_juniper_payload_proto(tvb
, pinfo
, tree
, juniper_subtree
, JUNIPER_PROTO_IP
, offset
+18);
1199 return tvb_captured_length(tvb
);
1202 /* Wrapper for Juniper service PIC cookie dissector */
1204 dissect_juniper_svcs(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
1206 proto_tree
* juniper_subtree
;
1207 unsigned offset
= 0;
1208 int bytes_processed
= 0;
1211 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "Juniper Services");
1212 col_clear(pinfo
->cinfo
, COL_INFO
);
1214 juniper_subtree
= proto_tree_add_subtree(tree
, tvb
, offset
, 4, ett_juniper
, NULL
, "Juniper Services cookie");
1216 /* parse header, match mgc, extract flags and build first tree */
1217 bytes_processed
= dissect_juniper_header(tvb
, pinfo
, tree
, juniper_subtree
, &flags
);
1219 if (bytes_processed
== -1)
1222 offset
+=bytes_processed
;
1224 if (flags
& JUNIPER_FLAG_PKT_IN
) {
1225 proto_tree_add_uint(juniper_subtree
, hf_juniper_proto
, tvb
, offset
, 2, JUNIPER_PROTO_IP
);
1231 dissect_juniper_payload_proto(tvb
, pinfo
, tree
, juniper_subtree
, JUNIPER_PROTO_IP
, offset
);
1232 return tvb_captured_length(tvb
);
1235 static int dissect_juniper_vn(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
, void* data _U_
)
1237 proto_tree
* juniper_subtree
;
1238 unsigned offset
= 0;
1239 uint32_t tlv_type
, tlv_len
;
1241 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
,
1242 "Juniper Virtual Network Information");
1243 col_clear(pinfo
->cinfo
, COL_INFO
);
1245 juniper_subtree
= proto_tree_add_subtree(tree
, tvb
, offset
, 20,
1246 ett_juniper
, NULL
, "Juniper Virtual Network Information");
1248 tlv_type
= tvb_get_uint8(tvb
, offset
);
1249 tlv_len
= tvb_get_uint8(tvb
, (offset
+ 1));
1250 offset
+= VN_TLV_HDR_SIZE
;
1252 while (tlv_type
!= 255) {
1255 case VN_TLV_HOST_IP
:
1256 proto_tree_add_item(juniper_subtree
, hf_juniper_vn_host_ip
, tvb
,
1257 offset
, 4, ENC_BIG_ENDIAN
);
1260 proto_tree_add_bitmask(juniper_subtree
, tvb
, offset
, hf_juniper_vn_flags
, ett_juniper_vn_flags
, vn_flags
, ENC_BIG_ENDIAN
);
1263 proto_tree_add_item(juniper_subtree
, hf_juniper_vn_src
, tvb
, offset
, tlv_len
, ENC_NA
|ENC_ASCII
);
1266 proto_tree_add_item(juniper_subtree
, hf_juniper_vn_dst
, tvb
, offset
, tlv_len
, ENC_NA
|ENC_ASCII
);
1269 proto_tree_add_expert(juniper_subtree
, pinfo
, &ei_juniper_vn_incorrect_format
, tvb
, 0, 0);
1274 tlv_type
= tvb_get_uint8(tvb
, offset
);
1275 tlv_len
= tvb_get_uint8(tvb
, (offset
+ 1));
1276 offset
+= VN_TLV_HDR_SIZE
;
1280 dissect_juniper_payload_proto(tvb
, pinfo
, tree
, juniper_subtree
, JUNIPER_PROTO_ETHER
, offset
);
1282 return tvb_captured_length(tvb
);
1284 static int dissect_juniper_st(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
, void* data _U_
)
1287 proto_tree
* juniper_subtree
, *eth_tree
, *ip_tree
, *esp_tree
;
1288 unsigned offset
= 0;
1290 uint32_t type
, len
, ip_proto
;
1291 int bytes_processed
;
1293 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
,
1294 "Juniper Secure Tunnel Information");
1295 col_clear(pinfo
->cinfo
, COL_INFO
);
1297 juniper_subtree
= proto_tree_add_subtree(tree
, tvb
, offset
, 70,
1298 ett_juniper
, NULL
, "Juniper Secure Tunnel Information");
1300 bytes_processed
= dissect_juniper_header(tvb
, pinfo
, tree
, juniper_subtree
, &flags
);
1301 if (bytes_processed
< 1) {
1302 return tvb_captured_length(tvb
);
1305 offset
+= bytes_processed
;
1307 /* Dissect lower layers */
1308 eth_tree
= proto_tree_add_subtree(juniper_subtree
, tvb
, offset
, 14, ett_juniper_st_eth
, NULL
, "Tunnel Ethernet Header");
1309 proto_tree_add_item(eth_tree
, hf_juniper_st_eth_dst
, tvb
, offset
, 6, ENC_NA
);
1311 proto_tree_add_item(eth_tree
, hf_juniper_st_eth_src
, tvb
, offset
, 6, ENC_NA
);
1313 proto_tree_add_item_ret_uint(eth_tree
, hf_juniper_st_eth_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &type
);
1315 /* XXX can we have a VLAN header here ?*/
1318 ip_tree
= proto_tree_add_subtree(juniper_subtree
, tvb
, offset
, -1, ett_juniper_st_ip
, &ti
, "Tunnel IP Header");
1319 proto_tree_add_item_ret_uint(ip_tree
, hf_juniper_st_ip_len
, tvb
, offset
, 1, ENC_BIG_ENDIAN
, &len
);
1321 proto_item_set_len(ti
, len
);
1322 proto_tree_add_item_ret_uint(ip_tree
, hf_juniper_st_ip_proto
, tvb
, offset
+9, 1, ENC_BIG_ENDIAN
, &ip_proto
);
1324 /* ESP is expected */
1325 if (ip_proto
!= IP_PROTO_ESP
) {
1326 return tvb_captured_length(tvb
);
1328 esp_tree
= proto_tree_add_subtree(juniper_subtree
, tvb
, offset
, 8, ett_juniper_st_esp
, NULL
, "Tunnel ESP Header");
1329 proto_tree_add_item(esp_tree
, hf_juniper_st_esp_spi
, tvb
, offset
, 4, ENC_NA
);
1331 proto_tree_add_item(esp_tree
, hf_juniper_st_esp_seq
, tvb
, offset
, 4, ENC_NA
);
1333 /* 16 bytes unknown data remains in example trace */
1334 proto_tree_add_subtree(juniper_subtree
, tvb
, offset
, 16, ett_juniper_st_unknown
, NULL
, "Tunnel Unknown Data");
1338 return tvb_captured_length(tvb
);
1341 dissect_juniper_payload_proto(tvb
, pinfo
, tree
, juniper_subtree
, ip_heuristic_guess(tvb_get_uint8(tvb
,offset
)), offset
);
1343 return tvb_captured_length(tvb
);
1348 /* list of Juniper supported PPP proto IDs */
1350 ppp_heuristic_guess(uint16_t proto
) {
1356 case PPP_MPLS_MULTI
:
1369 return false; /* did not find a ppp header */
1374 * return the IP version number based on the first byte of the IP header
1375 * returns 0 if it does not match a valid first IPv4/IPv6 header byte
1378 ip_heuristic_guess(uint8_t ip_header_byte
) {
1380 switch(ip_header_byte
) {
1392 return JUNIPER_PROTO_IP
;
1409 return JUNIPER_PROTO_IP6
;
1411 return JUNIPER_PROTO_UNKNOWN
; /* did not find a ip header */
1415 /* return cookie length dep. on cookie SVC id */
1417 unsigned juniper_svc_cookie_len (uint64_t cookie
) {
1419 uint8_t svc_cookie_id
;
1420 svc_cookie_id
= (uint8_t)(cookie
>> 56) & 0xff;
1422 switch(svc_cookie_id
) {
1424 return LS_PIC_COOKIE_LEN
;
1425 case GSP_SVC_REQ_APOLLO
:
1426 case GSP_SVC_REQ_LSQ
:
1427 return AS_PIC_COOKIE_LEN
;
1433 /* return the next-level protocol based on cookie input */
1435 juniper_svc_cookie_proto (uint64_t cookie
, uint16_t pictype
, uint8_t flags
) {
1437 uint8_t svc_cookie_id
;
1441 svc_cookie_id
= (uint8_t)(cookie
>> 56) & 0xff;
1442 lsq_proto
= (uint16_t)((cookie
>> 16) & LSQ_L3_PROTO_MASK
);
1443 lsq_dir
= (uint8_t)(cookie
>> 24) & 0x3;
1446 switch (svc_cookie_id
) {
1449 case JUNIPER_PIC_MLPPP
:
1450 return JUNIPER_PROTO_PPP
;
1451 case JUNIPER_PIC_MLFR
:
1452 return JUNIPER_PROTO_ISO
;
1454 return JUNIPER_PROTO_UNKNOWN
;
1456 case GSP_SVC_REQ_APOLLO
:
1457 case GSP_SVC_REQ_LSQ
:
1459 case LSQ_L3_PROTO_IPV4
:
1461 case JUNIPER_PIC_MLPPP
:
1462 /* incoming traffic would have the direction bits set
1463 * -> this must be IS-IS over PPP
1465 if ((flags
& JUNIPER_FLAG_PKT_IN
) == JUNIPER_FLAG_PKT_IN
&&
1466 lsq_dir
!= (LSQ_COOKIE_RE
|LSQ_COOKIE_DIR
))
1467 return JUNIPER_PROTO_PPP
;
1469 return JUNIPER_PROTO_IP
;
1470 case JUNIPER_PIC_MLFR
:
1471 if (lsq_dir
== (LSQ_COOKIE_RE
|LSQ_COOKIE_DIR
))
1472 return JUNIPER_PROTO_UNKNOWN
;
1474 return JUNIPER_PROTO_IP
;
1476 return JUNIPER_PROTO_UNKNOWN
;
1478 case LSQ_L3_PROTO_IPV6
:
1479 return JUNIPER_PROTO_IP6
;
1480 case LSQ_L3_PROTO_MPLS
:
1481 return JUNIPER_PROTO_MPLS
;
1482 case LSQ_L3_PROTO_ISO
:
1483 return JUNIPER_PROTO_ISO
;
1485 return JUNIPER_PROTO_UNKNOWN
;
1488 return JUNIPER_PROTO_UNKNOWN
;
1494 proto_register_juniper(void)
1496 static hf_register_info hf
[] = {
1497 { &hf_juniper_magic
,
1498 { "Magic Number", "juniper.magic-number", FT_UINT24
, BASE_HEX
,
1499 NULL
, 0x0, NULL
, HFILL
}},
1500 { &hf_juniper_direction
,
1501 { "Direction", "juniper.direction", FT_UINT8
, BASE_HEX
,
1502 VALS(juniper_direction_vals
), 0x01, NULL
, HFILL
}},
1503 { &hf_juniper_l2hdr_presence
,
1504 { "L2 header presence", "juniper.l2hdr", FT_UINT8
, BASE_HEX
,
1505 VALS(juniper_l2hdr_presence_vals
), 0x02, NULL
, HFILL
}},
1506 { &hf_juniper_ext_total_len
,
1507 { "Extension(s) Total length", "juniper.ext_total_len", FT_UINT16
, BASE_DEC
,
1508 NULL
, 0x0, NULL
, HFILL
}},
1509 { &hf_juniper_cookie_len
,
1510 { "Cookie length", "juniper.cookie_len", FT_UINT32
, BASE_DEC
,
1511 NULL
, 0x0, NULL
, HFILL
}},
1512 { &hf_juniper_atm2_cookie
,
1513 { "Cookie", "juniper.atm2.cookie", FT_UINT64
, BASE_HEX
,
1514 NULL
, 0x0, NULL
, HFILL
}},
1515 { &hf_juniper_atm1_cookie
,
1516 { "Cookie", "juniper.atm1.cookie", FT_UINT32
, BASE_HEX
,
1517 NULL
, 0x0, NULL
, HFILL
}},
1518 { &hf_juniper_mlpic_cookie
,
1519 { "Cookie", "juniper.mlpic.cookie", FT_UINT16
, BASE_HEX
,
1520 NULL
, 0x0, NULL
, HFILL
}},
1521 { &hf_juniper_lspic_cookie
,
1522 { "Cookie", "juniper.lspic.cookie", FT_UINT32
, BASE_HEX
,
1523 NULL
, 0x0, NULL
, HFILL
}},
1524 { &hf_juniper_aspic_cookie
,
1525 { "Cookie", "juniper.aspic.cookie", FT_UINT64
, BASE_HEX
,
1526 NULL
, 0x0, NULL
, HFILL
}},
1528 { "VLan ID", "juniper.vlan", FT_UINT16
, BASE_DEC
,
1529 NULL
, 0x0, NULL
, HFILL
}},
1530 { &hf_juniper_proto
,
1531 { "Protocol", "juniper.proto", FT_UINT16
, BASE_DEC
,
1532 VALS(juniper_proto_vals
), 0x0, NULL
, HFILL
}},
1533 { &hf_juniper_payload_type
,
1534 { "Payload Type", "juniper.payload_type", FT_UINT16
, BASE_DEC
,
1535 VALS(juniper_proto_vals
), 0x0, NULL
, HFILL
}},
1536 { &hf_juniper_encap_type
,
1537 { "Encapsulation Type", "juniper.encap_type", FT_UINT8
, BASE_DEC
,
1538 NULL
, 0x0, NULL
, HFILL
}},
1539 { &hf_juniper_ext_ifd
,
1540 /* Juniper PCAP extensions */
1541 { "Device Interface Index", "juniper.ext.ifd", FT_UINT32
, BASE_DEC
,
1542 NULL
, 0x0, NULL
, HFILL
}},
1543 { &hf_juniper_ext_ifl
,
1544 { "Logical Interface Index", "juniper.ext.ifl", FT_UINT32
, BASE_DEC
,
1545 NULL
, 0x0, NULL
, HFILL
}},
1546 { &hf_juniper_ext_unit
,
1547 { "Logical Unit Number", "juniper.ext.unit", FT_UINT32
, BASE_DEC
,
1548 NULL
, 0x0, NULL
, HFILL
}},
1549 { &hf_juniper_ext_ifmt
,
1550 { "Device Media Type", "juniper.ext.ifmt", FT_UINT16
, BASE_DEC
,
1551 VALS(juniper_ifmt_vals
), 0x0, NULL
, HFILL
}},
1552 { &hf_juniper_ext_ifle
,
1553 { "Logical Interface Encapsulation", "juniper.ext.ifle", FT_UINT16
, BASE_DEC
,
1554 VALS(juniper_ifle_vals
), 0x0, NULL
, HFILL
}},
1555 { &hf_juniper_ext_ttp_ifmt
,
1556 { "TTP derived Device Media Type", "juniper.ext.ttp_ifmt", FT_UINT16
, BASE_DEC
,
1557 VALS(juniper_ifmt_vals
), 0x0, NULL
, HFILL
}},
1558 { &hf_juniper_ext_ttp_ifle
,
1559 { "TTP derived Logical Interface Encapsulation", "juniper.ext.ttp_ifle", FT_UINT16
, BASE_DEC
,
1560 VALS(juniper_ifle_vals
), 0x0, NULL
, HFILL
}},
1561 { &hf_juniper_unknown_data
,
1562 { "Unknown data", "juniper.unknown_data", FT_BYTES
, BASE_NONE
,
1563 NULL
, 0x0, NULL
, HFILL
}},
1564 { &hf_juniper_vn_host_ip
,
1565 { "Host IP", "juniper.vn.host_ip", FT_IPv4
, BASE_NONE
,
1566 NULL
, 0x0, NULL
, HFILL
}},
1567 { &hf_juniper_vn_src
,
1568 { "Src VN", "juniper.vn.src", FT_STRING
, BASE_NONE
,
1569 NULL
, 0x0, NULL
, HFILL
}},
1570 { &hf_juniper_vn_dst
,
1571 { "Dst VN", "juniper.vn.dst", FT_STRING
, BASE_NONE
,
1572 NULL
, 0x0, NULL
, HFILL
}},
1573 { &hf_juniper_vn_flags
,
1574 { "Flags", "juniper.vn.flags", FT_UINT32
, BASE_HEX
, NULL
, VN_FLAG_MASK
,
1576 { &hf_juniper_vn_flag_alert
,
1577 { "Action Alert", "juniper.vn.flags.alert", FT_BOOLEAN
, 32,
1578 TFS(&tfs_set_notset
), VN_FLAG_ALERT
, NULL
, HFILL
}},
1579 { &hf_juniper_vn_flag_drop
,
1580 { "Action Drop", "juniper.vn.flags.drop", FT_BOOLEAN
, 32,
1581 TFS(&tfs_set_notset
), VN_FLAG_DROP
, NULL
, HFILL
}},
1582 { &hf_juniper_vn_flag_deny
,
1583 { "Action Deny", "juniper.vn.flags.deny", FT_BOOLEAN
, 32,
1584 TFS(&tfs_set_notset
), VN_FLAG_DENY
, NULL
, HFILL
}},
1585 { &hf_juniper_vn_flag_log
,
1586 { "Action Log", "juniper.vn.flags.log", FT_BOOLEAN
, 32,
1587 TFS(&tfs_set_notset
), VN_FLAG_LOG
, NULL
, HFILL
}},
1588 { &hf_juniper_vn_flag_pass
,
1589 { "Action Pass", "juniper.vn.flags.pass", FT_BOOLEAN
, 32,
1590 TFS(&tfs_set_notset
), VN_FLAG_PASS
, NULL
, HFILL
}},
1591 { &hf_juniper_vn_flag_reject
,
1592 { "Action Reject", "juniper.vn.flags.reject", FT_BOOLEAN
, 32,
1593 TFS(&tfs_set_notset
), VN_FLAG_REJECT
, NULL
, HFILL
}},
1594 { &hf_juniper_vn_flag_mirror
,
1595 { "Action Mirror", "juniper.vn.flags.mirror", FT_BOOLEAN
, 32,
1596 TFS(&tfs_set_notset
), VN_FLAG_MIRROR
, NULL
, HFILL
}},
1597 { &hf_juniper_vn_flag_direction
,
1598 { "Direction Ingress", "juniper.vn.flags.direction", FT_BOOLEAN
, 32,
1599 TFS(&tfs_set_notset
), VN_FLAG_DIRECTION
, NULL
, HFILL
}},
1600 { &hf_juniper_st_eth_dst
,
1601 { "Destination", "juniper.st.eth.dst", FT_ETHER
, BASE_NONE
,
1602 NULL
, 0x0, NULL
, HFILL
}},
1603 { &hf_juniper_st_eth_src
,
1604 { "Source", "juniper.st.eth.src", FT_ETHER
, BASE_NONE
,
1605 NULL
, 0x0, NULL
, HFILL
}},
1606 { &hf_juniper_st_eth_type
,
1607 { "Type", "juniper.st.eth.type", FT_UINT16
, BASE_HEX
,
1608 VALS(etype_vals
), 0x0, NULL
, HFILL
}},
1609 { &hf_juniper_st_ip_len
,
1610 { "Header Length", "juniper.st.ip.len", FT_UINT8
, BASE_DEC
,
1611 NULL
, 0x0f, NULL
, HFILL
}},
1612 { &hf_juniper_st_ip_proto
,
1613 { "Protocol", "juniper.st.ip.proto", FT_UINT8
, BASE_DEC
| BASE_EXT_STRING
,
1614 &ipproto_val_ext
, 0x0, NULL
, HFILL
}},
1615 { &hf_juniper_st_esp_spi
,
1616 { "ESP SPI", "juniper.st.esp.spi", FT_UINT32
, BASE_DEC
,
1617 NULL
, 0x0, NULL
, HFILL
}},
1618 { &hf_juniper_st_esp_seq
,
1619 { "ESP Sequence", "juniper.st.esp.seq", FT_UINT32
, BASE_DEC
,
1620 NULL
, 0x0, NULL
, HFILL
}},
1624 static int *ett
[] = {
1626 &ett_juniper_vn_flags
,
1627 &ett_juniper_st_eth
,
1629 &ett_juniper_st_esp
,
1630 &ett_juniper_st_unknown
,
1633 static ei_register_info ei
[] = {
1634 { &ei_juniper_no_magic
, { "juniper.magic-number.none", PI_PROTOCOL
, PI_WARN
, "No Magic-Number found!", EXPFILL
}},
1635 { &ei_juniper_vn_incorrect_format
, { "juniper.vn.incorrect_format", PI_PROTOCOL
, PI_WARN
, "Incorrect format", EXPFILL
}},
1638 expert_module_t
* expert_juniper
;
1640 proto_juniper
= proto_register_protocol("Juniper", "Juniper", "juniper");
1641 proto_register_field_array(proto_juniper
, hf
, array_length(hf
));
1642 proto_register_subtree_array(ett
, array_length(ett
));
1643 expert_juniper
= expert_register_protocol(proto_juniper
);
1644 expert_register_field_array(expert_juniper
, ei
, array_length(ei
));
1646 payload_table
= register_dissector_table("juniper.proto", "Juniper payload dissectors", proto_juniper
, FT_UINT32
, BASE_HEX
);
1651 proto_reg_handoff_juniper(void)
1653 dissector_handle_t juniper_atm1_handle
;
1654 dissector_handle_t juniper_atm2_handle
;
1655 dissector_handle_t juniper_pppoe_handle
;
1656 dissector_handle_t juniper_mlppp_handle
;
1657 dissector_handle_t juniper_mlfr_handle
;
1658 dissector_handle_t juniper_ether_handle
;
1659 dissector_handle_t juniper_ppp_handle
;
1660 dissector_handle_t juniper_frelay_handle
;
1661 dissector_handle_t juniper_chdlc_handle
;
1662 dissector_handle_t juniper_ggsn_handle
;
1663 dissector_handle_t juniper_vp_handle
;
1664 dissector_handle_t juniper_svcs_handle
;
1665 dissector_handle_t juniper_vn_handle
;
1666 dissector_handle_t juniper_st_handle
;
1668 juniper_atm2_handle
= create_dissector_handle(dissect_juniper_atm2
, proto_juniper
);
1669 juniper_atm1_handle
= create_dissector_handle(dissect_juniper_atm1
, proto_juniper
);
1670 juniper_pppoe_handle
= create_dissector_handle(dissect_juniper_pppoe
, proto_juniper
);
1671 juniper_mlppp_handle
= create_dissector_handle(dissect_juniper_mlppp
, proto_juniper
);
1672 juniper_mlfr_handle
= create_dissector_handle(dissect_juniper_mlfr
, proto_juniper
);
1673 juniper_ether_handle
= create_dissector_handle(dissect_juniper_ether
, proto_juniper
);
1674 juniper_ppp_handle
= create_dissector_handle(dissect_juniper_ppp
, proto_juniper
);
1675 juniper_frelay_handle
= create_dissector_handle(dissect_juniper_frelay
, proto_juniper
);
1676 juniper_chdlc_handle
= create_dissector_handle(dissect_juniper_chdlc
, proto_juniper
);
1677 juniper_ggsn_handle
= create_dissector_handle(dissect_juniper_ggsn
, proto_juniper
);
1678 juniper_vp_handle
= create_dissector_handle(dissect_juniper_vp
, proto_juniper
);
1679 juniper_svcs_handle
= create_dissector_handle(dissect_juniper_svcs
, proto_juniper
);
1680 juniper_vn_handle
= create_dissector_handle(dissect_juniper_vn
, proto_juniper
);
1681 juniper_st_handle
= create_dissector_handle(dissect_juniper_st
, proto_juniper
);
1683 dissector_add_uint("wtap_encap", WTAP_ENCAP_JUNIPER_ATM2
, juniper_atm2_handle
);
1684 dissector_add_uint("wtap_encap", WTAP_ENCAP_JUNIPER_ATM1
, juniper_atm1_handle
);
1685 dissector_add_uint("wtap_encap", WTAP_ENCAP_JUNIPER_PPPOE
, juniper_pppoe_handle
);
1686 dissector_add_uint("wtap_encap", WTAP_ENCAP_JUNIPER_MLPPP
, juniper_mlppp_handle
);
1687 dissector_add_uint("wtap_encap", WTAP_ENCAP_JUNIPER_MLFR
, juniper_mlfr_handle
);
1688 dissector_add_uint("wtap_encap", WTAP_ENCAP_JUNIPER_ETHER
, juniper_ether_handle
);
1689 dissector_add_uint("wtap_encap", WTAP_ENCAP_JUNIPER_PPP
, juniper_ppp_handle
);
1690 dissector_add_uint("wtap_encap", WTAP_ENCAP_JUNIPER_FRELAY
, juniper_frelay_handle
);
1691 dissector_add_uint("wtap_encap", WTAP_ENCAP_JUNIPER_CHDLC
, juniper_chdlc_handle
);
1692 dissector_add_uint("wtap_encap", WTAP_ENCAP_JUNIPER_GGSN
, juniper_ggsn_handle
);
1693 dissector_add_uint("wtap_encap", WTAP_ENCAP_JUNIPER_VP
, juniper_vp_handle
);
1694 dissector_add_uint("wtap_encap", WTAP_ENCAP_JUNIPER_SVCS
, juniper_svcs_handle
);
1695 dissector_add_uint("wtap_encap", WTAP_ENCAP_JUNIPER_VN
, juniper_vn_handle
);
1696 dissector_add_uint("wtap_encap", WTAP_ENCAP_JUNIPER_ST
, juniper_st_handle
);
1697 dissector_add_for_decode_as_with_preference("udp.port", juniper_vn_handle
);
1707 * indent-tabs-mode: nil
1710 * ex: set shiftwidth=2 tabstop=8 expandtab:
1711 * :indentSize=2:tabSize=8:noTabs=true: