2 * Routines for Aruba PAPI dissection
3 * Copyright 2010, Alexis La Goutte <alexis.lagoutte at gmail dot com>
5 * Real name of PAPI : Protocol Application Program Interface
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
15 #include <epan/packet.h>
16 #include <epan/prefs.h>
17 #include <epan/expert.h>
18 #include <epan/addr_resolv.h>
19 #include "packet-ipv6.h"
21 /* This is not IANA assigned nor registered */
22 #define UDP_PORT_PAPI 8211
24 void proto_register_papi(void);
25 void proto_reg_handoff_papi(void);
27 static dissector_handle_t papi_handle
;
29 /* Initialize the protocol and registered fields */
30 static int proto_papi
;
31 static int hf_papi_hdr_magic
;
32 static int hf_papi_hdr_version
;
33 static int hf_papi_hdr_dest_ip
;
34 static int hf_papi_hdr_src_ip
;
35 static int hf_papi_hdr_nat_port_number
;
36 static int hf_papi_hdr_garbage
;
37 static int hf_papi_hdr_dest_port
;
38 static int hf_papi_hdr_src_port
;
39 static int hf_papi_hdr_packet_type
;
40 static int hf_papi_hdr_packet_size
;
41 static int hf_papi_hdr_seq_number
;
42 static int hf_papi_hdr_message_code
;
43 static int hf_papi_hdr_checksum
;
45 static int hf_papi_hdr_srcipv6
;
46 static int hf_papi_hdr_destipv6
;
48 static int hf_papi_debug
;
49 static int hf_papi_debug_text
;
50 static int hf_papi_debug_text_length
;
51 static int hf_papi_debug_48bits
;
52 static int hf_papi_debug_8bits
;
53 static int hf_papi_debug_16bits
;
54 static int hf_papi_debug_32bits
;
55 static int hf_papi_debug_ipv4
;
56 static int hf_papi_debug_64bits
;
57 static int hf_papi_debug_bytes
;
58 static int hf_papi_debug_bytes_length
;
60 static int hf_papi_licmgr
;
61 static int hf_papi_licmgr_payload_len
;
62 static int hf_papi_licmgr_tlv
;
63 static int hf_papi_licmgr_type
;
64 static int hf_papi_licmgr_length
;
65 static int hf_papi_licmgr_value
;
66 static int hf_papi_licmgr_ip
;
67 static int hf_papi_licmgr_serial_number
;
68 static int hf_papi_licmgr_hostname
;
69 static int hf_papi_licmgr_mac_address
;
70 static int hf_papi_licmgr_license_ap_remaining
;
71 static int hf_papi_licmgr_license_pef_remaining
;
72 static int hf_papi_licmgr_license_rfp_remaining
;
73 static int hf_papi_licmgr_license_xsec_remaining
;
74 static int hf_papi_licmgr_license_acr_remaining
;
75 static int hf_papi_licmgr_license_ap_used
;
76 static int hf_papi_licmgr_license_pef_used
;
77 static int hf_papi_licmgr_license_rfp_used
;
78 static int hf_papi_licmgr_license_xsec_used
;
79 static int hf_papi_licmgr_license_acr_used
;
80 static int hf_papi_licmgr_padding
;
82 static expert_field ei_papi_debug_unknown
;
84 /* variable for dissector table for subdissectors */
85 static dissector_table_t papi_dissector_table
;
87 /* Global PAPI Debug Preference */
88 static bool g_papi_debug
;
90 /* Initialize the subtree pointers */
92 static int ett_papi_licmgr
;
93 static int ett_papi_licmgr_tlv
;
95 #define SAMBA_WRAPPER 8442
96 #define RESOLVER_PORT 8392
97 #define PB_INT_TASK 8448
98 #define STATION_MANAGEMENT_LOPRI 8419
99 #define MOBILE_IP 8383
100 #define SIBYTE_FASTPATH_PORT 8355
101 #define WLAN_MANAGEMENT_SERVER 8224
102 #define SIBYTE_CONSOLE_CLIENT2 8357
103 #define AUTH_SERVER_LOPRI 8420
104 #define MOB_FASTPATH_PORT 8354
105 #define SAP_RRAD_PORT 8382
107 #define RAPPER_PORT2 8424
108 #define IKE_DAEMON_RAW 8232
109 #define STATION_MANAGEMENT 8345
110 #define PPPD_START 8241
111 #define SETUP_DIALOG 8434
112 #define WEB_GRAPHGEN1 8346
113 #define SNMP_TRAP_RAW 8402
114 #define ARUBA_NTPD 8377
115 #define STATION_MANAGEMENT_LOPRI_AP 8452
116 #define CLI_LOG_RAW 8364
117 #define AUTH_SERVER_RAW 8227
118 #define RAPPER_PORT5 8427
119 #define MESH_DAEMON 8433
120 #define PHONE_HOME 8437
121 #define FPCLI_SIBYTE_CONSOLE2 8368
122 #define FASTPATH_WEB_CLIENT 8218
123 #define SERVER_LOAD_BALANCING 8384
124 #define IKE_DAEMON 8231
126 #define MOBILITY_CLIENT 8217
127 #define SNMP_TRAPMGR 8363
128 #define PIM_TOSIBYTE 8416
129 #define RAPPER_PORT9 8431
130 #define CERT_MANAGER_MASTER 8353
131 #define MISC_PROC 8445
132 #define PPPD_END 8340
134 #define RAPPER_PORT6 8428
135 #define RRA_SERVER 8238
136 #define NANNY_PORT_MEM_MON 8371
137 #define SYS_MAPPER_LOPRI 8435
138 #define RAPPER_PORT4 8426
139 #define SAPM_HYBRID_AP 8436
140 #define FASTPATH_CLI_CLIENT 8213
141 #define CFGM_RAW 8362
143 #define SYSLOGDWRAP 8407
144 #define WEBS_AM_PORT 8352
145 #define QPDQ_STANDALONE 8401
146 #define FPCLI_RAW 8361
147 #define VRRP_DAEMON 8391
148 #define AMAP_MGMT_PORT 8395
149 #define CAP_MGMT_PORT 8351
150 #define SAPM_SERVER 8222
151 #define PPPD_DAEMON 8234
152 #define LAST_SERVICE 8999
153 #define DHCP_SERVER 8390
154 #define ADMINSERVER 8403
155 #define SYS_MAPPER 8396
156 #define PUBSUB_SERVER 8378
157 #define AMAPI_SNMP_TRAP_CLIENT 8440
159 #define SIBYTE_CONSOLE_PORT 8348
160 #define SNMP_DAEMON 8219
161 #define SIBYTE_DNLD_FILE 8374
162 #define UTILITY_PROCESS 8449
163 #define SAPM_RAPCP 8438
164 #define SIBYTE_MACH_INFO 8386
165 #define SIBYTE_CONSOLE_CLIENT1 8356
167 #define RF_CLIENT 8410
169 #define FASTPATH_CLI_SERVER 8239
170 #define FASTPATH_AUTH_CLIENT 8360
171 #define CRYPTO_POST_PORT 8400
172 #define HTTPD_WRAP 8404
173 #define MMSCONFIGMGR 8412
174 #define FPAPPS_AUTH_PORT 8381
175 #define FPWEB_RAW 8415
177 #define CERT_CLIENT 8349
178 #define SIBYTE_RAW 8228
179 #define FPAPPS_VRRP_PORT 8379
180 #define AIR_MONITOR 8225
181 #define ANOMALY_DETECTION 8387
182 #define ARUBA_FILTER 8388
183 #define MSGH_HELPER 8446
184 #define FASTPATH_SERVER 8212
185 #define MOBILITY_AGENT 8229
186 #define OSPF_DAEMON 8441
188 #define MOBILITY_SERVER 8216
189 #define SIBYTE_CONSOLE_CLIENT3 8358
190 #define FPCLI_SIBYTE_CONSOLE1 8367
191 #define AUTH_CLIENT 8215
192 #define FPCLI_SIBYTE_CONSOLE3 8369
193 #define AMAPI_SAMPLE_CLIENT 8221
194 #define PPPOE_DAEMON 8411
195 #define UDB_SERVER 8344
196 #define RAPPER_PORT1 8423
197 #define PAPI_EPHEMERAL 65535
198 #define MVC_SERVER 8422
199 #define RAPPER_PORT3 8425
200 #define DHCP_DAEMON 8359
201 #define EMWEB_RAW 8365
202 #define STATSMGR 8397
203 #define FASTPATH_ADD_SERVER 8240
204 #define AMAPI_CLI_CLIENT 8220
205 #define AUTH_SERVER 8214
206 #define MESSAGE_HANDLER 8999
207 #define AMAP_PROC 8394
209 #define CFGMANAGER 8226
210 #define RAPPER_PORT8 8430
211 #define L2TPD_DAEMON_RAW 8233
212 #define WLAN_MANAGEMENT_SERVER_LOPRI 8421
213 #define NANNY_PORT 8370
214 #define RAPPER_PORT10 8432
215 #define RAPPER_PORT7 8429
216 #define AMAPI_WEB_CLIENT 8235
217 #define WEB_CLI_RAW 8375
218 #define CERT_MANAGER 8343
219 #define NCFGTEST_APP 8406
220 #define REM_DSLMGR 8439
221 #define PROFILE_MANAGER 8405
222 #define LICENSE_MANAGER 8389
223 #define MMSWEBSVC 8414
224 #define SSH_AUTH_PORT 8393
225 #define STATION_MANAGEMENT_AP 8451
226 #define AMP_SERVER 8444
227 #define HTTPD_WRAP_AUTH_PORT 8417
228 #define FAULTMGR 8399
229 #define SIBYTE_HEARTBEAT 8237
230 #define USBHELPER_CLIENT 8447
231 #define SAPM_CLIENT 8223
232 #define RF_MANAGER 8409
233 #define WEB_GRAPHGEN2 8347
234 #define HARDWARE_MONITOR_PORT 8366
236 #define WIRED_MAC_LOOKUP 8376
237 #define CDP_PROC 8350
238 #define AAA_MGMT_PORT 8372
239 #define DBSYNC_PORT 8380
240 #define AMAPI_SNMP_CLIENT 8236
241 #define PORT_UBT 15560
243 /* defining Packet Size & HDR version no for PAPI */
244 #define PAPI_PACKET_SIZE 76
245 #define V4V6_HDR_VERSION 0x03
247 static const value_string papi_port_vals
[] = {
248 { FASTPATH_SERVER
, "FASTPATH_SERVER" },
249 { FASTPATH_CLI_CLIENT
, "FASTPATH_CLI_CLIENT" },
250 { AUTH_SERVER
, "AUTH_SERVER" },
251 { AUTH_CLIENT
, "AUTH_CLIENT" },
252 { MOBILITY_SERVER
, "MOBILITY_SERVER" },
253 { MOBILITY_CLIENT
, "MOBILITY_CLIENT" },
254 { FASTPATH_WEB_CLIENT
, "FASTPATH_WEB_CLIENT" },
255 { SNMP_DAEMON
, "SNMP_DAEMON" },
256 { AMAPI_CLI_CLIENT
, "AMAPI_CLI_CLIENT" },
257 { AMAPI_SAMPLE_CLIENT
, "AMAPI_SAMPLE_CLIENT" },
258 { SAPM_SERVER
, "SAPM_SERVER" },
259 { SAPM_CLIENT
, "SAPM_CLIENT" },
260 { WLAN_MANAGEMENT_SERVER
, "WLAN_MANAGEMENT_SERVER" },
261 { AIR_MONITOR
, "AIR_MONITOR" },
262 { CFGMANAGER
, "CFGMANAGER" },
263 { AUTH_SERVER_RAW
, "AUTH_SERVER_RAW" },
264 { SIBYTE_RAW
, "SIBYTE_RAW" },
265 { MOBILITY_AGENT
, "MOBILITY_AGENT" },
266 { IKE_DAEMON
, "IKE_DAEMON" },
267 { IKE_DAEMON_RAW
, "IKE_DAEMON_RAW" },
268 { L2TPD_DAEMON_RAW
, "L2TPD_DAEMON_RAW" },
269 { PPPD_DAEMON
, "PPPD_DAEMON" },
270 { AMAPI_WEB_CLIENT
, "AMAPI_WEB_CLIENT" },
271 { AMAPI_SNMP_CLIENT
, "AMAPI_SNMP_CLIENT" },
272 { SIBYTE_HEARTBEAT
, "SIBYTE_HEARTBEAT" },
273 { RRA_SERVER
, "RRA_SERVER" },
274 { FASTPATH_CLI_SERVER
, "FASTPATH_CLI_SERVER" },
275 { FASTPATH_ADD_SERVER
, "FASTPATH_ADD_SERVER" },
276 { PPPD_START
, "PPPD_START" },
277 { PPPD_END
, "PPPD_END" },
280 { CERT_MANAGER
, "CERT_MANAGER" },
281 { UDB_SERVER
, "UDB_SERVER" },
282 { STATION_MANAGEMENT
, "STATION_MANAGEMENT" },
283 { WEB_GRAPHGEN1
, "WEB_GRAPHGEN1" },
284 { WEB_GRAPHGEN2
, "WEB_GRAPHGEN2" },
285 { SIBYTE_CONSOLE_PORT
, "SIBYTE_CONSOLE_PORT" },
286 { CERT_CLIENT
, "CERT_CLIENT" },
287 { CDP_PROC
, "CDP_PROC" },
288 { CAP_MGMT_PORT
, "CAP_MGMT_PORT" },
289 { WEBS_AM_PORT
, "WEBS_AM_PORT" },
290 { CERT_MANAGER_MASTER
, "CERT_MANAGER_MASTER" },
291 { MOB_FASTPATH_PORT
, "MOB_FASTPATH_PORT" },
292 { SIBYTE_FASTPATH_PORT
, "SIBYTE_FASTPATH_PORT" },
293 { SIBYTE_CONSOLE_CLIENT1
, "SIBYTE_CONSOLE_CLIENT1" },
294 { SIBYTE_CONSOLE_CLIENT2
, "SIBYTE_CONSOLE_CLIENT2" },
295 { SIBYTE_CONSOLE_CLIENT3
, "SIBYTE_CONSOLE_CLIENT3" },
296 { DHCP_DAEMON
, "DHCP_DAEMON" },
297 { FASTPATH_AUTH_CLIENT
, "FASTPATH_AUTH_CLIENT" },
298 { FPCLI_RAW
, "FPCLI_RAW" },
299 { CFGM_RAW
, "CFGM_RAW" },
300 { SNMP_TRAPMGR
, "SNMP_TRAPMGR" },
301 { CLI_LOG_RAW
, "CLI_LOG_RAW" },
302 { EMWEB_RAW
, "EMWEB_RAW" },
303 { HARDWARE_MONITOR_PORT
, "HARDWARE_MONITOR_PORT" },
304 { FPCLI_SIBYTE_CONSOLE1
, "FPCLI_SIBYTE_CONSOLE1" },
305 { FPCLI_SIBYTE_CONSOLE2
, "FPCLI_SIBYTE_CONSOLE2" },
306 { FPCLI_SIBYTE_CONSOLE3
, "FPCLI_SIBYTE_CONSOLE3" },
307 { NANNY_PORT
, "NANNY_PORT" },
308 { NANNY_PORT_MEM_MON
, "NANNY_PORT_MEM_MON" },
309 { AAA_MGMT_PORT
, "AAA_MGMT_PORT" },
311 { SIBYTE_DNLD_FILE
, "SIBYTE_DNLD_FILE" },
312 { WEB_CLI_RAW
, "WEB_CLI_RAW" },
313 { WIRED_MAC_LOOKUP
, "WIRED_MAC_LOOKUP" },
314 { ARUBA_NTPD
, "ARUBA_NTPD" },
315 { PUBSUB_SERVER
, "PUBSUB_SERVER" },
316 { FPAPPS_VRRP_PORT
, "FPAPPS_VRRP_PORT" },
317 { DBSYNC_PORT
, "DBSYNC_PORT" },
318 { FPAPPS_AUTH_PORT
, "FPAPPS_AUTH_PORT" },
319 { SAP_RRAD_PORT
, "SAP_RRAD_PORT" },
320 { MOBILE_IP
, "MOBILE_IP" },
321 { SERVER_LOAD_BALANCING
, "SERVER_LOAD_BALANCING" },
323 { SIBYTE_MACH_INFO
, "SIBYTE_MACH_INFO" },
324 { ANOMALY_DETECTION
, "ANOMALY_DETECTION" },
325 { ARUBA_FILTER
, "ARUBA_FILTER" },
326 { LICENSE_MANAGER
, "LICENSE_MANAGER" },
327 { DHCP_SERVER
, "DHCP_SERVER" },
328 { VRRP_DAEMON
, "VRRP_DAEMON" },
329 { RESOLVER_PORT
, "RESOLVER_PORT" },
330 { SSH_AUTH_PORT
, "SSH_AUTH_PORT" },
331 { AMAP_PROC
, "AMAP_PROC" },
332 { AMAP_MGMT_PORT
, "AMAP_MGMT_PORT" },
333 { SYS_MAPPER
, "SYS_MAPPER" },
334 { STATSMGR
, "STATSMGR" },
335 { SPOTMGR
, "SPOTMGR" },
336 { FAULTMGR
, "FAULTMGR" },
337 { CRYPTO_POST_PORT
, "CRYPTO_POST_PORT" },
338 { QPDQ_STANDALONE
, "QPDQ_STANDALONE" },
339 { SNMP_TRAP_RAW
, "SNMP_TRAP_RAW" },
340 { ADMINSERVER
, "ADMINSERVER" },
341 { HTTPD_WRAP
, "HTTPD_WRAP" },
342 { PROFILE_MANAGER
, "PROFILE_MANAGER" },
343 { NCFGTEST_APP
, "NCFGTEST_APP" },
344 { SYSLOGDWRAP
, "SYSLOGDWRAP" },
346 { RF_MANAGER
, "RF_MANAGER" },
347 { RF_CLIENT
, "RF_CLIENT" },
348 { PPPOE_DAEMON
, "PPPOE_DAEMON" },
349 { MMSCONFIGMGR
, "MMSCONFIGMGR" },
351 { MMSWEBSVC
, "MMSWEBSVC" },
352 { FPWEB_RAW
, "FPWEB_RAW" },
353 { PIM_TOSIBYTE
, "PIM_TOSIBYTE" },
354 { HTTPD_WRAP_AUTH_PORT
, "HTTPD_WRAP_AUTH_PORT" },
355 { REPGEN
, "REPGEN" },
356 { STATION_MANAGEMENT_LOPRI
, "STATION_MANAGEMENT_LOPRI" },
357 { AUTH_SERVER_LOPRI
, "AUTH_SERVER_LOPRI" },
358 { WLAN_MANAGEMENT_SERVER_LOPRI
, "WLAN_MANAGEMENT_SERVER_LOPRI" },
359 { MVC_SERVER
, "MVC_SERVER" },
360 { RAPPER_PORT1
, "RAPPER_PORT1" },
361 { RAPPER_PORT2
, "RAPPER_PORT2" },
362 { RAPPER_PORT3
, "RAPPER_PORT3" },
363 { RAPPER_PORT4
, "RAPPER_PORT4" },
364 { RAPPER_PORT5
, "RAPPER_PORT5" },
365 { RAPPER_PORT6
, "RAPPER_PORT6" },
366 { RAPPER_PORT7
, "RAPPER_PORT7" },
367 { RAPPER_PORT8
, "RAPPER_PORT8" },
368 { RAPPER_PORT9
, "RAPPER_PORT9" },
369 { RAPPER_PORT10
, "RAPPER_PORT10" },
370 { MESH_DAEMON
, "MESH_DAEMON" },
371 { SETUP_DIALOG
, "SETUP_DIALOG" },
372 { SYS_MAPPER_LOPRI
, "SYS_MAPPER_LOPRI" },
373 { SAPM_HYBRID_AP
, "SAPM_HYBRID_AP" },
374 { PHONE_HOME
, "PHONE_HOME" },
375 { SAPM_RAPCP
, "SAPM_RAPCP" },
376 { REM_DSLMGR
, "REM_DSLMGR" },
377 { AMAPI_SNMP_TRAP_CLIENT
, "AMAPI_SNMP_TRAP_CLIENT" },
378 { OSPF_DAEMON
, "OSPF_DAEMON" },
379 { SAMBA_WRAPPER
, "SAMBA_WRAPPER" },
380 { AMP_SERVER
, "AMP_SERVER" },
381 { MISC_PROC
, "MISC_PROC" },
382 { MSGH_HELPER
, "MSGH_HELPER" },
383 { USBHELPER_CLIENT
, "USBHELPER_CLIENT" },
384 { PB_INT_TASK
, "PB_INT_TASK" },
385 { UTILITY_PROCESS
, "UTILITY_PROCESS" },
386 { SYSMGR
, "SYSMGR" },
387 { STATION_MANAGEMENT_AP
, "STATION_MANAGEMENT_AP" },
388 { STATION_MANAGEMENT_LOPRI_AP
, "STATION_MANAGEMENT_LOPRI_AP" },
391 { LAST_SERVICE
, "LAST_SERVICE / MESSAGE_HANDLER" },
392 //{ MESSAGE_HANDLER, "MESSAGE_HANDLER" },
393 { PORT_UBT
, "PORT_UBT" },
394 { PAPI_EPHEMERAL
, "PAPI_EPHEMERAL" },
398 static value_string_ext papi_port_vals_ext
= VALUE_STRING_EXT_INIT(papi_port_vals
);
400 /* PAPI License Manager ! */
401 static const value_string licmgr_type_vals
[] = {
403 { 2, "Serial Number" },
405 { 5, "Mac Address" },
406 { 7, "License AP Remaining" },
407 { 8, "License PEF Remaining" },
408 { 9, "License RFP Remaining" },
409 { 10, "License xSec Remaining " },
410 { 11, "License ACR Remaining " },
411 { 12, "License AP Used" },
412 { 13, "License PEF Used" },
413 { 14, "License AP Used" },
414 { 15, "License xSec Used" },
415 { 16, "License ACR Used" },
416 { 17, "License WebCC Key ?" },
417 { 18, "License WebCC Remaining ?" },
418 { 19, "License WebCC Used ?" },
422 dissect_papi_license_manager(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
425 proto_tree
*licmgr_tree
, *licmgr_subtree
;
426 unsigned offset_end
, payload_len
, offset
= 0;
428 ti
= proto_tree_add_item(tree
, hf_papi_licmgr
, tvb
, offset
, -1, ENC_NA
);
429 licmgr_tree
= proto_item_add_subtree(ti
, ett_papi_licmgr
);
431 proto_tree_add_item_ret_uint(licmgr_tree
, hf_papi_licmgr_payload_len
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &payload_len
);
433 col_set_str(pinfo
->cinfo
, COL_INFO
, "PAPI - Licence Manager");
435 offset_end
= offset
+ payload_len
;
437 while (offset
< offset_end
) {
438 unsigned optlen
, type
;
439 proto_item
*tlv_item
;
441 type
= tvb_get_ntohs(tvb
, offset
);
442 optlen
= tvb_get_ntohs(tvb
, offset
+2);
443 tlv_item
= proto_tree_add_item(licmgr_tree
, hf_papi_licmgr_tlv
, tvb
, offset
, 2+2+optlen
, ENC_NA
);
445 proto_item_append_text(tlv_item
, ": (t=%d,l=%d) %s", type
, optlen
, val_to_str(type
, licmgr_type_vals
, "Unknown Type (%02d)") );
447 licmgr_subtree
= proto_item_add_subtree(tlv_item
, ett_papi_licmgr_tlv
);
449 proto_tree_add_item(licmgr_subtree
, hf_papi_licmgr_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
452 proto_tree_add_item(licmgr_subtree
, hf_papi_licmgr_length
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
455 proto_tree_add_item(licmgr_subtree
, hf_papi_licmgr_value
, tvb
, offset
, optlen
, ENC_NA
);
458 case 1: /* IP Address */
459 proto_tree_add_item(licmgr_subtree
, hf_papi_licmgr_ip
, tvb
, offset
, 4, ENC_NA
);
460 proto_item_append_text(tlv_item
, ": %s", tvb_ip_to_str(pinfo
->pool
, tvb
, offset
));
462 case 2: /* Serial Number */
463 proto_tree_add_item(licmgr_subtree
, hf_papi_licmgr_serial_number
, tvb
, offset
, 32, ENC_ASCII
);
464 proto_item_append_text(tlv_item
, ": %s", tvb_get_string_enc(pinfo
->pool
,tvb
, offset
, optlen
, ENC_ASCII
));
466 case 3: /* Hostname */
467 proto_tree_add_item(licmgr_subtree
, hf_papi_licmgr_hostname
, tvb
, offset
, optlen
, ENC_ASCII
);
468 proto_item_append_text(tlv_item
, ": %s", tvb_get_string_enc(pinfo
->pool
,tvb
, offset
, optlen
, ENC_ASCII
));
470 case 5: /* MAC Address */
471 proto_tree_add_item(licmgr_subtree
, hf_papi_licmgr_mac_address
, tvb
, offset
, optlen
, ENC_NA
);
472 proto_item_append_text(tlv_item
, ": %s", tvb_get_ether_name(tvb
, offset
));
474 case 7: /* License AP remaining */
475 proto_tree_add_item(licmgr_subtree
, hf_papi_licmgr_license_ap_remaining
, tvb
, offset
, 4, ENC_NA
);
476 proto_item_append_text(tlv_item
, ": %u", tvb_get_ntohl(tvb
, offset
));
478 case 8: /* License PEF remaining */
479 proto_tree_add_item(licmgr_subtree
, hf_papi_licmgr_license_pef_remaining
, tvb
, offset
, 4, ENC_NA
);
480 proto_item_append_text(tlv_item
, ": %u", tvb_get_ntohl(tvb
, offset
));
482 case 9: /* License RFP remaining */
483 proto_tree_add_item(licmgr_subtree
, hf_papi_licmgr_license_rfp_remaining
, tvb
, offset
, 4, ENC_NA
);
484 proto_item_append_text(tlv_item
, ": %u", tvb_get_ntohl(tvb
, offset
));
486 case 10: /* License xSec remaining */
487 proto_tree_add_item(licmgr_subtree
, hf_papi_licmgr_license_xsec_remaining
, tvb
, offset
, 4, ENC_NA
);
488 proto_item_append_text(tlv_item
, ": %u", tvb_get_ntohl(tvb
, offset
));
490 case 11: /* License ACR remaining */
491 proto_tree_add_item(licmgr_subtree
, hf_papi_licmgr_license_acr_remaining
, tvb
, offset
, 4, ENC_NA
);
492 proto_item_append_text(tlv_item
, ": %u", tvb_get_ntohl(tvb
, offset
));
494 case 12: /* License AP used */
495 proto_tree_add_item(licmgr_subtree
, hf_papi_licmgr_license_ap_used
, tvb
, offset
, 4, ENC_NA
);
496 proto_item_append_text(tlv_item
, ": %u", tvb_get_ntohl(tvb
, offset
));
498 case 13: /* License PEF used */
499 proto_tree_add_item(licmgr_subtree
, hf_papi_licmgr_license_pef_used
, tvb
, offset
, 4, ENC_NA
);
500 proto_item_append_text(tlv_item
, ": %u", tvb_get_ntohl(tvb
, offset
));
502 case 14: /* License RFP used */
503 proto_tree_add_item(licmgr_subtree
, hf_papi_licmgr_license_rfp_used
, tvb
, offset
, 4, ENC_NA
);
504 proto_item_append_text(tlv_item
, ": %u", tvb_get_ntohl(tvb
, offset
));
506 case 15: /* License xSec used */
507 proto_tree_add_item(licmgr_subtree
, hf_papi_licmgr_license_xsec_used
, tvb
, offset
, 4, ENC_NA
);
508 proto_item_append_text(tlv_item
, ": %u", tvb_get_ntohl(tvb
, offset
));
510 case 16: /* License ACR used */
511 proto_tree_add_item(licmgr_subtree
, hf_papi_licmgr_license_acr_used
, tvb
, offset
, 4, ENC_NA
);
512 proto_item_append_text(tlv_item
, ": %u", tvb_get_ntohl(tvb
, offset
));
518 proto_tree_add_item(licmgr_tree
, hf_papi_licmgr_padding
, tvb
, offset
, -1, ENC_NA
);
519 offset
+= tvb_reported_length_remaining(tvb
, offset
);
524 /* PAPI Debug loop ! */
526 dissect_papi_debug(tvbuff_t
*tvb
, packet_info
*pinfo
, unsigned offset
, proto_tree
*tree
)
529 proto_tree
*debug_tree
, *debug_sub_tree
;
532 ti
= proto_tree_add_item(tree
, hf_papi_debug
, tvb
, offset
, -1, ENC_NA
);
533 debug_tree
= proto_item_add_subtree(ti
, ett_papi
);
535 while(offset
< tvb_reported_length(tvb
)) {
536 switch(tvb_get_uint8(tvb
,offset
)) {
538 ti
= proto_tree_add_item(debug_tree
, hf_papi_debug_text
, tvb
, offset
+3, tvb_get_ntohs(tvb
,offset
+1), ENC_ASCII
);
539 debug_sub_tree
= proto_item_add_subtree(ti
, ett_papi
);
540 proto_tree_add_item(debug_sub_tree
, hf_papi_debug_text_length
, tvb
, offset
+1, 2, ENC_BIG_ENDIAN
);
541 offset
+= tvb_get_ntohs(tvb
, offset
+1) + 3;
544 proto_tree_add_item(debug_tree
, hf_papi_debug_48bits
, tvb
, offset
+1, 6, ENC_BIG_ENDIAN
);
548 proto_tree_add_item(debug_tree
, hf_papi_debug_8bits
, tvb
, offset
+1, 1, ENC_BIG_ENDIAN
);
552 proto_tree_add_item(debug_tree
, hf_papi_debug_16bits
, tvb
, offset
+1, 2, ENC_BIG_ENDIAN
);
556 proto_tree_add_item(debug_tree
, hf_papi_debug_32bits
, tvb
, offset
+1, 4, ENC_BIG_ENDIAN
);
560 proto_tree_add_item(debug_tree
, hf_papi_debug_ipv4
, tvb
, offset
+1, 4, ENC_BIG_ENDIAN
);
564 proto_tree_add_item(debug_tree
, hf_papi_debug_16bits
, tvb
, offset
+1, 2, ENC_BIG_ENDIAN
);
568 ti
= proto_tree_add_item(debug_tree
, hf_papi_debug_bytes
, tvb
, offset
+3, tvb_get_ntohs(tvb
,offset
+1), ENC_NA
);
569 debug_sub_tree
= proto_item_add_subtree(ti
, ett_papi
);
570 proto_tree_add_item(debug_sub_tree
, hf_papi_debug_bytes_length
, tvb
, offset
+1, 2, ENC_BIG_ENDIAN
);
571 offset
+= tvb_get_ntohs(tvb
,offset
+1) + 3;
574 proto_tree_add_item(debug_tree
, hf_papi_debug_64bits
, tvb
, offset
+1, 8, ENC_BIG_ENDIAN
);
578 proto_tree_add_expert_format(debug_tree
, pinfo
, &ei_papi_debug_unknown
, tvb
, offset
, 1, "Unknown (%d)", tvb_get_uint8(tvb
, offset
));
587 dissect_papi(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
590 proto_tree
*papi_tree
;
592 uint32_t dest_port
, src_port
, hdr_version
;
596 /* All PAPI packet start with 0x4972 ! */
597 if ( tvb_get_ntohs(tvb
, offset
) != 0x4972 )
600 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "PAPI");
601 col_set_str(pinfo
->cinfo
, COL_INFO
, "PAPI - Aruba AP Control Protocol");
603 ti
= proto_tree_add_item(tree
, proto_papi
, tvb
, 0, PAPI_PACKET_SIZE
, ENC_NA
);
604 papi_tree
= proto_item_add_subtree(ti
, ett_papi
);
606 proto_tree_add_item(papi_tree
, hf_papi_hdr_magic
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
609 proto_tree_add_item_ret_uint(papi_tree
, hf_papi_hdr_version
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &hdr_version
);
612 proto_tree_add_item(papi_tree
, hf_papi_hdr_dest_ip
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
615 proto_tree_add_item(papi_tree
, hf_papi_hdr_src_ip
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
618 proto_tree_add_item(papi_tree
, hf_papi_hdr_nat_port_number
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
621 proto_tree_add_item(papi_tree
, hf_papi_hdr_garbage
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
624 proto_tree_add_item_ret_uint(papi_tree
, hf_papi_hdr_dest_port
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &dest_port
);
627 proto_tree_add_item_ret_uint(papi_tree
, hf_papi_hdr_src_port
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &src_port
);
630 proto_tree_add_item(papi_tree
, hf_papi_hdr_packet_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
633 proto_tree_add_item(papi_tree
, hf_papi_hdr_packet_size
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
636 proto_tree_add_item(papi_tree
, hf_papi_hdr_seq_number
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
639 proto_tree_add_item(papi_tree
, hf_papi_hdr_message_code
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
642 proto_tree_add_item(papi_tree
, hf_papi_hdr_checksum
, tvb
, offset
, 16, ENC_NA
);
645 if (hdr_version
== V4V6_HDR_VERSION
) {
647 proto_tree_add_item(papi_tree
, hf_papi_hdr_destipv6
, tvb
, offset
, IPv6_ADDR_SIZE
, ENC_NA
);
648 offset
+= IPv6_ADDR_SIZE
;
650 proto_tree_add_item(papi_tree
, hf_papi_hdr_srcipv6
, tvb
, offset
, IPv6_ADDR_SIZE
, ENC_NA
);
651 offset
+= IPv6_ADDR_SIZE
;
657 offset
= dissect_papi_debug(tvb
, pinfo
, offset
, papi_tree
);
660 next_tvb
= tvb_new_subset_remaining(tvb
, offset
);
661 if (!dissector_try_uint_with_data(papi_dissector_table
, dest_port
, next_tvb
, pinfo
, tree
, true, NULL
)) {
662 if (!dissector_try_uint_with_data(papi_dissector_table
, src_port
, next_tvb
, pinfo
, tree
, true, NULL
)) {
663 call_data_dissector(next_tvb
, pinfo
, tree
);
667 return tvb_captured_length(tvb
);
671 proto_register_papi(void)
673 module_t
*papi_module
;
675 static hf_register_info hf
[] = {
676 { &hf_papi_hdr_magic
,
677 { "Magic", "papi.hdr.magic",
678 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
679 "PAPI Header Magic Number", HFILL
}
681 { &hf_papi_hdr_version
,
682 { "Version", "papi.hdr.version",
683 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
684 "PAPI Protocol Version", HFILL
}
686 { &hf_papi_hdr_dest_ip
,
687 { "Destination IP", "papi.hdr.dest.ip",
688 FT_IPv4
, BASE_NONE
, NULL
, 0x0,
691 { &hf_papi_hdr_src_ip
,
692 { "Source IP", "papi.hdr.src.ip",
693 FT_IPv4
, BASE_NONE
, NULL
, 0x0,
696 { &hf_papi_hdr_nat_port_number
,
697 { "NAT Port Number", "papi.hdr.nat_port_number",
698 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
701 { &hf_papi_hdr_garbage
,
702 { "Garbage", "papi.hdr.garbage",
703 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
706 { &hf_papi_hdr_dest_port
,
707 { "Destination Port", "papi.hdr.dest.port",
708 FT_UINT16
, BASE_DEC
|BASE_EXT_STRING
, &papi_port_vals_ext
, 0x0,
711 { &hf_papi_hdr_src_port
,
712 { "Source Port", "papi.hdr.src.port",
713 FT_UINT16
, BASE_DEC
|BASE_EXT_STRING
, &papi_port_vals_ext
, 0x0,
716 { &hf_papi_hdr_packet_type
,
717 { "Packet Type", "papi.hdr.packet.type",
718 FT_UINT16
, BASE_DEC
|BASE_HEX
, NULL
, 0x0,
721 { &hf_papi_hdr_packet_size
,
722 { "Packet Size", "papi.hdr.packet.size",
723 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
726 { &hf_papi_hdr_seq_number
,
727 { "Sequence Number", "papi.hdr.seq_number",
728 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
731 { &hf_papi_hdr_message_code
,
732 { "Message Code", "papi.hdr.message_code",
733 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
736 { &hf_papi_hdr_checksum
,
737 { "Checksum", "papi.hdr.checksum",
738 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
741 { &hf_papi_hdr_destipv6
,/* IPv6 address of Destination */
742 { "Destination IPv6", "papi.hdr.dest.ipv6",
743 FT_IPv6
, BASE_NONE
, NULL
, 0x0,
746 { &hf_papi_hdr_srcipv6
,/* IPv6 address of Source */
747 { "Source IPv6", "papi.hdr.src.ipv6",
748 FT_IPv6
, BASE_NONE
, NULL
, 0x0,
752 { "Debug", "papi.debug",
753 FT_NONE
, BASE_NONE
, NULL
, 0x0,
756 { &hf_papi_debug_text
,
757 { "Debug (Text)", "papi.debug.text",
758 FT_STRING
, BASE_NONE
, NULL
, 0x0,
761 { &hf_papi_debug_text_length
,
762 { "Debug Text Length", "papi.debug.text_length",
763 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
766 { &hf_papi_debug_bytes
,
767 { "Debug (Bytes)", "papi.debug.bytes",
768 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
771 { &hf_papi_debug_bytes_length
,
772 { "Debug Bytes Length", "papi.debug.bytes_length",
773 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
776 { &hf_papi_debug_48bits
,
777 { "Debug (48 Bits)", "papi.debug.48bits",
778 FT_UINT64
, BASE_DEC
, NULL
, 0x0,
781 { &hf_papi_debug_8bits
,
782 { "Debug (8 Bits)", "papi.debug.8bits",
783 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
786 { &hf_papi_debug_16bits
,
787 { "Debug (16 Bits)", "papi.debug.16bits",
788 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
791 { &hf_papi_debug_32bits
,
792 { "Debug (32 Bits)", "papi.debug.32bits",
793 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
796 { &hf_papi_debug_ipv4
,
797 { "Debug (IPv4)", "papi.debug.ipv4",
798 FT_IPv4
, BASE_NONE
, NULL
, 0x0,
801 { &hf_papi_debug_64bits
,
802 { "Debug (64 Bits)", "papi.debug.64bits",
803 FT_UINT64
, BASE_DEC
, NULL
, 0x0,
808 { "License Manager", "papi.licmgr",
809 FT_NONE
, BASE_NONE
, NULL
, 0x0,
812 { &hf_papi_licmgr_payload_len
,
813 { "Payload Length", "papi.licmgr.payload_len",
814 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
817 { &hf_papi_licmgr_tlv
,
818 { "TLV", "papi.licmgr.tlv",
819 FT_NONE
, BASE_NONE
, NULL
, 0x0,
822 { &hf_papi_licmgr_type
,
823 { "Type", "papi.licmgr.type",
824 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
827 { &hf_papi_licmgr_length
,
828 { "Length", "papi.licmgr.length",
829 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
832 { &hf_papi_licmgr_value
,
833 { "Value", "papi.licmgr.value",
834 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
837 { &hf_papi_licmgr_ip
,
838 { "License Manager IP Address", "papi.licmgr.ip",
839 FT_IPv4
, BASE_NONE
, NULL
, 0x0,
842 { &hf_papi_licmgr_serial_number
,
843 { "Serial Number", "papi.licmgr.serial_number",
844 FT_STRING
, BASE_NONE
, NULL
, 0x0,
847 { &hf_papi_licmgr_hostname
,
848 { "Hostname", "papi.licmgr.hostname",
849 FT_STRING
, BASE_NONE
, NULL
, 0x0,
852 { &hf_papi_licmgr_mac_address
,
853 { "MAC Address", "papi.licmgr.mac_address",
854 FT_ETHER
, BASE_NONE
, NULL
, 0x0,
857 { &hf_papi_licmgr_license_ap_remaining
,
858 { "License AP remaining", "papi.licmgr.license.ap.remaining",
859 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
862 { &hf_papi_licmgr_license_pef_remaining
,
863 { "License PEF remaining", "papi.licmgr.license.pef.remaining",
864 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
867 { &hf_papi_licmgr_license_rfp_remaining
,
868 { "License RFP remaining", "papi.licmgr.license.rfp.remaining",
869 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
872 { &hf_papi_licmgr_license_xsec_remaining
,
873 { "License xSEC remaining", "papi.licmgr.license.xsec.remaining",
874 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
877 { &hf_papi_licmgr_license_acr_remaining
,
878 { "License ACR remaining", "papi.licmgr.license.acr.remaining",
879 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
882 { &hf_papi_licmgr_license_ap_used
,
883 { "License AP used", "papi.licmgr.license.ap.used",
884 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
887 { &hf_papi_licmgr_license_pef_used
,
888 { "License PEF used", "papi.licmgr.license.pef.used",
889 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
892 { &hf_papi_licmgr_license_rfp_used
,
893 { "License RFP used", "papi.licmgr.license.rfp.used",
894 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
897 { &hf_papi_licmgr_license_xsec_used
,
898 { "License xSec used", "papi.licmgr.license.xsec.used",
899 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
902 { &hf_papi_licmgr_license_acr_used
,
903 { "License ACR used", "papi.licmgr.license.acr.used",
904 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
907 { &hf_papi_licmgr_padding
,
908 { "Padding", "papi.licmgr.padding",
909 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
914 /* Setup protocol subtree array */
915 static int *ett
[] = {
921 static ei_register_info ei
[] = {
922 { &ei_papi_debug_unknown
, { "papi.debug.unknown", PI_PROTOCOL
, PI_WARN
, "Unknown", EXPFILL
}},
925 expert_module_t
* expert_papi
;
927 proto_papi
= proto_register_protocol("Aruba PAPI", "PAPI", "papi");
929 proto_register_field_array(proto_papi
, hf
, array_length(hf
));
930 proto_register_subtree_array(ett
, array_length(ett
));
931 expert_papi
= expert_register_protocol(proto_papi
);
932 expert_register_field_array(expert_papi
, ei
, array_length(ei
));
934 papi_module
= prefs_register_protocol(proto_papi
, NULL
);
936 /* creating a dissector table for the protocol & registering the same */
937 papi_dissector_table
= register_dissector_table("papi.port", "PAPI protocol", proto_papi
, FT_UINT16
, BASE_DEC
);
939 prefs_register_bool_preference(papi_module
, "experimental_decode",
940 "Do experimental decode",
941 "Attempt to decode parts of the message that aren't fully understood yet",
944 papi_handle
= register_dissector("papi", dissect_papi
, proto_papi
);
949 proto_reg_handoff_papi(void)
951 dissector_add_uint("papi.port", LICENSE_MANAGER
, create_dissector_handle(dissect_papi_license_manager
, -1));
952 dissector_add_uint_with_preference("udp.port", UDP_PORT_PAPI
, papi_handle
);
955 * Editor modelines - https://www.wireshark.org/tools/modelines.html
960 * indent-tabs-mode: nil
963 * vi: set shiftwidth=4 tabstop=8 expandtab:
964 * :indentSize=4:tabSize=8:noTabs=true: