PageRenderTime 60ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 1ms

/epan/dissectors/packet-ppp.c

https://github.com/labx-technologies-llc/wireshark
C | 6870 lines | 5576 code | 732 blank | 562 comment | 274 complexity | d565937fffc7e1d4a6d6170abe1b6cf1 MD5 | raw file
Possible License(s): GPL-2.0, BSD-3-Clause

Large files files are truncated, but you can click here to view the full file

  1. /* packet-ppp.c
  2. * Routines for ppp packet disassembly
  3. * RFC 1661, RFC 1662
  4. *
  5. * $Id$
  6. *
  7. * Wireshark - Network traffic analyzer
  8. * By Gerald Combs <gerald@wireshark.org>
  9. *
  10. * This file created and by Mike Hall <mlh@io.com>
  11. * Copyright 1998
  12. *
  13. * This program is free software; you can redistribute it and/or
  14. * modify it under the terms of the GNU General Public License
  15. * as published by the Free Software Foundation; either version 2
  16. * of the License, or (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  26. */
  27. #include "config.h"
  28. #include <glib.h>
  29. #include <epan/packet.h>
  30. #include <epan/prefs.h>
  31. #include <epan/wmem/wmem.h>
  32. #include "packet-ppp.h"
  33. #include <epan/ppptypes.h>
  34. #include <epan/etypes.h>
  35. #include <epan/expert.h>
  36. #include <epan/ip_opts.h>
  37. #include <epan/atalk-utils.h>
  38. #include "packet-chdlc.h"
  39. #include "packet-ip.h"
  40. #include "packet-ipx.h"
  41. #include "packet-vines.h"
  42. #include <epan/nlpid.h>
  43. #include <epan/crc16-tvb.h>
  44. #include <epan/crc32-tvb.h>
  45. #include <epan/ipproto.h>
  46. #include <epan/addr_resolv.h>
  47. #include <epan/oui.h>
  48. #include "packet-usb.h"
  49. #include "packet-sll.h"
  50. static int proto_ppp = -1;
  51. static int hf_ppp_direction = -1;
  52. static int hf_ppp_address = -1;
  53. static int hf_ppp_control = -1;
  54. static int hf_ppp_protocol = -1;
  55. static int hf_ppp_code = -1;
  56. static int hf_ppp_identifier = -1;
  57. static int hf_ppp_length = -1;
  58. static int hf_ppp_magic_number = -1;
  59. static int hf_ppp_oui = -1;
  60. static int hf_ppp_kind = -1;
  61. static int hf_ppp_data = -1;
  62. static int hf_ppp_opt_type = -1;
  63. static int hf_ppp_opt_type_copy = -1;
  64. static int hf_ppp_opt_type_class = -1;
  65. static int hf_ppp_opt_type_number = -1;
  66. static gint ett_ppp = -1;
  67. static gint ett_ppp_opt_type = -1;
  68. static expert_field ei_ppp_opt_len_invalid = EI_INIT;
  69. static int proto_ppp_hdlc = -1;
  70. static gint ett_ppp_hdlc_data = -1;
  71. static int proto_lcp = -1;
  72. static gint ett_lcp = -1;
  73. static gint ett_lcp_options = -1;
  74. static gint ett_lcp_vendor_opt = -1;
  75. static gint ett_lcp_mru_opt = -1;
  76. static gint ett_lcp_asyncmap_opt = -1;
  77. static gint ett_lcp_authprot_opt = -1;
  78. static gint ett_lcp_qualprot_opt = -1;
  79. static gint ett_lcp_magicnumber_opt = -1;
  80. static gint ett_lcp_linkqualmon_opt = -1;
  81. static gint ett_lcp_pcomp_opt = -1;
  82. static gint ett_lcp_acccomp_opt = -1;
  83. static gint ett_lcp_fcs_alternatives_opt = -1;
  84. static gint ett_lcp_self_desc_pad_opt = -1;
  85. static gint ett_lcp_numbered_mode_opt = -1;
  86. static gint ett_lcp_callback_opt = -1;
  87. static gint ett_lcp_compound_frames_opt = -1;
  88. static gint ett_lcp_nomdataencap_opt = -1;
  89. static gint ett_lcp_multilink_mrru_opt = -1;
  90. static gint ett_lcp_multilink_ssnh_opt = -1;
  91. static gint ett_lcp_multilink_ep_disc_opt = -1;
  92. static gint ett_lcp_magic_block = -1;
  93. static gint ett_lcp_dce_identifier_opt = -1;
  94. static gint ett_lcp_multilink_pp_opt = -1;
  95. static gint ett_lcp_bacp_link_discrim_opt = -1;
  96. static gint ett_lcp_auth_opt = -1;
  97. static gint ett_lcp_cobs_opt = -1;
  98. static gint ett_lcp_prefix_elision_opt = -1;
  99. static gint ett_multilink_hdr_fmt_opt = -1;
  100. static gint ett_lcp_internationalization_opt = -1;
  101. static gint ett_lcp_simple_opt = -1;
  102. static int proto_ipcp = -1;
  103. static gint ett_ipcp = -1;
  104. static gint ett_ipcp_options = -1;
  105. static gint ett_ipcp_ipaddrs_opt = -1;
  106. static gint ett_ipcp_compress_opt = -1;
  107. static gint ett_ipcp_ipaddr_opt = -1;
  108. static gint ett_ipcp_mobileipv4_opt = -1;
  109. static gint ett_ipcp_pridns_opt = -1;
  110. static gint ett_ipcp_secdns_opt = -1;
  111. static gint ett_ipcp_prinbns_opt = -1;
  112. static gint ett_ipcp_secnbns_opt = -1;
  113. static gint ett_ipcp_iphc_rtp_compress_opt = -1;
  114. static gint ett_ipcp_iphc_enhanced_rtp_compress_opt = -1;
  115. static gint ett_ipcp_iphc_neghdrcomp_opt = -1;
  116. static gint ett_ipcp_rohc_profiles_opt = -1;
  117. static int proto_vsncp = -1;
  118. static gint ett_vsncp = -1;
  119. static gint ett_vsncp_options = -1;
  120. static int proto_vsnp = -1;
  121. static gint hf_vsnp_pdnid = -1;
  122. static gint ett_vsnp =-1;
  123. static int proto_osinlcp = -1;
  124. static gint ett_osinlcp = -1;
  125. static gint ett_osinlcp_options = -1;
  126. static gint ett_osinlcp_align_npdu_opt = -1;
  127. static int proto_bcp = -1;
  128. static int hf_bcp_flags = -1;
  129. static int hf_bcp_fcs_present = -1;
  130. static int hf_bcp_zeropad = -1;
  131. static int hf_bcp_bcontrol = -1;
  132. static int hf_bcp_pads = -1;
  133. static int hf_bcp_mac_type = -1;
  134. static gint ett_bcp = -1;
  135. static gint ett_bcp_flags = -1;
  136. static int proto_ccp = -1;
  137. static gint ett_ccp = -1;
  138. static gint ett_ccp_options = -1;
  139. static gint ett_ccp_oui_opt = -1;
  140. static gint ett_ccp_predict1_opt = -1;
  141. static gint ett_ccp_predict2_opt = -1;
  142. static gint ett_ccp_puddle_opt = -1;
  143. static gint ett_ccp_hpppc_opt = -1;
  144. static gint ett_ccp_stac_opt = -1;
  145. static gint ett_ccp_stac_opt_check_mode = -1;
  146. static gint ett_ccp_mppe_opt = -1;
  147. static gint ett_ccp_mppe_opt_supp_bits = -1;
  148. static gint ett_ccp_gfza_opt = -1;
  149. static gint ett_ccp_v42bis_opt = -1;
  150. static gint ett_ccp_bsdcomp_opt = -1;
  151. static gint ett_ccp_lzsdcp_opt = -1;
  152. static gint ett_ccp_mvrca_opt = -1;
  153. static gint ett_ccp_dce_opt = -1;
  154. static gint ett_ccp_deflate_opt = -1;
  155. static gint ett_ccp_v44lzjh_opt = -1;
  156. static int proto_cbcp = -1;
  157. static gint ett_cbcp = -1;
  158. static gint ett_cbcp_options = -1;
  159. static gint ett_cbcp_callback_opt = -1;
  160. static gint ett_cbcp_callback_opt_addr = -1;
  161. static int proto_bacp = -1;
  162. static gint ett_bacp = -1;
  163. static gint ett_bacp_options = -1;
  164. static gint ett_bacp_favored_peer_opt = -1;
  165. static int proto_bap = -1;
  166. static gint ett_bap = -1;
  167. static gint ett_bap_options = -1;
  168. static gint ett_bap_link_type_opt = -1;
  169. static gint ett_bap_phone_delta_opt = -1;
  170. static gint ett_bap_phone_delta_subopt = -1;
  171. static gint ett_bap_call_status_opt = -1;
  172. static int proto_comp_data = -1;
  173. #if 0 /* see dissect_comp_data() */
  174. static gint ett_comp_data = -1;
  175. #endif
  176. static int proto_pppmuxcp = -1;
  177. static int hf_pppmux_flags_pid = -1;
  178. static int hf_pppmux_flags_field_length = -1;
  179. static gint ett_pppmuxcp = -1;
  180. static gint ett_pppmuxcp_options = -1;
  181. static int proto_pppmux = -1;
  182. static int hf_pppmux_protocol = -1;
  183. static gint ett_pppmux = -1;
  184. static gint ett_pppmux_subframe = -1;
  185. static gint ett_pppmux_subframe_hdr = -1;
  186. static gint ett_pppmux_subframe_flags = -1;
  187. static gint ett_pppmux_subframe_info = -1;
  188. static int proto_mp = -1;
  189. static int hf_mp_frag_first = -1;
  190. static int hf_mp_frag_last = -1;
  191. static int hf_mp_short_sequence_num_reserved = -1;
  192. static int hf_mp_sequence_num = -1;
  193. static int hf_mp_sequence_num_reserved = -1;
  194. static int hf_mp_short_sequence_num = -1;
  195. static int ett_mp = -1;
  196. static int ett_mp_flags = -1;
  197. static int proto_mplscp = -1;
  198. static gint ett_mplscp = -1;
  199. static gint ett_mplscp_options = -1;
  200. static int proto_cdpcp = -1;
  201. static gint ett_cdpcp = -1;
  202. static gint ett_cdpcp_options = -1;
  203. static int proto_pap = -1; /* PAP vars */
  204. static gint ett_pap = -1;
  205. static gint ett_pap_data = -1;
  206. static gint hf_pap_code = -1;
  207. static gint hf_pap_identifier = -1;
  208. static gint hf_pap_length = -1;
  209. static gint hf_pap_data = -1;
  210. static gint hf_pap_peer_id = -1;
  211. static gint hf_pap_peer_id_length = -1;
  212. static gint hf_pap_password = -1;
  213. static gint hf_pap_password_length = -1;
  214. static gint hf_pap_message = -1;
  215. static gint hf_pap_message_length = -1;
  216. static gint hf_pap_stuff = -1;
  217. static int proto_chap = -1; /* CHAP vars */
  218. static gint ett_chap = -1;
  219. static gint ett_chap_data = -1;
  220. static gint hf_chap_code = -1;
  221. static gint hf_chap_identifier = -1;
  222. static gint hf_chap_length = -1;
  223. static gint hf_chap_data = -1;
  224. static gint hf_chap_value_size = -1;
  225. static gint hf_chap_value = -1;
  226. static gint hf_chap_name = -1;
  227. static gint hf_chap_message = -1;
  228. static int proto_ipv6cp = -1; /* IPv6CP vars */
  229. static gint ett_ipv6cp = -1;
  230. static gint ett_ipv6cp_options = -1;
  231. static gint ett_ipv6cp_if_id_opt = -1;
  232. static gint ett_ipv6cp_compress_opt = -1;
  233. static int proto_iphc_crtp = -1; /* CRTP vars */
  234. static int hf_iphc_crtp_cid8 = -1;
  235. static int hf_iphc_crtp_cid16 = -1;
  236. static int hf_iphc_crtp_gen = -1;
  237. static int hf_iphc_crtp_seq = -1;
  238. static int hf_iphc_crtp_fh_flags = -1;
  239. static int hf_iphc_crtp_cs_flags = -1;
  240. static int hf_iphc_crtp_cs_cnt = -1;
  241. static int hf_iphc_crtp_cs_invalid = -1;
  242. static gint ett_iphc_crtp = -1;
  243. static gint ett_iphc_crtp_hdr = -1;
  244. static gint ett_iphc_crtp_info = -1;
  245. static dissector_table_t ppp_subdissector_table;
  246. static dissector_handle_t chdlc_handle;
  247. static dissector_handle_t data_handle;
  248. static dissector_handle_t eth_withfcs_handle;
  249. static dissector_handle_t eth_withoutfcs_handle;
  250. static const value_string ppp_direction_vals[] = {
  251. {P2P_DIR_RECV, "DCE->DTE"},
  252. {P2P_DIR_SENT, "DTE->DCE"},
  253. {0, NULL}
  254. };
  255. /* options */
  256. static gint ppp_fcs_decode = 0; /* 0 = No FCS, 1 = 16 bit FCS, 2 = 32 bit FCS */
  257. #define NO_FCS 0
  258. #define FCS_16 1
  259. #define FCS_32 2
  260. const enum_val_t fcs_options[] = {
  261. {"none", "None", NO_FCS},
  262. {"16-bit", "16-Bit", FCS_16},
  263. {"32-bit", "32-Bit", FCS_32},
  264. {NULL, NULL, -1}
  265. };
  266. gboolean ppp_vj_decomp = TRUE; /* Default to VJ header decompression */
  267. /*
  268. * For Default Protocol ID negotiated with PPPMuxCP. We need to
  269. * this ID so that if the first subframe doesn't have protocol
  270. * ID, we can use it
  271. */
  272. static guint pppmux_def_prot_id = 0;
  273. /* PPP definitions */
  274. /*
  275. * Used by the GTP dissector as well.
  276. * www.iana.org/assignments/ppp-numbers
  277. */
  278. static const value_string ppp_vals[] = {
  279. {PPP_PADDING, "Padding Protocol"},
  280. {PPP_ROHC_SCID, "ROHC small-CID"},
  281. {PPP_ROHC_LCID, "ROHC large-CID"},
  282. {PPP_IP, "Internet Protocol version 4"},
  283. {PPP_OSI, "OSI Network Layer"},
  284. {PPP_XNSIDP, "Xerox NS IDP"},
  285. {PPP_DEC4, "DECnet Phase IV"},
  286. {PPP_AT, "Appletalk"},
  287. {PPP_IPX, "Novell IPX"},
  288. {PPP_VJC_COMP, "Van Jacobson Compressed TCP/IP"},
  289. {PPP_VJC_UNCOMP, "Van Jacobson Uncompressed TCP/IP"},
  290. {PPP_BCP, "Bridging PDU"},
  291. {PPP_ST, "Stream Protocol (ST-II)"},
  292. {PPP_VINES, "Banyan Vines"},
  293. {PPP_AT_EDDP, "AppleTalk EDDP"},
  294. {PPP_AT_SB, "AppleTalk SmartBuffered"},
  295. {PPP_MP, "Multi-Link"},
  296. {PPP_NB, "NETBIOS Framing"},
  297. {PPP_CISCO, "Cisco Systems"},
  298. {PPP_ASCOM, "Ascom Timeplex"},
  299. {PPP_LBLB, "Fujitsu Link Backup and Load Balancing (LBLB)"},
  300. {PPP_RL, "DCA Remote Lan"},
  301. {PPP_SDTP, "Serial Data Transport Protocol (PPP-SDTP)"},
  302. {PPP_LLC, "SNA over 802.2"},
  303. {PPP_SNA, "SNA"},
  304. {PPP_IPV6HC, "IPv6 Header Compression "},
  305. {PPP_KNX, "KNX Bridging Data"},
  306. {PPP_ENCRYPT, "Encryption"},
  307. {PPP_ILE, "Individual Link Encryption"},
  308. {PPP_IPV6, "Internet Protocol version 6"},
  309. {PPP_MUX, "PPP Muxing"},
  310. {PPP_VSNP, "Vendor-Specific Network Protocol (VSNP)"},
  311. {PPP_TNP, "TRILL Network Protocol (TNP)"},
  312. {PPP_RTP_FH, "RTP IPHC Full Header"},
  313. {PPP_RTP_CTCP, "RTP IPHC Compressed TCP"},
  314. {PPP_RTP_CNTCP, "RTP IPHC Compressed Non TCP"},
  315. {PPP_RTP_CUDP8, "RTP IPHC Compressed UDP 8"},
  316. {PPP_RTP_CRTP8, "RTP IPHC Compressed RTP 8"},
  317. {PPP_STAMPEDE, "Stampede Bridging"},
  318. {PPP_MPPLUS, "MP+ Protocol"},
  319. {PPP_NTCITS_IPI, "NTCITS IPI"},
  320. {PPP_ML_SLCOMP, "Single link compression in multilink"},
  321. {PPP_COMP, "Compressed datagram"},
  322. {PPP_STP_HELLO, "802.1d Hello Packets"},
  323. {PPP_IBM_SR, "IBM Source Routing BPDU"},
  324. {PPP_DEC_LB, "DEC LANBridge100 Spanning Tree"},
  325. {PPP_CDP, "Cisco Discovery Protocol"},
  326. {PPP_NETCS, "Netcs Twin Routing"},
  327. {PPP_STP, "STP - Scheduled Transfer Protocol"},
  328. {PPP_EDP, "EDP - Extreme Discovery Protocol"},
  329. {PPP_OSCP, "Optical Supervisory Channel Protocol (OSCP)"},
  330. {PPP_OSCP2, "Optical Supervisory Channel Protocol (OSCP)"},
  331. {PPP_LUXCOM, "Luxcom"},
  332. {PPP_SIGMA, "Sigma Network Systems"},
  333. {PPP_ACSP, "Apple Client Server Protocol"},
  334. {PPP_MPLS_UNI, "MPLS Unicast"},
  335. {PPP_MPLS_MULTI, "MPLS Multicast"},
  336. {PPP_P12844, "IEEE p1284.4 standard - data packets"},
  337. {PPP_TETRA, "ETSI TETRA Network Protocol Type 1"},
  338. {PPP_MFTP, "Multichannel Flow Treatment Protocol"},
  339. {PPP_RTP_CTCPND, "RTP IPHC Compressed TCP No Delta"},
  340. {PPP_RTP_CS, "RTP IPHC Context State"},
  341. {PPP_RTP_CUDP16, "RTP IPHC Compressed UDP 16"},
  342. {PPP_RTP_CRDP16, "RTP IPHC Compressed RTP 16"},
  343. {PPP_CCCP, "Cray Communications Control Protocol"},
  344. {PPP_CDPD_MNRP, "CDPD Mobile Network Registration Protocol"},
  345. {PPP_EXPANDAP, "Expand accelerator protocol"},
  346. {PPP_ODSICP, "ODSICP NCP"},
  347. {PPP_DOCSIS, "DOCSIS DLL"},
  348. {PPP_CETACEANNDP, "Cetacean Network Detection Protocol"},
  349. {PPP_LZS, "Stacker LZS"},
  350. {PPP_REFTEK, "RefTek Protocol"},
  351. {PPP_FC, "Fibre Channel"},
  352. {PPP_EMIT, "EMIT Protocols"},
  353. {PPP_VSP, "Vendor-Specific Protocol (VSP)"},
  354. {PPP_TLSP, "TRILL Link State Protocol (TLSP)"},
  355. {PPP_IPCP, "Internet Protocol Control Protocol"},
  356. {PPP_OSINLCP, "OSI Network Layer Control Protocol"},
  357. {PPP_XNSIDPCP, "Xerox NS IDP Control Protocol"},
  358. {PPP_DECNETCP, "DECnet Phase IV Control Protocol"},
  359. {PPP_ATCP, "AppleTalk Control Protocol"},
  360. {PPP_IPXCP, "Novell IPX Control Protocol"},
  361. {PPP_BRIDGENCP, "Bridging NCP"},
  362. {PPP_SPCP, "Stream Protocol Control Protocol"},
  363. {PPP_BVCP, "Banyan Vines Control Protocol"},
  364. {PPP_MLCP, "Multi-Link Control Protocol"},
  365. {PPP_NBCP, "NETBIOS Framing Control Protocol"},
  366. {PPP_CISCOCP, "Cisco Systems Control Protocol"},
  367. {PPP_ASCOMCP, "Ascom Timeplex"},
  368. {PPP_LBLBCP, "Fujitsu LBLB Control Protocol"},
  369. {PPP_RLNCP, "DCA Remote Lan Network Control Protocol (RLNCP)"},
  370. {PPP_SDCP, "Serial Data Control Protocol (PPP-SDCP)"},
  371. {PPP_LLCCP, "SNA over 802.2 Control Protocol"},
  372. {PPP_SNACP, "SNA Control Protocol"},
  373. {PPP_IP6HCCP, "IP6 Header Compression Control Protocol"},
  374. {PPP_KNXCP, "KNX Bridging Control Protocol"},
  375. {PPP_ECP, "Encryption Control Protocol"},
  376. {PPP_ILECP, "Individual Link Encryption Control Protocol"},
  377. {PPP_IPV6CP, "IPv6 Control Protocol"},
  378. {PPP_MUXCP, "PPP Muxing Control Protocol"},
  379. {PPP_VSNCP, "Vendor-Specific Network Control Protocol (VSNCP)"},
  380. {PPP_TNCP, "TRILL Network Control Protocol"},
  381. {PPP_STAMPEDECP, "Stampede Bridging Control Protocol"},
  382. {PPP_MPPCP, "MP+ Control Protocol"},
  383. {PPP_IPICP, "NTCITS IPI Control Protocol"},
  384. {PPP_SLCC, "Single link compression in multilink control"},
  385. {PPP_CCP, "Compression Control Protocol"},
  386. {PPP_CDPCP, "Cisco Discovery Protocol Control Protocol"},
  387. {PPP_NETCSCP, "Netcs Twin Routing"},
  388. {PPP_STPCP, "STP - Control Protocol"},
  389. {PPP_EDPCP, "EDPCP - Extreme Discovery Protocol Control Protocol"},
  390. {PPP_ACSPC, "Apple Client Server Protocol Control"},
  391. {PPP_MPLSCP, "MPLS Control Protocol"},
  392. {PPP_P12844CP, "IEEE p1284.4 standard - Protocol Control"},
  393. {PPP_TETRACP, "ETSI TETRA TNP1 Control Protocol"},
  394. {PPP_MFTPCP, "Multichannel Flow Treatment Protocol"},
  395. {PPP_LCP, "Link Control Protocol"},
  396. {PPP_PAP, "Password Authentication Protocol"},
  397. {PPP_LQR, "Link Quality Report"},
  398. {PPP_SPAP, "Shiva Password Authentication Protocol"},
  399. {PPP_CBCP, "Callback Control Protocol (CBCP)"},
  400. {PPP_BACP, "BACP Bandwidth Allocation Control Protocol"},
  401. {PPP_BAP, "BAP Bandwidth Allocation Protocol"},
  402. {PPP_VSAP, "Vendor-Specific Authentication Protocol (VSAP)"},
  403. {PPP_CONTCP, "Container Control Protocol"},
  404. {PPP_CHAP, "Challenge Handshake Authentication Protocol"},
  405. {PPP_RSAAP, "RSA Authentication Protocol"},
  406. {PPP_EAP, "Extensible Authentication Protocol"},
  407. {PPP_SIEP, "Mitsubishi Security Information Exchange Protocol (SIEP)"},
  408. {PPP_SBAP, "Stampede Bridging Authorization Protocol"},
  409. {PPP_PRPAP, "Proprietary Authentication Protocol"},
  410. {PPP_PRPAP2, "Proprietary Authentication Protocol"},
  411. {PPP_PRPNIAP, "Proprietary Node ID Authentication Protocol"},
  412. {0, NULL}
  413. };
  414. value_string_ext ppp_vals_ext = VALUE_STRING_EXT_INIT(ppp_vals);
  415. /* CP (LCP, CCP, IPCP, etc.) codes.
  416. * from pppd fsm.h
  417. */
  418. #define VNDRSPCFC 0 /* Vendor Specific: RFC 2153 */
  419. #define CONFREQ 1 /* Configuration Request */
  420. #define CONFACK 2 /* Configuration Ack */
  421. #define CONFNAK 3 /* Configuration Nak */
  422. #define CONFREJ 4 /* Configuration Reject */
  423. #define TERMREQ 5 /* Termination Request */
  424. #define TERMACK 6 /* Termination Ack */
  425. #define CODEREJ 7 /* Code Reject */
  426. static const value_string cp_vals[] = {
  427. {VNDRSPCFC, "Vendor Specific"},
  428. {CONFREQ, "Configuration Request"},
  429. {CONFACK, "Configuration Ack"},
  430. {CONFNAK, "Configuration Nak"},
  431. {CONFREJ, "Configuration Reject"},
  432. {TERMREQ, "Termination Request"},
  433. {TERMACK, "Termination Ack"},
  434. {CODEREJ, "Code Reject"},
  435. {0, NULL}
  436. };
  437. /*
  438. * LCP-specific packet types.
  439. */
  440. #define PROTREJ 8 /* Protocol Reject */
  441. #define ECHOREQ 9 /* Echo Request */
  442. #define ECHOREP 10 /* Echo Reply */
  443. #define DISCREQ 11 /* Discard Request */
  444. #define IDENT 12 /* Identification */
  445. #define TIMEREMAIN 13 /* Time remaining */
  446. /*
  447. * CCP-specific packet types.
  448. */
  449. #define RESETREQ 14 /* Reset Request */
  450. #define RESETACK 15 /* Reset Ack */
  451. /*
  452. * CBCP-specific packet types.
  453. */
  454. #define CBREQ 1 /* Callback Request */
  455. #define CBRES 2 /* Callback Response */
  456. #define CBACK 3 /* Callback Ack */
  457. #define CBCP_OPT 6 /* Use callback control protocol */
  458. /*
  459. * BAP-specific packet types.
  460. */
  461. #define BAP_CREQ 1 /* Call Request */
  462. #define BAP_CRES 2 /* Call Response */
  463. #define BAP_CBREQ 3 /* Callback Request */
  464. #define BAP_CBRES 4 /* Callback Response */
  465. #define BAP_LDQREQ 5 /* Link Drop Query Request */
  466. #define BAP_LDQRES 6 /* Link Drop Query Response */
  467. #define BAP_CSI 7 /* Call Status Indication */
  468. #define BAP_CSRES 8 /* Call Status Response */
  469. static const value_string lcp_vals[] = {
  470. {VNDRSPCFC, "Vendor Specific"},
  471. {CONFREQ, "Configuration Request"},
  472. {CONFACK, "Configuration Ack"},
  473. {CONFNAK, "Configuration Nak"},
  474. {CONFREJ, "Configuration Reject"},
  475. {TERMREQ, "Termination Request"},
  476. {TERMACK, "Termination Ack"},
  477. {CODEREJ, "Code Reject"},
  478. {PROTREJ, "Protocol Reject"},
  479. {ECHOREQ, "Echo Request"},
  480. {ECHOREP, "Echo Reply"},
  481. {DISCREQ, "Discard Request"},
  482. {IDENT, "Identification"},
  483. {TIMEREMAIN, "Time Remaining"},
  484. {0, NULL}
  485. };
  486. static const value_string ccp_vals[] = {
  487. {VNDRSPCFC, "Vendor Specific"},
  488. {CONFREQ, "Configuration Request"},
  489. {CONFACK, "Configuration Ack"},
  490. {CONFNAK, "Configuration Nak"},
  491. {CONFREJ, "Configuration Reject"},
  492. {TERMREQ, "Termination Request"},
  493. {TERMACK, "Termination Ack"},
  494. {CODEREJ, "Code Reject"},
  495. {RESETREQ, "Reset Request"},
  496. {RESETACK, "Reset Ack"},
  497. {0, NULL}
  498. };
  499. static const value_string cbcp_vals[] = {
  500. {CBREQ, "Callback Request"},
  501. {CBRES, "Callback Response"},
  502. {CBACK, "Callback Ack"},
  503. {0, NULL}
  504. };
  505. static const value_string bap_vals[] = {
  506. {BAP_CREQ, "Call Request"},
  507. {BAP_CRES, "Call Response"},
  508. {BAP_CBREQ, "Callback Request"},
  509. {BAP_CBRES, "Callback Response"},
  510. {BAP_LDQREQ, "Link Drop Query Request"},
  511. {BAP_LDQRES, "Link Drop Query Response"},
  512. {BAP_CSI, "Call Status Indication"},
  513. {BAP_CSRES, "Call Status Response"},
  514. {0, NULL}
  515. };
  516. #define BAP_RESP_CODE_REQACK 0x00
  517. #define BAP_RESP_CODE_REQNAK 0x01
  518. #define BAP_RESP_CODE_REQREJ 0x02
  519. #define BAP_RESP_CODE_REQFULLNAK 0x03
  520. static const value_string bap_resp_code_vals[] = {
  521. {BAP_RESP_CODE_REQACK, "Request Ack"},
  522. {BAP_RESP_CODE_REQNAK, "Request Nak"},
  523. {BAP_RESP_CODE_REQREJ, "Request Rej"},
  524. {BAP_RESP_CODE_REQFULLNAK, "Request Full Nak"},
  525. {0, NULL}
  526. };
  527. #define BAP_LINK_TYPE_ISDN 0 /* ISDN */
  528. #define BAP_LINK_TYPE_X25 1 /* X.25 */
  529. #define BAP_LINK_TYPE_ANALOG 2 /* Analog */
  530. #define BAP_LINK_TYPE_SD 3 /* Switched Digital (non-ISDN) */
  531. #define BAP_LINK_TYPE_ISDNOV 4 /* ISDN data over voice */
  532. #define BAP_LINK_TYPE_RESV5 5 /* Reserved */
  533. #define BAP_LINK_TYPE_RESV6 6 /* Reserved */
  534. #define BAP_LINK_TYPE_RESV7 7 /* Reserved */
  535. static const value_string bap_link_type_vals[] = {
  536. {BAP_LINK_TYPE_ISDN, "ISDN"},
  537. {BAP_LINK_TYPE_X25, "X.25"},
  538. {BAP_LINK_TYPE_ANALOG, "Analog"},
  539. {BAP_LINK_TYPE_SD, "Switched Digital (non-ISDN)"},
  540. {BAP_LINK_TYPE_ISDNOV, "ISDN data over voice"},
  541. {BAP_LINK_TYPE_RESV5, "Reserved"},
  542. {BAP_LINK_TYPE_RESV6, "Reserved"},
  543. {BAP_LINK_TYPE_RESV7, "Reserved"},
  544. {0, NULL}
  545. };
  546. #define BAP_PHONE_DELTA_SUBOPT_UNIQ_DIGIT 1 /* Unique Digit */
  547. #define BAP_PHONE_DELTA_SUBOPT_SUBSC_NUM 2 /* Subscriber Number */
  548. #define BAP_PHONE_DELTA_SUBOPT_PHONENUM_SUBADDR 3 /* Phone Number Sub Address */
  549. static const value_string bap_phone_delta_subopt_vals[] = {
  550. {BAP_PHONE_DELTA_SUBOPT_UNIQ_DIGIT, "Unique Digit"},
  551. {BAP_PHONE_DELTA_SUBOPT_SUBSC_NUM, "Subscriber Number"},
  552. {BAP_PHONE_DELTA_SUBOPT_PHONENUM_SUBADDR, "Phone Number Sub Address"},
  553. {0, NULL}
  554. };
  555. /*
  556. * Cause codes for Cause.
  557. *
  558. * The following code table is taken from packet-q931.c but is slightly
  559. * adapted to BAP protocol.
  560. */
  561. static const value_string q931_cause_code_vals[] = {
  562. {0x00, "Call successful"},
  563. {0x01, "Unallocated (unassigned) number"},
  564. {0x02, "No route to specified transit network"},
  565. {0x03, "No route to destination"},
  566. {0x04, "Send special information tone"},
  567. {0x05, "Misdialled trunk prefix"},
  568. {0x06, "Channel unacceptable"},
  569. {0x07, "Call awarded and being delivered in an established channel"},
  570. {0x08, "Prefix 0 dialed but not allowed"},
  571. {0x09, "Prefix 1 dialed but not allowed"},
  572. {0x0A, "Prefix 1 dialed but not required"},
  573. {0x0B, "More digits received than allowed, call is proceeding"},
  574. {0x10, "Normal call clearing"},
  575. {0x11, "User busy"},
  576. {0x12, "No user responding"},
  577. {0x13, "No answer from user (user alerted)"},
  578. {0x14, "Subscriber absent"},
  579. {0x15, "Call rejected"},
  580. {0x16, "Number changed"},
  581. {0x17, "Reverse charging rejected"},
  582. {0x18, "Call suspended"},
  583. {0x19, "Call resumed"},
  584. {0x1A, "Non-selected user clearing"},
  585. {0x1B, "Destination out of order"},
  586. {0x1C, "Invalid number format (incomplete number)"},
  587. {0x1D, "Facility rejected"},
  588. {0x1E, "Response to STATUS ENQUIRY"},
  589. {0x1F, "Normal unspecified"},
  590. {0x21, "Circuit out of order"},
  591. {0x22, "No circuit/channel available"},
  592. {0x23, "Destination unattainable"},
  593. {0x25, "Degraded service"},
  594. {0x26, "Network out of order"},
  595. {0x27, "Transit delay range cannot be achieved"},
  596. {0x28, "Throughput range cannot be achieved"},
  597. {0x29, "Temporary failure"},
  598. {0x2A, "Switching equipment congestion"},
  599. {0x2B, "Access information discarded"},
  600. {0x2C, "Requested circuit/channel not available"},
  601. {0x2D, "Pre-empted"},
  602. {0x2E, "Precedence call blocked"},
  603. {0x2F, "Resources unavailable, unspecified"},
  604. {0x31, "Quality of service unavailable"},
  605. {0x32, "Requested facility not subscribed"},
  606. {0x33, "Reverse charging not allowed"},
  607. {0x34, "Outgoing calls barred"},
  608. {0x35, "Outgoing calls barred within CUG"},
  609. {0x36, "Incoming calls barred"},
  610. {0x37, "Incoming calls barred within CUG"},
  611. {0x38, "Call waiting not subscribed"},
  612. {0x39, "Bearer capability not authorized"},
  613. {0x3A, "Bearer capability not presently available"},
  614. {0x3E, "Inconsistency in designated outgoing access information and subscriber class"},
  615. {0x3F, "Service or option not available, unspecified"},
  616. {0x41, "Bearer capability not implemented"},
  617. {0x42, "Channel type not implemented"},
  618. {0x43, "Transit network selection not implemented"},
  619. {0x44, "Message not implemented"},
  620. {0x45, "Requested facility not implemented"},
  621. {0x46, "Only restricted digital information bearer capability is available"},
  622. {0x4F, "Service or option not implemented, unspecified"},
  623. {0x51, "Invalid call reference value"},
  624. {0x52, "Identified channel does not exist"},
  625. {0x53, "Call identity does not exist for suspended call"},
  626. {0x54, "Call identity in use"},
  627. {0x55, "No call suspended"},
  628. {0x56, "Call having the requested call identity has been cleared"},
  629. {0x57, "Called user not member of CUG"},
  630. {0x58, "Incompatible destination"},
  631. {0x59, "Non-existent abbreviated address entry"},
  632. {0x5A, "Destination address missing, and direct call not subscribed"},
  633. {0x5B, "Invalid transit network selection (national use)"},
  634. {0x5C, "Invalid facility parameter"},
  635. {0x5D, "Mandatory information element is missing"},
  636. {0x5F, "Invalid message, unspecified"},
  637. {0x60, "Mandatory information element is missing"},
  638. {0x61, "Message type non-existent or not implemented"},
  639. {0x62, "Message not compatible with call state or message type non-existent or not implemented"},
  640. {0x63, "Information element non-existent or not implemented"},
  641. {0x64, "Invalid information element contents"},
  642. {0x65, "Message not compatible with call state"},
  643. {0x66, "Recovery on timer expiry"},
  644. {0x67, "Parameter non-existent or not implemented - passed on"},
  645. {0x6E, "Message with unrecognized parameter discarded"},
  646. {0x6F, "Protocol error, unspecified"},
  647. {0x7F, "Internetworking, unspecified"},
  648. {0xFF, "Non-specific failure"},
  649. {0, NULL}
  650. };
  651. static value_string_ext q931_cause_code_vals_ext = VALUE_STRING_EXT_INIT(q931_cause_code_vals);
  652. static const value_string bap_call_status_opt_action_vals[] = {
  653. {0, "No retry"},
  654. {1, "Retry"},
  655. {0, NULL}
  656. };
  657. #define STAC_CM_NONE 0
  658. #define STAC_CM_LCB 1
  659. #define STAC_CM_CRC 2
  660. #define STAC_CM_SN 3
  661. #define STAC_CM_EXTMODE 4
  662. static const value_string stac_checkmode_vals[] = {
  663. {STAC_CM_NONE, "None"},
  664. {STAC_CM_LCB, "LCB"},
  665. {STAC_CM_CRC, "CRC"},
  666. {STAC_CM_SN, "Sequence Number"},
  667. {STAC_CM_EXTMODE, "Extended Mode"},
  668. {0, NULL}
  669. };
  670. #define LZSDCP_CM_NONE 0
  671. #define LZSDCP_CM_LCB 1
  672. #define LZSDCP_CM_SN 2
  673. #define LZSDCP_CM_SN_LCB 3
  674. static const value_string lzsdcp_checkmode_vals[] = {
  675. {LZSDCP_CM_NONE, "None"},
  676. {LZSDCP_CM_LCB, "LCB"},
  677. {LZSDCP_CM_SN, "Sequence Number"},
  678. {LZSDCP_CM_SN_LCB, "Sequence Number + LCB (default)"},
  679. {0, NULL}
  680. };
  681. #define LZSDCP_PM_NONE 0
  682. #define LZSDCP_PM_PROC_UNCOMP 1
  683. static const value_string lzsdcp_processmode_vals[] = {
  684. {LZSDCP_PM_NONE, "None (default)"},
  685. {LZSDCP_PM_PROC_UNCOMP, "Process-Uncompressed"},
  686. {0, NULL}
  687. };
  688. #define DCE_MODE_1 1
  689. #define DCE_MODE_2 2
  690. static const value_string dce_mode_vals[] = {
  691. {DCE_MODE_1, "No Additional Negotiation"},
  692. {DCE_MODE_2, "Full PPP Negotiation and State Machine"},
  693. {0, NULL}
  694. };
  695. /*
  696. * Options. (LCP)
  697. */
  698. #define CI_VENDORSPECIFIC 0 /* Vendor Specific [RFC2153] */
  699. #define CI_MRU 1 /* Maximum Receive Unit [RFC1661] */
  700. #define CI_ASYNCMAP 2 /* Async Control Character Map */
  701. #define CI_AUTHPROT 3 /* Authentication Protocol [RFC1661] */
  702. #define CI_QUALITY 4 /* Quality Protocol [RFC1661] */
  703. #define CI_MAGICNUMBER 5 /* Magic Number [RFC1661] */
  704. #define CI_LINKQUALMON 6 /* DEPRECATED (Quality Protocol) [RFC1172] */
  705. #define CI_PCOMPRESSION 7 /* Protocol Field Compression [RFC1661] */
  706. #define CI_ACCOMPRESSION 8 /* Address/Control Field Compression
  707. [RFC1661] */
  708. #define CI_FCS_ALTERNATIVES 9 /* FCS Alternatives [RFC1570] */
  709. #define CI_SELF_DESCRIBING_PAD 10 /* Self-Describing Pad [RFC1570] */
  710. #define CI_NUMBERED_MODE 11 /* Numbered Mode [RFC1663] */
  711. #define CI_MULTILINK_PROC 12 /* DEPRECATED (Multi-Link Procedure) */
  712. #define CI_CALLBACK 13 /* Callback [RFC1570] */
  713. #define CI_CONNECTTIME 14 /* DEPRECATED (Connect Time) */
  714. #define CI_COMPOUND_FRAMES 15 /* DEPRECATED (Compound Frames) [RFC1570] */
  715. #define CI_NOMDATAENCAP 16 /* DEPRECATED (Nominal Data Encapsulation) */
  716. /* NOTE: IANA lists CI_NOMDATAENCAP as 16, but it is listed as 14 in
  717. * http://tools.ietf.org/html/draft-ietf-pppext-dataencap-03.
  718. * Which is correct is anyone's guess. */
  719. #define CI_MULTILINK_MRRU 17 /* Multilink MRRU [RFC1990] */
  720. #define CI_MULTILINK_SSNH 18 /* Multilink Short Sequence Number Header
  721. [RFC1990] */
  722. #define CI_MULTILINK_EP_DISC 19 /* Multilink Endpoint Discriminator
  723. [RFC1990] */
  724. #define CI_PROP_KEN 20 /* Proprietary [Ken Culbert] ken@funk.com */
  725. #define CI_DCE_IDENTIFIER 21 /* DCE Identifier [RFC1976]: Warning:
  726. Option type 25 in the RFC is incorrect */
  727. #define CI_MULTILINK_PLUS_PROC 22 /* Multilink Plus Procedure [RFC1934] */
  728. #define CI_LINK_DISC_FOR_BACP 23 /* Link Discriminator for BACP [RFC2125] */
  729. #define CI_LCP_AUTHENTICATION 24 /* LCP Authentication Option [Culbert] */
  730. #define CI_COBS 25 /* Consistent Overhead Byte Stuffing (COBS)
  731. [Carlson] */
  732. #define CI_PREFIX_ELISION 26 /* Prefix elision [RFC2686][RFC2687] */
  733. #define CI_MULTILINK_HDR_FMT 27 /* Multilink header format
  734. [RFC2686][RFC2687] */
  735. #define CI_INTERNATIONALIZATION 28 /* Internationalization [RFC2484] */
  736. #define CI_SDL_ON_SONET_SDH 29 /* Simple Data Link on SONET/SDH
  737. [RFC2823] */
  738. #define CI_UNASSIGNED 30 /* Unassigned ... but so are 31-255, so
  739. why do they bother specifically
  740. mentioning this one, I wonder? */
  741. static int hf_lcp_magic_number = -1;
  742. static int hf_lcp_data = -1;
  743. static int hf_lcp_message = -1;
  744. static int hf_lcp_secs_remaining = -1;
  745. static int hf_lcp_rej_proto = -1;
  746. static int hf_lcp_opt_type = -1;
  747. static int hf_lcp_opt_length = -1;
  748. static int hf_lcp_opt_oui = -1;
  749. static int hf_lcp_opt_kind = -1;
  750. static int hf_lcp_opt_data = -1;
  751. static int hf_lcp_opt_mru = -1;
  752. static int hf_lcp_opt_asyncmap = -1;
  753. static int hf_lcp_opt_asyncmap_nul = -1;
  754. static int hf_lcp_opt_asyncmap_soh = -1;
  755. static int hf_lcp_opt_asyncmap_stx = -1;
  756. static int hf_lcp_opt_asyncmap_etx = -1;
  757. static int hf_lcp_opt_asyncmap_eot = -1;
  758. static int hf_lcp_opt_asyncmap_enq = -1;
  759. static int hf_lcp_opt_asyncmap_ack = -1;
  760. static int hf_lcp_opt_asyncmap_bel = -1;
  761. static int hf_lcp_opt_asyncmap_bs = -1;
  762. static int hf_lcp_opt_asyncmap_ht = -1;
  763. static int hf_lcp_opt_asyncmap_lf = -1;
  764. static int hf_lcp_opt_asyncmap_vt = -1;
  765. static int hf_lcp_opt_asyncmap_ff = -1;
  766. static int hf_lcp_opt_asyncmap_cr = -1;
  767. static int hf_lcp_opt_asyncmap_so = -1;
  768. static int hf_lcp_opt_asyncmap_si = -1;
  769. static int hf_lcp_opt_asyncmap_dle = -1;
  770. static int hf_lcp_opt_asyncmap_dc1 = -1;
  771. static int hf_lcp_opt_asyncmap_dc2 = -1;
  772. static int hf_lcp_opt_asyncmap_dc3 = -1;
  773. static int hf_lcp_opt_asyncmap_dc4 = -1;
  774. static int hf_lcp_opt_asyncmap_nak = -1;
  775. static int hf_lcp_opt_asyncmap_syn = -1;
  776. static int hf_lcp_opt_asyncmap_etb = -1;
  777. static int hf_lcp_opt_asyncmap_can = -1;
  778. static int hf_lcp_opt_asyncmap_em = -1;
  779. static int hf_lcp_opt_asyncmap_sub = -1;
  780. static int hf_lcp_opt_asyncmap_esc = -1;
  781. static int hf_lcp_opt_asyncmap_fs = -1;
  782. static int hf_lcp_opt_asyncmap_gs = -1;
  783. static int hf_lcp_opt_asyncmap_rs = -1;
  784. static int hf_lcp_opt_asyncmap_us = -1;
  785. static int hf_lcp_opt_auth_protocol = -1;
  786. static int hf_lcp_opt_algorithm = -1;
  787. static int hf_lcp_opt_quality_protocol = -1;
  788. static int hf_lcp_opt_magic_number = -1;
  789. static int hf_lcp_opt_reportingperiod = -1;
  790. static int hf_lcp_opt_fcs_alternatives = -1;
  791. static int hf_lcp_opt_fcs_alternatives_null = -1;
  792. static int hf_lcp_opt_fcs_alternatives_ccitt16 = -1;
  793. static int hf_lcp_opt_fcs_alternatives_ccitt32 = -1;
  794. static int hf_lcp_opt_maximum = -1;
  795. static int hf_lcp_opt_window = -1;
  796. static int hf_lcp_opt_hdlc_address = -1;
  797. static int hf_lcp_opt_operation = -1;
  798. static int hf_lcp_opt_message = -1;
  799. static int hf_lcp_opt_mrru = -1;
  800. static int hf_lcp_opt_ep_disc_class = -1;
  801. static int hf_lcp_opt_ip_address = -1;
  802. static int hf_lcp_opt_802_1_address = -1;
  803. static int hf_lcp_opt_magic_block = -1;
  804. static int hf_lcp_opt_psndn = -1;
  805. static int hf_lcp_opt_mode = -1;
  806. static int hf_lcp_opt_unused = -1;
  807. static int hf_lcp_opt_link_discrim = -1;
  808. static int hf_lcp_opt_id = -1;
  809. static int hf_lcp_opt_cobs_flags = -1;
  810. static int hf_lcp_opt_cobs_flags_res = -1;
  811. static int hf_lcp_opt_cobs_flags_pre = -1;
  812. static int hf_lcp_opt_cobs_flags_zxe = -1;
  813. static int hf_lcp_opt_class = -1;
  814. static int hf_lcp_opt_prefix = -1;
  815. static int hf_lcp_opt_code = -1;
  816. static int hf_lcp_opt_max_susp_classes = -1;
  817. static int hf_lcp_opt_MIBenum = -1;
  818. static int hf_lcp_opt_language_tag = -1;
  819. static void dissect_lcp_vendor_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  820. int offset, guint length, packet_info *pinfo _U_, proto_tree *tree, void *data _U_);
  821. static void dissect_lcp_mru_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  822. int offset, guint length, packet_info *pinfo _U_, proto_tree *tree, void *data _U_);
  823. static void dissect_lcp_async_map_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  824. int offset, guint length, packet_info *pinfo _U_, proto_tree *tree, void *data _U_);
  825. static void dissect_lcp_authprot_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  826. int offset, guint length, packet_info *pinfo _U_, proto_tree *tree, void *data _U_);
  827. static void dissect_lcp_qualprot_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  828. int offset, guint length, packet_info *pinfo _U_, proto_tree *tree, void *data _U_);
  829. static void dissect_lcp_magicnumber_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  830. int offset, guint length, packet_info *pinfo _U_, proto_tree *tree, void *data _U_);
  831. static void dissect_lcp_linkqualmon_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  832. int offset, guint length, packet_info *pinfo _U_, proto_tree *tree, void *data _U_);
  833. static void dissect_lcp_simple_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  834. int offset, guint length, packet_info *pinfo _U_, proto_tree *tree, void *data _U_);
  835. static void dissect_lcp_fcs_alternatives_opt(const ip_tcp_opt *optp,
  836. tvbuff_t *tvb, int offset, guint length, packet_info *pinfo _U_,
  837. proto_tree *tree, void *data _U_);
  838. static void dissect_lcp_self_describing_pad_opt(const ip_tcp_opt *optp,
  839. tvbuff_t *tvb, int offset, guint length, packet_info *pinfo _U_,
  840. proto_tree *tree, void *data _U_);
  841. static void dissect_lcp_numbered_mode_opt(const ip_tcp_opt *optp,
  842. tvbuff_t *tvb, int offset, guint length, packet_info *pinfo _U_,
  843. proto_tree *tree, void *data _U_);
  844. static void dissect_lcp_callback_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  845. int offset, guint length, packet_info *pinfo _U_, proto_tree *tree, void *data _U_);
  846. static void dissect_lcp_multilink_mrru_opt(const ip_tcp_opt *optp,
  847. tvbuff_t *tvb, int offset, guint length, packet_info *pinfo _U_,
  848. proto_tree *tree, void *data _U_);
  849. static void dissect_lcp_multilink_ep_disc_opt(const ip_tcp_opt *optp,
  850. tvbuff_t *tvb, int offset, guint length, packet_info *pinfo _U_,
  851. proto_tree *tree, void *data _U_);
  852. static void dissect_lcp_dce_identifier_opt(const ip_tcp_opt *optp,
  853. tvbuff_t *tvb, int offset, guint length, packet_info *pinfo _U_,
  854. proto_tree *tree, void *data _U_);
  855. static void dissect_lcp_multilink_pp_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  856. int offset, guint length, packet_info *pinfo _U_, proto_tree *tree, void *data _U_);
  857. static void dissect_lcp_bacp_link_discriminator_opt(const ip_tcp_opt *optp,
  858. tvbuff_t *tvb, int offset, guint length, packet_info *pinfo _U_,
  859. proto_tree *tree, void *data _U_);
  860. static void dissect_lcp_auth_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  861. int offset, guint length, packet_info *pinfo _U_, proto_tree *tree, void *data _U_);
  862. static void dissect_lcp_cobs_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  863. int offset, guint length, packet_info *pinfo _U_, proto_tree *tree, void *data _U_);
  864. static void dissect_lcp_prefix_elision_opt(const ip_tcp_opt *optp,
  865. tvbuff_t *tvb, int offset, guint length, packet_info *pinfo _U_,
  866. proto_tree *tree, void *data _U_);
  867. static void dissect_lcp_multilink_hdr_fmt_opt(const ip_tcp_opt *optp,
  868. tvbuff_t *tvb, int offset, guint length, packet_info *pinfo _U_,
  869. proto_tree *tree, void *data _U_);
  870. static void dissect_lcp_internationalization_opt(const ip_tcp_opt *optp,
  871. tvbuff_t *tvb, int offset, guint length, packet_info *pinfo _U_,
  872. proto_tree *tree, void *data _U_);
  873. static void dissect_mp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
  874. static const ip_tcp_opt lcp_opts[] = {
  875. {CI_VENDORSPECIFIC, "Vendor Specific", &ett_lcp_vendor_opt,
  876. OPT_LEN_VARIABLE_LENGTH, 6, dissect_lcp_vendor_opt},
  877. {CI_MRU, "Maximum Receive Unit", &ett_lcp_mru_opt,
  878. OPT_LEN_FIXED_LENGTH, 4, dissect_lcp_mru_opt},
  879. {CI_ASYNCMAP, "Async Control Character Map", &ett_lcp_asyncmap_opt,
  880. OPT_LEN_FIXED_LENGTH, 6, dissect_lcp_async_map_opt},
  881. {CI_AUTHPROT, "Authentication Protocol", &ett_lcp_authprot_opt,
  882. OPT_LEN_VARIABLE_LENGTH, 4, dissect_lcp_authprot_opt},
  883. {CI_QUALITY, "Quality Protocol", &ett_lcp_qualprot_opt,
  884. OPT_LEN_VARIABLE_LENGTH, 4, dissect_lcp_qualprot_opt},
  885. {CI_MAGICNUMBER, "Magic Number", &ett_lcp_magicnumber_opt,
  886. OPT_LEN_FIXED_LENGTH, 6, dissect_lcp_magicnumber_opt},
  887. {CI_LINKQUALMON, "Link Quality Monitoring", &ett_lcp_linkqualmon_opt,
  888. OPT_LEN_FIXED_LENGTH, 6, dissect_lcp_linkqualmon_opt},
  889. {CI_PCOMPRESSION, "Protocol Field Compression", &ett_lcp_pcomp_opt,
  890. OPT_LEN_FIXED_LENGTH, 2, dissect_lcp_simple_opt},
  891. {CI_ACCOMPRESSION, "Address and Control Field Compression", &ett_lcp_acccomp_opt,
  892. OPT_LEN_FIXED_LENGTH, 2, dissect_lcp_simple_opt},
  893. {CI_FCS_ALTERNATIVES, "FCS Alternatives", &ett_lcp_fcs_alternatives_opt,
  894. OPT_LEN_FIXED_LENGTH, 3, dissect_lcp_fcs_alternatives_opt},
  895. {CI_SELF_DESCRIBING_PAD, "Self Describing Pad", &ett_lcp_self_desc_pad_opt,
  896. OPT_LEN_FIXED_LENGTH, 3, dissect_lcp_self_describing_pad_opt},
  897. {CI_NUMBERED_MODE, "Numbered Mode", &ett_lcp_numbered_mode_opt,
  898. OPT_LEN_VARIABLE_LENGTH, 4, dissect_lcp_numbered_mode_opt},
  899. /* TODO? CI_MULTILINK_PROC */
  900. {CI_CALLBACK, "Callback", &ett_lcp_callback_opt,
  901. OPT_LEN_VARIABLE_LENGTH, 3, dissect_lcp_callback_opt},
  902. /* TODO? CI_CONNECTTIME */
  903. {CI_COMPOUND_FRAMES, "Compound Frames (Deprecated)", &ett_lcp_compound_frames_opt,
  904. OPT_LEN_FIXED_LENGTH, 2, dissect_lcp_simple_opt},
  905. {CI_NOMDATAENCAP, "Nominal Data Encapsulation (Deprecated)", &ett_lcp_nomdataencap_opt,
  906. OPT_LEN_FIXED_LENGTH, 2, dissect_lcp_simple_opt},
  907. {CI_MULTILINK_MRRU, "Multilink MRRU", &ett_lcp_multilink_mrru_opt,
  908. OPT_LEN_FIXED_LENGTH, 4, dissect_lcp_multilink_mrru_opt},
  909. {CI_MULTILINK_SSNH, "Multilink Short Sequence Number Header", &ett_lcp_multilink_ssnh_opt,
  910. OPT_LEN_FIXED_LENGTH, 2, dissect_lcp_simple_opt},
  911. {CI_MULTILINK_EP_DISC, "Multilink Endpoint Discriminator", &ett_lcp_multilink_ep_disc_opt,
  912. OPT_LEN_VARIABLE_LENGTH, 3, dissect_lcp_multilink_ep_disc_opt},
  913. /* TODO? CI_PROP_KEN: ken@funk.com: www.funk.com => www.juniper.net */
  914. {CI_DCE_IDENTIFIER, "DCE Identifier", &ett_lcp_dce_identifier_opt,
  915. OPT_LEN_FIXED_LENGTH, 3, dissect_lcp_dce_identifier_opt},
  916. {CI_MULTILINK_PLUS_PROC, "Multi Link Plus Procedure", &ett_lcp_multilink_pp_opt,
  917. OPT_LEN_FIXED_LENGTH, 4, dissect_lcp_multilink_pp_opt},
  918. {CI_LINK_DISC_FOR_BACP, "Link Discriminator for BACP", &ett_lcp_bacp_link_discrim_opt,
  919. OPT_LEN_FIXED_LENGTH, 4, dissect_lcp_bacp_link_discriminator_opt},
  920. {CI_LCP_AUTHENTICATION, "LCP Authentication Option", &ett_lcp_auth_opt,
  921. OPT_LEN_VARIABLE_LENGTH, 3, dissect_lcp_auth_opt},
  922. {CI_COBS, "Consistent Overhead Byte Stuffing (COBS)", &ett_lcp_cobs_opt,
  923. OPT_LEN_FIXED_LENGTH, 3, dissect_lcp_cobs_opt},
  924. {CI_PREFIX_ELISION, "Prefix Elision", &ett_lcp_prefix_elision_opt,
  925. OPT_LEN_VARIABLE_LENGTH, 2, dissect_lcp_prefix_elision_opt},
  926. {CI_MULTILINK_HDR_FMT, "Multilink header format", &ett_multilink_hdr_fmt_opt,
  927. OPT_LEN_FIXED_LENGTH, 4, dissect_lcp_multilink_hdr_fmt_opt},
  928. {CI_INTERNATIONALIZATION, "Internationalization", &ett_lcp_internationalization_opt,
  929. OPT_LEN_VARIABLE_LENGTH, 7, dissect_lcp_internationalization_opt},
  930. {CI_SDL_ON_SONET_SDH, "Simple Data Link on SONET/SDH", &ett_lcp_simple_opt,
  931. OPT_LEN_FIXED_LENGTH, 2, dissect_lcp_simple_opt}
  932. /* TODO? CI_UNASSIGNED */
  933. };
  934. #define N_LCP_OPTS (sizeof lcp_opts / sizeof lcp_opts[0])
  935. /* 3GPP2 X.S0057-B v1.0
  936. * 9.1.4.1 3GPP2 VSNCP Configuration Options
  937. * Options. (VSNCP)
  938. */
  939. #define CI_PDN_IDENTIFIER 1
  940. #define CI_ACCESS_POINT_NM 2
  941. #define CI_PDN_TYPE 3
  942. #define CI_PDN_ADDRESS 4
  943. #define CI_PROTOCOL_CONFIG 5
  944. #define CI_ERROR_CODE 6
  945. #define CI_ATTACH_TYPE 7
  946. #define CI_IPv4DEFAULT_ROUTER 8
  947. #define CI_ADDRESS_ALLOC 9
  948. #define CI_APN_AMBR 10
  949. #define CI_IPv6_HSGW_LLA_IID 11
  950. static void dissect_vsncp_pdnid_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  951. int offset, guint length, packet_info *pinfo, proto_tree *tree, void *data _U_);
  952. static void dissect_vsncp_apname_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  953. int offset, guint length, packet_info *pinfo, proto_tree *tree, void *data _U_);
  954. static void dissect_vsncp_pdntype_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  955. int offset, guint length, packet_info *pinfo, proto_tree *tree, void *data _U_);
  956. static void dissect_vsncp_pdnaddress_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  957. int offset, guint length, packet_info *pinfo, proto_tree *tree, void *data _U_);
  958. static void dissect_vsncp_pco_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  959. int offset, guint length, packet_info *pinfo, proto_tree *tree, void *data _U_);
  960. static void dissect_vsncp_errorcode_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  961. int offset, guint length, packet_info *pinfo, proto_tree *tree, void *data _U_);
  962. static void dissect_vsncp_attachtype_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  963. int offset, guint length, packet_info *pinfo, proto_tree *tree, void *data _U_);
  964. static void dissect_vsncp_ipv4address_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  965. int offset, guint length, packet_info *pinfo, proto_tree *tree, void *data _U_);
  966. static void dissect_vsncp_addressalloc_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  967. int offset, guint length, packet_info *pinfo, proto_tree *tree, void *data _U_);
  968. static void dissect_vsncp_apn_ambr_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  969. int offset, guint length, packet_info *pinfo, proto_tree *tree, void *data _U_);
  970. static void dissect_vsncp_ipv6_hsgw_lla_iid_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  971. int offset, guint length, packet_info *pinfo, proto_tree *tree, void *data _U_);
  972. static const ip_tcp_opt vsncp_opts[] = {
  973. {CI_PDN_IDENTIFIER, "PDN Identifier", NULL,
  974. OPT_LEN_FIXED_LENGTH, 3, dissect_vsncp_pdnid_opt},
  975. {CI_ACCESS_POINT_NM, "Access Point Name", NULL,
  976. OPT_LEN_VARIABLE_LENGTH, 2, dissect_vsncp_apname_opt},
  977. {CI_PDN_TYPE, "PDN Type", NULL,
  978. OPT_LEN_FIXED_LENGTH, 3, dissect_vsncp_pdntype_opt},
  979. {CI_PDN_ADDRESS, "PDN Address", NULL,
  980. OPT_LEN_VARIABLE_LENGTH, 3, dissect_vsncp_pdnaddress_opt},
  981. {CI_PROTOCOL_CONFIG, "Protocol Configuration Options", NULL,
  982. OPT_LEN_VARIABLE_LENGTH, 3, dissect_vsncp_pco_opt},
  983. {CI_ERROR_CODE, "Error Code", NULL,
  984. OPT_LEN_FIXED_LENGTH, 3, dissect_vsncp_errorcode_opt},
  985. {CI_ATTACH_TYPE, "Attach Type", NULL,
  986. OPT_LEN_FIXED_LENGTH, 3, dissect_vsncp_attachtype_opt},
  987. {CI_IPv4DEFAULT_ROUTER, "IPv4 Default Router Address", NULL,
  988. OPT_LEN_FIXED_LENGTH, 6, dissect_vsncp_ipv4address_opt},
  989. {CI_ADDRESS_ALLOC, "Address Allocation Cause", NULL,
  990. OPT_LEN_FIXED_LENGTH, 3, dissect_vsncp_addressalloc_opt},
  991. {CI_APN_AMBR, "APN Aggregate Maximum Bit Rate(APN-AMBR)", NULL,
  992. OPT_LEN_VARIABLE_LENGTH, 4, dissect_vsncp_apn_ambr_opt},
  993. {CI_IPv6_HSGW_LLA_IID, "IPv6 HSGW Link Local Address IID", NULL,
  994. OPT_LEN_FIXED_LENGTH, 10, dissect_vsncp_ipv6_hsgw_lla_iid_opt}
  995. };
  996. #define N_VSNCP_OPTS (sizeof vsncp_opts / sizeof vsncp_opts[0])
  997. /*
  998. * CHAP Algorithms
  999. */
  1000. /* 0-4: Reserved */
  1001. #define CHAP_ALG_MD5 5 /* CHAP with MD5 */
  1002. #define CHAP_AGL_SHA1 6 /* CHAP with SHA-1 [Black] */
  1003. /* 7-127: Unassigned */
  1004. #define CHAP_ALG_MSV1 128 /* MS-CHAP */
  1005. #define CHAP_ALG_MSV2 129 /* MS-CHAP-2 */
  1006. static const range_string chap_alg_rvals[] = {
  1007. {0, 4, "Reserved"},
  1008. {CHAP_ALG_MD5, CHAP_ALG_MD5, "CHAP with MD5"},
  1009. {CHAP_AGL_SHA1, CHAP_AGL_SHA1, "CHAP with SHA-1"},
  1010. {CHAP_ALG_MSV1, CHAP_ALG_MSV1, "MS-CHAP"},
  1011. {CHAP_ALG_MSV2, CHAP_ALG_MSV2, "MS-CHAP-2"},
  1012. {0, 0, NULL}
  1013. };
  1014. /*
  1015. * Options. (IPCP)
  1016. * http://tools.ietf.org/html/rfc1172
  1017. * http://tools.ietf.org/html/rfc1332
  1018. * http://tools.ietf.org/html/rfc1877
  1019. * http://tools.ietf.org/html/rfc2290
  1020. * http://tools.ietf.org/html/rfc3241
  1021. * http://tools.ietf.org/html/rfc3545
  1022. */
  1023. #define CI_ADDRS 1 /* IP Addresses (deprecated) (RFC 1172) */
  1024. #define CI_COMPRESS_PROTO 2 /* Compression Protocol (RFC 1332) */
  1025. #define CI_ADDR 3 /* IP Address (RFC 1332) */
  1026. #define CI_MOBILE_IPv4 4 /* Mobile IPv4 (RFC 2290) */
  1027. #define CI_PRI_DNS 129 /* Primary DNS value (RFC 1877) */
  1028. #define CI_PRI_NBNS 130 /* Primary NBNS value (RFC 1877) */
  1029. #define CI_SEC_DNS 131 /* Secondary DNS value (RFC 1877) */
  1030. #define CI_SEC_NBNS 132 /* Secondary NBNS value (RFC 1877) */
  1031. static int hf_ipcp_opt_type = -1;
  1032. static int hf_ipcp_opt_length = -1;
  1033. static int hf_ipcp_opt_src_address = -1;
  1034. static int hf_ipcp_opt_dst_address = -1;
  1035. static int hf_ipcp_opt_compress_proto = -1;
  1036. static int hf_ipcp_opt_max_cid = -1;
  1037. static int hf_ipcp_opt_mrru = -1;
  1038. static int hf_ipcp_opt_max_slot_id = -1;
  1039. static int hf_ipcp_opt_comp_slot_id = -1;
  1040. static int hf_ipcp_opt_tcp_space = -1;
  1041. static int hf_ipcp_opt_non_tcp_space = -1;
  1042. static int hf_ipcp_opt_f_max_period = -1;
  1043. static int hf_ipcp_opt_f_max_time = -1;
  1044. static int hf_ipcp_opt_max_header = -1;
  1045. static int hf_ipcp_data = -1;
  1046. static int hf_ipcp_opt_ip_address = -1;
  1047. static int hf_ipcp_opt_mobilenodehomeaddr = -1;
  1048. static int hf_ipcp_opt_pri_dns_address = -1;
  1049. static int hf_ipcp_opt_pri_nbns_address = -1;
  1050. static int hf_ipcp_opt_sec_dns_address = -1;
  1051. static int hf_ipcp_opt_sec_nbns_address = -1;
  1052. static int hf_ipcp_opt_rohc_type = -1;
  1053. static int hf_ipcp_opt_rohc_length = -1;
  1054. static int hf_ipcp_opt_rohc_profile = -1;
  1055. static int hf_ipcp_opt_iphc_type = -1;
  1056. static int hf_ipcp_opt_iphc_length = -1;
  1057. static int hf_ipcp_opt_iphc_param = -1;
  1058. static void dissect_ipcp_addrs_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  1059. int offset, guint length, packet_info *pinfo _U_, proto_tree *tree, void *data _U_);
  1060. static void dissect_ipcp_compress_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  1061. int offset, guint length, packet_info *pinfo _U_, proto_tree *tree, void *data _U_);
  1062. static void dissect_ipcp_rohc_profiles_opt(const ip_tcp_opt *optp,
  1063. tvbuff_t *tvb, int offset, guint length, packet_info *pinfo _U_,
  1064. proto_tree *tree, void *data _U_);
  1065. static void dissect_ipcp_iphc_simple_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  1066. int offset, guint length, packet_info *pinfo _U_, proto_tree *tree, void *data _U_);
  1067. static void dissect_ipcp_iphc_neghdrcomp_opt(const ip_tcp_opt *optp,
  1068. tvbuff_t *tvb, int offset, guint length, packet_info *pinfo _U_,
  1069. proto_tree *tree, void *data _U_);
  1070. static void dissect_ipcp_addr_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  1071. int offset, guint length, packet_info *pinfo _U_, proto_tree *tree, void *data _U_);
  1072. static void dissect_ipcp_mobileipv4_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  1073. int offset, guint length, packet_info *pinfo _U_, proto_tree *tree, void *data _U_);
  1074. static void dissect_ipcp_pri_dns_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  1075. int offset, guint length, packet_info *pinfo _U_, proto_tree *tree, void *data _U_);
  1076. static void dissect_ipcp_pri_nbns_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  1077. int offset, guint length, packet_info *pinfo _U_, proto_tree *tree, void *data _U_);
  1078. static void dissect_ipcp_sec_dns_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
  1079. int offset, guint length, packet_info *pinfo _U_, proto_tree *tree, void *

Large files files are truncated, but you can click here to view the full file