From d53320919a29ca233356b649919e7a379d872140 Mon Sep 17 00:00:00 2001 From: Bill Meier Date: Tue, 15 May 2012 19:23:35 +0000 Subject: Remove unneeded #includes (stdlib, stdio, ctypes, time); In a few cases: do some whitespace, indentation cleanup & reformatting. svn path=/trunk/; revision=42632 --- epan/dissectors/packet-aim-admin.c | 3 - epan/dissectors/packet-aim-adverts.c | 3 - epan/dissectors/packet-aim-bos.c | 3 - epan/dissectors/packet-aim-buddylist.c | 3 - epan/dissectors/packet-aim-chat.c | 3 - epan/dissectors/packet-aim-chatnav.c | 3 - epan/dissectors/packet-aim-directory.c | 3 - epan/dissectors/packet-aim-email.c | 3 - epan/dissectors/packet-aim-icq.c | 3 - epan/dissectors/packet-aim-invitation.c | 3 - epan/dissectors/packet-aim-location.c | 3 - epan/dissectors/packet-aim-oft.c | 3 - epan/dissectors/packet-aim-popup.c | 3 - epan/dissectors/packet-aim-signon.c | 3 - epan/dissectors/packet-aim-sst.c | 3 - epan/dissectors/packet-aim-stats.c | 3 - epan/dissectors/packet-aim-translate.c | 3 - epan/dissectors/packet-aim-userlookup.c | 3 - epan/dissectors/packet-aim.c | 1 - epan/dissectors/packet-app-pkix-cert.c | 2 - epan/dissectors/packet-arcnet.c | 2 - epan/dissectors/packet-artnet.c | 6 +- epan/dissectors/packet-aruba-adp.c | 1 - epan/dissectors/packet-banana.c | 2 - epan/dissectors/packet-bfd.c | 4 +- epan/dissectors/packet-brdwlk.c | 2 - epan/dissectors/packet-capwap.c | 2 +- epan/dissectors/packet-ccsds.c | 3 +- epan/dissectors/packet-cell_broadcast.c | 9 +- epan/dissectors/packet-cgmp.c | 5 +- epan/dissectors/packet-cigi.c | 2 - epan/dissectors/packet-cimetrics.c | 2 + epan/dissectors/packet-cisco-sm.c | 28 +- epan/dissectors/packet-dccp.c | 6 +- epan/dissectors/packet-dcm.c | 4 +- epan/dissectors/packet-dhcp-failover.c | 2 - epan/dissectors/packet-dtp.c | 5 +- epan/dissectors/packet-enttec.c | 5 +- epan/dissectors/packet-exec.c | 6 +- epan/dissectors/packet-fc.c | 2 - epan/dissectors/packet-fcct.c | 2 - epan/dissectors/packet-fcels.c | 2 - epan/dissectors/packet-fcfcs.c | 2 - epan/dissectors/packet-fclctl.c | 2 - epan/dissectors/packet-fcoe.c | 2 - epan/dissectors/packet-fcsp.c | 2 - epan/dissectors/packet-g723.c | 2 - epan/dissectors/packet-gdsdb.c | 2 - epan/dissectors/packet-gift.c | 2 +- epan/dissectors/packet-git.c | 2 +- epan/dissectors/packet-gmrp.c | 2 - epan/dissectors/packet-gnutella.c | 3 - epan/dissectors/packet-gopher.c | 2 - epan/dissectors/packet-gsm_a_bssmap.c | 2 +- epan/dissectors/packet-gsm_a_common.c | 3 +- epan/dissectors/packet-gsm_a_dtap.c | 2 +- epan/dissectors/packet-gsm_a_rp.c | 2 +- epan/dissectors/packet-gsm_bsslap.c | 2 - epan/dissectors/packet-gsm_bssmap_le.c | 2 +- epan/dissectors/packet-icp.c | 2 +- epan/dissectors/packet-ieee80211.c | 1 - epan/dissectors/packet-ifcp.c | 2 - epan/dissectors/packet-igrp.c | 4 +- epan/dissectors/packet-image-gif.c | 1084 +++++---- epan/dissectors/packet-ipfc.c | 2 - epan/dissectors/packet-ipsec.c | 1 - epan/dissectors/packet-ismp.c | 2 - epan/dissectors/packet-iwarp-ddp-rdmap.c | 3 +- epan/dissectors/packet-l2tp.c | 3764 +++++++++++++++--------------- epan/dissectors/packet-laplink.c | 2 - epan/dissectors/packet-llt.c | 2 - epan/dissectors/packet-lsc.c | 2 - epan/dissectors/packet-lwres.c | 4 +- epan/dissectors/packet-m3ua.c | 3 - epan/dissectors/packet-manolito.c | 2 - epan/dissectors/packet-mesh.c | 2 - epan/dissectors/packet-mip.c | 3 - epan/dissectors/packet-mmse.c | 2 - epan/dissectors/packet-mpls-echo.c | 2572 ++++++++++---------- epan/dissectors/packet-mpls-pm.c | 2 - epan/dissectors/packet-mpls-psc.c | 2 - epan/dissectors/packet-mpls-y1711.c | 2 +- epan/dissectors/packet-msdp.c | 2 - epan/dissectors/packet-mstp.c | 2 - epan/dissectors/packet-mstp.h | 9 - epan/dissectors/packet-multipart.c | 10 +- epan/dissectors/packet-nbd.c | 9 +- epan/dissectors/packet-ndp.c | 5 +- epan/dissectors/packet-netdump.c | 2 - epan/dissectors/packet-netsync.c | 5 +- epan/dissectors/packet-nhrp.c | 4 +- epan/dissectors/packet-nt-tpcp.c | 33 +- epan/dissectors/packet-olsr.c | 1 - epan/dissectors/packet-openwire.c | 2 +- epan/dissectors/packet-opsi.c | 2 - epan/dissectors/packet-pcli.c | 5 +- epan/dissectors/packet-per.c | 7 +- epan/dissectors/packet-pktgen.c | 4 - epan/dissectors/packet-ptp.c | 2 - epan/dissectors/packet-pvfs2.c | 1 - epan/dissectors/packet-pw-cesopsn.c | 2 +- epan/dissectors/packet-pw-eth.c | 2 +- epan/dissectors/packet-pw-hdlc.c | 2 +- epan/dissectors/packet-pw-satop.c | 2 +- epan/dissectors/packet-redbackli.c | 5 +- epan/dissectors/packet-rlm.c | 3 +- epan/dissectors/packet-rmi.c | 1 - epan/dissectors/packet-rmt-alc.c | 1 - epan/dissectors/packet-rmt-common.c | 1 - epan/dissectors/packet-rmt-fec.c | 2 - epan/dissectors/packet-rmt-lct.c | 2 - epan/dissectors/packet-rmt-norm.c | 29 +- epan/dissectors/packet-rsh.c | 8 +- epan/dissectors/packet-rsync.c | 4 +- epan/dissectors/packet-rtnet.c | 5 +- epan/dissectors/packet-sccpmg.c | 2 - epan/dissectors/packet-sita.c | 584 +++-- epan/dissectors/packet-sndcp-xid.c | 2 - epan/dissectors/packet-synergy.c | 1 - epan/dissectors/packet-syslog.c | 4 +- epan/dissectors/packet-tds.c | 5 +- epan/dissectors/packet-teamspeak2.c | 4 +- epan/dissectors/packet-teredo.c | 3 +- epan/dissectors/packet-tivoconnect.c | 1 - epan/dissectors/packet-tnef.c | 3 - epan/dissectors/packet-tte-pcf.c | 1 - epan/dissectors/packet-turbocell.c | 2 - epan/dissectors/packet-turnchannel.c | 2 - epan/dissectors/packet-udld.c | 3 +- epan/dissectors/packet-udp.c | 2 +- epan/dissectors/packet-uma.c | 7 +- epan/dissectors/packet-v5ua.c | 3 - epan/dissectors/packet-vtp.c | 5 +- epan/dissectors/packet-wbxml.c | 3 - epan/dissectors/packet-wlccp.c | 2 - epan/dissectors/packet-wol.c | 5 +- epan/dissectors/packet-wow.c | 2 - epan/dissectors/packet-wsmp.c | 2 +- epan/dissectors/packet-wtls.c | 280 +-- epan/dissectors/packet-wtp.c | 4 +- epan/dissectors/packet-x11.c | 5 +- epan/dissectors/packet-x25.c | 7 +- epan/dissectors/packet-xdmcp.c | 2 +- epan/dissectors/packet-xot.c | 4 +- 144 files changed, 4329 insertions(+), 4455 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-aim-admin.c b/epan/dissectors/packet-aim-admin.c index 85d5668446..6166e635b2 100644 --- a/epan/dissectors/packet-aim-admin.c +++ b/epan/dissectors/packet-aim-admin.c @@ -27,9 +27,6 @@ # include "config.h" #endif -#include -#include - #include #include diff --git a/epan/dissectors/packet-aim-adverts.c b/epan/dissectors/packet-aim-adverts.c index 905ceab63e..c506d41deb 100644 --- a/epan/dissectors/packet-aim-adverts.c +++ b/epan/dissectors/packet-aim-adverts.c @@ -27,9 +27,6 @@ # include "config.h" #endif -#include -#include - #include #include diff --git a/epan/dissectors/packet-aim-bos.c b/epan/dissectors/packet-aim-bos.c index 418b76fdc0..94a1ac93aa 100644 --- a/epan/dissectors/packet-aim-bos.c +++ b/epan/dissectors/packet-aim-bos.c @@ -27,9 +27,6 @@ # include "config.h" #endif -#include -#include - #include #include diff --git a/epan/dissectors/packet-aim-buddylist.c b/epan/dissectors/packet-aim-buddylist.c index 3a135e9796..bfc521717b 100644 --- a/epan/dissectors/packet-aim-buddylist.c +++ b/epan/dissectors/packet-aim-buddylist.c @@ -27,9 +27,6 @@ # include "config.h" #endif -#include -#include - #include #include diff --git a/epan/dissectors/packet-aim-chat.c b/epan/dissectors/packet-aim-chat.c index c64c5b683b..0bba5cd626 100644 --- a/epan/dissectors/packet-aim-chat.c +++ b/epan/dissectors/packet-aim-chat.c @@ -28,9 +28,6 @@ # include "config.h" #endif -#include -#include - #include #include diff --git a/epan/dissectors/packet-aim-chatnav.c b/epan/dissectors/packet-aim-chatnav.c index 1e74ec1897..b90168cd22 100644 --- a/epan/dissectors/packet-aim-chatnav.c +++ b/epan/dissectors/packet-aim-chatnav.c @@ -27,9 +27,6 @@ # include "config.h" #endif -#include -#include - #include #include diff --git a/epan/dissectors/packet-aim-directory.c b/epan/dissectors/packet-aim-directory.c index 0e88ffe01d..f375885470 100644 --- a/epan/dissectors/packet-aim-directory.c +++ b/epan/dissectors/packet-aim-directory.c @@ -27,9 +27,6 @@ # include "config.h" #endif -#include -#include - #include #include diff --git a/epan/dissectors/packet-aim-email.c b/epan/dissectors/packet-aim-email.c index 754fed5272..d7a7b1c90f 100644 --- a/epan/dissectors/packet-aim-email.c +++ b/epan/dissectors/packet-aim-email.c @@ -27,9 +27,6 @@ # include "config.h" #endif -#include -#include - #include #include diff --git a/epan/dissectors/packet-aim-icq.c b/epan/dissectors/packet-aim-icq.c index 9e42fa2b91..60b67961df 100644 --- a/epan/dissectors/packet-aim-icq.c +++ b/epan/dissectors/packet-aim-icq.c @@ -27,9 +27,6 @@ # include "config.h" #endif -#include -#include - #include #include diff --git a/epan/dissectors/packet-aim-invitation.c b/epan/dissectors/packet-aim-invitation.c index 1481053677..cb43e94fe7 100644 --- a/epan/dissectors/packet-aim-invitation.c +++ b/epan/dissectors/packet-aim-invitation.c @@ -27,9 +27,6 @@ # include "config.h" #endif -#include -#include - #include #include diff --git a/epan/dissectors/packet-aim-location.c b/epan/dissectors/packet-aim-location.c index 25bfa012d1..52aa3d1e09 100644 --- a/epan/dissectors/packet-aim-location.c +++ b/epan/dissectors/packet-aim-location.c @@ -28,9 +28,6 @@ # include "config.h" #endif -#include -#include - #include #include diff --git a/epan/dissectors/packet-aim-oft.c b/epan/dissectors/packet-aim-oft.c index c2973e797a..820fd2280e 100644 --- a/epan/dissectors/packet-aim-oft.c +++ b/epan/dissectors/packet-aim-oft.c @@ -27,9 +27,6 @@ # include "config.h" #endif -#include -#include - #include #include diff --git a/epan/dissectors/packet-aim-popup.c b/epan/dissectors/packet-aim-popup.c index d00fc677b7..ec09bf4e70 100644 --- a/epan/dissectors/packet-aim-popup.c +++ b/epan/dissectors/packet-aim-popup.c @@ -27,9 +27,6 @@ # include "config.h" #endif -#include -#include - #include #include diff --git a/epan/dissectors/packet-aim-signon.c b/epan/dissectors/packet-aim-signon.c index fb8bfb3c36..268d0c95e6 100644 --- a/epan/dissectors/packet-aim-signon.c +++ b/epan/dissectors/packet-aim-signon.c @@ -28,9 +28,6 @@ # include "config.h" #endif -#include -#include - #include #include diff --git a/epan/dissectors/packet-aim-sst.c b/epan/dissectors/packet-aim-sst.c index 65cc9c26f0..2bf45d3f2c 100644 --- a/epan/dissectors/packet-aim-sst.c +++ b/epan/dissectors/packet-aim-sst.c @@ -27,9 +27,6 @@ # include "config.h" #endif -#include -#include - #include #include diff --git a/epan/dissectors/packet-aim-stats.c b/epan/dissectors/packet-aim-stats.c index 2f159ce66f..b366a94d91 100644 --- a/epan/dissectors/packet-aim-stats.c +++ b/epan/dissectors/packet-aim-stats.c @@ -27,9 +27,6 @@ # include "config.h" #endif -#include -#include - #include #include diff --git a/epan/dissectors/packet-aim-translate.c b/epan/dissectors/packet-aim-translate.c index c781a1ad5f..2427a7a9a7 100644 --- a/epan/dissectors/packet-aim-translate.c +++ b/epan/dissectors/packet-aim-translate.c @@ -27,9 +27,6 @@ # include "config.h" #endif -#include -#include - #include #include diff --git a/epan/dissectors/packet-aim-userlookup.c b/epan/dissectors/packet-aim-userlookup.c index ddfc45bf01..07445858f5 100644 --- a/epan/dissectors/packet-aim-userlookup.c +++ b/epan/dissectors/packet-aim-userlookup.c @@ -27,9 +27,6 @@ # include "config.h" #endif -#include -#include - #include #include diff --git a/epan/dissectors/packet-aim.c b/epan/dissectors/packet-aim.c index c4bfbb6d98..151f902ab8 100644 --- a/epan/dissectors/packet-aim.c +++ b/epan/dissectors/packet-aim.c @@ -29,7 +29,6 @@ # include "config.h" #endif -#include #include #include diff --git a/epan/dissectors/packet-app-pkix-cert.c b/epan/dissectors/packet-app-pkix-cert.c index 3ccd667c68..900a1bea20 100644 --- a/epan/dissectors/packet-app-pkix-cert.c +++ b/epan/dissectors/packet-app-pkix-cert.c @@ -32,8 +32,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-arcnet.c b/epan/dissectors/packet-arcnet.c index fa56d0f0bf..a6383cb4d5 100644 --- a/epan/dissectors/packet-arcnet.c +++ b/epan/dissectors/packet-arcnet.c @@ -27,8 +27,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-artnet.c b/epan/dissectors/packet-artnet.c index 46ef1c1571..f6f3c42f4e 100644 --- a/epan/dissectors/packet-artnet.c +++ b/epan/dissectors/packet-artnet.c @@ -30,10 +30,8 @@ #include "config.h" #endif -#include -#include -#include -#include +#include + #include #include #include diff --git a/epan/dissectors/packet-aruba-adp.c b/epan/dissectors/packet-aruba-adp.c index 8a194be5b0..56bf4f4782 100644 --- a/epan/dissectors/packet-aruba-adp.c +++ b/epan/dissectors/packet-aruba-adp.c @@ -27,7 +27,6 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include #include #include diff --git a/epan/dissectors/packet-banana.c b/epan/dissectors/packet-banana.c index d7232a5984..c7bbfdbc3b 100644 --- a/epan/dissectors/packet-banana.c +++ b/epan/dissectors/packet-banana.c @@ -32,8 +32,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-bfd.c b/epan/dissectors/packet-bfd.c index 07aa339e22..ac427c7321 100644 --- a/epan/dissectors/packet-bfd.c +++ b/epan/dissectors/packet-bfd.c @@ -38,10 +38,8 @@ # include "config.h" #endif -#include -#include - #include + #include #include diff --git a/epan/dissectors/packet-brdwlk.c b/epan/dissectors/packet-brdwlk.c index a90c4e20fd..289eb6ae5f 100644 --- a/epan/dissectors/packet-brdwlk.c +++ b/epan/dissectors/packet-brdwlk.c @@ -27,8 +27,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-capwap.c b/epan/dissectors/packet-capwap.c index 2f2f908d8e..3feaf036aa 100644 --- a/epan/dissectors/packet-capwap.c +++ b/epan/dissectors/packet-capwap.c @@ -27,7 +27,7 @@ # include "config.h" #endif -#include +#include #include #include diff --git a/epan/dissectors/packet-ccsds.c b/epan/dissectors/packet-ccsds.c index c7f64a7e3d..37293eeace 100644 --- a/epan/dissectors/packet-ccsds.c +++ b/epan/dissectors/packet-ccsds.c @@ -28,9 +28,8 @@ # include "config.h" #endif -#include - #include + #include #include #include diff --git a/epan/dissectors/packet-cell_broadcast.c b/epan/dissectors/packet-cell_broadcast.c index 26338a78ac..ad62ea7418 100644 --- a/epan/dissectors/packet-cell_broadcast.c +++ b/epan/dissectors/packet-cell_broadcast.c @@ -28,12 +28,10 @@ # include "config.h" #endif -#include -#include #include + #include -#include #include #include @@ -563,8 +561,3 @@ proto_register_cbs(void) /* subtree array */ proto_register_subtree_array(ett, array_length(ett)); } - -void -proto_reg_handoff_gsm_cbs(void) -{ -} diff --git a/epan/dissectors/packet-cgmp.c b/epan/dissectors/packet-cgmp.c index d122613560..f9d4d1a640 100644 --- a/epan/dissectors/packet-cgmp.c +++ b/epan/dissectors/packet-cgmp.c @@ -22,11 +22,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H #include "config.h" - -#include +#endif #include + #include /* diff --git a/epan/dissectors/packet-cigi.c b/epan/dissectors/packet-cigi.c index 72cf1aa321..95dcf62837 100644 --- a/epan/dissectors/packet-cigi.c +++ b/epan/dissectors/packet-cigi.c @@ -33,8 +33,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-cimetrics.c b/epan/dissectors/packet-cimetrics.c index 107fec2ba5..5e9f0757c6 100644 --- a/epan/dissectors/packet-cimetrics.c +++ b/epan/dissectors/packet-cimetrics.c @@ -27,6 +27,8 @@ # include "config.h" #endif +#include + #include #include "packet-llc.h" #include diff --git a/epan/dissectors/packet-cisco-sm.c b/epan/dissectors/packet-cisco-sm.c index 7e93d8c997..c8709f7e03 100644 --- a/epan/dissectors/packet-cisco-sm.c +++ b/epan/dissectors/packet-cisco-sm.c @@ -43,21 +43,21 @@ # include "config.h" #endif -#include +#include #include -#define MESSAGE_TYPE_START 0 -#define MESSAGE_TYPE_STOP 1 -#define MESSAGE_TYPE_ACTIVE 2 -#define MESSAGE_TYPE_STANDBY 3 -#define MESSAGE_TYPE_Q_HOLD_INVOKE 4 -#define MESSAGE_TYPE_Q_HOLD_RESPONSE 5 -#define MESSAGE_TYPE_Q_RESUME_INVOKE 6 -#define MESSAGE_TYPE_Q_RESUME_RESPONSE 7 -#define MESSAGE_TYPE_Q_RESET_INVOKE 8 -#define MESSAGE_TYPE_Q_RESET_RESPONSE 9 -#define MESSAGE_TYPE_PDU 0x8000 +#define MESSAGE_TYPE_START 0 +#define MESSAGE_TYPE_STOP 1 +#define MESSAGE_TYPE_ACTIVE 2 +#define MESSAGE_TYPE_STANDBY 3 +#define MESSAGE_TYPE_Q_HOLD_INVOKE 4 +#define MESSAGE_TYPE_Q_HOLD_RESPONSE 5 +#define MESSAGE_TYPE_Q_RESUME_INVOKE 6 +#define MESSAGE_TYPE_Q_RESUME_RESPONSE 7 +#define MESSAGE_TYPE_Q_RESET_INVOKE 8 +#define MESSAGE_TYPE_Q_RESET_RESPONSE 9 +#define MESSAGE_TYPE_PDU 0x8000 static const value_string sm_message_type_value[] = { { MESSAGE_TYPE_START, "Start Message" }, @@ -223,7 +223,7 @@ dissect_sm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case SM_PROTOCOL_X101: if (!tree) return; - /* XXX Reveres enginered so this may not be correct!!! + /* XXX Reverse enginered so this may not be correct!!! * EISUP - used between Cisco HSI and Cisco PGW devices, * uses RUDP with default port number 8003. * Protocol stack is RUDP->Cisco SM->SDP. @@ -261,7 +261,7 @@ dissect_sm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case SM_PROTOCOL_X114: if (!tree) return; - /* XXX Reveres enginered so this may not be correct!!! */ + /* XXX Reverse enginered so this may not be correct!!! */ proto_tree_add_item(sm_tree, hf_sm_len, tvb, offset, 2, ENC_BIG_ENDIAN); length = tvb_get_ntohs(tvb,offset); offset = offset + 2; diff --git a/epan/dissectors/packet-dccp.c b/epan/dissectors/packet-dccp.c index ed978642b7..bb91be4cf7 100644 --- a/epan/dissectors/packet-dccp.c +++ b/epan/dissectors/packet-dccp.c @@ -52,10 +52,8 @@ #include "config.h" #endif -#include -#include - #include + #include #include #include @@ -1428,7 +1426,7 @@ proto_reg_handoff_dccp(void) dccp_handle = create_dissector_handle(dissect_dccp, proto_dccp); dissector_add_uint("ip.proto", IP_PROTO_DCCP, dccp_handle); data_handle = find_dissector("data"); - dccp_tap = register_tap("dccp"); + dccp_tap = register_tap("dccp"); } /* diff --git a/epan/dissectors/packet-dcm.c b/epan/dissectors/packet-dcm.c index f330e714ba..32f813416c 100644 --- a/epan/dissectors/packet-dcm.c +++ b/epan/dissectors/packet-dcm.c @@ -206,14 +206,12 @@ # include "config.h" #endif -#include #include -#include #include -#include #include +#include #include #include #include diff --git a/epan/dissectors/packet-dhcp-failover.c b/epan/dissectors/packet-dhcp-failover.c index 41ad1b1f6b..37a4d74975 100644 --- a/epan/dissectors/packet-dhcp-failover.c +++ b/epan/dissectors/packet-dhcp-failover.c @@ -39,8 +39,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-dtp.c b/epan/dissectors/packet-dtp.c index c7001e3ada..ff90bc5693 100644 --- a/epan/dissectors/packet-dtp.c +++ b/epan/dissectors/packet-dtp.c @@ -28,11 +28,12 @@ * */ +#ifdef HAVE_CONFIG_H #include "config.h" - -#include +#endif #include + #include /* diff --git a/epan/dissectors/packet-enttec.c b/epan/dissectors/packet-enttec.c index 15e400dc71..c8566ebbca 100644 --- a/epan/dissectors/packet-enttec.c +++ b/epan/dissectors/packet-enttec.c @@ -30,9 +30,8 @@ #include "config.h" #endif -#include -#include -#include +#include + #include #include #include diff --git a/epan/dissectors/packet-exec.c b/epan/dissectors/packet-exec.c index 4c0b991610..21244e7f1c 100644 --- a/epan/dissectors/packet-exec.c +++ b/epan/dissectors/packet-exec.c @@ -31,13 +31,9 @@ #include -#include -#include -#include - +#include #include #include -#include #include #include diff --git a/epan/dissectors/packet-fc.c b/epan/dissectors/packet-fc.c index 8e175987de..a3d17b095c 100644 --- a/epan/dissectors/packet-fc.c +++ b/epan/dissectors/packet-fc.c @@ -30,8 +30,6 @@ #endif -#include - #include #include diff --git a/epan/dissectors/packet-fcct.c b/epan/dissectors/packet-fcct.c index 2a14339d22..4fb184abb9 100644 --- a/epan/dissectors/packet-fcct.c +++ b/epan/dissectors/packet-fcct.c @@ -27,8 +27,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-fcels.c b/epan/dissectors/packet-fcels.c index 5721938e56..fa3185f500 100644 --- a/epan/dissectors/packet-fcels.c +++ b/epan/dissectors/packet-fcels.c @@ -32,8 +32,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-fcfcs.c b/epan/dissectors/packet-fcfcs.c index 976dd7fce5..1d8c895cc1 100644 --- a/epan/dissectors/packet-fcfcs.c +++ b/epan/dissectors/packet-fcfcs.c @@ -27,8 +27,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-fclctl.c b/epan/dissectors/packet-fclctl.c index b21508d68d..fa93088ff1 100644 --- a/epan/dissectors/packet-fclctl.c +++ b/epan/dissectors/packet-fclctl.c @@ -27,8 +27,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-fcoe.c b/epan/dissectors/packet-fcoe.c index d1555b979e..7b25dd1e54 100644 --- a/epan/dissectors/packet-fcoe.c +++ b/epan/dissectors/packet-fcoe.c @@ -34,8 +34,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-fcsp.c b/epan/dissectors/packet-fcsp.c index febf1a6145..deb371de3f 100644 --- a/epan/dissectors/packet-fcsp.c +++ b/epan/dissectors/packet-fcsp.c @@ -28,8 +28,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-g723.c b/epan/dissectors/packet-g723.c index 6f0e272ad0..2405ed6559 100644 --- a/epan/dissectors/packet-g723.c +++ b/epan/dissectors/packet-g723.c @@ -29,8 +29,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-gdsdb.c b/epan/dissectors/packet-gdsdb.c index 3f25ad8f0c..86ab1f25d4 100644 --- a/epan/dissectors/packet-gdsdb.c +++ b/epan/dissectors/packet-gdsdb.c @@ -27,8 +27,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-gift.c b/epan/dissectors/packet-gift.c index cda1dfd896..3b5b3cb115 100644 --- a/epan/dissectors/packet-gift.c +++ b/epan/dissectors/packet-gift.c @@ -29,8 +29,8 @@ # include "config.h" #endif -#include #include + #include #include diff --git a/epan/dissectors/packet-git.c b/epan/dissectors/packet-git.c index a2700fb624..bd51496ff8 100644 --- a/epan/dissectors/packet-git.c +++ b/epan/dissectors/packet-git.c @@ -31,9 +31,9 @@ #endif #include -#include #include + #include #include #include diff --git a/epan/dissectors/packet-gmrp.c b/epan/dissectors/packet-gmrp.c index b9bd860e28..d1aeab5abc 100644 --- a/epan/dissectors/packet-gmrp.c +++ b/epan/dissectors/packet-gmrp.c @@ -30,8 +30,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-gnutella.c b/epan/dissectors/packet-gnutella.c index e65293358f..f5628d3c1b 100644 --- a/epan/dissectors/packet-gnutella.c +++ b/epan/dissectors/packet-gnutella.c @@ -27,11 +27,8 @@ #include "config.h" #endif -#include - #include - #include #include "packet-gnutella.h" #include "packet-tcp.h" diff --git a/epan/dissectors/packet-gopher.c b/epan/dissectors/packet-gopher.c index fd75f2a1fe..b9df44ba98 100644 --- a/epan/dissectors/packet-gopher.c +++ b/epan/dissectors/packet-gopher.c @@ -34,8 +34,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-gsm_a_bssmap.c b/epan/dissectors/packet-gsm_a_bssmap.c index b852f6fc42..1b4cd99892 100644 --- a/epan/dissectors/packet-gsm_a_bssmap.c +++ b/epan/dissectors/packet-gsm_a_bssmap.c @@ -40,7 +40,7 @@ # include "config.h" #endif -#include +#include #include #include diff --git a/epan/dissectors/packet-gsm_a_common.c b/epan/dissectors/packet-gsm_a_common.c index a1f6d16fc3..2826836c8c 100644 --- a/epan/dissectors/packet-gsm_a_common.c +++ b/epan/dissectors/packet-gsm_a_common.c @@ -31,9 +31,10 @@ # include "config.h" #endif -#include #include +#include + #include #include #include diff --git a/epan/dissectors/packet-gsm_a_dtap.c b/epan/dissectors/packet-gsm_a_dtap.c index 470751cdd8..2ebb95cb90 100644 --- a/epan/dissectors/packet-gsm_a_dtap.c +++ b/epan/dissectors/packet-gsm_a_dtap.c @@ -91,7 +91,7 @@ # include "config.h" #endif -#include +#include #include #include diff --git a/epan/dissectors/packet-gsm_a_rp.c b/epan/dissectors/packet-gsm_a_rp.c index faecd8a19d..45696fcf7c 100644 --- a/epan/dissectors/packet-gsm_a_rp.c +++ b/epan/dissectors/packet-gsm_a_rp.c @@ -36,7 +36,7 @@ # include "config.h" #endif -#include +#include #include #include diff --git a/epan/dissectors/packet-gsm_bsslap.c b/epan/dissectors/packet-gsm_bsslap.c index b4323e0677..696001597f 100644 --- a/epan/dissectors/packet-gsm_bsslap.c +++ b/epan/dissectors/packet-gsm_bsslap.c @@ -29,8 +29,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-gsm_bssmap_le.c b/epan/dissectors/packet-gsm_bssmap_le.c index bc26c53939..0146ddf0de 100644 --- a/epan/dissectors/packet-gsm_bssmap_le.c +++ b/epan/dissectors/packet-gsm_bssmap_le.c @@ -30,7 +30,7 @@ # include "config.h" #endif -#include +#include #include #include diff --git a/epan/dissectors/packet-icp.c b/epan/dissectors/packet-icp.c index 6aef654893..d6e19f2b8e 100644 --- a/epan/dissectors/packet-icp.c +++ b/epan/dissectors/packet-icp.c @@ -30,8 +30,8 @@ #include "config.h" #endif -#include #include + #include #include diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c index 36ec57b1ec..870dc57593 100644 --- a/epan/dissectors/packet-ieee80211.c +++ b/epan/dissectors/packet-ieee80211.c @@ -98,7 +98,6 @@ # include "config.h" #endif -#include #include #include diff --git a/epan/dissectors/packet-ifcp.c b/epan/dissectors/packet-ifcp.c index 91c9e7a73e..d1ae977db1 100644 --- a/epan/dissectors/packet-ifcp.c +++ b/epan/dissectors/packet-ifcp.c @@ -34,8 +34,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-igrp.c b/epan/dissectors/packet-igrp.c index df483228bb..535b82e89e 100644 --- a/epan/dissectors/packet-igrp.c +++ b/epan/dissectors/packet-igrp.c @@ -33,10 +33,8 @@ # include "config.h" #endif -#include -#include - #include + #include #include diff --git a/epan/dissectors/packet-image-gif.c b/epan/dissectors/packet-image-gif.c index 752ec1ba84..1ada5dafcc 100644 --- a/epan/dissectors/packet-image-gif.c +++ b/epan/dissectors/packet-image-gif.c @@ -33,14 +33,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* Edit this file with 4-space tabulation */ +/* Edit this file with 4-space indentation */ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include -#include #include #include @@ -55,8 +53,8 @@ */ #if (defined(DEBUG_image_gif) || defined(DEBUG_image)) #define DebugLog(x) \ - g_print("%s:%u: ", __FILE__, __LINE__); \ - g_print x + g_print("%s:%u: ", __FILE__, __LINE__); \ + g_print x #else #define DebugLog(x) ; #endif @@ -66,22 +64,22 @@ /************************** Variable declarations **************************/ static const value_string vals_true_false[] = { - { 0, "False" }, - { 1, "True" }, - { 0, NULL }, + { 0, "False" }, + { 1, "True" }, + { 0, NULL }, }; static const value_string vals_extensions[] = { - { 0xF9, "Graphics Control" }, - { 0xFE, "Comment" }, - { 0xFF, "Application" }, - { 0x01, "Plain Text" }, - { 0x00, NULL }, + { 0xF9, "Graphics Control" }, + { 0xFE, "Comment" }, + { 0xFF, "Application" }, + { 0x01, "Plain Text" }, + { 0x00, NULL }, }; enum { - GIF_87a = 0x87, - GIF_89a = 0x89 + GIF_87a = 0x87, + GIF_89a = 0x89 }; /* Initialize the protocol and registered fields */ @@ -139,293 +137,293 @@ static gint ett_image = -1; static gint dissect_gif(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) { - proto_item *ti; - proto_tree *gif_tree; /* Main GIF tree */ - proto_tree *subtree; /* Main GIF tree */ - guint offset = 0, len = 0; - guint8 peek; - gboolean color_map_present; - guint8 color_resolution; - guint8 image_bpp; - guint tvb_len = tvb_reported_length(tvb); - char *str = tvb_get_ephemeral_string(tvb, 0, 6); - guint8 version = 0; - - if (tvb_len < 20) - return 0; - - /* Check whether we're processing a GIF object */ - /* see http://www.w3.org/Graphics/GIF/spec-gif89a.txt section 17 */ - if (strcmp(str, "GIF87a") == 0) { - version = GIF_87a; - } else if (strcmp(str, "GIF89a") == 0) { - version = GIF_89a; - } else { - /* Not a GIF image! */ - return 0; - } - - DISSECTOR_ASSERT(version); - - /* Add summary to INFO column if it is enabled */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", str); - - /* In order to speed up dissection, do not add items to the protocol tree - * if it is not visible. However, compute the values that are needed for - * correct protocol dissection if they have more meaning than just adding - * items to the protocol tree. - */ - if (tree) { - ti = proto_tree_add_item(tree, proto_gif, tvb, 0, -1, ENC_NA); - proto_item_append_text(ti, ", Version: %s", str); - gif_tree = proto_item_add_subtree(ti, ett_gif); - /* GIF signature */ - proto_tree_add_item(gif_tree, hf_version, tvb, 0, 6, ENC_ASCII|ENC_NA); - /* Screen descriptor */ - proto_tree_add_item(gif_tree, hf_screen_width, tvb, 6, 2, ENC_LITTLE_ENDIAN); - proto_tree_add_item(gif_tree, hf_screen_height, tvb, 8, 2, ENC_LITTLE_ENDIAN); - - peek = tvb_get_guint8(tvb, 10); - /* Bitfield gccc 0ppp - * g... .... : global color map present - * .ccc .... : color resolution in bits (add one) - * .... 0... : GIF87a - reserved (no use) - * GIF89a - ordered (most important color 1st) - * .... .ppp : bits per pixel in image (add one) - */ - color_map_present = peek & 0x80; - color_resolution = 1 + ((peek & 0x60) >> 4); - image_bpp = 1 + (peek & 0x07); - - ti = proto_tree_add_text(gif_tree, tvb, 10, 1, - "Global settings:"); - if (color_map_present) - proto_item_append_text(ti, " (Global color table present)"); - proto_item_append_text(ti, - " (%u bit%s per color) (%u bit%s per pixel)", - color_resolution, plurality(color_resolution, "", "s"), - image_bpp, plurality(image_bpp, "", "s")); - subtree = proto_item_add_subtree(ti, ett_global_flags); - proto_tree_add_item(subtree, hf_global_color_map_present, - tvb, 10, 1, ENC_LITTLE_ENDIAN); - proto_tree_add_item(subtree, hf_global_color_resolution, - tvb, 10, 1, ENC_LITTLE_ENDIAN); - if (version == GIF_89a) { - proto_tree_add_item(subtree, hf_global_color_map_ordered, - tvb, 10, 1, ENC_LITTLE_ENDIAN); - } - proto_tree_add_item(subtree, hf_global_image_bpp, - tvb, 10, 1, ENC_LITTLE_ENDIAN); - - /* Background color */ - proto_tree_add_item(gif_tree, hf_background_color, - tvb, 11, 1, ENC_LITTLE_ENDIAN); - - /* byte at offset 12 is 0x00 - reserved in GIF87a but encodes the - * pixel aspect ratio in GIF89a as: - * aspect-ratio = (15 + pixel-aspect-ratio) / 64 - * where the aspect-ratio is not computed if pixel-aspect-ratio == 0 - */ - if (version == GIF_89a) { - peek = tvb_get_guint8(tvb, 12); - if (peek) { - /* Only display if different from 0 */ - proto_tree_add_uint_format(gif_tree, hf_pixel_aspect_ratio, - tvb, 12, 1, peek, - "%u, yields an aspect ratio of (15 + %u) / 64 = %.2f", - peek, peek, (float)(15 + peek) / 64.0); - } - } - - /* Global color map - * If present, it takes 2 ^ (image_bpp) byte tuples (R, G, B) - * that contain the Red, Green and Blue intensity of the colors - * in the Global Color Map */ - if (color_map_present) { - len = 3 * (1 << image_bpp); - proto_tree_add_item(gif_tree, hf_global_color_map, - tvb, 13, len, ENC_NA); - } else { - len = 0; - } - offset = 13 + len; - /* From now on, a set of images prefixed with the image separator - * character 0x2C (',') will appear in the byte stream. Each image - * hence consists of: - * - The image separator character 0x2C - * - Image left (16 bits LSB first): pixels from left border - * - Image top (16 bits LSB first): pixels from to border - * - Image width (16 bits LSB first) - * - Image height (16 bits LSB first) - * - A bitfield MI00 0ppp - * M... .... : Use global color map if unset (ignore ppp); - * if set a local color map will be defined. - * .I.. .... : Image formatted in interlaced order if set; - * otherwise it is plain sequential order - * ..0. .... : GIF87a - Reserved - * ..s. .... GIF89a - Set if local color map is ordered - * ...0 0... : Reserved - * .... .ppp : bits per pixel in image (add one) - * - If the local color map bit is set, then a local color table follows - * with length = 3 x 2 ^ (1 + bits per pixel) - * - The raster data - * - * NOTE that the GIF specification only requires that: - * image left + image width <= screen width - * image top + image height <= screen height - * - * The Raster Data is encoded as follows: - * - Code size (1 byte) - * - Blocks consisting of - * o Byte count (1 byte): number of bytes in the block - * o Data bytes: as many as specified in the byte count - * End of data is given with an empty block (byte count == 0). - * - * - * GIF terminator - * This is a synchronization method, based on the final character 0xB3 - * (';') at the end of an image - * - * - * GIF extension - * This is a block of data encoded as: - * - The GIF extension block introducer 0x21 ('!') - * - The extension function code (1 byte) - * - Blocks consisting of - * o Byte count (1 byte): number of bytes in the block - * o Data bytes: as many as specified in the byte count - * End of data is given with an empty block (byte count == 0). - * - * NOTE that the GIF extension block can only appear at the following - * locations: - * - Immediately before an Image Descriptor - * - Before the GIF termination character - */ - while (offset < tvb_len) { - peek = tvb_get_guint8(tvb, offset); - if (peek == 0x21) { /* GIF extension block */ - guint32 item_len = 2; /* Fixed header consisting of: - * 1 byte : 0x21 - * 1 byte : extension_label - */ - - ti = proto_tree_add_item(gif_tree, hf_extension, - tvb, offset, 1, ENC_NA); - subtree = proto_item_add_subtree(ti, ett_extension); - offset++; - proto_tree_add_item(subtree, hf_extension_label, - tvb, offset, 1, ENC_LITTLE_ENDIAN); - peek = tvb_get_guint8(tvb, offset); - proto_item_append_text(ti, ": %s", - val_to_str(peek, vals_extensions, - "")); - offset++; - do { - /* Read length of data block */ - len = tvb_get_guint8(tvb, offset); - proto_tree_add_text(subtree, tvb, - offset, 1 + len, - "Data block (length = %u)", len); - offset += (1 + len); - item_len += (1 + len); - } while (len > 0); - proto_item_set_len(ti, item_len); - } else if (peek == 0x2C) { /* Image separator */ - proto_tree *subtree2; - proto_item *ti2; - guint32 item_len = 11; /* Fixed header consisting of: - * 1 byte : 0x2C - * 2 bytes: image_left - * 2 bytes: image_top - * 2 bytes: image_width - * 2 bytes: image height - * 1 byte : packed bit field - * 1 byte : image code size - */ - - ti = proto_tree_add_item(gif_tree, hf_image, - tvb, offset, 1, ENC_NA); - subtree = proto_item_add_subtree(ti, ett_image); - offset++; - /* Screen descriptor */ - proto_tree_add_item(subtree, hf_image_left, - tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - proto_tree_add_item(subtree, hf_image_top, - tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - proto_tree_add_item(subtree, hf_image_width, - tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - proto_tree_add_item(subtree, hf_image_height, - tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - /* bit field */ - peek = tvb_get_guint8(tvb, offset); - color_map_present = peek & 0x80; - color_resolution = 1 + ((peek & 0x60) >> 4); - image_bpp = 1 + (peek & 0x07); - - ti2 = proto_tree_add_text(subtree, tvb, offset, 1, - "Local settings:"); - if (color_map_present) - proto_item_append_text(ti2, " (Local color table present)"); - proto_item_append_text(ti2, - " (%u bit%s per color) (%u bit%s per pixel)", - color_resolution, plurality(color_resolution, "", "s"), - image_bpp, plurality(image_bpp, "", "s")); - subtree2 = proto_item_add_subtree(ti2, ett_local_flags); - proto_tree_add_item(subtree2, hf_local_color_map_present, - tvb, offset, 1, ENC_LITTLE_ENDIAN); - proto_tree_add_item(subtree2, hf_local_color_resolution, - tvb, offset, 1, ENC_LITTLE_ENDIAN); - if (version == GIF_89a) { - proto_tree_add_item(subtree2, hf_local_color_map_ordered, - tvb, offset, 1, ENC_LITTLE_ENDIAN); - } - proto_tree_add_item(subtree2, hf_global_image_bpp, - tvb, offset, 1, ENC_LITTLE_ENDIAN); - offset++; - - /* Local color map - * If present, it takes 2 ^ (image_bpp) byte tuples (R, G, B) - * that contain the Red, Green and Blue intensity of the colors - * in the Local Color Map */ - if (color_map_present) { - len = 3 * (1 << image_bpp); - proto_tree_add_item(subtree, hf_local_color_map, - tvb, offset, len, ENC_NA); - } else { - len = 0; - } - offset += len; - item_len += len; - - proto_tree_add_item(subtree, hf_image_code_size, - tvb, offset, 1, ENC_LITTLE_ENDIAN); - offset++; - do { - /* Read length of data block */ - len = tvb_get_guint8(tvb, offset); - proto_tree_add_text(subtree, tvb, - offset, 1 + len, - "Data block (length = %u)", len); - offset += 1 + len; - item_len += (1 + len); - } while (len > 0); - proto_item_set_len(ti, item_len); - } else { - /* GIF processing stops at this very byte */ - proto_tree_add_item(gif_tree, hf_trailer, - tvb, offset, 1, ENC_NA); - break; - } - } /* while */ - } - return offset; + proto_item *ti; + proto_tree *gif_tree; /* Main GIF tree */ + proto_tree *subtree; /* Main GIF tree */ + guint offset = 0, len = 0; + guint8 peek; + gboolean color_map_present; + guint8 color_resolution; + guint8 image_bpp; + guint tvb_len = tvb_reported_length(tvb); + char *str = tvb_get_ephemeral_string(tvb, 0, 6); + guint8 version = 0; + + if (tvb_len < 20) + return 0; + + /* Check whether we're processing a GIF object */ + /* see http://www.w3.org/Graphics/GIF/spec-gif89a.txt section 17 */ + if (strcmp(str, "GIF87a") == 0) { + version = GIF_87a; + } else if (strcmp(str, "GIF89a") == 0) { + version = GIF_89a; + } else { + /* Not a GIF image! */ + return 0; + } + + DISSECTOR_ASSERT(version); + + /* Add summary to INFO column if it is enabled */ + if (check_col(pinfo->cinfo, COL_INFO)) + col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", str); + + /* In order to speed up dissection, do not add items to the protocol tree + * if it is not visible. However, compute the values that are needed for + * correct protocol dissection if they have more meaning than just adding + * items to the protocol tree. + */ + if (tree) { + ti = proto_tree_add_item(tree, proto_gif, tvb, 0, -1, ENC_NA); + proto_item_append_text(ti, ", Version: %s", str); + gif_tree = proto_item_add_subtree(ti, ett_gif); + /* GIF signature */ + proto_tree_add_item(gif_tree, hf_version, tvb, 0, 6, ENC_ASCII|ENC_NA); + /* Screen descriptor */ + proto_tree_add_item(gif_tree, hf_screen_width, tvb, 6, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(gif_tree, hf_screen_height, tvb, 8, 2, ENC_LITTLE_ENDIAN); + + peek = tvb_get_guint8(tvb, 10); + /* Bitfield gccc 0ppp + * g... .... : global color map present + * .ccc .... : color resolution in bits (add one) + * .... 0... : GIF87a - reserved (no use) + * GIF89a - ordered (most important color 1st) + * .... .ppp : bits per pixel in image (add one) + */ + color_map_present = peek & 0x80; + color_resolution = 1 + ((peek & 0x60) >> 4); + image_bpp = 1 + (peek & 0x07); + + ti = proto_tree_add_text(gif_tree, tvb, 10, 1, + "Global settings:"); + if (color_map_present) + proto_item_append_text(ti, " (Global color table present)"); + proto_item_append_text(ti, + " (%u bit%s per color) (%u bit%s per pixel)", + color_resolution, plurality(color_resolution, "", "s"), + image_bpp, plurality(image_bpp, "", "s")); + subtree = proto_item_add_subtree(ti, ett_global_flags); + proto_tree_add_item(subtree, hf_global_color_map_present, + tvb, 10, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(subtree, hf_global_color_resolution, + tvb, 10, 1, ENC_LITTLE_ENDIAN); + if (version == GIF_89a) { + proto_tree_add_item(subtree, hf_global_color_map_ordered, + tvb, 10, 1, ENC_LITTLE_ENDIAN); + } + proto_tree_add_item(subtree, hf_global_image_bpp, + tvb, 10, 1, ENC_LITTLE_ENDIAN); + + /* Background color */ + proto_tree_add_item(gif_tree, hf_background_color, + tvb, 11, 1, ENC_LITTLE_ENDIAN); + + /* byte at offset 12 is 0x00 - reserved in GIF87a but encodes the + * pixel aspect ratio in GIF89a as: + * aspect-ratio = (15 + pixel-aspect-ratio) / 64 + * where the aspect-ratio is not computed if pixel-aspect-ratio == 0 + */ + if (version == GIF_89a) { + peek = tvb_get_guint8(tvb, 12); + if (peek) { + /* Only display if different from 0 */ + proto_tree_add_uint_format(gif_tree, hf_pixel_aspect_ratio, + tvb, 12, 1, peek, + "%u, yields an aspect ratio of (15 + %u) / 64 = %.2f", + peek, peek, (float)(15 + peek) / 64.0); + } + } + + /* Global color map + * If present, it takes 2 ^ (image_bpp) byte tuples (R, G, B) + * that contain the Red, Green and Blue intensity of the colors + * in the Global Color Map */ + if (color_map_present) { + len = 3 * (1 << image_bpp); + proto_tree_add_item(gif_tree, hf_global_color_map, + tvb, 13, len, ENC_NA); + } else { + len = 0; + } + offset = 13 + len; + /* From now on, a set of images prefixed with the image separator + * character 0x2C (',') will appear in the byte stream. Each image + * hence consists of: + * - The image separator character 0x2C + * - Image left (16 bits LSB first): pixels from left border + * - Image top (16 bits LSB first): pixels from to border + * - Image width (16 bits LSB first) + * - Image height (16 bits LSB first) + * - A bitfield MI00 0ppp + * M... .... : Use global color map if unset (ignore ppp); + * if set a local color map will be defined. + * .I.. .... : Image formatted in interlaced order if set; + * otherwise it is plain sequential order + * ..0. .... : GIF87a - Reserved + * ..s. .... GIF89a - Set if local color map is ordered + * ...0 0... : Reserved + * .... .ppp : bits per pixel in image (add one) + * - If the local color map bit is set, then a local color table follows + * with length = 3 x 2 ^ (1 + bits per pixel) + * - The raster data + * + * NOTE that the GIF specification only requires that: + * image left + image width <= screen width + * image top + image height <= screen height + * + * The Raster Data is encoded as follows: + * - Code size (1 byte) + * - Blocks consisting of + * o Byte count (1 byte): number of bytes in the block + * o Data bytes: as many as specified in the byte count + * End of data is given with an empty block (byte count == 0). + * + * + * GIF terminator + * This is a synchronization method, based on the final character 0xB3 + * (';') at the end of an image + * + * + * GIF extension + * This is a block of data encoded as: + * - The GIF extension block introducer 0x21 ('!') + * - The extension function code (1 byte) + * - Blocks consisting of + * o Byte count (1 byte): number of bytes in the block + * o Data bytes: as many as specified in the byte count + * End of data is given with an empty block (byte count == 0). + * + * NOTE that the GIF extension block can only appear at the following + * locations: + * - Immediately before an Image Descriptor + * - Before the GIF termination character + */ + while (offset < tvb_len) { + peek = tvb_get_guint8(tvb, offset); + if (peek == 0x21) { /* GIF extension block */ + guint32 item_len = 2; /* Fixed header consisting of: + * 1 byte : 0x21 + * 1 byte : extension_label + */ + + ti = proto_tree_add_item(gif_tree, hf_extension, + tvb, offset, 1, ENC_NA); + subtree = proto_item_add_subtree(ti, ett_extension); + offset++; + proto_tree_add_item(subtree, hf_extension_label, + tvb, offset, 1, ENC_LITTLE_ENDIAN); + peek = tvb_get_guint8(tvb, offset); + proto_item_append_text(ti, ": %s", + val_to_str(peek, vals_extensions, + "")); + offset++; + do { + /* Read length of data block */ + len = tvb_get_guint8(tvb, offset); + proto_tree_add_text(subtree, tvb, + offset, 1 + len, + "Data block (length = %u)", len); + offset += (1 + len); + item_len += (1 + len); + } while (len > 0); + proto_item_set_len(ti, item_len); + } else if (peek == 0x2C) { /* Image separator */ + proto_tree *subtree2; + proto_item *ti2; + guint32 item_len = 11; /* Fixed header consisting of: + * 1 byte : 0x2C + * 2 bytes: image_left + * 2 bytes: image_top + * 2 bytes: image_width + * 2 bytes: image height + * 1 byte : packed bit field + * 1 byte : image code size + */ + + ti = proto_tree_add_item(gif_tree, hf_image, + tvb, offset, 1, ENC_NA); + subtree = proto_item_add_subtree(ti, ett_image); + offset++; + /* Screen descriptor */ + proto_tree_add_item(subtree, hf_image_left, + tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; + proto_tree_add_item(subtree, hf_image_top, + tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; + proto_tree_add_item(subtree, hf_image_width, + tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; + proto_tree_add_item(subtree, hf_image_height, + tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; + /* bit field */ + peek = tvb_get_guint8(tvb, offset); + color_map_present = peek & 0x80; + color_resolution = 1 + ((peek & 0x60) >> 4); + image_bpp = 1 + (peek & 0x07); + + ti2 = proto_tree_add_text(subtree, tvb, offset, 1, + "Local settings:"); + if (color_map_present) + proto_item_append_text(ti2, " (Local color table present)"); + proto_item_append_text(ti2, + " (%u bit%s per color) (%u bit%s per pixel)", + color_resolution, plurality(color_resolution, "", "s"), + image_bpp, plurality(image_bpp, "", "s")); + subtree2 = proto_item_add_subtree(ti2, ett_local_flags); + proto_tree_add_item(subtree2, hf_local_color_map_present, + tvb, offset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(subtree2, hf_local_color_resolution, + tvb, offset, 1, ENC_LITTLE_ENDIAN); + if (version == GIF_89a) { + proto_tree_add_item(subtree2, hf_local_color_map_ordered, + tvb, offset, 1, ENC_LITTLE_ENDIAN); + } + proto_tree_add_item(subtree2, hf_global_image_bpp, + tvb, offset, 1, ENC_LITTLE_ENDIAN); + offset++; + + /* Local color map + * If present, it takes 2 ^ (image_bpp) byte tuples (R, G, B) + * that contain the Red, Green and Blue intensity of the colors + * in the Local Color Map */ + if (color_map_present) { + len = 3 * (1 << image_bpp); + proto_tree_add_item(subtree, hf_local_color_map, + tvb, offset, len, ENC_NA); + } else { + len = 0; + } + offset += len; + item_len += len; + + proto_tree_add_item(subtree, hf_image_code_size, + tvb, offset, 1, ENC_LITTLE_ENDIAN); + offset++; + do { + /* Read length of data block */ + len = tvb_get_guint8(tvb, offset); + proto_tree_add_text(subtree, tvb, + offset, 1 + len, + "Data block (length = %u)", len); + offset += 1 + len; + item_len += (1 + len); + } while (len > 0); + proto_item_set_len(ti, item_len); + } else { + /* GIF processing stops at this very byte */ + proto_tree_add_item(gif_tree, hf_trailer, + tvb, offset, 1, ENC_NA); + break; + } + } /* while */ + } + return offset; } static gboolean dissect_gif_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - return dissect_gif(tvb, pinfo, tree) > 0; + return dissect_gif(tvb, pinfo, tree) > 0; } @@ -438,256 +436,256 @@ dissect_gif_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) void proto_register_gif(void) { - /* - * Setup list of header fields. - */ - static hf_register_info hf[] = { - /* - * GIF signature and version - */ - { &hf_version, - { "Version", - IMG_GIF ".version", - FT_STRING, BASE_NONE, NULL, 0x00, - "GIF Version", - HFILL - } - }, - - /* - * Logical screen descriptor - */ - { &hf_screen_width, - { "Screen width", - IMG_GIF ".screen.width", - FT_UINT16, BASE_DEC, NULL, 0x00, - NULL, - HFILL - } - }, - { &hf_screen_height, - { "Screen height", - IMG_GIF ".screen.height", - FT_UINT16, BASE_DEC, NULL, 0x00, - NULL, - HFILL - } - }, - { &hf_global_color_map_present, - { "Global color map is present", - IMG_GIF ".global.color_map.present", - FT_UINT8, BASE_DEC, VALS(vals_true_false), 0x80, - "Indicates if the global color map is present", - HFILL - } - }, - { &hf_global_color_resolution, - { "Bits per color minus 1", - IMG_GIF ".global.color_bpp", - FT_UINT8, BASE_DEC, NULL, 0x70, - "The number of bits per color is one plus the field value.", - HFILL - } - }, - { &hf_global_color_map_ordered, - { "Global color map is ordered", - IMG_GIF ".global.color_map.ordered", - FT_UINT8, BASE_DEC, VALS(vals_true_false), 0x08, - "Indicates whether the global color map is ordered.", - HFILL - } - }, - { &hf_global_image_bpp, - { "Image bits per pixel minus 1", - IMG_GIF ".global.bpp", - FT_UINT8, BASE_DEC, NULL, 0x07, - "The number of bits per pixel is one plus the field value.", - HFILL - } - }, - { &hf_background_color, - { "Background color index", - IMG_GIF ".image_background_index", - FT_UINT8, BASE_DEC, NULL, 0x00, - "Index of the background color in the color map.", - HFILL - } - }, - { &hf_pixel_aspect_ratio, - { "Global pixel aspect ratio", - IMG_GIF ".global.pixel_aspect_ratio", - FT_UINT8, BASE_DEC, NULL, 0x00, - "Gives an approximate value of the aspect ratio of the pixels.", - HFILL - } - }, - { &hf_global_color_map, - { "Global color map", - IMG_GIF ".global.color_map", - FT_BYTES, BASE_NONE, NULL, 0x00, - "Global color map.", - HFILL - } - }, - - /* - * Local color map (part of image) - */ - { &hf_local_color_map_present, - { "Local color map is present", - IMG_GIF ".local.color_map.present", - FT_UINT8, BASE_DEC, VALS(vals_true_false), 0x80, - "Indicates if the local color map is present", - HFILL - } - }, - { &hf_local_color_resolution, - { "Bits per color minus 1", - IMG_GIF ".local.color_bpp", - FT_UINT8, BASE_DEC, NULL, 0x70, - "The number of bits per color is one plus the field value.", - HFILL - } - }, - { &hf_local_color_map_ordered, - { "Local color map is ordered", - IMG_GIF ".local.color_map.ordered", - FT_UINT8, BASE_DEC, VALS(vals_true_false), 0x08, - "Indicates whether the local color map is ordered.", - HFILL - } - }, - { &hf_local_image_bpp, - { "Image bits per pixel minus 1", - IMG_GIF ".local.bpp", - FT_UINT8, BASE_DEC, NULL, 0x07, - "The number of bits per pixel is one plus the field value.", - HFILL - } - }, - { &hf_local_color_map, - { "Local color map", - IMG_GIF ".local.color_map", - FT_BYTES, BASE_NONE, NULL, 0x00, - "Local color map.", - HFILL - } - }, - - /* - * Extension - */ - { &hf_extension, - { "Extension", - IMG_GIF ".extension", - FT_NONE, BASE_NONE, NULL, 0x00, - "Extension.", - HFILL - } - }, - { &hf_extension_label, - { "Extension label", - IMG_GIF ".extension.label", - FT_UINT8, BASE_HEX, VALS(vals_extensions), 0x00, - "Extension label.", - HFILL - } - }, - - /* - * Image - */ - { &hf_image, - { "Image", - IMG_GIF ".image", - FT_NONE, BASE_NONE, NULL, 0x00, - "Image.", - HFILL - } - }, - { &hf_image_left, - { "Image left position", - IMG_GIF ".image.left", - FT_UINT16, BASE_DEC, NULL, 0x00, - "Offset between left of Screen and left of Image.", - HFILL - } - }, - { &hf_image_top, - { "Image top position", - IMG_GIF ".image.top", - FT_UINT16, BASE_DEC, NULL, 0x00, - "Offset between top of Screen and top of Image.", - HFILL - } - }, - { &hf_image_width, - { "Image width", - IMG_GIF ".image.width", - FT_UINT16, BASE_DEC, NULL, 0x00, - "Image width.", - HFILL - } - }, - { &hf_image_height, - { "Image height", - IMG_GIF ".image.height", - FT_UINT16, BASE_DEC, NULL, 0x00, - "Image height.", - HFILL - } - }, - { &hf_image_code_size, - { "LZW minimum code size", - IMG_GIF ".image.code_size", - FT_UINT8, BASE_DEC, NULL, 0x00, - "Minimum code size for the LZW compression.", - HFILL - } - }, - /* - * Trailer - */ - { &hf_trailer, - { "Trailer (End of the GIF stream)", - IMG_GIF ".end", - FT_NONE, BASE_NONE, NULL, 0x00, - "This byte tells the decoder that the data stream is finished.", - HFILL - } - }, - }; - - /* Setup protocol subtree array */ - static gint *ett[] = { - &ett_gif, - &ett_global_flags, - &ett_local_flags, - &ett_extension, - &ett_image, - }; - - /* Register the protocol name and description */ - proto_gif = proto_register_protocol( - "Compuserve GIF", - "GIF image", - IMG_GIF - ); - - /* Required function calls to register the header fields - * and subtrees used */ - proto_register_field_array(proto_gif, hf, array_length(hf)); - proto_register_subtree_array(ett, array_length(ett)); - - new_register_dissector(IMG_GIF, dissect_gif, proto_gif); + /* + * Setup list of header fields. + */ + static hf_register_info hf[] = { + /* + * GIF signature and version + */ + { &hf_version, + { "Version", + IMG_GIF ".version", + FT_STRING, BASE_NONE, NULL, 0x00, + "GIF Version", + HFILL + } + }, + + /* + * Logical screen descriptor + */ + { &hf_screen_width, + { "Screen width", + IMG_GIF ".screen.width", + FT_UINT16, BASE_DEC, NULL, 0x00, + NULL, + HFILL + } + }, + { &hf_screen_height, + { "Screen height", + IMG_GIF ".screen.height", + FT_UINT16, BASE_DEC, NULL, 0x00, + NULL, + HFILL + } + }, + { &hf_global_color_map_present, + { "Global color map is present", + IMG_GIF ".global.color_map.present", + FT_UINT8, BASE_DEC, VALS(vals_true_false), 0x80, + "Indicates if the global color map is present", + HFILL + } + }, + { &hf_global_color_resolution, + { "Bits per color minus 1", + IMG_GIF ".global.color_bpp", + FT_UINT8, BASE_DEC, NULL, 0x70, + "The number of bits per color is one plus the field value.", + HFILL + } + }, + { &hf_global_color_map_ordered, + { "Global color map is ordered", + IMG_GIF ".global.color_map.ordered", + FT_UINT8, BASE_DEC, VALS(vals_true_false), 0x08, + "Indicates whether the global color map is ordered.", + HFILL + } + }, + { &hf_global_image_bpp, + { "Image bits per pixel minus 1", + IMG_GIF ".global.bpp", + FT_UINT8, BASE_DEC, NULL, 0x07, + "The number of bits per pixel is one plus the field value.", + HFILL + } + }, + { &hf_background_color, + { "Background color index", + IMG_GIF ".image_background_index", + FT_UINT8, BASE_DEC, NULL, 0x00, + "Index of the background color in the color map.", + HFILL + } + }, + { &hf_pixel_aspect_ratio, + { "Global pixel aspect ratio", + IMG_GIF ".global.pixel_aspect_ratio", + FT_UINT8, BASE_DEC, NULL, 0x00, + "Gives an approximate value of the aspect ratio of the pixels.", + HFILL + } + }, + { &hf_global_color_map, + { "Global color map", + IMG_GIF ".global.color_map", + FT_BYTES, BASE_NONE, NULL, 0x00, + "Global color map.", + HFILL + } + }, + + /* + * Local color map (part of image) + */ + { &hf_local_color_map_present, + { "Local color map is present", + IMG_GIF ".local.color_map.present", + FT_UINT8, BASE_DEC, VALS(vals_true_false), 0x80, + "Indicates if the local color map is present", + HFILL + } + }, + { &hf_local_color_resolution, + { "Bits per color minus 1", + IMG_GIF ".local.color_bpp", + FT_UINT8, BASE_DEC, NULL, 0x70, + "The number of bits per color is one plus the field value.", + HFILL + } + }, + { &hf_local_color_map_ordered, + { "Local color map is ordered", + IMG_GIF ".local.color_map.ordered", + FT_UINT8, BASE_DEC, VALS(vals_true_false), 0x08, + "Indicates whether the local color map is ordered.", + HFILL + } + }, + { &hf_local_image_bpp, + { "Image bits per pixel minus 1", + IMG_GIF ".local.bpp", + FT_UINT8, BASE_DEC, NULL, 0x07, + "The number of bits per pixel is one plus the field value.", + HFILL + } + }, + { &hf_local_color_map, + { "Local color map", + IMG_GIF ".local.color_map", + FT_BYTES, BASE_NONE, NULL, 0x00, + "Local color map.", + HFILL + } + }, + + /* + * Extension + */ + { &hf_extension, + { "Extension", + IMG_GIF ".extension", + FT_NONE, BASE_NONE, NULL, 0x00, + "Extension.", + HFILL + } + }, + { &hf_extension_label, + { "Extension label", + IMG_GIF ".extension.label", + FT_UINT8, BASE_HEX, VALS(vals_extensions), 0x00, + "Extension label.", + HFILL + } + }, + + /* + * Image + */ + { &hf_image, + { "Image", + IMG_GIF ".image", + FT_NONE, BASE_NONE, NULL, 0x00, + "Image.", + HFILL + } + }, + { &hf_image_left, + { "Image left position", + IMG_GIF ".image.left", + FT_UINT16, BASE_DEC, NULL, 0x00, + "Offset between left of Screen and left of Image.", + HFILL + } + }, + { &hf_image_top, + { "Image top position", + IMG_GIF ".image.top", + FT_UINT16, BASE_DEC, NULL, 0x00, + "Offset between top of Screen and top of Image.", + HFILL + } + }, + { &hf_image_width, + { "Image width", + IMG_GIF ".image.width", + FT_UINT16, BASE_DEC, NULL, 0x00, + "Image width.", + HFILL + } + }, + { &hf_image_height, + { "Image height", + IMG_GIF ".image.height", + FT_UINT16, BASE_DEC, NULL, 0x00, + "Image height.", + HFILL + } + }, + { &hf_image_code_size, + { "LZW minimum code size", + IMG_GIF ".image.code_size", + FT_UINT8, BASE_DEC, NULL, 0x00, + "Minimum code size for the LZW compression.", + HFILL + } + }, + /* + * Trailer + */ + { &hf_trailer, + { "Trailer (End of the GIF stream)", + IMG_GIF ".end", + FT_NONE, BASE_NONE, NULL, 0x00, + "This byte tells the decoder that the data stream is finished.", + HFILL + } + }, + }; + + /* Setup protocol subtree array */ + static gint *ett[] = { + &ett_gif, + &ett_global_flags, + &ett_local_flags, + &ett_extension, + &ett_image, + }; + + /* Register the protocol name and description */ + proto_gif = proto_register_protocol( + "Compuserve GIF", + "GIF image", + IMG_GIF + ); + + /* Required function calls to register the header fields + * and subtrees used */ + proto_register_field_array(proto_gif, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + + new_register_dissector(IMG_GIF, dissect_gif, proto_gif); } void proto_reg_handoff_gif(void) { - dissector_handle_t gif_handle = find_dissector(IMG_GIF); - /* Register the GIF media type */ - dissector_add_string("media_type", "image/gif", gif_handle); - heur_dissector_add("http", dissect_gif_heur, proto_gif); + dissector_handle_t gif_handle = find_dissector(IMG_GIF); + /* Register the GIF media type */ + dissector_add_string("media_type", "image/gif", gif_handle); + heur_dissector_add("http", dissect_gif_heur, proto_gif); } diff --git a/epan/dissectors/packet-ipfc.c b/epan/dissectors/packet-ipfc.c index 08edffd006..bd0455bc1c 100644 --- a/epan/dissectors/packet-ipfc.c +++ b/epan/dissectors/packet-ipfc.c @@ -30,8 +30,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-ipsec.c b/epan/dissectors/packet-ipsec.c index 56f80ab4d2..555cb11e5e 100644 --- a/epan/dissectors/packet-ipsec.c +++ b/epan/dissectors/packet-ipsec.c @@ -74,7 +74,6 @@ ADD: Additional generic (non-checked) ICV length of 128, 192 and 256. #endif #include -#include #include #include diff --git a/epan/dissectors/packet-ismp.c b/epan/dissectors/packet-ismp.c index 03fd4747cf..0fe5dfee2c 100644 --- a/epan/dissectors/packet-ismp.c +++ b/epan/dissectors/packet-ismp.c @@ -28,8 +28,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-iwarp-ddp-rdmap.c b/epan/dissectors/packet-iwarp-ddp-rdmap.c index b7955d5256..79dfff15fc 100644 --- a/epan/dissectors/packet-iwarp-ddp-rdmap.c +++ b/epan/dissectors/packet-iwarp-ddp-rdmap.c @@ -31,8 +31,9 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include + #include + #include /* DEFINES */ diff --git a/epan/dissectors/packet-l2tp.c b/epan/dissectors/packet-l2tp.c index e421c5b5f7..d06c2b3948 100644 --- a/epan/dissectors/packet-l2tp.c +++ b/epan/dissectors/packet-l2tp.c @@ -35,7 +35,7 @@ * http://tools.ietf.org/html/rfc3931 * * Layer Two Tunneling Protocol "L2TP" number assignments: - * http://www.iana.org/assignments/l2tp-parameters + * http://www.iana.org/assignments/l2tp-parameters * * Pseudowire types: * @@ -54,6 +54,18 @@ * XXX - what about LAPD? */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include +#include +#include +#include +#include + static int proto_l2tp = -1; static int hf_l2tp_type = -1; static int hf_l2tp_length_bit = -1; @@ -96,37 +108,24 @@ static int hf_l2tp_avp_assigned_session_id = -1; static int hf_l2tp_avp_remote_session_id = -1; static int hf_l2tp_avp_local_session_id = -1; -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - #define UDP_PORT_L2TP 1701 -#define CONTROL_BIT(msg_info) (msg_info & 0x8000) /* Type bit control = 1 data = 0 */ -#define LENGTH_BIT(msg_info) (msg_info & 0x4000) /* Length bit = 1 */ -#define RESERVE_BITS(msg_info) (msg_info &0x37F8) /* Reserved bit - usused */ -#define SEQUENCE_BIT(msg_info) (msg_info & 0x0800) /* SEQUENCE bit = 1 Ns and Nr fields */ -#define OFFSET_BIT(msg_info) (msg_info & 0x0200) /* Offset */ -#define PRIORITY_BIT(msg_info) (msg_info & 0x0100) /* Priority */ -#define L2TP_VERSION(msg_info) (msg_info & 0x000f) /* Version of l2tp */ -#define MANDATORY_BIT(msg_info) (msg_info & 0x8000) /* Mandatory = 1 */ -#define HIDDEN_BIT(msg_info) (msg_info & 0x4000) /* Hidden = 1 */ -#define AVP_LENGTH(msg_info) (msg_info & 0x03ff) /* AVP Length */ -#define FRAMING_SYNC(msg_info) (msg_info & 0x0001) /* SYNC Framing Type */ -#define FRAMING_ASYNC(msg_info) (msg_info & 0x0002) /* ASYNC Framing Type */ -#define BEARER_DIGITAL(msg_info) (msg_info & 0x0001) /* Digital Bearer Type */ -#define BEARER_ANALOG(msg_info) (msg_info & 0x0002) /* Analog Bearer Type */ -#define CIRCUIT_STATUS_BIT(msg_info) (msg_info & 0x0001) /* Circuit Status */ -#define CIRCUIT_TYPE_BIT(msg_info) (msg_info & 0x0001) /* Circuit Condition */ +#define CONTROL_BIT(msg_info) (msg_info & 0x8000) /* Type bit control = 1 data = 0 */ +#define LENGTH_BIT(msg_info) (msg_info & 0x4000) /* Length bit = 1 */ +#define RESERVE_BITS(msg_info) (msg_info &0x37F8) /* Reserved bit - usused */ +#define SEQUENCE_BIT(msg_info) (msg_info & 0x0800) /* SEQUENCE bit = 1 Ns and Nr fields */ +#define OFFSET_BIT(msg_info) (msg_info & 0x0200) /* Offset */ +#define PRIORITY_BIT(msg_info) (msg_info & 0x0100) /* Priority */ +#define L2TP_VERSION(msg_info) (msg_info & 0x000f) /* Version of l2tp */ +#define MANDATORY_BIT(msg_info) (msg_info & 0x8000) /* Mandatory = 1 */ +#define HIDDEN_BIT(msg_info) (msg_info & 0x4000) /* Hidden = 1 */ +#define AVP_LENGTH(msg_info) (msg_info & 0x03ff) /* AVP Length */ +#define FRAMING_SYNC(msg_info) (msg_info & 0x0001) /* SYNC Framing Type */ +#define FRAMING_ASYNC(msg_info) (msg_info & 0x0002) /* ASYNC Framing Type */ +#define BEARER_DIGITAL(msg_info) (msg_info & 0x0001) /* Digital Bearer Type */ +#define BEARER_ANALOG(msg_info) (msg_info & 0x0002) /* Analog Bearer Type */ +#define CIRCUIT_STATUS_BIT(msg_info) (msg_info & 0x0001) /* Circuit Status */ +#define CIRCUIT_TYPE_BIT(msg_info) (msg_info & 0x0001) /* Circuit Condition */ /* DOCSIS DMPT Sub-Layer Header definitions */ #define FLOW_ID_MASK 0x0E @@ -145,28 +144,28 @@ static enum_val_t l2tpv3_cookies[] = { {NULL, NULL, 0} }; -#define L2TPv3_PROTOCOL_ETH 0 -#define L2TPv3_PROTOCOL_CHDLC 1 -#define L2TPv3_PROTOCOL_FR 2 -#define L2TPv3_PROTOCOL_PPP 3 -#define L2TPv3_PROTOCOL_IP 4 -#define L2TPv3_PROTOCOL_MPLS 5 -#define L2TPv3_PROTOCOL_AAL5 6 -#define L2TPv3_PROTOCOL_LAPD 7 +#define L2TPv3_PROTOCOL_ETH 0 +#define L2TPv3_PROTOCOL_CHDLC 1 +#define L2TPv3_PROTOCOL_FR 2 +#define L2TPv3_PROTOCOL_PPP 3 +#define L2TPv3_PROTOCOL_IP 4 +#define L2TPv3_PROTOCOL_MPLS 5 +#define L2TPv3_PROTOCOL_AAL5 6 +#define L2TPv3_PROTOCOL_LAPD 7 #define L2TPv3_PROTOCOL_DOCSIS_DMPT 8 -#define L2TPv3_PROTOCOL_ERICSSON 9 +#define L2TPv3_PROTOCOL_ERICSSON 9 static enum_val_t l2tpv3_protocols[] = { - {"eth", "Ethernet", L2TPv3_PROTOCOL_ETH}, - {"chdlc", "Cisco HDLC", L2TPv3_PROTOCOL_CHDLC}, - {"fr", "Frame Relay", L2TPv3_PROTOCOL_FR}, - {"ppp", "PPP", L2TPv3_PROTOCOL_PPP}, - {"ip", "IP", L2TPv3_PROTOCOL_IP}, - {"mpls", "MPLS", L2TPv3_PROTOCOL_MPLS}, - {"aal5", "AAL5", L2TPv3_PROTOCOL_AAL5}, - {"lapd", "LAPD", L2TPv3_PROTOCOL_LAPD}, - {"docsis-dmpt", "DOCSIS-DMPT", L2TPv3_PROTOCOL_DOCSIS_DMPT}, - {"ehdlc", "Ericsson HDLC", L2TPv3_PROTOCOL_ERICSSON}, + {"eth", "Ethernet", L2TPv3_PROTOCOL_ETH}, + {"chdlc", "Cisco HDLC", L2TPv3_PROTOCOL_CHDLC}, + {"fr", "Frame Relay", L2TPv3_PROTOCOL_FR}, + {"ppp", "PPP", L2TPv3_PROTOCOL_PPP}, + {"ip", "IP", L2TPv3_PROTOCOL_IP}, + {"mpls", "MPLS", L2TPv3_PROTOCOL_MPLS}, + {"aal5", "AAL5", L2TPv3_PROTOCOL_AAL5}, + {"lapd", "LAPD", L2TPv3_PROTOCOL_LAPD}, + {"docsis-dmpt", "DOCSIS-DMPT", L2TPv3_PROTOCOL_DOCSIS_DMPT}, + {"ehdlc", "Ericsson HDLC", L2TPv3_PROTOCOL_ERICSSON}, {NULL, NULL, 0} }; @@ -189,15 +188,15 @@ static gint l2tpv3_cookie = 4; static gint l2tpv3_protocol = L2TPv3_PROTOCOL_CHDLC; static gint l2tpv3_l2_specific = L2TPv3_L2_SPECIFIC_DEFAULT; -#define MESSAGE_TYPE_SCCRQ 1 -#define MESSAGE_TYPE_SCCRP 2 -#define MESSAGE_TYPE_SCCCN 3 -#define MESSAGE_TYPE_StopCCN 4 -#define MESSAGE_TYPE_Reserved_5 5 -#define MESSAGE_TYPE_HELLO 6 -#define MESSAGE_TYPE_OCRQ 7 -#define MESSAGE_TYPE_OCRP 8 -#define MESSAGE_TYPE_OCCN 9 +#define MESSAGE_TYPE_SCCRQ 1 +#define MESSAGE_TYPE_SCCRP 2 +#define MESSAGE_TYPE_SCCCN 3 +#define MESSAGE_TYPE_StopCCN 4 +#define MESSAGE_TYPE_Reserved_5 5 +#define MESSAGE_TYPE_HELLO 6 +#define MESSAGE_TYPE_OCRQ 7 +#define MESSAGE_TYPE_OCRP 8 +#define MESSAGE_TYPE_OCCN 9 #define MESSAGE_TYPE_ICRQ 10 #define MESSAGE_TYPE_ICRP 11 #define MESSAGE_TYPE_ICCN 12 @@ -218,376 +217,375 @@ static gint l2tpv3_l2_specific = L2TPv3_L2_SPECIFIC_DEFAULT; #define MESSAGE_TYPE_MSEN 27 static const value_string message_type_vals[] = { - { MESSAGE_TYPE_SCCRQ, "Start_Control_Request" }, - { MESSAGE_TYPE_SCCRP, "Start_Control_Reply" }, - { MESSAGE_TYPE_SCCCN, "Start_Control_Connected" }, - { MESSAGE_TYPE_StopCCN, "Stop_Control_Notification" }, - { MESSAGE_TYPE_HELLO, "Hello" }, - { MESSAGE_TYPE_OCRQ, "Outgoing_Call_Request" }, - { MESSAGE_TYPE_OCRP, "Outgoing_Call_Reply" }, - { MESSAGE_TYPE_OCCN, "Outgoing_Call_Connected" }, - { MESSAGE_TYPE_ICRQ, "Incoming_Call_Request" }, - { MESSAGE_TYPE_ICRP, "Incoming_Call_Reply" }, - { MESSAGE_TYPE_ICCN, "Incoming_Call_Connected" }, - { MESSAGE_TYPE_CDN, "Call_Disconnect_Notification" }, - { MESSAGE_TYPE_WEN, "WAN_Error_Notify" }, - { MESSAGE_TYPE_SLI, "Set_Link_Info" }, - { MESSAGE_TYPE_MDMST, "Modem_Status" }, - { MESSAGE_TYPE_SRRQ, "Service_Relay_Request_Msg" }, - { MESSAGE_TYPE_SRRP, "Service_Relay_Reply_Message" }, - { MESSAGE_TYPE_ACK, "Explicit_Acknowledgement" }, - /* Fail Over Extensions - RFC4951 */ - { MESSAGE_TYPE_FSQ, "Failover_Session_Query_Message" }, - { MESSAGE_TYPE_FSR, "Failover_Session_Response_Message" }, - /* Multicast Management - RFC4045 */ - { MESSAGE_TYPE_MSRQ, "Multicast-Session-Request" }, - { MESSAGE_TYPE_MSRP, "Multicast-Session-Response" }, - { MESSAGE_TYPE_MSE, "Multicast-Session-Establishment" }, - { MESSAGE_TYPE_MSI, "Multicast-Session-Information" }, - { MESSAGE_TYPE_MSEN, "Multicast-Session-End-Notify" }, - { 0, NULL }, + { MESSAGE_TYPE_SCCRQ, "Start_Control_Request" }, + { MESSAGE_TYPE_SCCRP, "Start_Control_Reply" }, + { MESSAGE_TYPE_SCCCN, "Start_Control_Connected" }, + { MESSAGE_TYPE_StopCCN, "Stop_Control_Notification" }, + { MESSAGE_TYPE_HELLO, "Hello" }, + { MESSAGE_TYPE_OCRQ, "Outgoing_Call_Request" }, + { MESSAGE_TYPE_OCRP, "Outgoing_Call_Reply" }, + { MESSAGE_TYPE_OCCN, "Outgoing_Call_Connected" }, + { MESSAGE_TYPE_ICRQ, "Incoming_Call_Request" }, + { MESSAGE_TYPE_ICRP, "Incoming_Call_Reply" }, + { MESSAGE_TYPE_ICCN, "Incoming_Call_Connected" }, + { MESSAGE_TYPE_CDN, "Call_Disconnect_Notification" }, + { MESSAGE_TYPE_WEN, "WAN_Error_Notify" }, + { MESSAGE_TYPE_SLI, "Set_Link_Info" }, + { MESSAGE_TYPE_MDMST, "Modem_Status" }, + { MESSAGE_TYPE_SRRQ, "Service_Relay_Request_Msg" }, + { MESSAGE_TYPE_SRRP, "Service_Relay_Reply_Message" }, + { MESSAGE_TYPE_ACK, "Explicit_Acknowledgement" }, + /* Fail Over Extensions - RFC4951 */ + { MESSAGE_TYPE_FSQ, "Failover_Session_Query_Message" }, + { MESSAGE_TYPE_FSR, "Failover_Session_Response_Message" }, + /* Multicast Management - RFC4045 */ + { MESSAGE_TYPE_MSRQ, "Multicast-Session-Request" }, + { MESSAGE_TYPE_MSRP, "Multicast-Session-Response" }, + { MESSAGE_TYPE_MSE, "Multicast-Session-Establishment" }, + { MESSAGE_TYPE_MSI, "Multicast-Session-Information" }, + { MESSAGE_TYPE_MSEN, "Multicast-Session-End-Notify" }, + { 0, NULL }, }; static const value_string l2tp_message_type_short_str_vals[] = { - { MESSAGE_TYPE_SCCRQ, "SCCRQ" }, - { MESSAGE_TYPE_SCCRP, "SCCRP" }, - { MESSAGE_TYPE_SCCCN, "SCCCN" }, - { MESSAGE_TYPE_StopCCN, "StopCCN" }, - { 5, "Reserved"}, - { MESSAGE_TYPE_HELLO, "Hello" }, - { MESSAGE_TYPE_OCRQ, "OCRQ" }, - { MESSAGE_TYPE_OCRP, "OCRP" }, - { MESSAGE_TYPE_OCCN, "OCCN" }, - { MESSAGE_TYPE_ICRQ, "ICRQ" }, - { MESSAGE_TYPE_ICRP, "ICRP" }, - { MESSAGE_TYPE_ICCN, "ICCN" }, - { 13, "Reserved"}, - { MESSAGE_TYPE_CDN, "CDN" }, - { MESSAGE_TYPE_WEN, "WEN" }, - { MESSAGE_TYPE_SLI, "SLI" }, - { MESSAGE_TYPE_MDMST, "MDMST" }, - { MESSAGE_TYPE_SRRQ, "SRRQ" }, - { MESSAGE_TYPE_SRRP, "SRRP" }, - { MESSAGE_TYPE_ACK, "ACK" }, - /* Fail Over Extensions - RFC4951 */ - { MESSAGE_TYPE_FSQ, "FSQ" }, - { MESSAGE_TYPE_FSR, "FSR" }, - /* Multicast Management - RFC4045 */ - { MESSAGE_TYPE_MSRQ, "MSRQ" }, - { MESSAGE_TYPE_MSRP, "MSRP" }, - { MESSAGE_TYPE_MSE, "MSE" }, - { MESSAGE_TYPE_MSI, "MSI" }, - { MESSAGE_TYPE_MSEN, "MSEN" }, - { 0, NULL }, + { MESSAGE_TYPE_SCCRQ, "SCCRQ" }, + { MESSAGE_TYPE_SCCRP, "SCCRP" }, + { MESSAGE_TYPE_SCCCN, "SCCCN" }, + { MESSAGE_TYPE_StopCCN, "StopCCN" }, + { 5, "Reserved"}, + { MESSAGE_TYPE_HELLO, "Hello" }, + { MESSAGE_TYPE_OCRQ, "OCRQ" }, + { MESSAGE_TYPE_OCRP, "OCRP" }, + { MESSAGE_TYPE_OCCN, "OCCN" }, + { MESSAGE_TYPE_ICRQ, "ICRQ" }, + { MESSAGE_TYPE_ICRP, "ICRP" }, + { MESSAGE_TYPE_ICCN, "ICCN" }, + { 13, "Reserved"}, + { MESSAGE_TYPE_CDN, "CDN" }, + { MESSAGE_TYPE_WEN, "WEN" }, + { MESSAGE_TYPE_SLI, "SLI" }, + { MESSAGE_TYPE_MDMST, "MDMST" }, + { MESSAGE_TYPE_SRRQ, "SRRQ" }, + { MESSAGE_TYPE_SRRP, "SRRP" }, + { MESSAGE_TYPE_ACK, "ACK" }, + /* Fail Over Extensions - RFC4951 */ + { MESSAGE_TYPE_FSQ, "FSQ" }, + { MESSAGE_TYPE_FSR, "FSR" }, + /* Multicast Management - RFC4045 */ + { MESSAGE_TYPE_MSRQ, "MSRQ" }, + { MESSAGE_TYPE_MSRP, "MSRP" }, + { MESSAGE_TYPE_MSE, "MSE" }, + { MESSAGE_TYPE_MSI, "MSI" }, + { MESSAGE_TYPE_MSEN, "MSEN" }, + { 0, NULL }, }; -static const char *control_msg = "Control Message"; -static const char *data_msg = "Data Message"; +static const char *control_msg = "Control Message"; +static const char *data_msg = "Data Message"; static const value_string l2tp_type_vals[] = { - { 0, "Data Message" }, - { 1, "Control Message" }, - { 0, NULL }, + { 0, "Data Message" }, + { 1, "Control Message" }, + { 0, NULL }, }; static const value_string cause_code_direction_vals[] = { - { 0, "global error" }, - { 1, "at peer" }, - { 2, "at local" }, - { 0, NULL }, + { 0, "global error" }, + { 1, "at peer" }, + { 2, "at local" }, + { 0, NULL }, }; static const true_false_string l2tp_length_bit_truth = - { "Length field is present", "Length field is not present" }; + { "Length field is present", "Length field is not present" }; static const true_false_string l2tp_seq_bit_truth = - { "Ns and Nr fields are present", "Ns and Nr fields are not present" }; + { "Ns and Nr fields are present", "Ns and Nr fields are not present" }; static const true_false_string l2tp_offset_bit_truth = - { "Offset Size field is present", "Offset size field is not present" }; + { "Offset Size field is present", "Offset size field is not present" }; static const true_false_string l2tp_priority_truth = - { "This data message has priority", "No priority" }; + { "This data message has priority", "No priority" }; static const value_string authen_type_vals[] = { - { 0, "Reserved" }, - { 1, "Textual username/password exchange" }, - { 2, "PPP CHAP" }, - { 3, "PPP PAP" }, - { 4, "No Authentication" }, - { 5, "Microsoft CHAP Version 1" }, - { 6, "Reserved" }, - { 7, "EAP" }, - { 0, NULL } + { 0, "Reserved" }, + { 1, "Textual username/password exchange" }, + { 2, "PPP CHAP" }, + { 3, "PPP PAP" }, + { 4, "No Authentication" }, + { 5, "Microsoft CHAP Version 1" }, + { 6, "Reserved" }, + { 7, "EAP" }, + { 0, NULL } }; static const value_string data_sequencing_vals[] = { - { 0, "No incoming data packets require sequencing" }, - { 1, "Only non-IP data packets require sequencing" }, - { 2, "All incoming data packets require sequencing" }, - { 0, NULL } + { 0, "No incoming data packets require sequencing" }, + { 1, "Only non-IP data packets require sequencing" }, + { 2, "All incoming data packets require sequencing" }, + { 0, NULL } }; static const value_string l2_sublayer_vals[] = { - { 0, "No L2-Specific Sublayer" }, - { 1, "Default L2-Specific Sublayer present" }, - { 2, "ATM-Specific Sublayer present" }, - { 3, "MPT-Specific Sublayer" }, - { 4, "PSP-Specific Sublayer" }, - { 0, NULL } + { 0, "No L2-Specific Sublayer" }, + { 1, "Default L2-Specific Sublayer present" }, + { 2, "ATM-Specific Sublayer present" }, + { 3, "MPT-Specific Sublayer" }, + { 4, "PSP-Specific Sublayer" }, + { 0, NULL } }; static const value_string result_code_stopccn_vals[] = { - { 0, "Reserved", }, - { 1, "General request to clear control connection", }, - { 2, "General error, Error Code indicates the problem", }, - { 3, "Control connection already exists", }, - { 4, "Requester is not authorized to establish a control connection", }, - { 5, "The protocol version of the requester is not supported", }, - { 6, "Requester is being shut down", }, - { 7, "Finite state machine error or timeout", }, - { 8, "Control connection due to mismatching CCDS value", }, /* [RFC3308] */ - { 0, NULL } + { 0, "Reserved", }, + { 1, "General request to clear control connection", }, + { 2, "General error, Error Code indicates the problem", }, + { 3, "Control connection already exists", }, + { 4, "Requester is not authorized to establish a control connection", }, + { 5, "The protocol version of the requester is not supported", }, + { 6, "Requester is being shut down", }, + { 7, "Finite state machine error or timeout", }, + { 8, "Control connection due to mismatching CCDS value", }, /* [RFC3308] */ + { 0, NULL } }; static const value_string result_code_cdn_vals[] = { - { 0, "Reserved", }, - { 1, "Session disconnected due to loss of carrier or circuit disconnect", }, - { 2, "Session disconnected for the reason indicated in Error Code", }, - { 3, "Session disconnected for administrative reasons", }, - { 4, "Appropriate facilities unavailable (temporary condition)", }, - { 5, "Appropriate facilities unavailable (permanent condition)", }, - { 6, "Invalid destination", }, - { 7, "Call failed due to no carrier detected", }, - { 8, "Call failed due to detection of a busy signal", }, - { 9, "Call failed due to lack of a dial tone", }, - { 10, "Call was not established within time allotted by LAC", }, - { 11, "Call was connected but no appropriate framing was detected", }, - { 12, "Disconnecting call due to mismatching SDS value", }, - { 13, "Session not established due to losing tie breaker", }, - { 14, "Session not established due to unsupported PW type", }, - { 15, "Session not established, sequencing required without valid L2-Specific Sublayer", }, - { 16, "Finite state machine error or timeout", }, - { 17, "FR PVC was deleted permanently (no longer provisioned) ", }, /* [RFC4591] */ - { 18, "FR PVC has been INACTIVE for an extended period of time", }, /* [RFC4591] */ - { 19, "Mismatched FR Header Length", }, /* [RFC4591] */ - { 20, "HDLC Link was deleted permanently (no longer provisioned)", }, /* [RFC4349] */ - { 21, "HDLC Link has been INACTIVE for an extended period of time", }, /* [RFC4349] */ - { 22, "Session not established due to other LCCE can not support the OAM Cell Emulation", }, /* [RFC4454] */ - { 23, "Mismatching interface MTU", }, /* [RFC4667] */ - { 24, "Attempt to connect to non-existent forwarder", }, /* [RFC4667] */ - { 25, "Attempt to connect to unauthorized forwarder", }, /* [RFC4667] */ - { 26, "Loop Detected", }, /* [draft-ietf-l2tpext-tunnel-switching-06.txt] */ - - - { 0, NULL } + { 0, "Reserved", }, + { 1, "Session disconnected due to loss of carrier or circuit disconnect", }, + { 2, "Session disconnected for the reason indicated in Error Code", }, + { 3, "Session disconnected for administrative reasons", }, + { 4, "Appropriate facilities unavailable (temporary condition)", }, + { 5, "Appropriate facilities unavailable (permanent condition)", }, + { 6, "Invalid destination", }, + { 7, "Call failed due to no carrier detected", }, + { 8, "Call failed due to detection of a busy signal", }, + { 9, "Call failed due to lack of a dial tone", }, + { 10, "Call was not established within time allotted by LAC", }, + { 11, "Call was connected but no appropriate framing was detected", }, + { 12, "Disconnecting call due to mismatching SDS value", }, + { 13, "Session not established due to losing tie breaker", }, + { 14, "Session not established due to unsupported PW type", }, + { 15, "Session not established, sequencing required without valid L2-Specific Sublayer", }, + { 16, "Finite state machine error or timeout", }, + { 17, "FR PVC was deleted permanently (no longer provisioned) ", }, /* [RFC4591] */ + { 18, "FR PVC has been INACTIVE for an extended period of time", }, /* [RFC4591] */ + { 19, "Mismatched FR Header Length", }, /* [RFC4591] */ + { 20, "HDLC Link was deleted permanently (no longer provisioned)", }, /* [RFC4349] */ + { 21, "HDLC Link has been INACTIVE for an extended period of time", }, /* [RFC4349] */ + { 22, "Session not established due to other LCCE can not support the OAM Cell Emulation", }, /* [RFC4454] */ + { 23, "Mismatching interface MTU", }, /* [RFC4667] */ + { 24, "Attempt to connect to non-existent forwarder", }, /* [RFC4667] */ + { 25, "Attempt to connect to unauthorized forwarder", }, /* [RFC4667] */ + { 26, "Loop Detected", }, /* [draft-ietf-l2tpext-tunnel-switching-06.txt] */ + + + { 0, NULL } }; static const value_string error_code_vals[] = { - { 0, "No General Error", }, - { 1, "No control connection exists yet for this pair of LCCEs", }, - { 2, "Length is wrong", }, - { 3, "One of the field values was out of range", }, - { 4, "Insufficient resources to handle this operation now", }, - { 5, "Invalid Session ID", }, - { 6, "A generic vendor-specific error occurred", }, - { 7, "Try another", }, - { 8, "Receipt of an unknown AVP with the M bit set", }, - { 9, "Try another directed", }, - { 10, "Next hop unreachable", }, - { 11, "Next hop busy", }, - { 12, "TSA busy", }, - { 0, NULL } + { 0, "No General Error", }, + { 1, "No control connection exists yet for this pair of LCCEs", }, + { 2, "Length is wrong", }, + { 3, "One of the field values was out of range", }, + { 4, "Insufficient resources to handle this operation now", }, + { 5, "Invalid Session ID", }, + { 6, "A generic vendor-specific error occurred", }, + { 7, "Try another", }, + { 8, "Receipt of an unknown AVP with the M bit set", }, + { 9, "Try another directed", }, + { 10, "Next hop unreachable", }, + { 11, "Next hop busy", }, + { 12, "TSA busy", }, + { 0, NULL } }; -#define CONTROL_MESSAGE 0 -#define RESULT_ERROR_CODE 1 -#define PROTOCOL_VERSION 2 -#define FRAMING_CAPABILITIES 3 -#define BEARER_CAPABILITIES 4 -#define TIE_BREAKER 5 -#define FIRMWARE_REVISION 6 -#define HOST_NAME 7 -#define VENDOR_NAME 8 -#define ASSIGNED_TUNNEL_ID 9 -#define RECEIVE_WINDOW_SIZE 10 -#define CHALLENGE 11 -#define CAUSE_CODE 12 -#define CHALLENGE_RESPONSE 13 -#define ASSIGNED_SESSION 14 -#define CALL_SERIAL_NUMBER 15 -#define MINIMUM_BPS 16 -#define MAXIMUM_BPS 17 -#define BEARER_TYPE 18 -#define FRAMING_TYPE 19 -#define CALLED_NUMBER 21 -#define CALLING_NUMBER 22 -#define SUB_ADDRESS 23 -#define TX_CONNECT_SPEED 24 -#define PHYSICAL_CHANNEL 25 +#define CONTROL_MESSAGE 0 +#define RESULT_ERROR_CODE 1 +#define PROTOCOL_VERSION 2 +#define FRAMING_CAPABILITIES 3 +#define BEARER_CAPABILITIES 4 +#define TIE_BREAKER 5 +#define FIRMWARE_REVISION 6 +#define HOST_NAME 7 +#define VENDOR_NAME 8 +#define ASSIGNED_TUNNEL_ID 9 +#define RECEIVE_WINDOW_SIZE 10 +#define CHALLENGE 11 +#define CAUSE_CODE 12 +#define CHALLENGE_RESPONSE 13 +#define ASSIGNED_SESSION 14 +#define CALL_SERIAL_NUMBER 15 +#define MINIMUM_BPS 16 +#define MAXIMUM_BPS 17 +#define BEARER_TYPE 18 +#define FRAMING_TYPE 19 +#define CALLED_NUMBER 21 +#define CALLING_NUMBER 22 +#define SUB_ADDRESS 23 +#define TX_CONNECT_SPEED 24 +#define PHYSICAL_CHANNEL 25 #define INITIAL_RECEIVED_LCP_CONFREQ 26 -#define LAST_SENT_LCP_CONFREQ 27 -#define LAST_RECEIVED_LCP_CONFREQ 28 -#define PROXY_AUTHEN_TYPE 29 -#define PROXY_AUTHEN_NAME 30 -#define PROXY_AUTHEN_CHALLENGE 31 -#define PROXY_AUTHEN_ID 32 -#define PROXY_AUTHEN_RESPONSE 33 -#define CALL_STATUS_AVPS 34 -#define ACCM 35 -#define RANDOM_VECTOR 36 -#define PRIVATE_GROUP_ID 37 -#define RX_CONNECT_SPEED 38 -#define SEQUENCING_REQUIRED 39 -#define PPP_DISCONNECT_CAUSE_CODE 46 /* RFC 3145 */ -#define EXTENDED_VENDOR_ID 58 -#define MESSAGE_DIGEST 59 -#define ROUTER_ID 60 -#define ASSIGNED_CONTROL_CONN_ID 61 -#define PW_CAPABILITY_LIST 62 -#define LOCAL_SESSION_ID 63 -#define REMOTE_SESSION_ID 64 -#define ASSIGNED_COOKIE 65 -#define REMOTE_END_ID 66 -#define PW_TYPE 68 -#define L2_SPECIFIC_SUBLAYER 69 -#define DATA_SEQUENCING 70 -#define CIRCUIT_STATUS 71 -#define PREFERRED_LANGUAGE 72 -#define CTL_MSG_AUTH_NONCE 73 -#define TX_CONNECT_SPEED_V3 74 -#define RX_CONNECT_SPEED_V3 75 - -#define NUM_AVP_TYPES 96 +#define LAST_SENT_LCP_CONFREQ 27 +#define LAST_RECEIVED_LCP_CONFREQ 28 +#define PROXY_AUTHEN_TYPE 29 +#define PROXY_AUTHEN_NAME 30 +#define PROXY_AUTHEN_CHALLENGE 31 +#define PROXY_AUTHEN_ID 32 +#define PROXY_AUTHEN_RESPONSE 33 +#define CALL_STATUS_AVPS 34 +#define ACCM 35 +#define RANDOM_VECTOR 36 +#define PRIVATE_GROUP_ID 37 +#define RX_CONNECT_SPEED 38 +#define SEQUENCING_REQUIRED 39 +#define PPP_DISCONNECT_CAUSE_CODE 46 /* RFC 3145 */ +#define EXTENDED_VENDOR_ID 58 +#define MESSAGE_DIGEST 59 +#define ROUTER_ID 60 +#define ASSIGNED_CONTROL_CONN_ID 61 +#define PW_CAPABILITY_LIST 62 +#define LOCAL_SESSION_ID 63 +#define REMOTE_SESSION_ID 64 +#define ASSIGNED_COOKIE 65 +#define REMOTE_END_ID 66 +#define PW_TYPE 68 +#define L2_SPECIFIC_SUBLAYER 69 +#define DATA_SEQUENCING 70 +#define CIRCUIT_STATUS 71 +#define PREFERRED_LANGUAGE 72 +#define CTL_MSG_AUTH_NONCE 73 +#define TX_CONNECT_SPEED_V3 74 +#define RX_CONNECT_SPEED_V3 75 + +#define NUM_AVP_TYPES 96 static const value_string avp_type_vals[] = { - { CONTROL_MESSAGE, "Control Message" }, - { RESULT_ERROR_CODE, "Result-Error Code" }, - { PROTOCOL_VERSION, "Protocol Version" }, - { FRAMING_CAPABILITIES, "Framing Capabilities" }, - { BEARER_CAPABILITIES, "Bearer Capabilities" }, - { TIE_BREAKER, "Tie Breaker" }, - { FIRMWARE_REVISION, "Firmware Revision" }, - { HOST_NAME, "Host Name" }, - { VENDOR_NAME, "Vendor Name" }, - { ASSIGNED_TUNNEL_ID, "Assigned Tunnel ID" }, - { RECEIVE_WINDOW_SIZE, "Receive Window Size" }, - { CHALLENGE, "Challenge" }, - { CAUSE_CODE, "Cause Code" }, - { CHALLENGE_RESPONSE, "Challenge Response" }, - { ASSIGNED_SESSION, "Assigned Session" }, - { CALL_SERIAL_NUMBER, "Call Serial Number" }, - { MINIMUM_BPS, "Minimum BPS" }, - { MAXIMUM_BPS, "Maximum BPS" }, - { BEARER_TYPE, "Bearer Type" }, - { FRAMING_TYPE, "Framing Type" }, - { CALLED_NUMBER, "Called Number" }, - { CALLING_NUMBER, "Calling Number" }, - { SUB_ADDRESS, "Sub-Address" }, - { TX_CONNECT_SPEED, "Connect Speed" }, - { PHYSICAL_CHANNEL, "Physical Channel" }, - { INITIAL_RECEIVED_LCP_CONFREQ, "Initial Received LCP CONFREQ" }, - { LAST_SENT_LCP_CONFREQ, "Last Sent LCP CONFREQ" }, - { LAST_RECEIVED_LCP_CONFREQ, "Last Received LCP CONFREQ" }, - { PROXY_AUTHEN_TYPE, "Proxy Authen Type" }, - { PROXY_AUTHEN_NAME, "Proxy Authen Name" }, - { PROXY_AUTHEN_CHALLENGE, "Proxy Authen Challenge" }, - { PROXY_AUTHEN_ID, "Proxy Authen ID" }, - { PROXY_AUTHEN_RESPONSE, "Proxy Authen Response" }, - { CALL_STATUS_AVPS, "Call status AVPs" }, - { ACCM, "ACCM" }, - { RANDOM_VECTOR, "Random Vector" }, - { PRIVATE_GROUP_ID, "Private group ID" }, - { RX_CONNECT_SPEED, "RxConnect Speed" }, - { SEQUENCING_REQUIRED, "Sequencing Required" }, - { PPP_DISCONNECT_CAUSE_CODE, "PPP Disconnect Cause Code" }, - { EXTENDED_VENDOR_ID, "Extended Vendor ID" }, - { MESSAGE_DIGEST, "Message Digest" }, - { ROUTER_ID, "Router ID" }, - { ASSIGNED_CONTROL_CONN_ID, "Assigned Control Connection ID" }, - { PW_CAPABILITY_LIST, "Pseudowire Capability List" }, - { LOCAL_SESSION_ID, "Local Session ID" }, - { REMOTE_SESSION_ID, "Remote Session ID" }, - { ASSIGNED_COOKIE, "Assigned Cookie" }, - { REMOTE_END_ID, "Remote End ID" }, - { PW_TYPE, "Pseudowire Type" }, - { L2_SPECIFIC_SUBLAYER, "Layer2 Specific Sublayer" }, - { DATA_SEQUENCING, "Data Sequencing" }, - { CIRCUIT_STATUS, "Circuit Status" }, - { PREFERRED_LANGUAGE, "Preferred Language" }, - { CTL_MSG_AUTH_NONCE, "Control Message Authentication Nonce" }, - { TX_CONNECT_SPEED_V3, "Tx Connect Speed Version 3" }, - { RX_CONNECT_SPEED_V3, "Rx Connect Speed Version 3" }, - { 76, "Failover Capability" }, /*[RFC4951] */ - { 77, "Tunnel Recovery" }, /*[RFC4951] */ - { 78, "Suggested Control Sequence" }, /*[RFC4951] */ - { 79, "Failover Session State" }, /*[RFC4951] */ - { 80, "Multicast Capability" }, /*[RFC4045] */ - { 81, "New Outgoing Sessions" }, /*[RFC4045] */ - { 82, "New Outgoing Sessions Acknowledgement" }, /*[RFC4045] */ - { 83, "Withdraw Outgoing Sessions" }, /*[RFC4045] */ - { 84, "Multicast Packets Priority" }, /*[RFC4045] */ - { 85, "Frame-Relay Header Length" }, /*[RFC4591] */ - { 86, "ATM Maximum Concatenated Cells AVP" }, /*[RFC4454] */ - { 87, "OAM Emulation Required AVP" }, /*[RFC4454] */ - { 88, "ATM Alarm Status AVP" }, /*[RFC4454] */ + { CONTROL_MESSAGE, "Control Message" }, + { RESULT_ERROR_CODE, "Result-Error Code" }, + { PROTOCOL_VERSION, "Protocol Version" }, + { FRAMING_CAPABILITIES, "Framing Capabilities" }, + { BEARER_CAPABILITIES, "Bearer Capabilities" }, + { TIE_BREAKER, "Tie Breaker" }, + { FIRMWARE_REVISION, "Firmware Revision" }, + { HOST_NAME, "Host Name" }, + { VENDOR_NAME, "Vendor Name" }, + { ASSIGNED_TUNNEL_ID, "Assigned Tunnel ID" }, + { RECEIVE_WINDOW_SIZE, "Receive Window Size" }, + { CHALLENGE, "Challenge" }, + { CAUSE_CODE, "Cause Code" }, + { CHALLENGE_RESPONSE, "Challenge Response" }, + { ASSIGNED_SESSION, "Assigned Session" }, + { CALL_SERIAL_NUMBER, "Call Serial Number" }, + { MINIMUM_BPS, "Minimum BPS" }, + { MAXIMUM_BPS, "Maximum BPS" }, + { BEARER_TYPE, "Bearer Type" }, + { FRAMING_TYPE, "Framing Type" }, + { CALLED_NUMBER, "Called Number" }, + { CALLING_NUMBER, "Calling Number" }, + { SUB_ADDRESS, "Sub-Address" }, + { TX_CONNECT_SPEED, "Connect Speed" }, + { PHYSICAL_CHANNEL, "Physical Channel" }, + { INITIAL_RECEIVED_LCP_CONFREQ, "Initial Received LCP CONFREQ" }, + { LAST_SENT_LCP_CONFREQ, "Last Sent LCP CONFREQ" }, + { LAST_RECEIVED_LCP_CONFREQ, "Last Received LCP CONFREQ" }, + { PROXY_AUTHEN_TYPE, "Proxy Authen Type" }, + { PROXY_AUTHEN_NAME, "Proxy Authen Name" }, + { PROXY_AUTHEN_CHALLENGE, "Proxy Authen Challenge" }, + { PROXY_AUTHEN_ID, "Proxy Authen ID" }, + { PROXY_AUTHEN_RESPONSE, "Proxy Authen Response" }, + { CALL_STATUS_AVPS, "Call status AVPs" }, + { ACCM, "ACCM" }, + { RANDOM_VECTOR, "Random Vector" }, + { PRIVATE_GROUP_ID, "Private group ID" }, + { RX_CONNECT_SPEED, "RxConnect Speed" }, + { SEQUENCING_REQUIRED, "Sequencing Required" }, + { PPP_DISCONNECT_CAUSE_CODE, "PPP Disconnect Cause Code" }, + { EXTENDED_VENDOR_ID, "Extended Vendor ID" }, + { MESSAGE_DIGEST, "Message Digest" }, + { ROUTER_ID, "Router ID" }, + { ASSIGNED_CONTROL_CONN_ID, "Assigned Control Connection ID" }, + { PW_CAPABILITY_LIST, "Pseudowire Capability List" }, + { LOCAL_SESSION_ID, "Local Session ID" }, + { REMOTE_SESSION_ID, "Remote Session ID" }, + { ASSIGNED_COOKIE, "Assigned Cookie" }, + { REMOTE_END_ID, "Remote End ID" }, + { PW_TYPE, "Pseudowire Type" }, + { L2_SPECIFIC_SUBLAYER, "Layer2 Specific Sublayer" }, + { DATA_SEQUENCING, "Data Sequencing" }, + { CIRCUIT_STATUS, "Circuit Status" }, + { PREFERRED_LANGUAGE, "Preferred Language" }, + { CTL_MSG_AUTH_NONCE, "Control Message Authentication Nonce" }, + { TX_CONNECT_SPEED_V3, "Tx Connect Speed Version 3" }, + { RX_CONNECT_SPEED_V3, "Rx Connect Speed Version 3" }, + { 76, "Failover Capability" }, /*[RFC4951] */ + { 77, "Tunnel Recovery" }, /*[RFC4951] */ + { 78, "Suggested Control Sequence" }, /*[RFC4951] */ + { 79, "Failover Session State" }, /*[RFC4951] */ + { 80, "Multicast Capability" }, /*[RFC4045] */ + { 81, "New Outgoing Sessions" }, /*[RFC4045] */ + { 82, "New Outgoing Sessions Acknowledgement" }, /*[RFC4045] */ + { 83, "Withdraw Outgoing Sessions" }, /*[RFC4045] */ + { 84, "Multicast Packets Priority" }, /*[RFC4045] */ + { 85, "Frame-Relay Header Length" }, /*[RFC4591] */ + { 86, "ATM Maximum Concatenated Cells AVP" }, /*[RFC4454] */ + { 87, "OAM Emulation Required AVP" }, /*[RFC4454] */ + { 88, "ATM Alarm Status AVP" }, /*[RFC4454] */ /* Also, see ATM Alarm Status AVP Values below */ - { 89, "Attachment Group Identifier" }, /*[RFC4667] */ - { 90, "Local End Identifier" }, /*[RFC4667] */ - { 91, "Interface Maximum Transmission Unit" }, /*[RFC4667] */ - { 92, "FCS Retention" }, /*[RFC4720] */ - { 93, "Tunnel Switching Aggregator ID AVP" }, /*[draft-ietf-l2tpext-tunnel-switching-06.txt] */ - { 94, "Maximum Receive Unit (MRU) AVP" }, /*[RFC4623] */ - { 95, "Maximum Reassembled Receive Unit (MRRU) AVP" }, /*[RFC4623] */ - - - { 0, NULL } + { 89, "Attachment Group Identifier" }, /*[RFC4667] */ + { 90, "Local End Identifier" }, /*[RFC4667] */ + { 91, "Interface Maximum Transmission Unit" }, /*[RFC4667] */ + { 92, "FCS Retention" }, /*[RFC4720] */ + { 93, "Tunnel Switching Aggregator ID AVP" }, /*[draft-ietf-l2tpext-tunnel-switching-06.txt] */ + { 94, "Maximum Receive Unit (MRU) AVP" }, /*[RFC4623] */ + { 95, "Maximum Reassembled Receive Unit (MRRU) AVP" }, /*[RFC4623] */ + + { 0, NULL } }; -#define CISCO_ASSIGNED_CONNECTION_ID 1 -#define CISCO_PW_CAPABILITY_LIST 2 -#define CISCO_LOCAL_SESSION_ID 3 -#define CISCO_REMOTE_SESSION_ID 4 -#define CISCO_ASSIGNED_COOKIE 5 -#define CISCO_REMOTE_END_ID 6 -#define CISCO_PW_TYPE 7 -#define CISCO_CIRCUIT_STATUS 8 -#define CISCO_SESSION_TIE_BREAKER 9 -#define CISCO_DRAFT_AVP_VERSION 10 -#define CISCO_MESSAGE_DIGEST 12 -#define CISCO_AUTH_NONCE 13 -#define CISCO_INTERFACE_MTU 14 +#define CISCO_ASSIGNED_CONNECTION_ID 1 +#define CISCO_PW_CAPABILITY_LIST 2 +#define CISCO_LOCAL_SESSION_ID 3 +#define CISCO_REMOTE_SESSION_ID 4 +#define CISCO_ASSIGNED_COOKIE 5 +#define CISCO_REMOTE_END_ID 6 +#define CISCO_PW_TYPE 7 +#define CISCO_CIRCUIT_STATUS 8 +#define CISCO_SESSION_TIE_BREAKER 9 +#define CISCO_DRAFT_AVP_VERSION 10 +#define CISCO_MESSAGE_DIGEST 12 +#define CISCO_AUTH_NONCE 13 +#define CISCO_INTERFACE_MTU 14 static const value_string cisco_avp_type_vals[] = { - { CISCO_ASSIGNED_CONNECTION_ID, "Assigned Connection ID" }, - { CISCO_PW_CAPABILITY_LIST, "Pseudowire Capabilities List" }, - { CISCO_LOCAL_SESSION_ID, "Local Session ID" }, - { CISCO_REMOTE_SESSION_ID, "Remote Session ID" }, - { CISCO_ASSIGNED_COOKIE, "Assigned Cookie" }, - { CISCO_REMOTE_END_ID, "Remote End ID" }, - { CISCO_PW_TYPE, "Pseudowire Type" }, - { CISCO_CIRCUIT_STATUS, "Circuit Status" }, - { CISCO_SESSION_TIE_BREAKER, "Session Tie Breaker" }, - { CISCO_DRAFT_AVP_VERSION, "Draft AVP Version" }, - { CISCO_MESSAGE_DIGEST, "Message Digest" }, - { CISCO_AUTH_NONCE, "Control Message Authentication Nonce" }, - { CISCO_INTERFACE_MTU, "Interface MTU" }, - { 0, NULL } + { CISCO_ASSIGNED_CONNECTION_ID, "Assigned Connection ID" }, + { CISCO_PW_CAPABILITY_LIST, "Pseudowire Capabilities List" }, + { CISCO_LOCAL_SESSION_ID, "Local Session ID" }, + { CISCO_REMOTE_SESSION_ID, "Remote Session ID" }, + { CISCO_ASSIGNED_COOKIE, "Assigned Cookie" }, + { CISCO_REMOTE_END_ID, "Remote End ID" }, + { CISCO_PW_TYPE, "Pseudowire Type" }, + { CISCO_CIRCUIT_STATUS, "Circuit Status" }, + { CISCO_SESSION_TIE_BREAKER, "Session Tie Breaker" }, + { CISCO_DRAFT_AVP_VERSION, "Draft AVP Version" }, + { CISCO_MESSAGE_DIGEST, "Message Digest" }, + { CISCO_AUTH_NONCE, "Control Message Authentication Nonce" }, + { CISCO_INTERFACE_MTU, "Interface MTU" }, + { 0, NULL } }; static const value_string pw_types_vals[] = { - { 0x0001, "Frame Relay DLCI" }, - { 0x0002, "ATM AAL5 SDU VCC transport" }, - { 0x0003, "ATM Cell transparent Port Mode" }, - { 0x0004, "Ethernet VLAN" }, - { 0x0005, "Ethernet" }, - { 0x0006, "HDLC" }, - { 0x0007, "PPP" }, - { 0x0009, "ATM Cell transport VCC Mode" }, - { 0x000A, "ATM Cell transport VPC Mode" }, - { 0x000B, "IP Transport" }, - { 0x000C, "MPEG-TS Payload Type (MPTPW)" }, - { 0x000D, "Packet Streaming Protocol (PSPPW)" }, - { 0, NULL }, + { 0x0001, "Frame Relay DLCI" }, + { 0x0002, "ATM AAL5 SDU VCC transport" }, + { 0x0003, "ATM Cell transparent Port Mode" }, + { 0x0004, "Ethernet VLAN" }, + { 0x0005, "Ethernet" }, + { 0x0006, "HDLC" }, + { 0x0007, "PPP" }, + { 0x0009, "ATM Cell transport VCC Mode" }, + { 0x000A, "ATM Cell transport VPC Mode" }, + { 0x000B, "IP Transport" }, + { 0x000C, "MPEG-TS Payload Type (MPTPW)" }, + { 0x000D, "Packet Streaming Protocol (PSPPW)" }, + { 0, NULL }, }; static dissector_handle_t ppp_hdlc_handle; @@ -609,758 +607,758 @@ static dissector_handle_t data_handle; * Processes AVPs for Control Messages all versions and transports */ static void process_control_avps(tvbuff_t *tvb, - packet_info *pinfo, - proto_tree *l2tp_tree, - int idx, - int length) + packet_info *pinfo, + proto_tree *l2tp_tree, + int idx, + int length) { - proto_tree *l2tp_lcp_avp_tree, *l2tp_avp_tree, *l2tp_avp_tree_sub; - proto_item *tf, *te; - - int msg_type; - gboolean isStopCcn = FALSE; - int avp_type; - guint32 avp_vendor_id; - guint16 avp_len; - guint16 ver_len_hidden; - int rhcode = 10; - tvbuff_t *next_tvb; - guint16 result_code; - guint16 error_code; - guint32 bits; - guint16 firmware_rev; - - while (idx < length) { /* Process AVP's */ - ver_len_hidden = tvb_get_ntohs(tvb, idx); - avp_len = AVP_LENGTH(ver_len_hidden); - avp_vendor_id = tvb_get_ntohs(tvb, idx + 2); - avp_type = tvb_get_ntohs(tvb, idx + 4); - - if (avp_len < 1) { - proto_tree_add_text(l2tp_tree, tvb, idx, 0, - "AVP length must be >= 1"); - return; - } - - if (avp_vendor_id == VENDOR_IETF) { - tf = proto_tree_add_text(l2tp_tree, tvb, idx, - avp_len, "%s AVP", - val_to_str(avp_type, avp_type_vals, "Unknown (%u)")); - } else if (avp_vendor_id == VENDOR_CISCO) { /* Vendor-Specific AVP */ - tf = proto_tree_add_text(l2tp_tree, tvb, idx, - avp_len, "Vendor %s: %s AVP", - val_to_str_ext(avp_vendor_id, &sminmpec_values_ext, "Unknown (%u)"), - val_to_str(avp_type, cisco_avp_type_vals, "Unknown (%u)")); - } else { /* Vendor-Specific AVP */ - tf = proto_tree_add_text(l2tp_tree, tvb, idx, - avp_len, "Vendor %s AVP Type %u", - val_to_str_ext(avp_vendor_id, &sminmpec_values_ext, "Unknown (%u)"), - avp_type); - } - - - l2tp_avp_tree = proto_item_add_subtree(tf, ett_l2tp_avp); - - proto_tree_add_boolean_format(l2tp_avp_tree,hf_l2tp_avp_mandatory, tvb, idx, 1, - rhcode, "Mandatory: %s", - (MANDATORY_BIT(ver_len_hidden)) ? "True" : "False" ); - proto_tree_add_boolean_format(l2tp_avp_tree,hf_l2tp_avp_hidden, tvb, idx, 1, - rhcode, "Hidden: %s", - (HIDDEN_BIT(ver_len_hidden)) ? "True" : "False" ); - proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_avp_length, tvb, idx, 2, - rhcode, "Length: %u", avp_len); - if (HIDDEN_BIT(ver_len_hidden)) { /* don't try do display hidden */ - idx += avp_len; - continue; - } - - if (avp_len < 6) { - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 0, - "AVP length must be >= 6"); - return; - } - idx += 2; - avp_len -= 2; - - /* Special Case for handling Extended Vendor Id */ - if (avp_type == EXTENDED_VENDOR_ID) { - idx += 2; - proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_vendor_id, - tvb, idx, 4, ENC_BIG_ENDIAN); - - - idx += 4; - continue; - } - else { - proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_vendor_id, - tvb, idx, 2, ENC_BIG_ENDIAN); - idx += 2; - avp_len -= 2; - } - - if (avp_vendor_id == VENDOR_CISCO) { - proto_tree_add_uint(l2tp_avp_tree, hf_l2tp_cisco_avp_type, - tvb, idx, 2, avp_type); - idx += 2; - avp_len -= 2; - - /* For the time being, we don't decode any Vendor- - specific AVP. */ - switch (avp_type) { - case CISCO_ASSIGNED_CONNECTION_ID: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Assigned Control Connection ID: %u", - tvb_get_ntohl(tvb, idx)); - break; - - case CISCO_PW_CAPABILITY_LIST: - te = proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Pseudowire Capabilities List"); - l2tp_avp_tree_sub = proto_item_add_subtree(te, ett_l2tp_avp_sub); - while (avp_len >= 2) { - int pw_type = tvb_get_ntohs(tvb, idx); - - proto_tree_add_text(l2tp_avp_tree_sub, tvb, idx, - 2, "PW Type: (%u) %s", - pw_type, - val_to_str(pw_type, pw_types_vals, - "Unknown (0x%04x)")); - idx += 2; - avp_len -= 2; - } - break; - - case CISCO_LOCAL_SESSION_ID: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Local Session ID: %u", - tvb_get_ntohl(tvb, idx)); - break; - case CISCO_REMOTE_SESSION_ID: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Remote Session ID: %u", - tvb_get_ntohl(tvb, idx)); - break; - case CISCO_ASSIGNED_COOKIE: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Assigned Cookie: %s", - tvb_bytes_to_str(tvb, idx, avp_len)); - break; - case CISCO_REMOTE_END_ID: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Remote End ID: %s", - tvb_format_text(tvb, idx, avp_len)); - break; - case CISCO_PW_TYPE: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, - "Pseudowire Type: %u - %s", - tvb_get_ntohs(tvb, idx), - val_to_str(tvb_get_ntohs(tvb, idx), - pw_types_vals, "Unknown (0x%04x)")); - break; - case CISCO_CIRCUIT_STATUS: - bits = tvb_get_ntohs(tvb, idx); - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, - "Circuit Status: %s", - (CIRCUIT_STATUS_BIT(bits)) ? "Up" : "Down"); - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, - "Circuit Type: %s", - (CIRCUIT_TYPE_BIT(bits)) ? "New" : "Existing"); - break; - case CISCO_SESSION_TIE_BREAKER: - proto_tree_add_item(l2tp_avp_tree, hf_l2tp_tie_breaker, - tvb, idx, 8, ENC_BIG_ENDIAN); - break; - case CISCO_DRAFT_AVP_VERSION: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, - "Draft AVP Version: %u", - tvb_get_ntohs(tvb, idx)); - break; - case CISCO_MESSAGE_DIGEST: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Message Digest: %s", - tvb_bytes_to_str(tvb, idx, avp_len)); - break; - case CISCO_AUTH_NONCE: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Nonce: %s", - tvb_bytes_to_str(tvb, idx, avp_len)); - break; - case CISCO_INTERFACE_MTU: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Interface MTU: %u", - tvb_get_ntohs(tvb, idx)); - break; - - default: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, - avp_len, "Vendor-Specific AVP"); - break; - } - idx += avp_len; - continue; - } else if (avp_vendor_id != VENDOR_IETF) { - if (avp_len >= 2) { - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, - "Type: %u", avp_type); - idx += 2; - avp_len -= 2; - if (avp_len > 0) { - proto_tree_add_text(l2tp_avp_tree, tvb, idx, - avp_len, "Vendor-Specific AVP"); - } - } - idx += avp_len; - continue; - } - - proto_tree_add_uint(l2tp_avp_tree, hf_l2tp_avp_type, - tvb, idx, 2, avp_type); - idx += 2; - avp_len -= 2; - - switch (avp_type) { - - case CONTROL_MESSAGE: - msg_type = tvb_get_ntohs(tvb, idx); - proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_message_type, - tvb, idx, 2, ENC_BIG_ENDIAN); - - if (msg_type == MESSAGE_TYPE_StopCCN) { - isStopCcn = TRUE; - } - break; - - case RESULT_ERROR_CODE: - if (avp_len < 2) - break; - result_code = tvb_get_ntohs(tvb, idx); - if (isStopCcn) { - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, - "Result code: %u - %s", result_code, - val_to_str(result_code, result_code_stopccn_vals, "Unknown (%u)")); - } - else { - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, - "Result code: %u - %s", result_code, - val_to_str(result_code, result_code_cdn_vals, "Unknown (%u)")); - } - idx += 2; - avp_len -= 2; - - if (avp_len < 2) - break; - error_code = tvb_get_ntohs(tvb, idx); - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, - "Error code: %u - %s", error_code, - val_to_str(error_code, error_code_vals, "Unknown (%u)")); - idx += 2; - avp_len -= 2; - - if (avp_len == 0) - break; - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Error Message: %s", - tvb_format_text(tvb, idx, avp_len)); - break; - - case PROTOCOL_VERSION: - if (avp_len < 1) - break; - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 1, - "Version: %u", tvb_get_guint8(tvb, idx)); - idx += 1; - avp_len -= 1; - - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 1, - "Revision: %u", tvb_get_guint8(tvb, idx)); - break; - - case FRAMING_CAPABILITIES: - bits = tvb_get_ntohl(tvb, idx); - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Async Framing Supported: %s", - (FRAMING_ASYNC(bits)) ? "True" : "False"); - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Sync Framing Supported: %s", - (FRAMING_SYNC(bits)) ? "True" : "False"); - break; - - case BEARER_CAPABILITIES: - bits = tvb_get_ntohl(tvb, idx); - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Analog Access Supported: %s", - (BEARER_ANALOG(bits)) ? "True" : "False"); - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Digital Access Supported: %s", - (BEARER_DIGITAL(bits)) ? "True" : "False"); - break; - - case TIE_BREAKER: - proto_tree_add_item(l2tp_avp_tree, hf_l2tp_tie_breaker, tvb, idx, 8, ENC_BIG_ENDIAN); - break; - - case FIRMWARE_REVISION: - firmware_rev = tvb_get_ntohs(tvb, idx); - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, - "Firmware Revision: %d 0x%x", firmware_rev,firmware_rev ); - break; - - case HOST_NAME: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Host Name: %s", - tvb_format_text(tvb, idx, avp_len)); - break; - - case VENDOR_NAME: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Vendor Name: %s", - tvb_format_text(tvb, idx, avp_len)); - break; - - case ASSIGNED_TUNNEL_ID: - proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_assigned_tunnel_id, tvb, idx, 2, ENC_BIG_ENDIAN); - break; - - case RECEIVE_WINDOW_SIZE: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, - "Receive Window Size: %u", - tvb_get_ntohs(tvb, idx)); - break; - - case CHALLENGE: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "CHAP Challenge: %s", - tvb_bytes_to_str(tvb, idx, avp_len)); - break; - - case CAUSE_CODE: - /* - * XXX - export stuff from the Q.931 dissector - * to dissect the cause code and cause message, - * and use it. - */ - if (avp_len < 2) - break; - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, - "Cause Code: %u", - tvb_get_ntohs(tvb, idx)); - idx += 2; - avp_len -= 2; - - if (avp_len < 1) - break; - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 1, - "Cause Msg: %u", - tvb_get_guint8(tvb, idx)); - idx += 1; - avp_len -= 1; - - if (avp_len == 0) - break; - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Advisory Msg: %s", - tvb_format_text(tvb, idx, avp_len)); - break; - - case CHALLENGE_RESPONSE: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 16, - "CHAP Challenge Response: %s", - tvb_bytes_to_str(tvb, idx, 16)); - break; - - case ASSIGNED_SESSION: - proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_assigned_session_id, tvb, idx, 2, ENC_BIG_ENDIAN); - break; - - case CALL_SERIAL_NUMBER: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Call Serial Number: %u", - tvb_get_ntohl(tvb, idx)); - break; - - case MINIMUM_BPS: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Minimum BPS: %u", - tvb_get_ntohl(tvb, idx)); - break; - - case MAXIMUM_BPS: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Maximum BPS: %u", - tvb_get_ntohl(tvb, idx)); - break; - - case BEARER_TYPE: - bits = tvb_get_ntohl(tvb, idx); - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Analog Bearer Type: %s", - (BEARER_ANALOG(bits)) ? "True" : "False"); - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Digital Bearer Type: %s", - (BEARER_DIGITAL(bits)) ? "True" : "False"); - break; - - case FRAMING_TYPE: - bits = tvb_get_ntohl(tvb, idx); - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Async Framing Type: %s", - (FRAMING_ASYNC(bits)) ? "True" : "False"); - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Sync Framing Type: %s", - (FRAMING_SYNC(bits)) ? "True" : "False"); - break; - - case CALLED_NUMBER: - if (avp_len == 0) - break; - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Called Number: %s", - tvb_format_text(tvb, idx, avp_len)); - break; - - case CALLING_NUMBER: - if (avp_len == 0) - break; - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Calling Number: %s", - tvb_format_text(tvb, idx, avp_len)); - break; - - case SUB_ADDRESS: - if (avp_len == 0) - break; - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Sub-Address: %s", - tvb_format_text(tvb, idx, avp_len)); - break; - - case TX_CONNECT_SPEED: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Connect Speed: %u", - tvb_get_ntohl(tvb, idx)); - break; - - case PHYSICAL_CHANNEL: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Physical Channel: %u", - tvb_get_ntohl(tvb, idx)); - break; - - case INITIAL_RECEIVED_LCP_CONFREQ: - te = proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Initial Received LCP CONFREQ: %s", - tvb_bytes_to_str(tvb, idx, avp_len)); - l2tp_lcp_avp_tree = proto_item_add_subtree(te, ett_l2tp_lcp); - next_tvb = tvb_new_subset(tvb, idx, avp_len, avp_len); - call_dissector(ppp_lcp_options_handle, next_tvb, pinfo, l2tp_lcp_avp_tree ); - break; - - case LAST_SENT_LCP_CONFREQ: - te = proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Last Sent LCP CONFREQ: %s", - tvb_bytes_to_str(tvb, idx, avp_len)); - l2tp_lcp_avp_tree = proto_item_add_subtree(te, ett_l2tp_lcp); - next_tvb = tvb_new_subset(tvb, idx, avp_len, avp_len); - call_dissector(ppp_lcp_options_handle, next_tvb, pinfo, l2tp_lcp_avp_tree ); - break; - - case LAST_RECEIVED_LCP_CONFREQ: - te = proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Last Received LCP CONFREQ: %s", - tvb_bytes_to_str(tvb, idx, avp_len)); - l2tp_lcp_avp_tree = proto_item_add_subtree(te, ett_l2tp_lcp); - next_tvb = tvb_new_subset(tvb, idx, avp_len, avp_len); - call_dissector(ppp_lcp_options_handle, next_tvb, pinfo, l2tp_lcp_avp_tree ); - break; - - case PROXY_AUTHEN_TYPE: - msg_type = tvb_get_ntohs(tvb, idx); - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, - "Proxy Authen Type: %s", - val_to_str(msg_type, authen_type_vals, "Unknown (%u)")); - break; - - case PROXY_AUTHEN_NAME: - if (avp_len == 0) - break; - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Proxy Authen Name: %s", - tvb_format_text(tvb, idx, avp_len)); - break; - - case PROXY_AUTHEN_CHALLENGE: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Proxy Authen Challenge: %s", - tvb_bytes_to_str(tvb, idx, avp_len)); - break; - - case PROXY_AUTHEN_ID: - proto_tree_add_text(l2tp_avp_tree, tvb, idx + 1, 1, - "Proxy Authen ID: %u", - tvb_get_guint8(tvb, idx + 1)); - break; - - case PROXY_AUTHEN_RESPONSE: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Proxy Authen Response: %s", - tvb_bytes_to_str(tvb, idx, avp_len)); - break; - - case CALL_STATUS_AVPS: - if (avp_len < 2) - break; - idx += 2; - avp_len -= 2; - - if (avp_len < 4) - break; - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "CRC Errors: %u", tvb_get_ntohl(tvb, idx)); - idx += 4; - avp_len -= 4; - - if (avp_len < 4) - break; - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Framing Errors: %u", tvb_get_ntohl(tvb, idx)); - idx += 4; - avp_len -= 4; - - if (avp_len < 4) - break; - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Hardware Overruns: %u", tvb_get_ntohl(tvb, idx)); - idx += 4; - avp_len -= 4; - - if (avp_len < 4) - break; - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Buffer Overruns: %u", tvb_get_ntohl(tvb, idx)); - idx += 4; - avp_len -= 4; - - if (avp_len < 4) - break; - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Time-out Errors: %u", tvb_get_ntohl(tvb, idx)); - idx += 4; - avp_len -= 4; - - if (avp_len < 4) - break; - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Alignment Errors: %u", tvb_get_ntohl(tvb, idx)); - idx += 4; - avp_len -= 4; - break; - - case ACCM: - if (avp_len < 2) - break; - idx += 2; - avp_len -= 2; - - if (avp_len < 4) - break; - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Send ACCM: %u", tvb_get_ntohl(tvb, idx)); - idx += 4; - avp_len -= 4; - - if (avp_len < 4) - break; - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Receive ACCM: %u", tvb_get_ntohl(tvb, idx)); - idx += 4; - avp_len -= 4; - break; - - case RANDOM_VECTOR: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Random Vector: %s", - tvb_bytes_to_str(tvb, idx, avp_len)); - break; - - case PRIVATE_GROUP_ID: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Private Group ID: %s", - tvb_bytes_to_str(tvb, idx, avp_len)); - break; - - case RX_CONNECT_SPEED: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Rx Connect Speed: %u", - tvb_get_ntohl(tvb, idx)); - break; - - case PPP_DISCONNECT_CAUSE_CODE: - if (avp_len < 2) - break; - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, - "Disconnect Code: %u", - tvb_get_ntohs(tvb, idx)); - idx += 2; - avp_len -= 2; - - if (avp_len < 2) - break; - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, - "Control Protocol Number: %u", - tvb_get_ntohs(tvb, idx)); - idx += 2; - avp_len -= 2; - - if (avp_len < 1) - break; - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 1, - "Direction: %s", - val_to_str(tvb_get_guint8(tvb, idx), - cause_code_direction_vals, - "Reserved (%u)")); - idx += 1; - avp_len -= 1; - - if (avp_len == 0) - break; - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Message: %s", - tvb_format_text(tvb, idx, avp_len)); - break; - - case MESSAGE_DIGEST: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Message Digest: %s", - tvb_bytes_to_str(tvb, idx, avp_len)); - break; - case ROUTER_ID: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, - "Router ID: %u", - tvb_get_ntohl(tvb, idx)); - break; - case ASSIGNED_CONTROL_CONN_ID: - proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_assigned_control_conn_id, - tvb, idx, 4, ENC_BIG_ENDIAN); - break; - case PW_CAPABILITY_LIST: - te = proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Pseudowire Capabilities List"); - l2tp_avp_tree_sub = proto_item_add_subtree(te, ett_l2tp_avp_sub); - - while (avp_len >= 2) { - int pw_type = tvb_get_ntohs(tvb, idx); - proto_tree_add_text(l2tp_avp_tree_sub, tvb, idx, - 2, "PW Type: (%u) %s", - pw_type, - val_to_str(pw_type, pw_types_vals, - "Unknown (0x%04x)")); - idx += 2; - avp_len -= 2; - } - break; - case LOCAL_SESSION_ID: - proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_local_session_id, - tvb, idx, 4, ENC_BIG_ENDIAN); - break; - case REMOTE_SESSION_ID: - proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_remote_session_id, - tvb, idx, 4, ENC_BIG_ENDIAN); - break; - case ASSIGNED_COOKIE: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Assigned Cookie: %s", - tvb_bytes_to_str(tvb, idx, avp_len)); - break; - case REMOTE_END_ID: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Remote End ID: %s", - tvb_format_text(tvb, idx, avp_len)); - break; - case PW_TYPE: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, - "Pseudowire Type: %u - %s", - tvb_get_ntohs(tvb, idx), - val_to_str(tvb_get_ntohs(tvb, idx), - pw_types_vals, "Unknown (0x%04x)")); - break; - case L2_SPECIFIC_SUBLAYER: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, - "Layer2 Specific Sublayer: %s", - val_to_str(tvb_get_ntohs(tvb, idx), - l2_sublayer_vals, "Invalid (%u)")); - break; - case DATA_SEQUENCING: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, - "Data Sequencing: %s", - val_to_str(tvb_get_ntohs(tvb, idx), - data_sequencing_vals, "Invalid (%u)")); - break; - case CIRCUIT_STATUS: - bits = tvb_get_ntohs(tvb, idx); - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, - "Circuit Status: %s", - (CIRCUIT_STATUS_BIT(bits)) ? "Up" : "Down"); - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, - "Circuit Type: %s", - (CIRCUIT_TYPE_BIT(bits)) ? "New" : "Existing"); - break; - case PREFERRED_LANGUAGE: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Preferred Language: %s", - tvb_format_text(tvb, idx, avp_len)); - break; - case CTL_MSG_AUTH_NONCE: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Nonce: %s", - tvb_bytes_to_str(tvb, idx, avp_len)); - break; - case TX_CONNECT_SPEED_V3: - { - guint32 l_int, h_int; - if (avp_len < 8) - break; - - h_int = tvb_get_ntohl(tvb, idx); - l_int = tvb_get_ntohl(tvb, idx+4); - if (!h_int && !l_int) { - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 8, - "Tx Connect Speed v3: indeterminable or no physical p2p link"); - } - else { - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 8, - "Tx Connect Speed v3: %#x%04x", - h_int, l_int); - } - break; - } - case RX_CONNECT_SPEED_V3: - { - guint32 l_int, h_int; - if (avp_len < 8) - break; - - h_int = tvb_get_ntohl(tvb, idx); - l_int = tvb_get_ntohl(tvb, idx+4); - if (!h_int && !l_int) { - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 8, - "Rx Connect Speed v3: indeterminable or no physical p2p link"); - } - else { - proto_tree_add_text(l2tp_avp_tree, tvb, idx, 8, - "Rx Connect Speed v3: %#x%04x", - h_int, l_int); - } - break; - } - default: - proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, - "Unknown AVP"); - break; - } - - idx += avp_len; - } + proto_tree *l2tp_lcp_avp_tree, *l2tp_avp_tree, *l2tp_avp_tree_sub; + proto_item *tf, *te; + + int msg_type; + gboolean isStopCcn = FALSE; + int avp_type; + guint32 avp_vendor_id; + guint16 avp_len; + guint16 ver_len_hidden; + int rhcode = 10; + tvbuff_t *next_tvb; + guint16 result_code; + guint16 error_code; + guint32 bits; + guint16 firmware_rev; + + while (idx < length) { /* Process AVP's */ + ver_len_hidden = tvb_get_ntohs(tvb, idx); + avp_len = AVP_LENGTH(ver_len_hidden); + avp_vendor_id = tvb_get_ntohs(tvb, idx + 2); + avp_type = tvb_get_ntohs(tvb, idx + 4); + + if (avp_len < 1) { + proto_tree_add_text(l2tp_tree, tvb, idx, 0, + "AVP length must be >= 1"); + return; + } + + if (avp_vendor_id == VENDOR_IETF) { + tf = proto_tree_add_text(l2tp_tree, tvb, idx, + avp_len, "%s AVP", + val_to_str(avp_type, avp_type_vals, "Unknown (%u)")); + } else if (avp_vendor_id == VENDOR_CISCO) { /* Vendor-Specific AVP */ + tf = proto_tree_add_text(l2tp_tree, tvb, idx, + avp_len, "Vendor %s: %s AVP", + val_to_str_ext(avp_vendor_id, &sminmpec_values_ext, "Unknown (%u)"), + val_to_str(avp_type, cisco_avp_type_vals, "Unknown (%u)")); + } else { /* Vendor-Specific AVP */ + tf = proto_tree_add_text(l2tp_tree, tvb, idx, + avp_len, "Vendor %s AVP Type %u", + val_to_str_ext(avp_vendor_id, &sminmpec_values_ext, "Unknown (%u)"), + avp_type); + } + + + l2tp_avp_tree = proto_item_add_subtree(tf, ett_l2tp_avp); + + proto_tree_add_boolean_format(l2tp_avp_tree,hf_l2tp_avp_mandatory, tvb, idx, 1, + rhcode, "Mandatory: %s", + (MANDATORY_BIT(ver_len_hidden)) ? "True" : "False" ); + proto_tree_add_boolean_format(l2tp_avp_tree,hf_l2tp_avp_hidden, tvb, idx, 1, + rhcode, "Hidden: %s", + (HIDDEN_BIT(ver_len_hidden)) ? "True" : "False" ); + proto_tree_add_uint_format(l2tp_avp_tree,hf_l2tp_avp_length, tvb, idx, 2, + rhcode, "Length: %u", avp_len); + if (HIDDEN_BIT(ver_len_hidden)) { /* don't try do display hidden */ + idx += avp_len; + continue; + } + + if (avp_len < 6) { + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 0, + "AVP length must be >= 6"); + return; + } + idx += 2; + avp_len -= 2; + + /* Special Case for handling Extended Vendor Id */ + if (avp_type == EXTENDED_VENDOR_ID) { + idx += 2; + proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_vendor_id, + tvb, idx, 4, ENC_BIG_ENDIAN); + + + idx += 4; + continue; + } + else { + proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_vendor_id, + tvb, idx, 2, ENC_BIG_ENDIAN); + idx += 2; + avp_len -= 2; + } + + if (avp_vendor_id == VENDOR_CISCO) { + proto_tree_add_uint(l2tp_avp_tree, hf_l2tp_cisco_avp_type, + tvb, idx, 2, avp_type); + idx += 2; + avp_len -= 2; + + /* For the time being, we don't decode any Vendor- + specific AVP. */ + switch (avp_type) { + case CISCO_ASSIGNED_CONNECTION_ID: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Assigned Control Connection ID: %u", + tvb_get_ntohl(tvb, idx)); + break; + + case CISCO_PW_CAPABILITY_LIST: + te = proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Pseudowire Capabilities List"); + l2tp_avp_tree_sub = proto_item_add_subtree(te, ett_l2tp_avp_sub); + while (avp_len >= 2) { + int pw_type = tvb_get_ntohs(tvb, idx); + + proto_tree_add_text(l2tp_avp_tree_sub, tvb, idx, + 2, "PW Type: (%u) %s", + pw_type, + val_to_str(pw_type, pw_types_vals, + "Unknown (0x%04x)")); + idx += 2; + avp_len -= 2; + } + break; + + case CISCO_LOCAL_SESSION_ID: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Local Session ID: %u", + tvb_get_ntohl(tvb, idx)); + break; + case CISCO_REMOTE_SESSION_ID: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Remote Session ID: %u", + tvb_get_ntohl(tvb, idx)); + break; + case CISCO_ASSIGNED_COOKIE: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Assigned Cookie: %s", + tvb_bytes_to_str(tvb, idx, avp_len)); + break; + case CISCO_REMOTE_END_ID: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Remote End ID: %s", + tvb_format_text(tvb, idx, avp_len)); + break; + case CISCO_PW_TYPE: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, + "Pseudowire Type: %u - %s", + tvb_get_ntohs(tvb, idx), + val_to_str(tvb_get_ntohs(tvb, idx), + pw_types_vals, "Unknown (0x%04x)")); + break; + case CISCO_CIRCUIT_STATUS: + bits = tvb_get_ntohs(tvb, idx); + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, + "Circuit Status: %s", + (CIRCUIT_STATUS_BIT(bits)) ? "Up" : "Down"); + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, + "Circuit Type: %s", + (CIRCUIT_TYPE_BIT(bits)) ? "New" : "Existing"); + break; + case CISCO_SESSION_TIE_BREAKER: + proto_tree_add_item(l2tp_avp_tree, hf_l2tp_tie_breaker, + tvb, idx, 8, ENC_BIG_ENDIAN); + break; + case CISCO_DRAFT_AVP_VERSION: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, + "Draft AVP Version: %u", + tvb_get_ntohs(tvb, idx)); + break; + case CISCO_MESSAGE_DIGEST: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Message Digest: %s", + tvb_bytes_to_str(tvb, idx, avp_len)); + break; + case CISCO_AUTH_NONCE: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Nonce: %s", + tvb_bytes_to_str(tvb, idx, avp_len)); + break; + case CISCO_INTERFACE_MTU: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Interface MTU: %u", + tvb_get_ntohs(tvb, idx)); + break; + + default: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, + avp_len, "Vendor-Specific AVP"); + break; + } + idx += avp_len; + continue; + } else if (avp_vendor_id != VENDOR_IETF) { + if (avp_len >= 2) { + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, + "Type: %u", avp_type); + idx += 2; + avp_len -= 2; + if (avp_len > 0) { + proto_tree_add_text(l2tp_avp_tree, tvb, idx, + avp_len, "Vendor-Specific AVP"); + } + } + idx += avp_len; + continue; + } + + proto_tree_add_uint(l2tp_avp_tree, hf_l2tp_avp_type, + tvb, idx, 2, avp_type); + idx += 2; + avp_len -= 2; + + switch (avp_type) { + + case CONTROL_MESSAGE: + msg_type = tvb_get_ntohs(tvb, idx); + proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_message_type, + tvb, idx, 2, ENC_BIG_ENDIAN); + + if (msg_type == MESSAGE_TYPE_StopCCN) { + isStopCcn = TRUE; + } + break; + + case RESULT_ERROR_CODE: + if (avp_len < 2) + break; + result_code = tvb_get_ntohs(tvb, idx); + if (isStopCcn) { + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, + "Result code: %u - %s", result_code, + val_to_str(result_code, result_code_stopccn_vals, "Unknown (%u)")); + } + else { + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, + "Result code: %u - %s", result_code, + val_to_str(result_code, result_code_cdn_vals, "Unknown (%u)")); + } + idx += 2; + avp_len -= 2; + + if (avp_len < 2) + break; + error_code = tvb_get_ntohs(tvb, idx); + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, + "Error code: %u - %s", error_code, + val_to_str(error_code, error_code_vals, "Unknown (%u)")); + idx += 2; + avp_len -= 2; + + if (avp_len == 0) + break; + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Error Message: %s", + tvb_format_text(tvb, idx, avp_len)); + break; + + case PROTOCOL_VERSION: + if (avp_len < 1) + break; + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 1, + "Version: %u", tvb_get_guint8(tvb, idx)); + idx += 1; + avp_len -= 1; + + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 1, + "Revision: %u", tvb_get_guint8(tvb, idx)); + break; + + case FRAMING_CAPABILITIES: + bits = tvb_get_ntohl(tvb, idx); + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Async Framing Supported: %s", + (FRAMING_ASYNC(bits)) ? "True" : "False"); + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Sync Framing Supported: %s", + (FRAMING_SYNC(bits)) ? "True" : "False"); + break; + + case BEARER_CAPABILITIES: + bits = tvb_get_ntohl(tvb, idx); + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Analog Access Supported: %s", + (BEARER_ANALOG(bits)) ? "True" : "False"); + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Digital Access Supported: %s", + (BEARER_DIGITAL(bits)) ? "True" : "False"); + break; + + case TIE_BREAKER: + proto_tree_add_item(l2tp_avp_tree, hf_l2tp_tie_breaker, tvb, idx, 8, ENC_BIG_ENDIAN); + break; + + case FIRMWARE_REVISION: + firmware_rev = tvb_get_ntohs(tvb, idx); + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, + "Firmware Revision: %d 0x%x", firmware_rev,firmware_rev ); + break; + + case HOST_NAME: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Host Name: %s", + tvb_format_text(tvb, idx, avp_len)); + break; + + case VENDOR_NAME: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Vendor Name: %s", + tvb_format_text(tvb, idx, avp_len)); + break; + + case ASSIGNED_TUNNEL_ID: + proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_assigned_tunnel_id, tvb, idx, 2, ENC_BIG_ENDIAN); + break; + + case RECEIVE_WINDOW_SIZE: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, + "Receive Window Size: %u", + tvb_get_ntohs(tvb, idx)); + break; + + case CHALLENGE: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "CHAP Challenge: %s", + tvb_bytes_to_str(tvb, idx, avp_len)); + break; + + case CAUSE_CODE: + /* + * XXX - export stuff from the Q.931 dissector + * to dissect the cause code and cause message, + * and use it. + */ + if (avp_len < 2) + break; + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, + "Cause Code: %u", + tvb_get_ntohs(tvb, idx)); + idx += 2; + avp_len -= 2; + + if (avp_len < 1) + break; + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 1, + "Cause Msg: %u", + tvb_get_guint8(tvb, idx)); + idx += 1; + avp_len -= 1; + + if (avp_len == 0) + break; + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Advisory Msg: %s", + tvb_format_text(tvb, idx, avp_len)); + break; + + case CHALLENGE_RESPONSE: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 16, + "CHAP Challenge Response: %s", + tvb_bytes_to_str(tvb, idx, 16)); + break; + + case ASSIGNED_SESSION: + proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_assigned_session_id, tvb, idx, 2, ENC_BIG_ENDIAN); + break; + + case CALL_SERIAL_NUMBER: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Call Serial Number: %u", + tvb_get_ntohl(tvb, idx)); + break; + + case MINIMUM_BPS: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Minimum BPS: %u", + tvb_get_ntohl(tvb, idx)); + break; + + case MAXIMUM_BPS: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Maximum BPS: %u", + tvb_get_ntohl(tvb, idx)); + break; + + case BEARER_TYPE: + bits = tvb_get_ntohl(tvb, idx); + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Analog Bearer Type: %s", + (BEARER_ANALOG(bits)) ? "True" : "False"); + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Digital Bearer Type: %s", + (BEARER_DIGITAL(bits)) ? "True" : "False"); + break; + + case FRAMING_TYPE: + bits = tvb_get_ntohl(tvb, idx); + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Async Framing Type: %s", + (FRAMING_ASYNC(bits)) ? "True" : "False"); + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Sync Framing Type: %s", + (FRAMING_SYNC(bits)) ? "True" : "False"); + break; + + case CALLED_NUMBER: + if (avp_len == 0) + break; + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Called Number: %s", + tvb_format_text(tvb, idx, avp_len)); + break; + + case CALLING_NUMBER: + if (avp_len == 0) + break; + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Calling Number: %s", + tvb_format_text(tvb, idx, avp_len)); + break; + + case SUB_ADDRESS: + if (avp_len == 0) + break; + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Sub-Address: %s", + tvb_format_text(tvb, idx, avp_len)); + break; + + case TX_CONNECT_SPEED: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Connect Speed: %u", + tvb_get_ntohl(tvb, idx)); + break; + + case PHYSICAL_CHANNEL: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Physical Channel: %u", + tvb_get_ntohl(tvb, idx)); + break; + + case INITIAL_RECEIVED_LCP_CONFREQ: + te = proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Initial Received LCP CONFREQ: %s", + tvb_bytes_to_str(tvb, idx, avp_len)); + l2tp_lcp_avp_tree = proto_item_add_subtree(te, ett_l2tp_lcp); + next_tvb = tvb_new_subset(tvb, idx, avp_len, avp_len); + call_dissector(ppp_lcp_options_handle, next_tvb, pinfo, l2tp_lcp_avp_tree ); + break; + + case LAST_SENT_LCP_CONFREQ: + te = proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Last Sent LCP CONFREQ: %s", + tvb_bytes_to_str(tvb, idx, avp_len)); + l2tp_lcp_avp_tree = proto_item_add_subtree(te, ett_l2tp_lcp); + next_tvb = tvb_new_subset(tvb, idx, avp_len, avp_len); + call_dissector(ppp_lcp_options_handle, next_tvb, pinfo, l2tp_lcp_avp_tree ); + break; + + case LAST_RECEIVED_LCP_CONFREQ: + te = proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Last Received LCP CONFREQ: %s", + tvb_bytes_to_str(tvb, idx, avp_len)); + l2tp_lcp_avp_tree = proto_item_add_subtree(te, ett_l2tp_lcp); + next_tvb = tvb_new_subset(tvb, idx, avp_len, avp_len); + call_dissector(ppp_lcp_options_handle, next_tvb, pinfo, l2tp_lcp_avp_tree ); + break; + + case PROXY_AUTHEN_TYPE: + msg_type = tvb_get_ntohs(tvb, idx); + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, + "Proxy Authen Type: %s", + val_to_str(msg_type, authen_type_vals, "Unknown (%u)")); + break; + + case PROXY_AUTHEN_NAME: + if (avp_len == 0) + break; + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Proxy Authen Name: %s", + tvb_format_text(tvb, idx, avp_len)); + break; + + case PROXY_AUTHEN_CHALLENGE: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Proxy Authen Challenge: %s", + tvb_bytes_to_str(tvb, idx, avp_len)); + break; + + case PROXY_AUTHEN_ID: + proto_tree_add_text(l2tp_avp_tree, tvb, idx + 1, 1, + "Proxy Authen ID: %u", + tvb_get_guint8(tvb, idx + 1)); + break; + + case PROXY_AUTHEN_RESPONSE: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Proxy Authen Response: %s", + tvb_bytes_to_str(tvb, idx, avp_len)); + break; + + case CALL_STATUS_AVPS: + if (avp_len < 2) + break; + idx += 2; + avp_len -= 2; + + if (avp_len < 4) + break; + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "CRC Errors: %u", tvb_get_ntohl(tvb, idx)); + idx += 4; + avp_len -= 4; + + if (avp_len < 4) + break; + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Framing Errors: %u", tvb_get_ntohl(tvb, idx)); + idx += 4; + avp_len -= 4; + + if (avp_len < 4) + break; + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Hardware Overruns: %u", tvb_get_ntohl(tvb, idx)); + idx += 4; + avp_len -= 4; + + if (avp_len < 4) + break; + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Buffer Overruns: %u", tvb_get_ntohl(tvb, idx)); + idx += 4; + avp_len -= 4; + + if (avp_len < 4) + break; + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Time-out Errors: %u", tvb_get_ntohl(tvb, idx)); + idx += 4; + avp_len -= 4; + + if (avp_len < 4) + break; + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Alignment Errors: %u", tvb_get_ntohl(tvb, idx)); + idx += 4; + avp_len -= 4; + break; + + case ACCM: + if (avp_len < 2) + break; + idx += 2; + avp_len -= 2; + + if (avp_len < 4) + break; + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Send ACCM: %u", tvb_get_ntohl(tvb, idx)); + idx += 4; + avp_len -= 4; + + if (avp_len < 4) + break; + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Receive ACCM: %u", tvb_get_ntohl(tvb, idx)); + idx += 4; + avp_len -= 4; + break; + + case RANDOM_VECTOR: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Random Vector: %s", + tvb_bytes_to_str(tvb, idx, avp_len)); + break; + + case PRIVATE_GROUP_ID: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Private Group ID: %s", + tvb_bytes_to_str(tvb, idx, avp_len)); + break; + + case RX_CONNECT_SPEED: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Rx Connect Speed: %u", + tvb_get_ntohl(tvb, idx)); + break; + + case PPP_DISCONNECT_CAUSE_CODE: + if (avp_len < 2) + break; + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, + "Disconnect Code: %u", + tvb_get_ntohs(tvb, idx)); + idx += 2; + avp_len -= 2; + + if (avp_len < 2) + break; + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, + "Control Protocol Number: %u", + tvb_get_ntohs(tvb, idx)); + idx += 2; + avp_len -= 2; + + if (avp_len < 1) + break; + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 1, + "Direction: %s", + val_to_str(tvb_get_guint8(tvb, idx), + cause_code_direction_vals, + "Reserved (%u)")); + idx += 1; + avp_len -= 1; + + if (avp_len == 0) + break; + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Message: %s", + tvb_format_text(tvb, idx, avp_len)); + break; + + case MESSAGE_DIGEST: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Message Digest: %s", + tvb_bytes_to_str(tvb, idx, avp_len)); + break; + case ROUTER_ID: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 4, + "Router ID: %u", + tvb_get_ntohl(tvb, idx)); + break; + case ASSIGNED_CONTROL_CONN_ID: + proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_assigned_control_conn_id, + tvb, idx, 4, ENC_BIG_ENDIAN); + break; + case PW_CAPABILITY_LIST: + te = proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Pseudowire Capabilities List"); + l2tp_avp_tree_sub = proto_item_add_subtree(te, ett_l2tp_avp_sub); + + while (avp_len >= 2) { + int pw_type = tvb_get_ntohs(tvb, idx); + proto_tree_add_text(l2tp_avp_tree_sub, tvb, idx, + 2, "PW Type: (%u) %s", + pw_type, + val_to_str(pw_type, pw_types_vals, + "Unknown (0x%04x)")); + idx += 2; + avp_len -= 2; + } + break; + case LOCAL_SESSION_ID: + proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_local_session_id, + tvb, idx, 4, ENC_BIG_ENDIAN); + break; + case REMOTE_SESSION_ID: + proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_remote_session_id, + tvb, idx, 4, ENC_BIG_ENDIAN); + break; + case ASSIGNED_COOKIE: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Assigned Cookie: %s", + tvb_bytes_to_str(tvb, idx, avp_len)); + break; + case REMOTE_END_ID: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Remote End ID: %s", + tvb_format_text(tvb, idx, avp_len)); + break; + case PW_TYPE: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, + "Pseudowire Type: %u - %s", + tvb_get_ntohs(tvb, idx), + val_to_str(tvb_get_ntohs(tvb, idx), + pw_types_vals, "Unknown (0x%04x)")); + break; + case L2_SPECIFIC_SUBLAYER: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, + "Layer2 Specific Sublayer: %s", + val_to_str(tvb_get_ntohs(tvb, idx), + l2_sublayer_vals, "Invalid (%u)")); + break; + case DATA_SEQUENCING: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, + "Data Sequencing: %s", + val_to_str(tvb_get_ntohs(tvb, idx), + data_sequencing_vals, "Invalid (%u)")); + break; + case CIRCUIT_STATUS: + bits = tvb_get_ntohs(tvb, idx); + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, + "Circuit Status: %s", + (CIRCUIT_STATUS_BIT(bits)) ? "Up" : "Down"); + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 2, + "Circuit Type: %s", + (CIRCUIT_TYPE_BIT(bits)) ? "New" : "Existing"); + break; + case PREFERRED_LANGUAGE: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Preferred Language: %s", + tvb_format_text(tvb, idx, avp_len)); + break; + case CTL_MSG_AUTH_NONCE: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Nonce: %s", + tvb_bytes_to_str(tvb, idx, avp_len)); + break; + case TX_CONNECT_SPEED_V3: + { + guint32 l_int, h_int; + if (avp_len < 8) + break; + + h_int = tvb_get_ntohl(tvb, idx); + l_int = tvb_get_ntohl(tvb, idx+4); + if (!h_int && !l_int) { + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 8, + "Tx Connect Speed v3: indeterminable or no physical p2p link"); + } + else { + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 8, + "Tx Connect Speed v3: %#x%04x", + h_int, l_int); + } + break; + } + case RX_CONNECT_SPEED_V3: + { + guint32 l_int, h_int; + if (avp_len < 8) + break; + + h_int = tvb_get_ntohl(tvb, idx); + l_int = tvb_get_ntohl(tvb, idx+4); + if (!h_int && !l_int) { + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 8, + "Rx Connect Speed v3: indeterminable or no physical p2p link"); + } + else { + proto_tree_add_text(l2tp_avp_tree, tvb, idx, 8, + "Rx Connect Speed v3: %#x%04x", + h_int, l_int); + } + break; + } + default: + proto_tree_add_text(l2tp_avp_tree, tvb, idx, avp_len, + "Unknown AVP"); + break; + } + + idx += avp_len; + } } @@ -1371,149 +1369,149 @@ static void process_control_avps(tvbuff_t *tvb, */ static void process_l2tpv3_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - proto_tree *l2tp_tree, proto_item *l2tp_item, int *pIdx) + proto_tree *l2tp_tree, proto_item *l2tp_item, int *pIdx) { - int idx = *pIdx; - int sid; - guint8 oam_cell = 0; - proto_tree *l2_specific = NULL; - proto_item *ti = NULL; - tvbuff_t *next_tvb; - - /* Get Session ID */ - sid = tvb_get_ntohl(tvb, idx); - idx += 4; - - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo,COL_INFO, - "%s (session id=%u)", - data_msg, sid); - } - - if (tree) { - proto_tree_add_item(l2tp_tree, hf_l2tp_sid, tvb, idx-4, 4, ENC_BIG_ENDIAN); - proto_item_set_len(l2tp_item, idx); - if (!(tvb_offset_exists(tvb, idx))) - return; - if (l2tpv3_cookie != 0) - proto_tree_add_item(l2tp_tree, hf_l2tp_cookie, tvb, idx, l2tpv3_cookie, ENC_NA); - } - - switch(l2tpv3_l2_specific){ - case L2TPv3_L2_SPECIFIC_DEFAULT: - if (tree) { - ti = proto_tree_add_item(tree, hf_l2tp_l2_spec_def, - tvb, idx + l2tpv3_cookie, 4, ENC_NA); - l2_specific = proto_item_add_subtree(ti, ett_l2tp_l2_spec); - - proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_s, tvb, idx + l2tpv3_cookie, - 1, ENC_BIG_ENDIAN); - proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_sequence, tvb, - idx + l2tpv3_cookie + 1, 3, ENC_BIG_ENDIAN); - } - next_tvb = tvb_new_subset_remaining(tvb, idx + l2tpv3_cookie + 4); - break; - case L2TPv3_L2_SPECIFIC_DOCSIS_DMPT: - if (tree) { - ti = proto_tree_add_item(tree, hf_l2tp_l2_spec_docsis_dmpt, - tvb, idx + l2tpv3_cookie, 4, ENC_NA); - l2_specific = proto_item_add_subtree(ti, ett_l2tp_l2_spec); - - proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_v, tvb, - idx + l2tpv3_cookie,1, ENC_BIG_ENDIAN); - - proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_s, tvb, - idx + l2tpv3_cookie,1, ENC_BIG_ENDIAN); - - proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_flow_id, tvb, - idx + l2tpv3_cookie,1, ENC_BIG_ENDIAN); - - proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_sequence, tvb, - idx + l2tpv3_cookie + 2,2, ENC_BIG_ENDIAN); - } - next_tvb = tvb_new_subset_remaining(tvb, idx + l2tpv3_cookie + 4); - break; - case L2TPv3_L2_SPECIFIC_ATM: - if (tree) { - ti = proto_tree_add_item(tree, hf_l2tp_l2_spec_atm, - tvb, idx + l2tpv3_cookie, 4, ENC_NA); - l2_specific = proto_item_add_subtree(ti, ett_l2tp_l2_spec); - - proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_s, tvb, idx + l2tpv3_cookie, - 1, ENC_BIG_ENDIAN); - proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_t, tvb, idx + l2tpv3_cookie, - 1, ENC_BIG_ENDIAN); - /* - * As per RFC 4454, the T bit specifies whether - * we're transporting an OAM cell or an AAL5 frame. - */ - oam_cell = tvb_get_guint8(tvb, idx + l2tpv3_cookie) & 0x08; - proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_g, tvb, idx + l2tpv3_cookie, - 1, ENC_BIG_ENDIAN); - proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_c, tvb, idx + l2tpv3_cookie, - 1, ENC_BIG_ENDIAN); - proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_u, tvb, idx + l2tpv3_cookie, - 1, ENC_BIG_ENDIAN); - proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_sequence, tvb, - idx + l2tpv3_cookie + 1, 3, ENC_BIG_ENDIAN); - } - next_tvb = tvb_new_subset_remaining(tvb, idx + l2tpv3_cookie + 4); - break; - case L2TPv3_L2_SPECIFIC_LAPD: - if (tree) - proto_tree_add_text(tree, tvb, idx + l2tpv3_cookie + 4, 3,"LAPD info"); - next_tvb = tvb_new_subset_remaining(tvb, idx + l2tpv3_cookie+4+3); - break; - case L2TPv3_L2_SPECIFIC_NONE: - default: - next_tvb = tvb_new_subset_remaining(tvb, idx + l2tpv3_cookie); - break; - } - - switch(l2tpv3_protocol){ - case L2TPv3_PROTOCOL_ETH: - call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, tree); - break; - case L2TPv3_PROTOCOL_CHDLC: - call_dissector(chdlc_handle, next_tvb, pinfo, tree); - break; - case L2TPv3_PROTOCOL_FR: - call_dissector(fr_handle, next_tvb, pinfo, tree); - break; - case L2TPv3_PROTOCOL_PPP: - /* - * PPP is transported without Address and Control - * fields, ppp_hdlc_handle can handle that as if if - * was ACFC (NULL Address and Control) - */ - call_dissector(ppp_hdlc_handle, next_tvb, pinfo, tree); - break; - case L2TPv3_PROTOCOL_IP: - call_dissector(ip_handle, next_tvb, pinfo, tree); - break; - case L2TPv3_PROTOCOL_MPLS: - call_dissector(mpls_handle, next_tvb, pinfo, tree); - break; - case L2TPv3_PROTOCOL_DOCSIS_DMPT: - call_dissector(mp2t_handle, next_tvb, pinfo, tree); - break; - case L2TPv3_PROTOCOL_AAL5: - if (oam_cell) { - call_dissector(atm_oam_handle, next_tvb, pinfo, tree); - } else { - call_dissector(llc_handle, next_tvb, pinfo, tree); - } - break; - case L2TPv3_PROTOCOL_LAPD: - call_dissector(lapd_handle, next_tvb, pinfo, tree); - break; - case L2TPv3_PROTOCOL_ERICSSON: - call_dissector(ehdlc_handle, next_tvb, pinfo, tree); - break; - default: - call_dissector(data_handle, next_tvb, pinfo, tree); - break; - } + int idx = *pIdx; + int sid; + guint8 oam_cell = 0; + proto_tree *l2_specific = NULL; + proto_item *ti = NULL; + tvbuff_t *next_tvb; + + /* Get Session ID */ + sid = tvb_get_ntohl(tvb, idx); + idx += 4; + + if (check_col(pinfo->cinfo, COL_INFO)) { + col_add_fstr(pinfo->cinfo,COL_INFO, + "%s (session id=%u)", + data_msg, sid); + } + + if (tree) { + proto_tree_add_item(l2tp_tree, hf_l2tp_sid, tvb, idx-4, 4, ENC_BIG_ENDIAN); + proto_item_set_len(l2tp_item, idx); + if (!(tvb_offset_exists(tvb, idx))) + return; + if (l2tpv3_cookie != 0) + proto_tree_add_item(l2tp_tree, hf_l2tp_cookie, tvb, idx, l2tpv3_cookie, ENC_NA); + } + + switch(l2tpv3_l2_specific){ + case L2TPv3_L2_SPECIFIC_DEFAULT: + if (tree) { + ti = proto_tree_add_item(tree, hf_l2tp_l2_spec_def, + tvb, idx + l2tpv3_cookie, 4, ENC_NA); + l2_specific = proto_item_add_subtree(ti, ett_l2tp_l2_spec); + + proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_s, tvb, idx + l2tpv3_cookie, + 1, ENC_BIG_ENDIAN); + proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_sequence, tvb, + idx + l2tpv3_cookie + 1, 3, ENC_BIG_ENDIAN); + } + next_tvb = tvb_new_subset_remaining(tvb, idx + l2tpv3_cookie + 4); + break; + case L2TPv3_L2_SPECIFIC_DOCSIS_DMPT: + if (tree) { + ti = proto_tree_add_item(tree, hf_l2tp_l2_spec_docsis_dmpt, + tvb, idx + l2tpv3_cookie, 4, ENC_NA); + l2_specific = proto_item_add_subtree(ti, ett_l2tp_l2_spec); + + proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_v, tvb, + idx + l2tpv3_cookie,1, ENC_BIG_ENDIAN); + + proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_s, tvb, + idx + l2tpv3_cookie,1, ENC_BIG_ENDIAN); + + proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_flow_id, tvb, + idx + l2tpv3_cookie,1, ENC_BIG_ENDIAN); + + proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_sequence, tvb, + idx + l2tpv3_cookie + 2,2, ENC_BIG_ENDIAN); + } + next_tvb = tvb_new_subset_remaining(tvb, idx + l2tpv3_cookie + 4); + break; + case L2TPv3_L2_SPECIFIC_ATM: + if (tree) { + ti = proto_tree_add_item(tree, hf_l2tp_l2_spec_atm, + tvb, idx + l2tpv3_cookie, 4, ENC_NA); + l2_specific = proto_item_add_subtree(ti, ett_l2tp_l2_spec); + + proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_s, tvb, idx + l2tpv3_cookie, + 1, ENC_BIG_ENDIAN); + proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_t, tvb, idx + l2tpv3_cookie, + 1, ENC_BIG_ENDIAN); + /* + * As per RFC 4454, the T bit specifies whether + * we're transporting an OAM cell or an AAL5 frame. + */ + oam_cell = tvb_get_guint8(tvb, idx + l2tpv3_cookie) & 0x08; + proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_g, tvb, idx + l2tpv3_cookie, + 1, ENC_BIG_ENDIAN); + proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_c, tvb, idx + l2tpv3_cookie, + 1, ENC_BIG_ENDIAN); + proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_u, tvb, idx + l2tpv3_cookie, + 1, ENC_BIG_ENDIAN); + proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_sequence, tvb, + idx + l2tpv3_cookie + 1, 3, ENC_BIG_ENDIAN); + } + next_tvb = tvb_new_subset_remaining(tvb, idx + l2tpv3_cookie + 4); + break; + case L2TPv3_L2_SPECIFIC_LAPD: + if (tree) + proto_tree_add_text(tree, tvb, idx + l2tpv3_cookie + 4, 3,"LAPD info"); + next_tvb = tvb_new_subset_remaining(tvb, idx + l2tpv3_cookie+4+3); + break; + case L2TPv3_L2_SPECIFIC_NONE: + default: + next_tvb = tvb_new_subset_remaining(tvb, idx + l2tpv3_cookie); + break; + } + + switch(l2tpv3_protocol){ + case L2TPv3_PROTOCOL_ETH: + call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, tree); + break; + case L2TPv3_PROTOCOL_CHDLC: + call_dissector(chdlc_handle, next_tvb, pinfo, tree); + break; + case L2TPv3_PROTOCOL_FR: + call_dissector(fr_handle, next_tvb, pinfo, tree); + break; + case L2TPv3_PROTOCOL_PPP: + /* + * PPP is transported without Address and Control + * fields, ppp_hdlc_handle can handle that as if if + * was ACFC (NULL Address and Control) + */ + call_dissector(ppp_hdlc_handle, next_tvb, pinfo, tree); + break; + case L2TPv3_PROTOCOL_IP: + call_dissector(ip_handle, next_tvb, pinfo, tree); + break; + case L2TPv3_PROTOCOL_MPLS: + call_dissector(mpls_handle, next_tvb, pinfo, tree); + break; + case L2TPv3_PROTOCOL_DOCSIS_DMPT: + call_dissector(mp2t_handle, next_tvb, pinfo, tree); + break; + case L2TPv3_PROTOCOL_AAL5: + if (oam_cell) { + call_dissector(atm_oam_handle, next_tvb, pinfo, tree); + } else { + call_dissector(llc_handle, next_tvb, pinfo, tree); + } + break; + case L2TPv3_PROTOCOL_LAPD: + call_dissector(lapd_handle, next_tvb, pinfo, tree); + break; + case L2TPv3_PROTOCOL_ERICSSON: + call_dissector(ehdlc_handle, next_tvb, pinfo, tree); + break; + default: + call_dissector(data_handle, next_tvb, pinfo, tree); + break; + } } /* @@ -1523,38 +1521,38 @@ process_l2tpv3_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, static void process_l2tpv3_data_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_tree *l2tp_tree = NULL, *ctrl_tree; - proto_item *l2tp_item = NULL, *ti; - - int idx = 0; - int control; - int sid; - - control = tvb_get_ntohs(tvb, idx); - idx += 2; /* skip ahead */ - idx += 2; /* Skip the reserved */ - sid = tvb_get_ntohl(tvb, idx); - - if (tree) { - l2tp_item = proto_tree_add_item(tree, proto_l2tp, tvb, 0, -1, ENC_NA); - l2tp_tree = proto_item_add_subtree(l2tp_item, ett_l2tp); - proto_item_append_text(l2tp_item, " version 3"); - - ti = proto_tree_add_text(l2tp_tree, tvb, 0, 2, - "Packet Type: %s Session Id=%u", - data_msg, sid); - - ctrl_tree = proto_item_add_subtree(ti, ett_l2tp_ctrl); - proto_tree_add_uint(ctrl_tree, hf_l2tp_type, tvb, 0, 2, control); - proto_tree_add_boolean(ctrl_tree, hf_l2tp_length_bit, tvb, 0, 2, control); - proto_tree_add_boolean(ctrl_tree, hf_l2tp_seq_bit, tvb, 0, 2, control); - proto_tree_add_uint(ctrl_tree, hf_l2tp_version, tvb, 0, 2, control); - /* Data in v3 over UDP has this reserved */ - proto_tree_add_item(l2tp_tree, hf_l2tp_res, tvb, 2, 2, ENC_BIG_ENDIAN); - } - - /* Call process_l2tpv3_data from Session ID (offset in idx of 4) */ - process_l2tpv3_data(tvb, pinfo, tree, l2tp_tree, l2tp_item, &idx); + proto_tree *l2tp_tree = NULL, *ctrl_tree; + proto_item *l2tp_item = NULL, *ti; + + int idx = 0; + int control; + int sid; + + control = tvb_get_ntohs(tvb, idx); + idx += 2; /* skip ahead */ + idx += 2; /* Skip the reserved */ + sid = tvb_get_ntohl(tvb, idx); + + if (tree) { + l2tp_item = proto_tree_add_item(tree, proto_l2tp, tvb, 0, -1, ENC_NA); + l2tp_tree = proto_item_add_subtree(l2tp_item, ett_l2tp); + proto_item_append_text(l2tp_item, " version 3"); + + ti = proto_tree_add_text(l2tp_tree, tvb, 0, 2, + "Packet Type: %s Session Id=%u", + data_msg, sid); + + ctrl_tree = proto_item_add_subtree(ti, ett_l2tp_ctrl); + proto_tree_add_uint(ctrl_tree, hf_l2tp_type, tvb, 0, 2, control); + proto_tree_add_boolean(ctrl_tree, hf_l2tp_length_bit, tvb, 0, 2, control); + proto_tree_add_boolean(ctrl_tree, hf_l2tp_seq_bit, tvb, 0, 2, control); + proto_tree_add_uint(ctrl_tree, hf_l2tp_version, tvb, 0, 2, control); + /* Data in v3 over UDP has this reserved */ + proto_tree_add_item(l2tp_tree, hf_l2tp_res, tvb, 2, 2, ENC_BIG_ENDIAN); + } + + /* Call process_l2tpv3_data from Session ID (offset in idx of 4) */ + process_l2tpv3_data(tvb, pinfo, tree, l2tp_tree, l2tp_item, &idx); } /* @@ -1564,26 +1562,26 @@ process_l2tpv3_data_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static void process_l2tpv3_data_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_tree *l2tp_tree = NULL; - proto_item *l2tp_item = NULL; + proto_tree *l2tp_tree = NULL; + proto_item *l2tp_item = NULL; - int idx = 0; - int sid; + int idx = 0; + int sid; - sid = tvb_get_ntohl(tvb, idx); + sid = tvb_get_ntohl(tvb, idx); - if (tree) { - l2tp_item = proto_tree_add_item(tree, proto_l2tp, tvb, 0, -1, ENC_NA); - l2tp_tree = proto_item_add_subtree(l2tp_item, ett_l2tp); - proto_item_append_text(l2tp_item, " version 3"); + if (tree) { + l2tp_item = proto_tree_add_item(tree, proto_l2tp, tvb, 0, -1, ENC_NA); + l2tp_tree = proto_item_add_subtree(l2tp_item, ett_l2tp); + proto_item_append_text(l2tp_item, " version 3"); - proto_tree_add_text(l2tp_tree, tvb, 0, 4, - "Packet Type: %s Session Id=%u", - data_msg, sid); - } + proto_tree_add_text(l2tp_tree, tvb, 0, 4, + "Packet Type: %s Session Id=%u", + data_msg, sid); + } - /* Call process_l2tpv3_data from Session ID (offset in idx of 0) */ - process_l2tpv3_data(tvb, pinfo, tree, l2tp_tree, l2tp_item, &idx); + /* Call process_l2tpv3_data from Session ID (offset in idx of 0) */ + process_l2tpv3_data(tvb, pinfo, tree, l2tp_tree, l2tp_item, &idx); } /* @@ -1593,130 +1591,130 @@ process_l2tpv3_data_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static void process_l2tpv3_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int baseIdx) { - proto_tree *l2tp_tree=NULL, *ctrl_tree; - proto_item *l2tp_item = NULL, *ti; - - int idx = baseIdx; - int tmp_idx; - guint16 length = 0; /* Length field */ - guint32 ccid = 0; /* Control Connection ID */ - guint16 avp_type; - guint16 msg_type; - guint16 control = 0; - - control = tvb_get_ntohs(tvb, idx); - idx += 2; /* skip ahead */ - if (LENGTH_BIT(control)) { /* length field included ? */ - length = tvb_get_ntohs(tvb, idx); - idx += 2; - } - - /* Get Control Channel ID */ - ccid = tvb_get_ntohl(tvb, idx); - idx += 4; - - if (check_col(pinfo->cinfo, COL_INFO)) { - tmp_idx = idx; - - if ((LENGTH_BIT(control))&&(length==12)) /* ZLB Message */ - col_add_fstr(pinfo->cinfo, COL_INFO, - "%s - ZLB (tunnel id=%u)", - control_msg , ccid); - else - { - if (SEQUENCE_BIT(control)) { - tmp_idx += 4; - } - - tmp_idx+=4; - - avp_type = tvb_get_ntohs(tvb, tmp_idx); - tmp_idx += 2; - - if (avp_type == CONTROL_MESSAGE) { - /* We print message type */ - msg_type = tvb_get_ntohs(tvb, tmp_idx); - col_add_fstr(pinfo->cinfo, COL_INFO, - "%s - %s (tunnel id=%u)", - control_msg , - val_to_str(msg_type, l2tp_message_type_short_str_vals, "Unknown (%u)"), - ccid); - } - else { - /* - * This is not a control message. - * We never pass here except in case of bad l2tp packet! - */ - col_add_fstr(pinfo->cinfo, COL_INFO, - "%s (tunnel id=%u)", - control_msg, ccid); - } - } - } - - if (LENGTH_BIT(control)) { - /* - * Set the length of this tvbuff to be no longer than the length - * in the header. - * - * XXX - complain if that length is longer than the length of - * the tvbuff? Have "set_actual_length()" return a Boolean - * and have its callers check the result? - */ - set_actual_length(tvb, length+baseIdx); - } - - if (tree) { - l2tp_item = proto_tree_add_item(tree, proto_l2tp, tvb, 0, -1, ENC_NA); - l2tp_tree = proto_item_add_subtree(l2tp_item, ett_l2tp); - proto_item_append_text(l2tp_item, " version 3"); - - if (baseIdx) { - proto_tree_add_item(l2tp_tree, hf_l2tp_sid, tvb, 0, 4, ENC_BIG_ENDIAN); - } - ti = proto_tree_add_text(l2tp_tree, tvb, baseIdx, 2, - "Packet Type: %s Control Connection Id=%d", - (CONTROL_BIT(control) ? control_msg : data_msg), ccid); - - ctrl_tree = proto_item_add_subtree(ti, ett_l2tp_ctrl); - proto_tree_add_uint(ctrl_tree, hf_l2tp_type, tvb, baseIdx, 2, control); - proto_tree_add_boolean(ctrl_tree, hf_l2tp_length_bit, tvb, baseIdx, 2, control); - proto_tree_add_boolean(ctrl_tree, hf_l2tp_seq_bit, tvb, baseIdx, 2, control); - proto_tree_add_uint(ctrl_tree, hf_l2tp_version, tvb, baseIdx, 2, control); - } - idx = baseIdx + 2; - if (LENGTH_BIT(control)) { - if (tree) { - proto_tree_add_item(l2tp_tree, hf_l2tp_length, tvb, idx, 2, ENC_BIG_ENDIAN); - } - idx += 2; - } - - if (tree) { - proto_tree_add_item(l2tp_tree, hf_l2tp_ccid, tvb, idx, 4, ENC_BIG_ENDIAN); - } - idx += 4; - - if (SEQUENCE_BIT(control)) { - if (tree) { - proto_tree_add_item(l2tp_tree, hf_l2tp_Ns, tvb, idx, 2, ENC_BIG_ENDIAN); - } - idx += 2; - if (tree) { - proto_tree_add_item(l2tp_tree, hf_l2tp_Nr, tvb, idx, 2, ENC_BIG_ENDIAN); - } - idx += 2; - } - - if (tree && (LENGTH_BIT(control))&&(length==12)) { - proto_tree_add_text(l2tp_tree, tvb, 0, 0, "Zero Length Bit message"); - } - - if (!LENGTH_BIT(control)) { - return; - } - - process_control_avps(tvb, pinfo, l2tp_tree, idx, length+baseIdx); + proto_tree *l2tp_tree = NULL, *ctrl_tree; + proto_item *l2tp_item = NULL, *ti; + + int idx = baseIdx; + int tmp_idx; + guint16 length = 0; /* Length field */ + guint32 ccid = 0; /* Control Connection ID */ + guint16 avp_type; + guint16 msg_type; + guint16 control = 0; + + control = tvb_get_ntohs(tvb, idx); + idx += 2; /* skip ahead */ + if (LENGTH_BIT(control)) { /* length field included ? */ + length = tvb_get_ntohs(tvb, idx); + idx += 2; + } + + /* Get Control Channel ID */ + ccid = tvb_get_ntohl(tvb, idx); + idx += 4; + + if (check_col(pinfo->cinfo, COL_INFO)) { + tmp_idx = idx; + + if ((LENGTH_BIT(control))&&(length==12)) /* ZLB Message */ + col_add_fstr(pinfo->cinfo, COL_INFO, + "%s - ZLB (tunnel id=%u)", + control_msg , ccid); + else + { + if (SEQUENCE_BIT(control)) { + tmp_idx += 4; + } + + tmp_idx+=4; + + avp_type = tvb_get_ntohs(tvb, tmp_idx); + tmp_idx += 2; + + if (avp_type == CONTROL_MESSAGE) { + /* We print message type */ + msg_type = tvb_get_ntohs(tvb, tmp_idx); + col_add_fstr(pinfo->cinfo, COL_INFO, + "%s - %s (tunnel id=%u)", + control_msg , + val_to_str(msg_type, l2tp_message_type_short_str_vals, "Unknown (%u)"), + ccid); + } + else { + /* + * This is not a control message. + * We never pass here except in case of bad l2tp packet! + */ + col_add_fstr(pinfo->cinfo, COL_INFO, + "%s (tunnel id=%u)", + control_msg, ccid); + } + } + } + + if (LENGTH_BIT(control)) { + /* + * Set the length of this tvbuff to be no longer than the length + * in the header. + * + * XXX - complain if that length is longer than the length of + * the tvbuff? Have "set_actual_length()" return a Boolean + * and have its callers check the result? + */ + set_actual_length(tvb, length+baseIdx); + } + + if (tree) { + l2tp_item = proto_tree_add_item(tree, proto_l2tp, tvb, 0, -1, ENC_NA); + l2tp_tree = proto_item_add_subtree(l2tp_item, ett_l2tp); + proto_item_append_text(l2tp_item, " version 3"); + + if (baseIdx) { + proto_tree_add_item(l2tp_tree, hf_l2tp_sid, tvb, 0, 4, ENC_BIG_ENDIAN); + } + ti = proto_tree_add_text(l2tp_tree, tvb, baseIdx, 2, + "Packet Type: %s Control Connection Id=%d", + (CONTROL_BIT(control) ? control_msg : data_msg), ccid); + + ctrl_tree = proto_item_add_subtree(ti, ett_l2tp_ctrl); + proto_tree_add_uint(ctrl_tree, hf_l2tp_type, tvb, baseIdx, 2, control); + proto_tree_add_boolean(ctrl_tree, hf_l2tp_length_bit, tvb, baseIdx, 2, control); + proto_tree_add_boolean(ctrl_tree, hf_l2tp_seq_bit, tvb, baseIdx, 2, control); + proto_tree_add_uint(ctrl_tree, hf_l2tp_version, tvb, baseIdx, 2, control); + } + idx = baseIdx + 2; + if (LENGTH_BIT(control)) { + if (tree) { + proto_tree_add_item(l2tp_tree, hf_l2tp_length, tvb, idx, 2, ENC_BIG_ENDIAN); + } + idx += 2; + } + + if (tree) { + proto_tree_add_item(l2tp_tree, hf_l2tp_ccid, tvb, idx, 4, ENC_BIG_ENDIAN); + } + idx += 4; + + if (SEQUENCE_BIT(control)) { + if (tree) { + proto_tree_add_item(l2tp_tree, hf_l2tp_Ns, tvb, idx, 2, ENC_BIG_ENDIAN); + } + idx += 2; + if (tree) { + proto_tree_add_item(l2tp_tree, hf_l2tp_Nr, tvb, idx, 2, ENC_BIG_ENDIAN); + } + idx += 2; + } + + if (tree && (LENGTH_BIT(control))&&(length==12)) { + proto_tree_add_text(l2tp_tree, tvb, 0, 0, "Zero Length Bit message"); + } + + if (!LENGTH_BIT(control)) { + return; + } + + process_control_avps(tvb, pinfo, l2tp_tree, idx, length+baseIdx); } /* @@ -1728,207 +1726,207 @@ process_l2tpv3_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int static int dissect_l2tp_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_tree *l2tp_tree=NULL, *ctrl_tree; - proto_item *l2tp_item = NULL, *ti; - int idx = 0; - int tmp_idx; - guint16 length = 0; /* Length field */ - guint16 tid; /* Tunnel ID */ - guint16 cid; /* Call ID */ - guint16 offset_size; /* Offset size */ - guint16 avp_type; - guint16 msg_type; - guint16 control; - tvbuff_t *next_tvb; - - /* - * Don't accept packets that aren't for an L2TP version we know, - * as they might not be L2TP packets even though they happen - * to be coming from or going to the L2TP port. - */ - if (tvb_length(tvb) < 2) - return 0; /* not enough information to check */ - control = tvb_get_ntohs(tvb, 0); - switch (L2TP_VERSION(control)) { - - case 2: - case 3: - break; - - default: - return 0; - } - - col_set_str(pinfo->cinfo, COL_PROTOCOL, "L2TP"); - col_clear(pinfo->cinfo, COL_INFO); - - switch (L2TP_VERSION(control)) { - - case 2: - break; - - case 3: - col_set_str(pinfo->cinfo, COL_PROTOCOL, "L2TPv3"); - if (CONTROL_BIT(control)) { - /* Call to process l2tp v3 control message */ - process_l2tpv3_control(tvb, pinfo, tree, 0); - } - else { - /* Call to process l2tp v3 data message */ - process_l2tpv3_data_udp(tvb, pinfo, tree); - } - return tvb_length(tvb); - } - - if (LENGTH_BIT(control)) { /* length field included ? */ - idx += 2; /* skip ahead */ - length = tvb_get_ntohs(tvb, idx); - } - - /* collect the tunnel id & call id */ - idx += 2; - tid = tvb_get_ntohs(tvb, idx); - idx += 2; - cid = tvb_get_ntohs(tvb, idx); - - if (check_col(pinfo->cinfo, COL_INFO)) { - if (CONTROL_BIT(control)) { - /* CONTROL MESSAGE */ - tmp_idx = idx; - - if ((LENGTH_BIT(control))&&(length==12)) /* ZLB Message */ - col_add_fstr(pinfo->cinfo, COL_INFO, - "%s - ZLB (tunnel id=%d, session id=%u)", - control_msg, tid, cid); - else - { - if (SEQUENCE_BIT(control)) { - tmp_idx += 4; - } - - tmp_idx+=4; - - avp_type = tvb_get_ntohs(tvb, (tmp_idx+=2)); - - if (avp_type == CONTROL_MESSAGE) { - /* We print message type */ - msg_type = tvb_get_ntohs(tvb, tmp_idx+2); - col_add_fstr(pinfo->cinfo, COL_INFO, - "%s - %s (tunnel id=%u, session id=%u)", - control_msg, - val_to_str(msg_type, l2tp_message_type_short_str_vals, "Unknown (%u)"), - tid, cid); - } - else - { - /* - * This is not a control message. - * We never pass here except in case of bad l2tp packet! - */ - col_add_fstr(pinfo->cinfo, COL_INFO, - "%s (tunnel id=%u, session id=%u)", - control_msg, tid, cid); - - } - } - } - else { - /* DATA Message */ - col_add_fstr(pinfo->cinfo, COL_INFO, - "%s (tunnel id=%u, session id=%u)", - data_msg, tid, cid); - } - } - - if (LENGTH_BIT(control)) { - /* - * Set the length of this tvbuff to be no longer than the length - * in the header. - * - * XXX - complain if that length is longer than the length of - * the tvbuff? Have "set_actual_length()" return a Boolean - * and have its callers check the result? - */ - set_actual_length(tvb, length); - } - - if (tree) { - l2tp_item = proto_tree_add_item(tree,proto_l2tp, tvb, 0, -1, ENC_NA); - l2tp_tree = proto_item_add_subtree(l2tp_item, ett_l2tp); - - ti = proto_tree_add_text(l2tp_tree, tvb, 0, 2, - "Packet Type: %s Tunnel Id=%d Session Id=%d", - (CONTROL_BIT(control) ? control_msg : data_msg), tid, cid); - - ctrl_tree = proto_item_add_subtree(ti, ett_l2tp_ctrl); - proto_tree_add_uint(ctrl_tree, hf_l2tp_type, tvb, 0, 2, control); - proto_tree_add_boolean(ctrl_tree, hf_l2tp_length_bit, tvb, 0, 2, control); - proto_tree_add_boolean(ctrl_tree, hf_l2tp_seq_bit, tvb, 0, 2, control); - proto_tree_add_boolean(ctrl_tree, hf_l2tp_offset_bit, tvb, 0, 2, control); - proto_tree_add_boolean(ctrl_tree, hf_l2tp_priority, tvb, 0, 2, control); - proto_tree_add_uint(ctrl_tree, hf_l2tp_version, tvb, 0, 2, control); - } - idx = 2; - if (LENGTH_BIT(control)) { - if (tree) { - proto_tree_add_item(l2tp_tree, hf_l2tp_length, tvb, idx, 2, ENC_BIG_ENDIAN); - } - idx += 2; - } - - if (tree) { - proto_tree_add_item(l2tp_tree, hf_l2tp_tunnel, tvb, idx, 2, ENC_BIG_ENDIAN); - } - idx += 2; - if (tree) { - proto_tree_add_item(l2tp_tree, hf_l2tp_session, tvb, idx, 2, ENC_BIG_ENDIAN); - } - idx += 2; - - if (SEQUENCE_BIT(control)) { - if (tree) { - proto_tree_add_item(l2tp_tree, hf_l2tp_Ns, tvb, idx, 2, ENC_BIG_ENDIAN); - } - idx += 2; - if (tree) { - proto_tree_add_item(l2tp_tree, hf_l2tp_Nr, tvb, idx, 2, ENC_BIG_ENDIAN); - } - idx += 2; - } - if (OFFSET_BIT(control)) { - offset_size = tvb_get_ntohs(tvb, idx); - if (tree) { - proto_tree_add_uint(l2tp_tree, hf_l2tp_offset, tvb, idx, 2, - offset_size); - } - idx += 2; - if (offset_size != 0) { - if (tree) { - proto_tree_add_text(l2tp_tree, tvb, idx, offset_size, "Offset Padding"); - } - idx += offset_size; - } - } - - if (tree && (LENGTH_BIT(control))&&(length==12)) { - proto_tree_add_text(l2tp_tree, tvb, 0, 0, "Zero Length Bit message"); - } - - if (!CONTROL_BIT(control)) { /* Data Messages so we are done */ - if (tree) - proto_item_set_len(l2tp_item, idx); - /* If we have data, signified by having a length bit, dissect it */ - if (tvb_offset_exists(tvb, idx)) { - next_tvb = tvb_new_subset_remaining(tvb, idx); - call_dissector(ppp_hdlc_handle, next_tvb, pinfo, tree); - } - return tvb_length(tvb); - } - - if (LENGTH_BIT(control)) - process_control_avps(tvb, pinfo, l2tp_tree, idx, length); - - return tvb_length(tvb); + proto_tree *l2tp_tree = NULL, *ctrl_tree; + proto_item *l2tp_item = NULL, *ti; + int idx = 0; + int tmp_idx; + guint16 length = 0; /* Length field */ + guint16 tid; /* Tunnel ID */ + guint16 cid; /* Call ID */ + guint16 offset_size; /* Offset size */ + guint16 avp_type; + guint16 msg_type; + guint16 control; + tvbuff_t *next_tvb; + + /* + * Don't accept packets that aren't for an L2TP version we know, + * as they might not be L2TP packets even though they happen + * to be coming from or going to the L2TP port. + */ + if (tvb_length(tvb) < 2) + return 0; /* not enough information to check */ + control = tvb_get_ntohs(tvb, 0); + switch (L2TP_VERSION(control)) { + + case 2: + case 3: + break; + + default: + return 0; + } + + col_set_str(pinfo->cinfo, COL_PROTOCOL, "L2TP"); + col_clear(pinfo->cinfo, COL_INFO); + + switch (L2TP_VERSION(control)) { + + case 2: + break; + + case 3: + col_set_str(pinfo->cinfo, COL_PROTOCOL, "L2TPv3"); + if (CONTROL_BIT(control)) { + /* Call to process l2tp v3 control message */ + process_l2tpv3_control(tvb, pinfo, tree, 0); + } + else { + /* Call to process l2tp v3 data message */ + process_l2tpv3_data_udp(tvb, pinfo, tree); + } + return tvb_length(tvb); + } + + if (LENGTH_BIT(control)) { /* length field included ? */ + idx += 2; /* skip ahead */ + length = tvb_get_ntohs(tvb, idx); + } + + /* collect the tunnel id & call id */ + idx += 2; + tid = tvb_get_ntohs(tvb, idx); + idx += 2; + cid = tvb_get_ntohs(tvb, idx); + + if (check_col(pinfo->cinfo, COL_INFO)) { + if (CONTROL_BIT(control)) { + /* CONTROL MESSAGE */ + tmp_idx = idx; + + if ((LENGTH_BIT(control))&&(length==12)) /* ZLB Message */ + col_add_fstr(pinfo->cinfo, COL_INFO, + "%s - ZLB (tunnel id=%d, session id=%u)", + control_msg, tid, cid); + else + { + if (SEQUENCE_BIT(control)) { + tmp_idx += 4; + } + + tmp_idx+=4; + + avp_type = tvb_get_ntohs(tvb, (tmp_idx+=2)); + + if (avp_type == CONTROL_MESSAGE) { + /* We print message type */ + msg_type = tvb_get_ntohs(tvb, tmp_idx+2); + col_add_fstr(pinfo->cinfo, COL_INFO, + "%s - %s (tunnel id=%u, session id=%u)", + control_msg, + val_to_str(msg_type, l2tp_message_type_short_str_vals, "Unknown (%u)"), + tid, cid); + } + else + { + /* + * This is not a control message. + * We never pass here except in case of bad l2tp packet! + */ + col_add_fstr(pinfo->cinfo, COL_INFO, + "%s (tunnel id=%u, session id=%u)", + control_msg, tid, cid); + + } + } + } + else { + /* DATA Message */ + col_add_fstr(pinfo->cinfo, COL_INFO, + "%s (tunnel id=%u, session id=%u)", + data_msg, tid, cid); + } + } + + if (LENGTH_BIT(control)) { + /* + * Set the length of this tvbuff to be no longer than the length + * in the header. + * + * XXX - complain if that length is longer than the length of + * the tvbuff? Have "set_actual_length()" return a Boolean + * and have its callers check the result? + */ + set_actual_length(tvb, length); + } + + if (tree) { + l2tp_item = proto_tree_add_item(tree,proto_l2tp, tvb, 0, -1, ENC_NA); + l2tp_tree = proto_item_add_subtree(l2tp_item, ett_l2tp); + + ti = proto_tree_add_text(l2tp_tree, tvb, 0, 2, + "Packet Type: %s Tunnel Id=%d Session Id=%d", + (CONTROL_BIT(control) ? control_msg : data_msg), tid, cid); + + ctrl_tree = proto_item_add_subtree(ti, ett_l2tp_ctrl); + proto_tree_add_uint(ctrl_tree, hf_l2tp_type, tvb, 0, 2, control); + proto_tree_add_boolean(ctrl_tree, hf_l2tp_length_bit, tvb, 0, 2, control); + proto_tree_add_boolean(ctrl_tree, hf_l2tp_seq_bit, tvb, 0, 2, control); + proto_tree_add_boolean(ctrl_tree, hf_l2tp_offset_bit, tvb, 0, 2, control); + proto_tree_add_boolean(ctrl_tree, hf_l2tp_priority, tvb, 0, 2, control); + proto_tree_add_uint(ctrl_tree, hf_l2tp_version, tvb, 0, 2, control); + } + idx = 2; + if (LENGTH_BIT(control)) { + if (tree) { + proto_tree_add_item(l2tp_tree, hf_l2tp_length, tvb, idx, 2, ENC_BIG_ENDIAN); + } + idx += 2; + } + + if (tree) { + proto_tree_add_item(l2tp_tree, hf_l2tp_tunnel, tvb, idx, 2, ENC_BIG_ENDIAN); + } + idx += 2; + if (tree) { + proto_tree_add_item(l2tp_tree, hf_l2tp_session, tvb, idx, 2, ENC_BIG_ENDIAN); + } + idx += 2; + + if (SEQUENCE_BIT(control)) { + if (tree) { + proto_tree_add_item(l2tp_tree, hf_l2tp_Ns, tvb, idx, 2, ENC_BIG_ENDIAN); + } + idx += 2; + if (tree) { + proto_tree_add_item(l2tp_tree, hf_l2tp_Nr, tvb, idx, 2, ENC_BIG_ENDIAN); + } + idx += 2; + } + if (OFFSET_BIT(control)) { + offset_size = tvb_get_ntohs(tvb, idx); + if (tree) { + proto_tree_add_uint(l2tp_tree, hf_l2tp_offset, tvb, idx, 2, + offset_size); + } + idx += 2; + if (offset_size != 0) { + if (tree) { + proto_tree_add_text(l2tp_tree, tvb, idx, offset_size, "Offset Padding"); + } + idx += offset_size; + } + } + + if (tree && (LENGTH_BIT(control))&&(length==12)) { + proto_tree_add_text(l2tp_tree, tvb, 0, 0, "Zero Length Bit message"); + } + + if (!CONTROL_BIT(control)) { /* Data Messages so we are done */ + if (tree) + proto_item_set_len(l2tp_item, idx); + /* If we have data, signified by having a length bit, dissect it */ + if (tvb_offset_exists(tvb, idx)) { + next_tvb = tvb_new_subset_remaining(tvb, idx); + call_dissector(ppp_hdlc_handle, next_tvb, pinfo, tree); + } + return tvb_length(tvb); + } + + if (LENGTH_BIT(control)) + process_control_avps(tvb, pinfo, l2tp_tree, idx, length); + + return tvb_length(tvb); } @@ -1941,268 +1939,268 @@ dissect_l2tp_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static void dissect_l2tp_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - int idx = 0; - guint32 sid; /* Session ID */ - - /* Only L2TPv3 runs directly over IP */ - col_set_str(pinfo->cinfo, COL_PROTOCOL, "L2TPv3"); - - col_clear(pinfo->cinfo, COL_INFO); - - sid = tvb_get_ntohl(tvb, idx); - if (sid == 0) { - /* This is control message */ - /* Call to process l2tp v3 control message */ - process_l2tpv3_control(tvb, pinfo, tree, 4); - } - else { - /* Call to process l2tp v3 data message */ - process_l2tpv3_data_ip(tvb, pinfo, tree); - } - - return; + int idx = 0; + guint32 sid; /* Session ID */ + + /* Only L2TPv3 runs directly over IP */ + col_set_str(pinfo->cinfo, COL_PROTOCOL, "L2TPv3"); + + col_clear(pinfo->cinfo, COL_INFO); + + sid = tvb_get_ntohl(tvb, idx); + if (sid == 0) { + /* This is control message */ + /* Call to process l2tp v3 control message */ + process_l2tpv3_control(tvb, pinfo, tree, 4); + } + else { + /* Call to process l2tp v3 data message */ + process_l2tpv3_data_ip(tvb, pinfo, tree); + } + + return; } /* registration with the filtering engine */ void proto_register_l2tp(void) { - static hf_register_info hf[] = { - { &hf_l2tp_type, - { "Type", "l2tp.type", FT_UINT16, BASE_DEC, VALS(l2tp_type_vals), 0x8000, - "Type bit", HFILL }}, + static hf_register_info hf[] = { + { &hf_l2tp_type, + { "Type", "l2tp.type", FT_UINT16, BASE_DEC, VALS(l2tp_type_vals), 0x8000, + "Type bit", HFILL }}, - { &hf_l2tp_length_bit, - { "Length Bit", "l2tp.length_bit", FT_BOOLEAN, 16, TFS(&l2tp_length_bit_truth), 0x4000, - NULL, HFILL }}, + { &hf_l2tp_length_bit, + { "Length Bit", "l2tp.length_bit", FT_BOOLEAN, 16, TFS(&l2tp_length_bit_truth), 0x4000, + NULL, HFILL }}, - { &hf_l2tp_seq_bit, - { "Sequence Bit", "l2tp.seq_bit", FT_BOOLEAN, 16, TFS(&l2tp_seq_bit_truth), 0x0800, - NULL, HFILL }}, + { &hf_l2tp_seq_bit, + { "Sequence Bit", "l2tp.seq_bit", FT_BOOLEAN, 16, TFS(&l2tp_seq_bit_truth), 0x0800, + NULL, HFILL }}, - { &hf_l2tp_offset_bit, - { "Offset bit", "l2tp.offset_bit", FT_BOOLEAN, 16, TFS(&l2tp_offset_bit_truth), 0x0200, - NULL, HFILL }}, + { &hf_l2tp_offset_bit, + { "Offset bit", "l2tp.offset_bit", FT_BOOLEAN, 16, TFS(&l2tp_offset_bit_truth), 0x0200, + NULL, HFILL }}, - { &hf_l2tp_priority, - { "Priority", "l2tp.priority", FT_BOOLEAN, 16, TFS(&l2tp_priority_truth), 0x0100, - "Priority bit", HFILL }}, + { &hf_l2tp_priority, + { "Priority", "l2tp.priority", FT_BOOLEAN, 16, TFS(&l2tp_priority_truth), 0x0100, + "Priority bit", HFILL }}, - { &hf_l2tp_version, - { "Version", "l2tp.version", FT_UINT16, BASE_DEC, NULL, 0x000f, - NULL, HFILL }}, + { &hf_l2tp_version, + { "Version", "l2tp.version", FT_UINT16, BASE_DEC, NULL, 0x000f, + NULL, HFILL }}, - { &hf_l2tp_length, - { "Length","l2tp.length", FT_UINT16, BASE_DEC, NULL, 0x0, - NULL, HFILL }}, + { &hf_l2tp_length, + { "Length","l2tp.length", FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, - { &hf_l2tp_tunnel, - { "Tunnel ID","l2tp.tunnel", FT_UINT16, BASE_DEC, NULL, 0x0, /* Probably should be FT_BYTES */ - NULL, HFILL }}, + { &hf_l2tp_tunnel, + { "Tunnel ID","l2tp.tunnel", FT_UINT16, BASE_DEC, NULL, 0x0, /* Probably should be FT_BYTES */ + NULL, HFILL }}, - { &hf_l2tp_session, - { "Session ID","l2tp.session", FT_UINT16, BASE_DEC, NULL, 0x0, /* Probably should be FT_BYTES */ - NULL, HFILL }}, + { &hf_l2tp_session, + { "Session ID","l2tp.session", FT_UINT16, BASE_DEC, NULL, 0x0, /* Probably should be FT_BYTES */ + NULL, HFILL }}, - { &hf_l2tp_Ns, - { "Ns","l2tp.Ns", FT_UINT16, BASE_DEC, NULL, 0x0, - NULL, HFILL }}, + { &hf_l2tp_Ns, + { "Ns","l2tp.Ns", FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, - { &hf_l2tp_Nr, - { "Nr","l2tp.Nr", FT_UINT16, BASE_DEC, NULL, 0x0, - NULL, HFILL }}, + { &hf_l2tp_Nr, + { "Nr","l2tp.Nr", FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, - { &hf_l2tp_offset, - { "Offset","l2tp.offset", FT_UINT16, BASE_DEC, NULL, 0x0, - "Number of octest past the L2TP header at which thepayload data starts.", HFILL }}, + { &hf_l2tp_offset, + { "Offset","l2tp.offset", FT_UINT16, BASE_DEC, NULL, 0x0, + "Number of octest past the L2TP header at which thepayload data starts.", HFILL }}, - { &hf_l2tp_avp_mandatory, - { "Mandatory", "l2tp.avp.mandatory", FT_BOOLEAN, BASE_NONE, NULL, 0x0, - "Mandatory AVP", HFILL }}, + { &hf_l2tp_avp_mandatory, + { "Mandatory", "l2tp.avp.mandatory", FT_BOOLEAN, BASE_NONE, NULL, 0x0, + "Mandatory AVP", HFILL }}, - { &hf_l2tp_avp_hidden, - { "Hidden", "l2tp.avp.hidden", FT_BOOLEAN, BASE_NONE, NULL, 0x0, - "Hidden AVP", HFILL }}, + { &hf_l2tp_avp_hidden, + { "Hidden", "l2tp.avp.hidden", FT_BOOLEAN, BASE_NONE, NULL, 0x0, + "Hidden AVP", HFILL }}, - { &hf_l2tp_avp_length, - { "Length", "l2tp.avp.length", FT_UINT16, BASE_DEC, NULL, 0, - "AVP Length", HFILL }}, - - { &hf_l2tp_avp_vendor_id, - { "Vendor ID", "l2tp.avp.vendor_id", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0, - "AVP Vendor ID", HFILL }}, - - { &hf_l2tp_avp_type, - { "Type", "l2tp.avp.type", FT_UINT16, BASE_DEC, VALS(avp_type_vals), 0, - "AVP Type", HFILL }}, - - { &hf_l2tp_tie_breaker, - { "Tie Breaker", "l2tp.tie_breaker", FT_UINT64, BASE_HEX, NULL, 0, - NULL, HFILL }}, - - { &hf_l2tp_sid, - { "Session ID","l2tp.sid", FT_UINT32, BASE_DEC, NULL, 0x0, - NULL, HFILL }}, - - { &hf_l2tp_ccid, - { "Control Connection ID","l2tp.ccid", FT_UINT32, BASE_DEC, NULL, 0x0, - NULL, HFILL }}, - - { &hf_l2tp_res, - { "Reserved","l2tp.res", FT_UINT16, BASE_HEX, NULL, 0x0, - NULL, HFILL }}, - - { &hf_l2tp_cookie, - { "Cookie","l2tp.cookie", FT_BYTES, BASE_NONE, NULL, 0x0, - NULL, HFILL }}, - - { &hf_l2tp_l2_spec_def, - { "Default L2-Specific Sublayer","l2tp.l2_spec_def", FT_NONE, BASE_NONE, NULL, 0x0, - NULL, HFILL }}, - - { &hf_l2tp_l2_spec_atm, - { "ATM-Specific Sublayer","l2tp.l2_spec_atm", FT_NONE, BASE_NONE, NULL, 0x0, - NULL, HFILL }}, - - { &hf_l2tp_l2_spec_docsis_dmpt, - { "DOCSIS DMPT - Specific Sublayer","l2tp.l2_spec_docsis_dmpt", FT_NONE, BASE_NONE, NULL, 0x0, - NULL, HFILL }}, - - { &hf_l2tp_l2_spec_v, - { "V-bit","l2tp.l2_spec_v", FT_BOOLEAN, 8, NULL, 0x80, - "VCCV Bit", HFILL }}, - - { &hf_l2tp_l2_spec_s, - { "S-bit","l2tp.l2_spec_s", FT_BOOLEAN, 8, NULL, 0x40, - "Sequence Bit", HFILL }}, - - { &hf_l2tp_l2_spec_t, - { "T-bit","l2tp.l2_spec_t", FT_BOOLEAN, 8, NULL, 0x08, - "Transport Type Bit", HFILL }}, - - { &hf_l2tp_l2_spec_g, - { "G-bit","l2tp.l2_spec_g", FT_BOOLEAN, 8, NULL, 0x04, - "EFCI Bit", HFILL }}, - - { &hf_l2tp_l2_spec_c, - { "C-bit","l2tp.l2_spec_c", FT_BOOLEAN, 8, NULL, 0x02, - "CLP Bit", HFILL }}, - - { &hf_l2tp_l2_spec_u, - { "U-bit","l2tp.l2_spec_u", FT_BOOLEAN, 8, NULL, 0x01, - "C/R Bit", HFILL }}, - - { &hf_l2tp_l2_spec_flow_id, - { "Flow ID","l2tp.l2_spec_flow_id", FT_UINT8, BASE_HEX, NULL, FLOW_ID_MASK, - NULL, HFILL }}, - - { &hf_l2tp_l2_spec_sequence, - { "Sequence Number","l2tp.l2_spec_sequence", FT_UINT24, BASE_DEC, NULL, 0x0, - NULL, HFILL }}, - - { &hf_l2tp_cisco_avp_type, - { "Type", "l2tp.avp.ciscotype", FT_UINT16, BASE_DEC, VALS(cisco_avp_type_vals), 0, - "AVP Type", HFILL }}, - - { &hf_l2tp_avp_message_type, - { "Message Type", "l2tp.avp.message_type", FT_UINT16, BASE_DEC, VALS(message_type_vals), 0, - NULL, HFILL }}, - - { &hf_l2tp_avp_assigned_tunnel_id, - { "Assigned Tunnel ID", "l2tp.avp.assigned_tunnel_id", FT_UINT16, BASE_DEC, NULL, 0, - NULL, HFILL }}, - - { &hf_l2tp_avp_assigned_control_conn_id, - { "Assigned Control Connection ID", "l2tp.avp.assigned_control_conn_id", FT_UINT32, BASE_DEC, NULL, 0, - NULL, HFILL }}, - - { &hf_l2tp_avp_assigned_session_id, - { "Assigned Session ID", "l2tp.avp.assigned_session_id", FT_UINT16, BASE_DEC, NULL, 0, - NULL, HFILL }}, - - { &hf_l2tp_avp_remote_session_id, - { "Remote Session ID", "l2tp.avp.remote_session_id", FT_UINT32, BASE_DEC, NULL, 0, - NULL, HFILL }}, - - { &hf_l2tp_avp_local_session_id, - { "Local Session ID", "l2tp.avp.local_session_id", FT_UINT32, BASE_DEC, NULL, 0, - NULL, HFILL }}, - }; - - static gint *ett[] = { - &ett_l2tp, - &ett_l2tp_ctrl, - &ett_l2tp_avp, - &ett_l2tp_avp_sub, - &ett_l2tp_l2_spec, - &ett_l2tp_lcp, - }; - - module_t *l2tp_module; - - proto_l2tp = proto_register_protocol( - "Layer 2 Tunneling Protocol", "L2TP", "l2tp"); - proto_register_field_array(proto_l2tp, hf, array_length(hf)); - proto_register_subtree_array(ett, array_length(ett)); - - l2tp_module = prefs_register_protocol(proto_l2tp, NULL); - - prefs_register_enum_preference(l2tp_module, - "cookie_size", - "L2TPv3 Cookie Size", - "L2TPv3 Cookie Size", - &l2tpv3_cookie, - l2tpv3_cookies, - FALSE); - - prefs_register_enum_preference(l2tp_module, - "l2_specific", - "L2TPv3 L2-Specific Sublayer", - "L2TPv3 L2-Specific Sublayer", - &l2tpv3_l2_specific, - l2tpv3_l2_specifics, - FALSE); - - prefs_register_enum_preference(l2tp_module, - "protocol", - "Decode L2TPv3 packet contents as this protocol", - "Decode L2TPv3 packet contents as this protocol", - &l2tpv3_protocol, - l2tpv3_protocols, - FALSE); + { &hf_l2tp_avp_length, + { "Length", "l2tp.avp.length", FT_UINT16, BASE_DEC, NULL, 0, + "AVP Length", HFILL }}, + + { &hf_l2tp_avp_vendor_id, + { "Vendor ID", "l2tp.avp.vendor_id", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0, + "AVP Vendor ID", HFILL }}, + + { &hf_l2tp_avp_type, + { "Type", "l2tp.avp.type", FT_UINT16, BASE_DEC, VALS(avp_type_vals), 0, + "AVP Type", HFILL }}, + + { &hf_l2tp_tie_breaker, + { "Tie Breaker", "l2tp.tie_breaker", FT_UINT64, BASE_HEX, NULL, 0, + NULL, HFILL }}, + + { &hf_l2tp_sid, + { "Session ID","l2tp.sid", FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_l2tp_ccid, + { "Control Connection ID","l2tp.ccid", FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_l2tp_res, + { "Reserved","l2tp.res", FT_UINT16, BASE_HEX, NULL, 0x0, + NULL, HFILL }}, + + { &hf_l2tp_cookie, + { "Cookie","l2tp.cookie", FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + { &hf_l2tp_l2_spec_def, + { "Default L2-Specific Sublayer","l2tp.l2_spec_def", FT_NONE, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + { &hf_l2tp_l2_spec_atm, + { "ATM-Specific Sublayer","l2tp.l2_spec_atm", FT_NONE, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + { &hf_l2tp_l2_spec_docsis_dmpt, + { "DOCSIS DMPT - Specific Sublayer","l2tp.l2_spec_docsis_dmpt", FT_NONE, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + { &hf_l2tp_l2_spec_v, + { "V-bit","l2tp.l2_spec_v", FT_BOOLEAN, 8, NULL, 0x80, + "VCCV Bit", HFILL }}, + + { &hf_l2tp_l2_spec_s, + { "S-bit","l2tp.l2_spec_s", FT_BOOLEAN, 8, NULL, 0x40, + "Sequence Bit", HFILL }}, + + { &hf_l2tp_l2_spec_t, + { "T-bit","l2tp.l2_spec_t", FT_BOOLEAN, 8, NULL, 0x08, + "Transport Type Bit", HFILL }}, + + { &hf_l2tp_l2_spec_g, + { "G-bit","l2tp.l2_spec_g", FT_BOOLEAN, 8, NULL, 0x04, + "EFCI Bit", HFILL }}, + + { &hf_l2tp_l2_spec_c, + { "C-bit","l2tp.l2_spec_c", FT_BOOLEAN, 8, NULL, 0x02, + "CLP Bit", HFILL }}, + + { &hf_l2tp_l2_spec_u, + { "U-bit","l2tp.l2_spec_u", FT_BOOLEAN, 8, NULL, 0x01, + "C/R Bit", HFILL }}, + + { &hf_l2tp_l2_spec_flow_id, + { "Flow ID","l2tp.l2_spec_flow_id", FT_UINT8, BASE_HEX, NULL, FLOW_ID_MASK, + NULL, HFILL }}, + + { &hf_l2tp_l2_spec_sequence, + { "Sequence Number","l2tp.l2_spec_sequence", FT_UINT24, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_l2tp_cisco_avp_type, + { "Type", "l2tp.avp.ciscotype", FT_UINT16, BASE_DEC, VALS(cisco_avp_type_vals), 0, + "AVP Type", HFILL }}, + + { &hf_l2tp_avp_message_type, + { "Message Type", "l2tp.avp.message_type", FT_UINT16, BASE_DEC, VALS(message_type_vals), 0, + NULL, HFILL }}, + + { &hf_l2tp_avp_assigned_tunnel_id, + { "Assigned Tunnel ID", "l2tp.avp.assigned_tunnel_id", FT_UINT16, BASE_DEC, NULL, 0, + NULL, HFILL }}, + + { &hf_l2tp_avp_assigned_control_conn_id, + { "Assigned Control Connection ID", "l2tp.avp.assigned_control_conn_id", FT_UINT32, BASE_DEC, NULL, 0, + NULL, HFILL }}, + + { &hf_l2tp_avp_assigned_session_id, + { "Assigned Session ID", "l2tp.avp.assigned_session_id", FT_UINT16, BASE_DEC, NULL, 0, + NULL, HFILL }}, + + { &hf_l2tp_avp_remote_session_id, + { "Remote Session ID", "l2tp.avp.remote_session_id", FT_UINT32, BASE_DEC, NULL, 0, + NULL, HFILL }}, + + { &hf_l2tp_avp_local_session_id, + { "Local Session ID", "l2tp.avp.local_session_id", FT_UINT32, BASE_DEC, NULL, 0, + NULL, HFILL }}, + }; + + static gint *ett[] = { + &ett_l2tp, + &ett_l2tp_ctrl, + &ett_l2tp_avp, + &ett_l2tp_avp_sub, + &ett_l2tp_l2_spec, + &ett_l2tp_lcp, + }; + + module_t *l2tp_module; + + proto_l2tp = proto_register_protocol( + "Layer 2 Tunneling Protocol", "L2TP", "l2tp"); + proto_register_field_array(proto_l2tp, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + + l2tp_module = prefs_register_protocol(proto_l2tp, NULL); + + prefs_register_enum_preference(l2tp_module, + "cookie_size", + "L2TPv3 Cookie Size", + "L2TPv3 Cookie Size", + &l2tpv3_cookie, + l2tpv3_cookies, + FALSE); + + prefs_register_enum_preference(l2tp_module, + "l2_specific", + "L2TPv3 L2-Specific Sublayer", + "L2TPv3 L2-Specific Sublayer", + &l2tpv3_l2_specific, + l2tpv3_l2_specifics, + FALSE); + + prefs_register_enum_preference(l2tp_module, + "protocol", + "Decode L2TPv3 packet contents as this protocol", + "Decode L2TPv3 packet contents as this protocol", + &l2tpv3_protocol, + l2tpv3_protocols, + FALSE); } void proto_reg_handoff_l2tp(void) { - dissector_handle_t l2tp_udp_handle; - dissector_handle_t l2tp_ip_handle; - - l2tp_udp_handle = new_create_dissector_handle(dissect_l2tp_udp, proto_l2tp); - dissector_add_uint("udp.port", UDP_PORT_L2TP, l2tp_udp_handle); - - l2tp_ip_handle = create_dissector_handle(dissect_l2tp_ip, proto_l2tp); - dissector_add_uint("ip.proto", IP_PROTO_L2TP, l2tp_ip_handle); - - /* - * Get a handle for the PPP-in-HDLC-like-framing dissector. - */ - ppp_hdlc_handle = find_dissector("ppp_hdlc"); - ppp_lcp_options_handle = find_dissector("ppp_lcp_options"); - - /* - * Get a handle for the dissectors used in v3. - */ - eth_withoutfcs_handle = find_dissector("eth_withoutfcs"); - chdlc_handle = find_dissector("chdlc"); - fr_handle = find_dissector("fr"); - ip_handle = find_dissector("ip"); - mpls_handle = find_dissector("mpls"); - atm_oam_handle = find_dissector("atm_oam_cell"); - llc_handle = find_dissector("llc"); - lapd_handle = find_dissector("lapd"); - mp2t_handle = find_dissector("mp2t"); - ehdlc_handle = find_dissector("ehdlc"); - data_handle = find_dissector("data"); + dissector_handle_t l2tp_udp_handle; + dissector_handle_t l2tp_ip_handle; + + l2tp_udp_handle = new_create_dissector_handle(dissect_l2tp_udp, proto_l2tp); + dissector_add_uint("udp.port", UDP_PORT_L2TP, l2tp_udp_handle); + + l2tp_ip_handle = create_dissector_handle(dissect_l2tp_ip, proto_l2tp); + dissector_add_uint("ip.proto", IP_PROTO_L2TP, l2tp_ip_handle); + + /* + * Get a handle for the PPP-in-HDLC-like-framing dissector. + */ + ppp_hdlc_handle = find_dissector("ppp_hdlc"); + ppp_lcp_options_handle = find_dissector("ppp_lcp_options"); + + /* + * Get a handle for the dissectors used in v3. + */ + eth_withoutfcs_handle = find_dissector("eth_withoutfcs"); + chdlc_handle = find_dissector("chdlc"); + fr_handle = find_dissector("fr"); + ip_handle = find_dissector("ip"); + mpls_handle = find_dissector("mpls"); + atm_oam_handle = find_dissector("atm_oam_cell"); + llc_handle = find_dissector("llc"); + lapd_handle = find_dissector("lapd"); + mp2t_handle = find_dissector("mp2t"); + ehdlc_handle = find_dissector("ehdlc"); + data_handle = find_dissector("data"); } diff --git a/epan/dissectors/packet-laplink.c b/epan/dissectors/packet-laplink.c index 6978f2c741..6d1e1cf05b 100644 --- a/epan/dissectors/packet-laplink.c +++ b/epan/dissectors/packet-laplink.c @@ -27,8 +27,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-llt.c b/epan/dissectors/packet-llt.c index 463dd26532..7325eaf297 100644 --- a/epan/dissectors/packet-llt.c +++ b/epan/dissectors/packet-llt.c @@ -27,8 +27,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-lsc.c b/epan/dissectors/packet-lsc.c index 3d7c89c125..1e56e16746 100644 --- a/epan/dissectors/packet-lsc.c +++ b/epan/dissectors/packet-lsc.c @@ -27,8 +27,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-lwres.c b/epan/dissectors/packet-lwres.c index 60c9e8692f..9b7700db12 100644 --- a/epan/dissectors/packet-lwres.c +++ b/epan/dissectors/packet-lwres.c @@ -28,12 +28,10 @@ #include "config.h" #endif -#include -#include -#include #include #include + #include #include #include "packet-dns.h" diff --git a/epan/dissectors/packet-m3ua.c b/epan/dissectors/packet-m3ua.c index f7a31b3b9a..fbf608aa34 100644 --- a/epan/dissectors/packet-m3ua.c +++ b/epan/dissectors/packet-m3ua.c @@ -36,9 +36,6 @@ # include "config.h" #endif -#include - - #include #include diff --git a/epan/dissectors/packet-manolito.c b/epan/dissectors/packet-manolito.c index 934edfa95f..ad056c67e8 100644 --- a/epan/dissectors/packet-manolito.c +++ b/epan/dissectors/packet-manolito.c @@ -29,8 +29,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-mesh.c b/epan/dissectors/packet-mesh.c index a9fdf4ef47..5b7d520888 100644 --- a/epan/dissectors/packet-mesh.c +++ b/epan/dissectors/packet-mesh.c @@ -28,8 +28,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-mip.c b/epan/dissectors/packet-mip.c index 8b54f6fff8..d7e3db2941 100644 --- a/epan/dissectors/packet-mip.c +++ b/epan/dissectors/packet-mip.c @@ -30,10 +30,7 @@ # include "config.h" #endif -#include - #include -#include #include #include diff --git a/epan/dissectors/packet-mmse.c b/epan/dissectors/packet-mmse.c index ea65607f12..0cacccbfb8 100644 --- a/epan/dissectors/packet-mmse.c +++ b/epan/dissectors/packet-mmse.c @@ -37,8 +37,6 @@ # include "config.h" #endif -#include -#include #include #include diff --git a/epan/dissectors/packet-mpls-echo.c b/epan/dissectors/packet-mpls-echo.c index c2776e82c9..a6881a3d7a 100644 --- a/epan/dissectors/packet-mpls-echo.c +++ b/epan/dissectors/packet-mpls-echo.c @@ -12,7 +12,7 @@ * Krishnamurthy Mayya * Nikitha Malgi * - Support for LSP Ping extensions as per RFC 6426 - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 @@ -32,8 +32,8 @@ # include "config.h" #endif -#include #include + #include #include #include @@ -164,42 +164,42 @@ static gint ett_mpls_echo_tlv_ilso = -1; static guint global_mpls_echo_udp_port = UDP_PORT_MPLS_ECHO; static const value_string mpls_echo_msgtype[] = { - {1, "MPLS Echo Request"}, - {2, "MPLS Echo Reply"}, - {3, "MPLS Data Plane Verification Request"}, - {4, "MPLS Data Plane Verification Reply"}, - {0, NULL} + {1, "MPLS Echo Request"}, + {2, "MPLS Echo Reply"}, + {3, "MPLS Data Plane Verification Request"}, + {4, "MPLS Data Plane Verification Reply"}, + {0, NULL} }; static const value_string mpls_echo_replymode[] = { - {1, "Do not reply"}, - {2, "Reply via an IPv4/IPv6 UDP packet"}, - {3, "Reply via an IPv4/IPv6 UDP packet with Router Alert"}, - {4, "Reply via application level control channel"}, - {0, NULL} + {1, "Do not reply"}, + {2, "Reply via an IPv4/IPv6 UDP packet"}, + {3, "Reply via an IPv4/IPv6 UDP packet with Router Alert"}, + {4, "Reply via application level control channel"}, + {0, NULL} }; /* http://www.iana.org/assignments/mpls-lsp-ping-parameters/mpls-lsp-ping-parameters.xml */ static const value_string mpls_echo_returncode[] = { - {0, "No return code"}, - {1, "Malformed echo request received"}, - {2, "One or more of the TLVs was not understood"}, - {3, "Replying router is an egress for the FEC at stack depth RSC"}, - {4, "Replying router has no mapping for the FEC at stack depth RSC"}, - {5, "Downstream Mapping Mismatch"}, /*[RFC4379] */ - {6, "Upstream Interface Index Unknown"}, /*[RFC4379]*/ - {7, "Reserved"}, - {8, "Label switched at stack-depth RSC"}, - {9, "Label switched but no MPLS forwarding at stack-depth RSC"}, - {10, "Mapping for this FEC is not the given label at stack depth RSC"}, - {11, "No label entry at stack-depth RSC"}, - {12, "Protocol not associated with interface at FEC stack depth RSC"}, - {13, "Premature termination, label stack shrinking to a single label"}, - {14, "See DDM TLV for meaning of Return Code and Return SubCode"}, /*[RFC6424] */ - {15, "Label switched with FEC change"}, /*[RFC6424] */ - /* 16-251 Unassigned */ - /* 252-255 Reserved for Vendor private use [RFC4379 */ - {0, NULL} + {0, "No return code"}, + {1, "Malformed echo request received"}, + {2, "One or more of the TLVs was not understood"}, + {3, "Replying router is an egress for the FEC at stack depth RSC"}, + {4, "Replying router has no mapping for the FEC at stack depth RSC"}, + {5, "Downstream Mapping Mismatch"}, /*[RFC4379] */ + {6, "Upstream Interface Index Unknown"}, /*[RFC4379]*/ + {7, "Reserved"}, + {8, "Label switched at stack-depth RSC"}, + {9, "Label switched but no MPLS forwarding at stack-depth RSC"}, + {10, "Mapping for this FEC is not the given label at stack depth RSC"}, + {11, "No label entry at stack-depth RSC"}, + {12, "Protocol not associated with interface at FEC stack depth RSC"}, + {13, "Premature termination, label stack shrinking to a single label"}, + {14, "See DDM TLV for meaning of Return Code and Return SubCode"}, /*[RFC6424] */ + {15, "Label switched with FEC change"}, /*[RFC6424] */ + /* 16-251 Unassigned */ + /* 252-255 Reserved for Vendor private use [RFC4379 */ + {0, NULL} }; #define TLV_TARGET_FEC_STACK 0x0001 @@ -224,126 +224,126 @@ static const value_string mpls_echo_returncode[] = { /* MPLS Echo TLV Type names */ static const value_string mpls_echo_tlv_type_names[] = { - { TLV_TARGET_FEC_STACK, "Target FEC Stack" }, - { TLV_DOWNSTREAM_MAPPING, "Downstream Mapping" }, - { TLV_PAD, "Pad" }, - { TLV_ERROR_CODE, "Error Code" }, - { TLV_VENDOR_CODE, "Vendor Enterprise Code" }, - { TLV_TBD, "TDB" }, - { TLV_ILSO_IPv4, "IPv4 Interface and Label Stack Object" }, - { TLV_ILSO_IPv6, "IPv6 Interface and Label Stack Object" }, - { TLV_ERRORED_TLV, "Errored TLVs" }, - { TLV_REPLY_TOS, "Reply TOS Byte" }, - { TLV_RTO_IPv4, "IPv4 Reply-to Object" }, - { TLV_RTO_IPv6, "IPv6 Reply-to Object" }, - { TLV_VENDOR_PRIVATE_START, "Vendor Private" }, - { TLV_REVERSE_PATH_FEC_STACK, "Reverse-path Target FEC Stack" }, - { TLV_SRC_IDENTIFIER, "Source Identifier TLV" }, - { TLV_DST_IDENTIFIER, "Destination Identifier TLV" }, - { 0, NULL} + { TLV_TARGET_FEC_STACK, "Target FEC Stack" }, + { TLV_DOWNSTREAM_MAPPING, "Downstream Mapping" }, + { TLV_PAD, "Pad" }, + { TLV_ERROR_CODE, "Error Code" }, + { TLV_VENDOR_CODE, "Vendor Enterprise Code" }, + { TLV_TBD, "TDB" }, + { TLV_ILSO_IPv4, "IPv4 Interface and Label Stack Object" }, + { TLV_ILSO_IPv6, "IPv6 Interface and Label Stack Object" }, + { TLV_ERRORED_TLV, "Errored TLVs" }, + { TLV_REPLY_TOS, "Reply TOS Byte" }, + { TLV_RTO_IPv4, "IPv4 Reply-to Object" }, + { TLV_RTO_IPv6, "IPv6 Reply-to Object" }, + { TLV_VENDOR_PRIVATE_START, "Vendor Private" }, + { TLV_REVERSE_PATH_FEC_STACK, "Reverse-path Target FEC Stack" }, + { TLV_SRC_IDENTIFIER, "Source Identifier TLV" }, + { TLV_DST_IDENTIFIER, "Destination Identifier TLV" }, + { 0, NULL} }; -#define TLV_FEC_STACK_LDP_IPv4 1 -#define TLV_FEC_STACK_LDP_IPv6 2 -#define TLV_FEC_STACK_RSVP_IPv4 3 -#define TLV_FEC_STACK_RSVP_IPv6 4 -#define TLV_FEC_STACK_RES 5 -#define TLV_FEC_STACK_VPN_IPv4 6 -#define TLV_FEC_STACK_VPN_IPv6 7 -#define TLV_FEC_STACK_L2_VPN 8 -#define TLV_FEC_STACK_L2_CID_OLD 9 -#define TLV_FEC_STACK_L2_CID_NEW 10 -#define TLV_FEC_STACK_L2_FEC_129 11 -#define TLV_FEC_STACK_BGP_LAB_v4 12 -#define TLV_FEC_STACK_BGP_LAB_v6 13 -#define TLV_FEC_STACK_GEN_IPv4 14 -#define TLV_FEC_STACK_GEN_IPv6 15 -#define TLV_FEC_STACK_NIL 16 +#define TLV_FEC_STACK_LDP_IPv4 1 +#define TLV_FEC_STACK_LDP_IPv6 2 +#define TLV_FEC_STACK_RSVP_IPv4 3 +#define TLV_FEC_STACK_RSVP_IPv6 4 +#define TLV_FEC_STACK_RES 5 +#define TLV_FEC_STACK_VPN_IPv4 6 +#define TLV_FEC_STACK_VPN_IPv6 7 +#define TLV_FEC_STACK_L2_VPN 8 +#define TLV_FEC_STACK_L2_CID_OLD 9 +#define TLV_FEC_STACK_L2_CID_NEW 10 +#define TLV_FEC_STACK_L2_FEC_129 11 +#define TLV_FEC_STACK_BGP_LAB_v4 12 +#define TLV_FEC_STACK_BGP_LAB_v6 13 +#define TLV_FEC_STACK_GEN_IPv4 14 +#define TLV_FEC_STACK_GEN_IPv6 15 +#define TLV_FEC_STACK_NIL 16 /*As per RFC 6426, http://tools.ietf.org/html/rfc6426 Section: 2.3 */ -#define TLV_FEC_STACK_STATIC_LSP 22 -#define TLV_FEC_STACK_STATIC_PW 23 +#define TLV_FEC_STACK_STATIC_LSP 22 +#define TLV_FEC_STACK_STATIC_PW 23 #define TLV_FEC_VENDOR_PRIVATE_START 0xFC00 #define TLV_FEC_VENDOR_PRIVATE_END 0xFFFF /* FEC sub-TLV Type names */ static const value_string mpls_echo_tlv_fec_names[] = { - { TLV_FEC_STACK_LDP_IPv4, "LDP IPv4 prefix"}, - { TLV_FEC_STACK_LDP_IPv6, "LDP IPv6 prefix"}, - { TLV_FEC_STACK_RSVP_IPv4, "RSVP IPv4 Session Query"}, - { TLV_FEC_STACK_RSVP_IPv6, "RSVP IPv6 Session Query"}, - { TLV_FEC_STACK_RES, "Reserved"}, - { TLV_FEC_STACK_VPN_IPv4, "VPN IPv4 prefix"}, - { TLV_FEC_STACK_VPN_IPv6, "VPN IPv6 prefix"}, - { TLV_FEC_STACK_L2_VPN, "L2 VPN endpoint"}, - { TLV_FEC_STACK_L2_CID_OLD, "FEC 128 Pseudowire (old)"}, - { TLV_FEC_STACK_L2_CID_NEW, "FEC 128 Pseudowire (new)"}, - { TLV_FEC_STACK_L2_FEC_129, "FEC 129 Pseudowire"}, - { TLV_FEC_STACK_BGP_LAB_v4, "BGP labeled IPv4 prefix"}, - { TLV_FEC_STACK_BGP_LAB_v6, "BGP labeled IPv6 prefix"}, - { TLV_FEC_STACK_GEN_IPv4, "Generic IPv4 prefix"}, - { TLV_FEC_STACK_GEN_IPv6, "Generic IPv6 prefix"}, - { TLV_FEC_STACK_NIL, "Nil FEC"}, - { TLV_FEC_STACK_STATIC_LSP, "Static LSP"}, - { TLV_FEC_STACK_STATIC_PW, "Static Pseudowire"}, - { TLV_FEC_VENDOR_PRIVATE_START, "Vendor Private"}, - { 0, NULL} + { TLV_FEC_STACK_LDP_IPv4, "LDP IPv4 prefix"}, + { TLV_FEC_STACK_LDP_IPv6, "LDP IPv6 prefix"}, + { TLV_FEC_STACK_RSVP_IPv4, "RSVP IPv4 Session Query"}, + { TLV_FEC_STACK_RSVP_IPv6, "RSVP IPv6 Session Query"}, + { TLV_FEC_STACK_RES, "Reserved"}, + { TLV_FEC_STACK_VPN_IPv4, "VPN IPv4 prefix"}, + { TLV_FEC_STACK_VPN_IPv6, "VPN IPv6 prefix"}, + { TLV_FEC_STACK_L2_VPN, "L2 VPN endpoint"}, + { TLV_FEC_STACK_L2_CID_OLD, "FEC 128 Pseudowire (old)"}, + { TLV_FEC_STACK_L2_CID_NEW, "FEC 128 Pseudowire (new)"}, + { TLV_FEC_STACK_L2_FEC_129, "FEC 129 Pseudowire"}, + { TLV_FEC_STACK_BGP_LAB_v4, "BGP labeled IPv4 prefix"}, + { TLV_FEC_STACK_BGP_LAB_v6, "BGP labeled IPv6 prefix"}, + { TLV_FEC_STACK_GEN_IPv4, "Generic IPv4 prefix"}, + { TLV_FEC_STACK_GEN_IPv6, "Generic IPv6 prefix"}, + { TLV_FEC_STACK_NIL, "Nil FEC"}, + { TLV_FEC_STACK_STATIC_LSP, "Static LSP"}, + { TLV_FEC_STACK_STATIC_PW, "Static Pseudowire"}, + { TLV_FEC_VENDOR_PRIVATE_START, "Vendor Private"}, + { 0, NULL} }; static const value_string mpls_echo_tlv_pad[] = { - { 1, "Drop Pad TLV from reply" }, - { 2, "Copy Pad TLV to reply" }, - { 0, NULL} + { 1, "Drop Pad TLV from reply" }, + { 2, "Copy Pad TLV to reply" }, + { 0, NULL} }; -#define TLV_ADDR_IPv4 1 -#define TLV_ADDR_UNNUM_IPv4 2 -#define TLV_ADDR_IPv6 3 -#define TLV_ADDR_UNNUM_IPv6 4 +#define TLV_ADDR_IPv4 1 +#define TLV_ADDR_UNNUM_IPv4 2 +#define TLV_ADDR_IPv6 3 +#define TLV_ADDR_UNNUM_IPv6 4 /* As per RFC 6426, http://tools.ietf.org/html/rfc6426 Section: 2.1 */ -#define TLV_ADDR_NONIP 5 +#define TLV_ADDR_NONIP 5 static const value_string mpls_echo_tlv_addr_type[] = { - {TLV_ADDR_IPv4, "IPv4 Numbered"}, - {TLV_ADDR_UNNUM_IPv4, "IPv4 Unnumbered"}, - {TLV_ADDR_IPv6, "IPv6 Numbered"}, - {TLV_ADDR_UNNUM_IPv6, "IPv6 Unnumbered"}, - {TLV_ADDR_NONIP, "Non IP"}, - {0, NULL} + {TLV_ADDR_IPv4, "IPv4 Numbered"}, + {TLV_ADDR_UNNUM_IPv4, "IPv4 Unnumbered"}, + {TLV_ADDR_IPv6, "IPv6 Numbered"}, + {TLV_ADDR_UNNUM_IPv6, "IPv6 Unnumbered"}, + {TLV_ADDR_NONIP, "Non IP"}, + {0, NULL} }; -#define TLV_DS_MAP_HASH_NO_MP 0 -#define TLV_DS_MAP_HASH_LABEL 1 -#define TLV_DS_MAP_HASH_IP 2 -#define TLV_DS_MAP_HASH_LABEL_RANGE 3 -#define TLV_DS_MAP_HASH_IP_RANGE 4 -#define TLV_DS_MAP_HASH_NO_LABEL 5 -#define TLV_DS_MAP_HASH_ALL_IP 6 -#define TLV_DS_MAP_HASH_NO_MATCH 7 -#define TLV_DS_MAP_HASH_BITMASK_IP 8 -#define TLV_DS_MAP_HASH_BITMASK_LABEL 9 +#define TLV_DS_MAP_HASH_NO_MP 0 +#define TLV_DS_MAP_HASH_LABEL 1 +#define TLV_DS_MAP_HASH_IP 2 +#define TLV_DS_MAP_HASH_LABEL_RANGE 3 +#define TLV_DS_MAP_HASH_IP_RANGE 4 +#define TLV_DS_MAP_HASH_NO_LABEL 5 +#define TLV_DS_MAP_HASH_ALL_IP 6 +#define TLV_DS_MAP_HASH_NO_MATCH 7 +#define TLV_DS_MAP_HASH_BITMASK_IP 8 +#define TLV_DS_MAP_HASH_BITMASK_LABEL 9 static const value_string mpls_echo_tlv_ds_map_hash_type[] = { - {TLV_DS_MAP_HASH_NO_MP, "no multipath"}, - {TLV_DS_MAP_HASH_LABEL, "label"}, - {TLV_DS_MAP_HASH_IP, "IP address"}, - {TLV_DS_MAP_HASH_LABEL_RANGE, "label range"}, - {TLV_DS_MAP_HASH_IP_RANGE, "IP address range"}, - {TLV_DS_MAP_HASH_NO_LABEL, "no more labels"}, - {TLV_DS_MAP_HASH_ALL_IP, "All IP addresses"}, - {TLV_DS_MAP_HASH_NO_MATCH, "no match"}, - {TLV_DS_MAP_HASH_BITMASK_IP, "Bit-masked IPv4 address set"}, - {TLV_DS_MAP_HASH_BITMASK_LABEL, "Bit-masked label set"}, - {0, NULL} + {TLV_DS_MAP_HASH_NO_MP, "no multipath"}, + {TLV_DS_MAP_HASH_LABEL, "label"}, + {TLV_DS_MAP_HASH_IP, "IP address"}, + {TLV_DS_MAP_HASH_LABEL_RANGE, "label range"}, + {TLV_DS_MAP_HASH_IP_RANGE, "IP address range"}, + {TLV_DS_MAP_HASH_NO_LABEL, "no more labels"}, + {TLV_DS_MAP_HASH_ALL_IP, "All IP addresses"}, + {TLV_DS_MAP_HASH_NO_MATCH, "no match"}, + {TLV_DS_MAP_HASH_BITMASK_IP, "Bit-masked IPv4 address set"}, + {TLV_DS_MAP_HASH_BITMASK_LABEL, "Bit-masked label set"}, + {0, NULL} }; static const value_string mpls_echo_tlv_ds_map_mp_proto[] = { - {0, "Unknown"}, - {1, "Static"}, - {2, "BGP"}, - {3, "LDP"}, - {4, "RSVP-TE"}, - {5, "Reserved"}, - {0, NULL} + {0, "Unknown"}, + {1, "Static"}, + {2, "BGP"}, + {3, "LDP"}, + {4, "RSVP-TE"}, + {5, "Reserved"}, + {0, NULL} }; /* @@ -352,261 +352,261 @@ static const value_string mpls_echo_tlv_ds_map_mp_proto[] = { static void dissect_mpls_echo_tlv_fec(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem) { - proto_tree *ti = NULL, *tlv_fec_tree = NULL; - proto_item *hidden_item; - guint16 idx = 1, nil_idx = 1, type, saved_type; - int length, nil_length, pad; - guint32 label; - guint8 exp, bos, ttl; - - if (tree){ - while (rem >= 4){ /* Type, Length */ + proto_tree *ti = NULL, *tlv_fec_tree = NULL; + proto_item *hidden_item; + guint16 idx = 1, nil_idx = 1, type, saved_type; + int length, nil_length, pad; + guint32 label; + guint8 exp, bos, ttl; + + if (tree) { + while (rem >= 4) { /* Type, Length */ type = tvb_get_ntohs(tvb, offset); - saved_type = type; - /* Check for Vendor Private sub-TLVs */ - if(type >= TLV_FEC_VENDOR_PRIVATE_START) /* && <= TLV_FEC_VENDOR_PRIVATE_END always true */ - type = TLV_FEC_VENDOR_PRIVATE_START; + saved_type = type; + /* Check for Vendor Private sub-TLVs */ + if (type >= TLV_FEC_VENDOR_PRIVATE_START) /* && <= TLV_FEC_VENDOR_PRIVATE_END always true */ + type = TLV_FEC_VENDOR_PRIVATE_START; length = tvb_get_ntohs(tvb, offset + 2); ti = proto_tree_add_text(tree, tvb, offset, length + 4, "FEC Element %u: %s", - idx, val_to_str(type, mpls_echo_tlv_fec_names, - "Unknown FEC type (0x%04X)")); + idx, val_to_str(type, mpls_echo_tlv_fec_names, + "Unknown FEC type (0x%04X)")); tlv_fec_tree = proto_item_add_subtree(ti, ett_mpls_echo_tlv_fec); - if(tlv_fec_tree == NULL) return; + if (tlv_fec_tree == NULL) return; /* FEC sub-TLV Type and Length */ - proto_tree_add_uint_format(tlv_fec_tree, hf_mpls_echo_tlv_fec_type, tvb, - offset, 2, saved_type, "Type: %s (%u)", - val_to_str(type, mpls_echo_tlv_fec_names, "Unknown sub-TLV type"), saved_type); + proto_tree_add_uint_format(tlv_fec_tree, hf_mpls_echo_tlv_fec_type, tvb, + offset, 2, saved_type, "Type: %s (%u)", + val_to_str(type, mpls_echo_tlv_fec_names, "Unknown sub-TLV type"), saved_type); proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_len, tvb, offset + 2, - 2, ENC_BIG_ENDIAN); + 2, ENC_BIG_ENDIAN); - if (length + 4 > rem){ - proto_tree_add_text(tlv_fec_tree, tvb, offset, rem, - "Error processing FEC sub-TLV: length is %u and reminder is %u", - length, rem - 4); - return; - } + if (length + 4 > rem) { + proto_tree_add_text(tlv_fec_tree, tvb, offset, rem, + "Error processing FEC sub-TLV: length is %u and reminder is %u", + length, rem - 4); + return; + } /* FEC sub-TLV Value */ switch (type) { case TLV_FEC_STACK_LDP_IPv4: proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_ldp_ipv4, - tvb, offset + 4, 4, ENC_BIG_ENDIAN); + tvb, offset + 4, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_ldp_ipv4_mask, - tvb, offset + 8, 1, ENC_BIG_ENDIAN); + tvb, offset + 8, 1, ENC_BIG_ENDIAN); if (length == 8) proto_tree_add_text(tlv_fec_tree, tvb, offset + 9, 3, "Padding"); break; - case TLV_FEC_STACK_LDP_IPv6: + case TLV_FEC_STACK_LDP_IPv6: proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_ldp_ipv6, - tvb, offset + 4, 16, ENC_NA); + tvb, offset + 4, 16, ENC_NA); proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_ldp_ipv6_mask, - tvb, offset + 20, 1, ENC_BIG_ENDIAN); + tvb, offset + 20, 1, ENC_BIG_ENDIAN); if (length == 20) proto_tree_add_text(tlv_fec_tree, tvb, offset + 21, 3, "Padding"); break; - case TLV_FEC_STACK_RSVP_IPv4: - if (length != 20){ - proto_tree_add_text(tlv_fec_tree, tvb, offset, rem, - "Error processing sub-TLV: length is %d, should be 20", length); - return; - } - proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_rsvp_ipv4_ipv4_endpoint, - tvb, offset + 4, 4, ENC_BIG_ENDIAN); - proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_rsvp_ip_mbz1, - tvb, offset + 8, 2, ENC_BIG_ENDIAN); - proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_rsvp_ip_tunnel_id, - tvb, offset + 10, 2, ENC_BIG_ENDIAN); - proto_tree_add_text(tlv_fec_tree, tvb, offset + 12, 4, - "Extended Tunnel ID: 0x%08X (%s)", tvb_get_ntohl(tvb, offset + 12), - tvb_ip_to_str(tvb, offset + 12)); - hidden_item = proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_rsvp_ipv4_ext_tunnel_id, - tvb, offset + 12, 4, ENC_BIG_ENDIAN); - PROTO_ITEM_SET_HIDDEN(hidden_item); - proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_rsvp_ipv4_ipv4_sender, - tvb, offset + 16, 4, ENC_BIG_ENDIAN); - proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_rsvp_ip_mbz2, - tvb, offset + 20, 2, ENC_BIG_ENDIAN); - proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_rsvp_ip_lsp_id, - tvb, offset + 22, 2, ENC_BIG_ENDIAN); - break; + case TLV_FEC_STACK_RSVP_IPv4: + if (length != 20) { + proto_tree_add_text(tlv_fec_tree, tvb, offset, rem, + "Error processing sub-TLV: length is %d, should be 20", length); + return; + } + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_rsvp_ipv4_ipv4_endpoint, + tvb, offset + 4, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_rsvp_ip_mbz1, + tvb, offset + 8, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_rsvp_ip_tunnel_id, + tvb, offset + 10, 2, ENC_BIG_ENDIAN); + proto_tree_add_text(tlv_fec_tree, tvb, offset + 12, 4, + "Extended Tunnel ID: 0x%08X (%s)", tvb_get_ntohl(tvb, offset + 12), + tvb_ip_to_str(tvb, offset + 12)); + hidden_item = proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_rsvp_ipv4_ext_tunnel_id, + tvb, offset + 12, 4, ENC_BIG_ENDIAN); + PROTO_ITEM_SET_HIDDEN(hidden_item); + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_rsvp_ipv4_ipv4_sender, + tvb, offset + 16, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_rsvp_ip_mbz2, + tvb, offset + 20, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_rsvp_ip_lsp_id, + tvb, offset + 22, 2, ENC_BIG_ENDIAN); + break; case TLV_FEC_STACK_RSVP_IPv6: - if (length != 56){ + if (length != 56) { proto_tree_add_text(tlv_fec_tree, tvb, offset, rem, - "Error processing sub-TLV: length is %d, should be 56", length); + "Error processing sub-TLV: length is %d, should be 56", length); return; } proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_rsvp_ipv6_ipv6_endpoint, - tvb, offset + 4, 16, ENC_NA); + tvb, offset + 4, 16, ENC_NA); proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_rsvp_ip_mbz1, - tvb, offset + 20, 2, ENC_BIG_ENDIAN); + tvb, offset + 20, 2, ENC_BIG_ENDIAN); proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_rsvp_ip_tunnel_id, - tvb, offset + 22, 2, ENC_BIG_ENDIAN); + tvb, offset + 22, 2, ENC_BIG_ENDIAN); proto_tree_add_text(tlv_fec_tree, tvb, offset + 24, 16, - "Extended Tunnel ID: 0x%s (%s)", - tvb_bytes_to_str(tvb, offset + 24, 16), - tvb_ip6_to_str(tvb, offset + 24)); + "Extended Tunnel ID: 0x%s (%s)", + tvb_bytes_to_str(tvb, offset + 24, 16), + tvb_ip6_to_str(tvb, offset + 24)); hidden_item = proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_rsvp_ipv6_ext_tunnel_id, - tvb, offset + 24, 16, ENC_NA); - PROTO_ITEM_SET_HIDDEN(hidden_item); + tvb, offset + 24, 16, ENC_NA); + PROTO_ITEM_SET_HIDDEN(hidden_item); proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_rsvp_ipv6_ipv6_sender, - tvb, offset + 40, 16, ENC_NA); + tvb, offset + 40, 16, ENC_NA); proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_rsvp_ip_mbz2, - tvb, offset + 56, 2, ENC_BIG_ENDIAN); + tvb, offset + 56, 2, ENC_BIG_ENDIAN); proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_rsvp_ip_lsp_id, - tvb, offset + 58, 2, ENC_BIG_ENDIAN); + tvb, offset + 58, 2, ENC_BIG_ENDIAN); break; case TLV_FEC_STACK_L2_CID_OLD: proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_l2cid_remote, - tvb, offset + 4, 4, ENC_BIG_ENDIAN); + tvb, offset + 4, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_l2cid_vcid, - tvb, offset + 8, 4, ENC_BIG_ENDIAN); + tvb, offset + 8, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_l2cid_encap, - tvb, offset + 12, 2, ENC_BIG_ENDIAN); + tvb, offset + 12, 2, ENC_BIG_ENDIAN); proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_l2cid_mbz, - tvb, offset + 14, 2, ENC_BIG_ENDIAN); + tvb, offset + 14, 2, ENC_BIG_ENDIAN); break; - case TLV_FEC_STACK_L2_CID_NEW: - if (length < 14){ + case TLV_FEC_STACK_L2_CID_NEW: + if (length < 14) { proto_tree_add_text(tlv_fec_tree, tvb, offset, rem, - "Error processing sub-TLV: length is %d, should be 14", length); + "Error processing sub-TLV: length is %d, should be 14", length); return; } proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_l2cid_sender, - tvb, offset + 4, 4, ENC_BIG_ENDIAN); + tvb, offset + 4, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_l2cid_remote, - tvb, offset + 8, 4, ENC_BIG_ENDIAN); + tvb, offset + 8, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_l2cid_vcid, - tvb, offset + 12, 4, ENC_BIG_ENDIAN); + tvb, offset + 12, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_l2cid_encap, - tvb, offset + 16, 2, ENC_BIG_ENDIAN); + tvb, offset + 16, 2, ENC_BIG_ENDIAN); proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_l2cid_mbz, - tvb, offset + 18, 2, ENC_BIG_ENDIAN); + tvb, offset + 18, 2, ENC_BIG_ENDIAN); break; - case TLV_FEC_VENDOR_PRIVATE_START: - if (length < 4) { /* SMI Enterprise code */ - proto_tree_add_text(tlv_fec_tree, tvb, offset + 4, length, - "Error processing Vendor Private sub-TLV: length is %d, should be >= 4", - length); - } else { - proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_vendor, tvb, - offset + 4, 4, ENC_BIG_ENDIAN); - proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_value, tvb, - offset + 8, length - 4, ENC_NA); - } - break; - case TLV_FEC_STACK_BGP_LAB_v4: + case TLV_FEC_VENDOR_PRIVATE_START: + if (length < 4) { /* SMI Enterprise code */ + proto_tree_add_text(tlv_fec_tree, tvb, offset + 4, length, + "Error processing Vendor Private sub-TLV: length is %d, should be >= 4", + length); + } else { + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_vendor, tvb, + offset + 4, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_value, tvb, + offset + 8, length - 4, ENC_NA); + } + break; + case TLV_FEC_STACK_BGP_LAB_v4: proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_bgp_nh, - tvb, offset + 4, 4, ENC_BIG_ENDIAN); + tvb, offset + 4, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_bgp_ipv4, - tvb, offset + 8, 4, ENC_BIG_ENDIAN); + tvb, offset + 8, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_bgp_len, - tvb, offset + 12, 1, ENC_BIG_ENDIAN); + tvb, offset + 12, 1, ENC_BIG_ENDIAN); if (length == 12) proto_tree_add_text(tlv_fec_tree, tvb, offset + 13, 3, "Padding"); - break; - case TLV_FEC_STACK_GEN_IPv4: + break; + case TLV_FEC_STACK_GEN_IPv4: proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_gen_ipv4, - tvb, offset + 4, 4, ENC_BIG_ENDIAN); + tvb, offset + 4, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_gen_ipv4_mask, - tvb, offset + 8, 1, ENC_BIG_ENDIAN); + tvb, offset + 8, 1, ENC_BIG_ENDIAN); if (length == 8) proto_tree_add_text(tlv_fec_tree, tvb, offset + 9, 3, "Padding"); - break; - case TLV_FEC_STACK_GEN_IPv6: + break; + case TLV_FEC_STACK_GEN_IPv6: proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_gen_ipv6, - tvb, offset + 4, 16, ENC_NA); + tvb, offset + 4, 16, ENC_NA); proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_gen_ipv6_mask, - tvb, offset + 20, 1, ENC_BIG_ENDIAN); + tvb, offset + 20, 1, ENC_BIG_ENDIAN); if (length == 20) proto_tree_add_text(tlv_fec_tree, tvb, offset + 21, 3, "Padding"); - break; - case TLV_FEC_STACK_NIL: + break; + case TLV_FEC_STACK_NIL: nil_length = length; - while (nil_length >= 4){ - decode_mpls_label(tvb, offset + 4, &label, &exp, &bos, &ttl); - if (label <= LABEL_MAX_RESERVED){ - proto_tree_add_uint_format(tlv_fec_tree, hf_mpls_echo_tlv_fec_nil_label, - tvb, offset + 4, 3, label, "Label %u: %u (%s)", nil_idx, label, - val_to_str(label, special_labels, "Reserved - Unknown")); - } else { - proto_tree_add_uint_format(tlv_fec_tree, hf_mpls_echo_tlv_fec_nil_label, - tvb, offset + 4, 3, label, "Label %u: %u", nil_idx, label); - } - nil_length -= 4; - offset += 4; - nil_idx++; - } - break; - case TLV_FEC_STACK_STATIC_LSP: - proto_tree_add_item (tlv_fec_tree, hf_mpls_echo_lspping_tlv_src_gid, - tvb, (offset + 4), 4, ENC_BIG_ENDIAN); - proto_tree_add_item (tlv_fec_tree, hf_mpls_echo_lspping_tlv_src_nid, + while (nil_length >= 4) { + decode_mpls_label(tvb, offset + 4, &label, &exp, &bos, &ttl); + if (label <= LABEL_MAX_RESERVED) { + proto_tree_add_uint_format(tlv_fec_tree, hf_mpls_echo_tlv_fec_nil_label, + tvb, offset + 4, 3, label, "Label %u: %u (%s)", nil_idx, label, + val_to_str(label, special_labels, "Reserved - Unknown")); + } else { + proto_tree_add_uint_format(tlv_fec_tree, hf_mpls_echo_tlv_fec_nil_label, + tvb, offset + 4, 3, label, "Label %u: %u", nil_idx, label); + } + nil_length -= 4; + offset += 4; + nil_idx++; + } + break; + case TLV_FEC_STACK_STATIC_LSP: + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_lspping_tlv_src_gid, + tvb, (offset + 4), 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_lspping_tlv_src_nid, tvb, (offset + 8), 4, ENC_BIG_ENDIAN); - proto_tree_add_item (tlv_fec_tree, hf_mpls_echo_lspping_tlv_src_tunnel_no, + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_lspping_tlv_src_tunnel_no, tvb, (offset + 12), 2, ENC_BIG_ENDIAN); - proto_tree_add_item (tlv_fec_tree, hf_mpls_echo_lspping_tlv_lsp_no, - tvb, (offset + 14), 2, ENC_BIG_ENDIAN); - proto_tree_add_item (tlv_fec_tree, hf_mpls_echo_lspping_tlv_dst_gid, - tvb, (offset + 16), 4, ENC_BIG_ENDIAN); - proto_tree_add_item (tlv_fec_tree, hf_mpls_echo_lspping_tlv_dst_nid, - tvb, (offset + 20), 4, ENC_BIG_ENDIAN); - proto_tree_add_item (tlv_fec_tree, hf_mpls_echo_lspping_tlv_dst_tunnel_no, - tvb, (offset + 24), 2, ENC_BIG_ENDIAN); - proto_tree_add_item (tlv_fec_tree, hf_mpls_echo_lspping_tlv_resv, - tvb, (offset + 26), 2, ENC_BIG_ENDIAN); - break; - case TLV_FEC_STACK_STATIC_PW: - proto_tree_add_item (tlv_fec_tree, hf_mpls_echo_lspping_tlv_pw_serv_identifier, + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_lspping_tlv_lsp_no, + tvb, (offset + 14), 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_lspping_tlv_dst_gid, + tvb, (offset + 16), 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_lspping_tlv_dst_nid, + tvb, (offset + 20), 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_lspping_tlv_dst_tunnel_no, + tvb, (offset + 24), 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_lspping_tlv_resv, + tvb, (offset + 26), 2, ENC_BIG_ENDIAN); + break; + case TLV_FEC_STACK_STATIC_PW: + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_lspping_tlv_pw_serv_identifier, tvb, (offset + 4), 8, ENC_BIG_ENDIAN); - proto_tree_add_item (tlv_fec_tree, hf_mpls_echo_lspping_tlv_src_gid, - tvb, (offset + 12), 4, ENC_BIG_ENDIAN); - proto_tree_add_item (tlv_fec_tree, hf_mpls_echo_lspping_tlv_src_nid, - tvb, (offset + 16), 4, ENC_BIG_ENDIAN); - proto_tree_add_item (tlv_fec_tree, hf_mpls_echo_lspping_tlv_pw_src_ac_id, - tvb, (offset + 20), 4, ENC_BIG_ENDIAN); - proto_tree_add_item (tlv_fec_tree, hf_mpls_echo_lspping_tlv_dst_gid, - tvb, (offset + 24), 4, ENC_BIG_ENDIAN); - proto_tree_add_item (tlv_fec_tree, hf_mpls_echo_lspping_tlv_dst_nid, - tvb, (offset + 28), 4, ENC_BIG_ENDIAN); - proto_tree_add_item (tlv_fec_tree, hf_mpls_echo_lspping_tlv_pw_dst_ac_id, - tvb, (offset + 32), 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_lspping_tlv_src_gid, + tvb, (offset + 12), 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_lspping_tlv_src_nid, + tvb, (offset + 16), 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_lspping_tlv_pw_src_ac_id, + tvb, (offset + 20), 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_lspping_tlv_dst_gid, + tvb, (offset + 24), 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_lspping_tlv_dst_nid, + tvb, (offset + 28), 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_lspping_tlv_pw_dst_ac_id, + tvb, (offset + 32), 4, ENC_BIG_ENDIAN); break; case TLV_FEC_STACK_RES: case TLV_FEC_STACK_VPN_IPv4: case TLV_FEC_STACK_VPN_IPv6: case TLV_FEC_STACK_L2_VPN: default: - if(length) - proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_value, - tvb, offset + 4, length, ENC_NA); + if (length) + proto_tree_add_item(tlv_fec_tree, hf_mpls_echo_tlv_fec_value, + tvb, offset + 4, length, ENC_NA); break; } - /* - * Check for padding based on sub-TLV length alignment; - * FEC sub-TLVs is zero-padded to align to four-octet boundary. - */ - if (length % 4){ - pad = 4 - (length % 4); - if (length + 4 + pad > rem){ - proto_tree_add_text(tlv_fec_tree, tvb, offset, rem, - "Error processing FEC sub-TLV: padded length is %u and reminder is %u", - length + pad, rem - 4); - return; - } else { - proto_tree_add_text(tlv_fec_tree, tvb, offset + 4 + length, pad, "Padding"); - } - length += pad; - } + /* + * Check for padding based on sub-TLV length alignment; + * FEC sub-TLVs is zero-padded to align to four-octet boundary. + */ + if (length % 4) { + pad = 4 - (length % 4); + if (length + 4 + pad > rem) { + proto_tree_add_text(tlv_fec_tree, tvb, offset, rem, + "Error processing FEC sub-TLV: padded length is %u and reminder is %u", + length + pad, rem - 4); + return; + } else { + proto_tree_add_text(tlv_fec_tree, tvb, offset + 4 + length, pad, "Padding"); + } + length += pad; + } rem -= 4 + length; offset += 4 + length; idx++; - } } + } } /* @@ -615,170 +615,170 @@ dissect_mpls_echo_tlv_fec(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem static void dissect_mpls_echo_tlv_ds_map(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem) { - proto_tree *ti = NULL, *tlv_ds_map_tree = NULL; - guint16 mplen, idx = 1; - guint32 label; - guint8 exp, bos, proto; - guint8 hash_type, addr_type; - - proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_mtu, tvb, - offset, 2, ENC_BIG_ENDIAN); - proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_addr_type, tvb, - offset + 2, 1, ENC_BIG_ENDIAN); - ti = proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_res, tvb, - offset + 3, 1, ENC_BIG_ENDIAN); - tlv_ds_map_tree = proto_item_add_subtree(ti, ett_mpls_echo_tlv_ds_map); - - proto_tree_add_item(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_flag_res, tvb, - offset + 3, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_flag_i, tvb, - offset + 3, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_flag_n, tvb, - offset + 3, 1, ENC_BIG_ENDIAN); - - addr_type = tvb_get_guint8(tvb, offset + 2); - switch(addr_type){ - case TLV_ADDR_IPv4: - proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_ds_ip, tvb, - offset + 4, 4, ENC_BIG_ENDIAN); - proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_int_ip, tvb, - offset + 8, 4, ENC_BIG_ENDIAN); - break; - case TLV_ADDR_UNNUM_IPv4: - case TLV_ADDR_UNNUM_IPv6: - proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_ds_ip, tvb, - offset + 4, 4, ENC_BIG_ENDIAN); - proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_if_index, tvb, - offset + 8, 4, ENC_BIG_ENDIAN); - break; - case TLV_ADDR_IPv6: - proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_ds_ipv6, tvb, - offset + 4, 16, ENC_NA); - proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_int_ipv6, tvb, - offset + 20, 16, ENC_NA); - rem -= 24; - offset += 24; + proto_tree *ti = NULL, *tlv_ds_map_tree = NULL; + guint16 mplen, idx = 1; + guint32 label; + guint8 exp, bos, proto; + guint8 hash_type, addr_type; + + proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_mtu, tvb, + offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_addr_type, tvb, + offset + 2, 1, ENC_BIG_ENDIAN); + ti = proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_res, tvb, + offset + 3, 1, ENC_BIG_ENDIAN); + tlv_ds_map_tree = proto_item_add_subtree(ti, ett_mpls_echo_tlv_ds_map); + + proto_tree_add_item(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_flag_res, tvb, + offset + 3, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_flag_i, tvb, + offset + 3, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_flag_n, tvb, + offset + 3, 1, ENC_BIG_ENDIAN); + + addr_type = tvb_get_guint8(tvb, offset + 2); + switch(addr_type) { + case TLV_ADDR_IPv4: + proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_ds_ip, tvb, + offset + 4, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_int_ip, tvb, + offset + 8, 4, ENC_BIG_ENDIAN); + break; + case TLV_ADDR_UNNUM_IPv4: + case TLV_ADDR_UNNUM_IPv6: + proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_ds_ip, tvb, + offset + 4, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_if_index, tvb, + offset + 8, 4, ENC_BIG_ENDIAN); + break; + case TLV_ADDR_IPv6: + proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_ds_ipv6, tvb, + offset + 4, 16, ENC_NA); + proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_int_ipv6, tvb, + offset + 20, 16, ENC_NA); + rem -= 24; + offset += 24; + break; + case TLV_ADDR_NONIP : + proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_ingress_if_num, tvb, + (offset + 4), 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_egress_if_num, tvb, + (offset + 8), 4, ENC_BIG_ENDIAN); + break; + default: + proto_tree_add_text(tree, tvb, offset + 4, 8, + "Error processing TLV: Unknown Address Type of %u", + addr_type); + break; + } + proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_hash_type, tvb, + offset + 12, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_depth, tvb, + offset + 13, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_muti_len, tvb, + offset + 14, 2, ENC_BIG_ENDIAN); + + /* Get the Multipath Length and Hash Type */ + mplen = tvb_get_ntohs(tvb, offset + 14); + hash_type = tvb_get_guint8(tvb, offset + 12); + + rem -= 16; + offset += 16; + if (rem < mplen) { + proto_tree_add_text(tree, tvb, offset, rem, + "Error processing TLV: Multi Path length is %d and reminder is %u", + mplen, rem); + return; + } + rem -= mplen; + if (mplen) { + switch(hash_type) { + case TLV_DS_MAP_HASH_IP: + if (mplen != 4) { + proto_tree_add_text(tree, tvb, offset, mplen, + "Multi Path length is %u and should be 4", mplen); + break; + } + ti = proto_tree_add_text(tree, tvb, offset, 4, + "Multipath Information"); + tlv_ds_map_tree = proto_item_add_subtree(ti, ett_mpls_echo_tlv_ds_map); + proto_tree_add_item(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_mp_ip, tvb, + offset, 4, ENC_BIG_ENDIAN); + break; + case TLV_DS_MAP_HASH_IP_RANGE: + if (mplen != 8) { + proto_tree_add_text(tree, tvb, offset, mplen, + "Multi Path length is %u and should be 8", mplen); break; - case TLV_ADDR_NONIP : - proto_tree_add_item (tree, hf_mpls_echo_tlv_ds_map_ingress_if_num, tvb, - (offset + 4), 4, ENC_BIG_ENDIAN); - proto_tree_add_item (tree, hf_mpls_echo_tlv_ds_map_egress_if_num, tvb, - (offset + 8), 4, ENC_BIG_ENDIAN); + } + ti = proto_tree_add_text(tree, tvb, offset, 8, + "Multipath Information"); + tlv_ds_map_tree = proto_item_add_subtree(ti, ett_mpls_echo_tlv_ds_map); + proto_tree_add_item(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_mp_ip_low, tvb, + offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_mp_ip_high, tvb, + offset + 4, 4, ENC_BIG_ENDIAN); + break; + case TLV_DS_MAP_HASH_NO_MP: + case TLV_DS_MAP_HASH_NO_LABEL: + case TLV_DS_MAP_HASH_ALL_IP: + case TLV_DS_MAP_HASH_NO_MATCH: + proto_tree_add_text(tree, tvb, offset, mplen, + "No Multipath Information"); + break; + case TLV_DS_MAP_HASH_BITMASK_IP: + if (mplen < 4) { + proto_tree_add_text(tree, tvb, offset, mplen, + "Multi Path length is %u and should be >= 4", mplen); break; - default: - proto_tree_add_text(tree, tvb, offset + 4, 8, - "Error processing TLV: Unknown Address Type of %u", - addr_type); - break; - } - proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_hash_type, tvb, - offset + 12, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_depth, tvb, - offset + 13, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_muti_len, tvb, - offset + 14, 2, ENC_BIG_ENDIAN); - - /* Get the Multipath Length and Hash Type */ - mplen = tvb_get_ntohs(tvb, offset + 14); - hash_type = tvb_get_guint8(tvb, offset + 12); - - rem -= 16; - offset += 16; - if (rem < mplen){ - proto_tree_add_text(tree, tvb, offset, rem, - "Error processing TLV: Multi Path length is %d and reminder is %u", - mplen, rem); - return; - } - rem -= mplen; - if(mplen){ - switch(hash_type){ - case TLV_DS_MAP_HASH_IP: - if(mplen != 4){ - proto_tree_add_text(tree, tvb, offset, mplen, - "Multi Path length is %u and should be 4", mplen); - break; - } - ti = proto_tree_add_text(tree, tvb, offset, 4, - "Multipath Information"); - tlv_ds_map_tree = proto_item_add_subtree(ti, ett_mpls_echo_tlv_ds_map); - proto_tree_add_item(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_mp_ip, tvb, - offset, 4, ENC_BIG_ENDIAN); - break; - case TLV_DS_MAP_HASH_IP_RANGE: - if(mplen != 8){ - proto_tree_add_text(tree, tvb, offset, mplen, - "Multi Path length is %u and should be 8", mplen); - break; - } - ti = proto_tree_add_text(tree, tvb, offset, 8, - "Multipath Information"); - tlv_ds_map_tree = proto_item_add_subtree(ti, ett_mpls_echo_tlv_ds_map); - proto_tree_add_item(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_mp_ip_low, tvb, - offset, 4, ENC_BIG_ENDIAN); - proto_tree_add_item(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_mp_ip_high, tvb, - offset + 4, 4, ENC_BIG_ENDIAN); - break; - case TLV_DS_MAP_HASH_NO_MP: - case TLV_DS_MAP_HASH_NO_LABEL: - case TLV_DS_MAP_HASH_ALL_IP: - case TLV_DS_MAP_HASH_NO_MATCH: - proto_tree_add_text(tree, tvb, offset, mplen, - "No Multipath Information"); - break; - case TLV_DS_MAP_HASH_BITMASK_IP: - if(mplen < 4){ - proto_tree_add_text(tree, tvb, offset, mplen, - "Multi Path length is %u and should be >= 4", mplen); - break; - } - ti = proto_tree_add_text(tree, tvb, offset, mplen, - "Multipath Information"); - tlv_ds_map_tree = proto_item_add_subtree(ti, ett_mpls_echo_tlv_ds_map); - proto_tree_add_item(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_mp_ip, tvb, - offset, 4, ENC_BIG_ENDIAN); - if(mplen > 4) - proto_tree_add_item(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_mp_mask, tvb, - offset + 4, mplen - 4, ENC_NA); - break; - default: - proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_mp_value, tvb, - offset, mplen, ENC_NA); - break; - } - } - - offset += mplen; - - while (rem >= 4){ - decode_mpls_label(tvb, offset, &label, &exp, &bos, &proto); - ti = proto_tree_add_text(tree, tvb, offset, 4, "Downstream Label Element %u", - idx); - tlv_ds_map_tree = proto_item_add_subtree(ti, ett_mpls_echo_tlv_ds_map); - proto_item_append_text(ti, ", Label: %u", label); - if (label <= LABEL_MAX_RESERVED){ - proto_tree_add_uint_format(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_mp_label, - tvb, offset, 3, label, "Downstream Label: %u (%s)", label, - val_to_str(label, special_labels, "Reserved - Unknown")); - proto_item_append_text(ti, " (%s)", val_to_str(label, special_labels, - "Reserved - Unknown")); - } else { - proto_tree_add_uint_format(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_mp_label, - tvb, offset, 3, label, "Downstream Label: %u", label); - } - proto_item_append_text(ti, ", Exp: %u, BOS: %u", exp, bos); - proto_tree_add_uint_format(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_mp_exp, - tvb, offset + 2, 1, exp, "Downstream Exp: %u", exp); - proto_tree_add_uint_format(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_mp_bos, - tvb, offset + 2, 1, bos, "Downstream BOS: %u", bos); - proto_tree_add_item(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_mp_proto, - tvb, offset + 3, 1, ENC_BIG_ENDIAN); - proto_item_append_text(ti, ", Protocol: %u (%s)", proto, val_to_str(proto, - mpls_echo_tlv_ds_map_mp_proto, "Unknown")); - rem -= 4; - offset += 4; - idx++; - } + } + ti = proto_tree_add_text(tree, tvb, offset, mplen, + "Multipath Information"); + tlv_ds_map_tree = proto_item_add_subtree(ti, ett_mpls_echo_tlv_ds_map); + proto_tree_add_item(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_mp_ip, tvb, + offset, 4, ENC_BIG_ENDIAN); + if (mplen > 4) + proto_tree_add_item(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_mp_mask, tvb, + offset + 4, mplen - 4, ENC_NA); + break; + default: + proto_tree_add_item(tree, hf_mpls_echo_tlv_ds_map_mp_value, tvb, + offset, mplen, ENC_NA); + break; + } + } + + offset += mplen; + + while (rem >= 4) { + decode_mpls_label(tvb, offset, &label, &exp, &bos, &proto); + ti = proto_tree_add_text(tree, tvb, offset, 4, "Downstream Label Element %u", + idx); + tlv_ds_map_tree = proto_item_add_subtree(ti, ett_mpls_echo_tlv_ds_map); + proto_item_append_text(ti, ", Label: %u", label); + if (label <= LABEL_MAX_RESERVED) { + proto_tree_add_uint_format(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_mp_label, + tvb, offset, 3, label, "Downstream Label: %u (%s)", label, + val_to_str(label, special_labels, "Reserved - Unknown")); + proto_item_append_text(ti, " (%s)", val_to_str(label, special_labels, + "Reserved - Unknown")); + } else { + proto_tree_add_uint_format(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_mp_label, + tvb, offset, 3, label, "Downstream Label: %u", label); + } + proto_item_append_text(ti, ", Exp: %u, BOS: %u", exp, bos); + proto_tree_add_uint_format(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_mp_exp, + tvb, offset + 2, 1, exp, "Downstream Exp: %u", exp); + proto_tree_add_uint_format(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_mp_bos, + tvb, offset + 2, 1, bos, "Downstream BOS: %u", bos); + proto_tree_add_item(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_mp_proto, + tvb, offset + 3, 1, ENC_BIG_ENDIAN); + proto_item_append_text(ti, ", Protocol: %u (%s)", proto, val_to_str(proto, + mpls_echo_tlv_ds_map_mp_proto, "Unknown")); + rem -= 4; + offset += 4; + idx++; + } } /* @@ -787,88 +787,88 @@ dissect_mpls_echo_tlv_ds_map(tvbuff_t *tvb, guint offset, proto_tree *tree, int static void dissect_mpls_echo_tlv_ilso(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem, gboolean is_ipv6) { - proto_tree *ti = NULL, *tlv_ilso = NULL; - guint8 type; - guint16 idx = 1; - guint32 label; - guint8 exp, bos, ttl; - - proto_tree_add_item(tree, hf_mpls_echo_tlv_ilso_addr_type, tvb, offset, 1, ENC_BIG_ENDIAN); - type = tvb_get_guint8(tvb, offset); - offset += 1; - rem -= 1; - - proto_tree_add_item(tree, hf_mpls_echo_tlv_ilso_mbz, tvb, offset, 3, ENC_BIG_ENDIAN); - offset += 3; - rem -= 3; - - if ((type == TLV_ADDR_IPv4) || (type == TLV_ADDR_UNNUM_IPv4)) { - if (is_ipv6) { - proto_tree_add_text(tree, tvb, offset, 4, "Incorrect address type for TLV ?"); - } - proto_tree_add_item(tree, hf_mpls_echo_tlv_ilso_ipv4_addr, tvb, - offset, 4, ENC_BIG_ENDIAN); - if (type == TLV_ADDR_IPv4) { - proto_tree_add_item(tree, hf_mpls_echo_tlv_ilso_ipv4_int_addr, tvb, - offset + 4, 4, ENC_BIG_ENDIAN); - } else { - proto_tree_add_item(tree, hf_mpls_echo_tlv_ilso_int_index, tvb, - offset + 4, 4, ENC_BIG_ENDIAN); - } - offset += 8; - rem -= 8; - } else if ((type == TLV_ADDR_IPv6) || (type == TLV_ADDR_UNNUM_IPv6)) { - if (!is_ipv6) { - proto_tree_add_text(tree, tvb, offset, 16, "Incorrect address type for TLV ?"); - } - - proto_tree_add_item(tree, hf_mpls_echo_tlv_ilso_ipv6_addr, tvb, - offset, 16, ENC_NA); - if (type == TLV_ADDR_IPv6) { - proto_tree_add_item(tree, hf_mpls_echo_tlv_ilso_ipv6_int_addr, tvb, - offset + 16, 16, ENC_NA); - offset += 32; - rem -= 32; - } else { - proto_tree_add_item(tree, hf_mpls_echo_tlv_ilso_int_index, tvb, - offset + 16, 4, ENC_BIG_ENDIAN); - offset += 20; - rem -= 20; - } - } else { - proto_tree_add_text(tree, tvb, offset, 0, "Incorrect address type for TLV"); - return; - } - - - while (rem >= 4){ - decode_mpls_label(tvb, offset, &label, &exp, &bos, &ttl); - ti = proto_tree_add_text(tree, tvb, offset, 4, "Label Stack Element %u", - idx); - tlv_ilso = proto_item_add_subtree(ti, ett_mpls_echo_tlv_ilso); - proto_item_append_text(ti, ", Label: %u", label); - if (label <= LABEL_MAX_RESERVED){ - proto_tree_add_uint_format(tlv_ilso, hf_mpls_echo_tlv_ilso_label, - tvb, offset, 3, label, "Label: %u (%s)", label, - val_to_str(label, special_labels, "Reserved - Unknown")); - proto_item_append_text(ti, " (%s)", val_to_str(label, special_labels, - "Reserved - Unknown")); - } else { - proto_tree_add_uint_format(tlv_ilso, hf_mpls_echo_tlv_ilso_label, - tvb, offset, 3, label, "Label: %u", label); - } - proto_item_append_text(ti, ", Exp: %u, BOS: %u, TTL: %u", - exp, bos, ttl); - proto_tree_add_uint_format(tlv_ilso, hf_mpls_echo_tlv_ilso_exp, - tvb, offset + 2, 1, exp, "Exp: %u", exp); - proto_tree_add_uint_format(tlv_ilso, hf_mpls_echo_tlv_ilso_bos, - tvb, offset + 2, 1, bos, "BOS: %u", bos); - proto_tree_add_item(tlv_ilso, hf_mpls_echo_tlv_ilso_ttl, - tvb, offset + 3, 1, ENC_BIG_ENDIAN); - rem -= 4; - offset += 4; - idx++; + proto_tree *ti = NULL, *tlv_ilso = NULL; + guint8 type; + guint16 idx = 1; + guint32 label; + guint8 exp, bos, ttl; + + proto_tree_add_item(tree, hf_mpls_echo_tlv_ilso_addr_type, tvb, offset, 1, ENC_BIG_ENDIAN); + type = tvb_get_guint8(tvb, offset); + offset += 1; + rem -= 1; + + proto_tree_add_item(tree, hf_mpls_echo_tlv_ilso_mbz, tvb, offset, 3, ENC_BIG_ENDIAN); + offset += 3; + rem -= 3; + + if ((type == TLV_ADDR_IPv4) || (type == TLV_ADDR_UNNUM_IPv4)) { + if (is_ipv6) { + proto_tree_add_text(tree, tvb, offset, 4, "Incorrect address type for TLV ?"); } + proto_tree_add_item(tree, hf_mpls_echo_tlv_ilso_ipv4_addr, tvb, + offset, 4, ENC_BIG_ENDIAN); + if (type == TLV_ADDR_IPv4) { + proto_tree_add_item(tree, hf_mpls_echo_tlv_ilso_ipv4_int_addr, tvb, + offset + 4, 4, ENC_BIG_ENDIAN); + } else { + proto_tree_add_item(tree, hf_mpls_echo_tlv_ilso_int_index, tvb, + offset + 4, 4, ENC_BIG_ENDIAN); + } + offset += 8; + rem -= 8; + } else if ((type == TLV_ADDR_IPv6) || (type == TLV_ADDR_UNNUM_IPv6)) { + if (!is_ipv6) { + proto_tree_add_text(tree, tvb, offset, 16, "Incorrect address type for TLV ?"); + } + + proto_tree_add_item(tree, hf_mpls_echo_tlv_ilso_ipv6_addr, tvb, + offset, 16, ENC_NA); + if (type == TLV_ADDR_IPv6) { + proto_tree_add_item(tree, hf_mpls_echo_tlv_ilso_ipv6_int_addr, tvb, + offset + 16, 16, ENC_NA); + offset += 32; + rem -= 32; + } else { + proto_tree_add_item(tree, hf_mpls_echo_tlv_ilso_int_index, tvb, + offset + 16, 4, ENC_BIG_ENDIAN); + offset += 20; + rem -= 20; + } + } else { + proto_tree_add_text(tree, tvb, offset, 0, "Incorrect address type for TLV"); + return; + } + + + while (rem >= 4) { + decode_mpls_label(tvb, offset, &label, &exp, &bos, &ttl); + ti = proto_tree_add_text(tree, tvb, offset, 4, "Label Stack Element %u", + idx); + tlv_ilso = proto_item_add_subtree(ti, ett_mpls_echo_tlv_ilso); + proto_item_append_text(ti, ", Label: %u", label); + if (label <= LABEL_MAX_RESERVED) { + proto_tree_add_uint_format(tlv_ilso, hf_mpls_echo_tlv_ilso_label, + tvb, offset, 3, label, "Label: %u (%s)", label, + val_to_str(label, special_labels, "Reserved - Unknown")); + proto_item_append_text(ti, " (%s)", val_to_str(label, special_labels, + "Reserved - Unknown")); + } else { + proto_tree_add_uint_format(tlv_ilso, hf_mpls_echo_tlv_ilso_label, + tvb, offset, 3, label, "Label: %u", label); + } + proto_item_append_text(ti, ", Exp: %u, BOS: %u, TTL: %u", + exp, bos, ttl); + proto_tree_add_uint_format(tlv_ilso, hf_mpls_echo_tlv_ilso_exp, + tvb, offset + 2, 1, exp, "Exp: %u", exp); + proto_tree_add_uint_format(tlv_ilso, hf_mpls_echo_tlv_ilso_bos, + tvb, offset + 2, 1, bos, "BOS: %u", bos); + proto_tree_add_item(tlv_ilso, hf_mpls_echo_tlv_ilso_ttl, + tvb, offset + 3, 1, ENC_BIG_ENDIAN); + rem -= 4; + offset += 4; + idx++; + } } static int @@ -880,13 +880,13 @@ dissect_mpls_echo_tlv(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem, gb static void dissect_mpls_echo_tlv_errored(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem) { - int errored_tlv_length; + int errored_tlv_length; - while(rem >= 4){ - errored_tlv_length = dissect_mpls_echo_tlv(tvb, offset, tree, rem, TRUE); - rem -= errored_tlv_length; - offset += errored_tlv_length; - } + while(rem >= 4) { + errored_tlv_length = dissect_mpls_echo_tlv(tvb, offset, tree, rem, TRUE); + rem -= errored_tlv_length; + offset += errored_tlv_length; + } } /* @@ -895,173 +895,173 @@ dissect_mpls_echo_tlv_errored(tvbuff_t *tvb, guint offset, proto_tree *tree, int static int dissect_mpls_echo_tlv(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem, gboolean in_errored) { - guint16 type, saved_type; - int length; - proto_tree *ti = NULL, *mpls_echo_tlv_tree = NULL; - - length = tvb_reported_length_remaining(tvb, offset); - rem = MIN(rem, length); - - if( rem < 4 ) { /* Type Length */ - if(tree) - proto_tree_add_text(tree, tvb, offset, rem, - "Error processing TLV: length is %d, should be >= 4", - rem); - return rem; - } - type = tvb_get_ntohs(tvb, offset); - length = tvb_get_ntohs(tvb, offset + 2), + guint16 type, saved_type; + int length; + proto_tree *ti = NULL, *mpls_echo_tlv_tree = NULL; + + length = tvb_reported_length_remaining(tvb, offset); + rem = MIN(rem, length); + + if ( rem < 4 ) { /* Type Length */ + if (tree) + proto_tree_add_text(tree, tvb, offset, rem, + "Error processing TLV: length is %d, should be >= 4", + rem); + return rem; + } + type = tvb_get_ntohs(tvb, offset); + length = tvb_get_ntohs(tvb, offset + 2), rem -= 4; /* do not count Type Length */ - length = MIN(length, rem); - - if (tree) { - /* Check for Vendor Private TLVs */ - saved_type = type; - if(type >= TLV_VENDOR_PRIVATE_START) /* && <= TLV_VENDOR_PRIVATE_END always true */ - type = TLV_VENDOR_PRIVATE_START; - - ti = proto_tree_add_text(tree, tvb, offset, length + 4, "%s%s", - in_errored ? "Errored TLV Type: " : "", - val_to_str(type, mpls_echo_tlv_type_names, "Unknown TLV type (0x%04X)")); - mpls_echo_tlv_tree = proto_item_add_subtree(ti, ett_mpls_echo_tlv); - if(mpls_echo_tlv_tree == NULL) return length+4; - - /* MPLS Echo TLV Type and Length */ - if (in_errored){ - proto_tree_add_uint_format(mpls_echo_tlv_tree, hf_mpls_echo_tlv_errored_type, tvb, - offset, 2, saved_type, "Errored TLV Type: %s (%u)", - val_to_str(type, mpls_echo_tlv_type_names, "Unknown TLV type"), saved_type); - } else { - proto_tree_add_uint_format(mpls_echo_tlv_tree, hf_mpls_echo_tlv_type, tvb, - offset, 2, saved_type, "Type: %s (%u)", - val_to_str(type, mpls_echo_tlv_type_names, "Unknown TLV type"), saved_type); - } - proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_len, tvb, offset + 2, 2, ENC_BIG_ENDIAN); - - /* MPLS Echo TLV Value */ - if (length == 0) - return 4; /* Empty TLV, return Type and Length consumed. */ - - switch (type) { - case TLV_TARGET_FEC_STACK: - dissect_mpls_echo_tlv_fec(tvb, offset + 4, mpls_echo_tlv_tree, length); - break; - case TLV_PAD: - proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_padaction, tvb, - offset + 4, 1, ENC_BIG_ENDIAN); - if (length > 1) - proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_padding, tvb, - offset + 5, length - 1, ENC_NA); - break; - case TLV_VENDOR_CODE: - proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_vendor, tvb, - offset + 4, 4, ENC_BIG_ENDIAN); - break; - case TLV_ILSO_IPv4: - if(length < 12) { - proto_tree_add_text(mpls_echo_tlv_tree, tvb, offset + 4, length, - "Error processing TLV: length is %d, should be >= 12", - length); - break; - } - dissect_mpls_echo_tlv_ilso(tvb, offset + 4, mpls_echo_tlv_tree, length, FALSE); - break; - case TLV_ILSO_IPv6: - if(length < 24) { - proto_tree_add_text(mpls_echo_tlv_tree, tvb, offset + 4, length, - "Error processing TLV: length is %d, should be >= 24", - length); - break; - } - dissect_mpls_echo_tlv_ilso(tvb, offset + 4, mpls_echo_tlv_tree, length, TRUE); - break; - case TLV_RTO_IPv4: - if(length != 4) { - proto_tree_add_text(mpls_echo_tlv_tree, tvb, offset + 4, length, - "Error processing TLV: length is %d, should be 4", - length); - break; - } - proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_rto_ipv4, - tvb, offset + 4, 4, ENC_BIG_ENDIAN); - break; - case TLV_RTO_IPv6: - if(length != 16) { - proto_tree_add_text(mpls_echo_tlv_tree, tvb, offset + 4, length, - "Error processing TLV: length is %d, should be 16", - length); - break; - } - proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_rto_ipv6, - tvb, offset + 4, 16, ENC_NA); - break; - case TLV_VENDOR_PRIVATE_START: - if (length < 4) { /* SMI Enterprise code */ - proto_tree_add_text(mpls_echo_tlv_tree, tvb, offset + 4, length, - "Error processing Vendor Private TLV: length is %d, should be >= 4", - length); - } else { - proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_vendor, tvb, - offset + 4, 4, ENC_BIG_ENDIAN); - proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_value, tvb, - offset + 8, length - 4, ENC_NA); - } - break; - case TLV_DOWNSTREAM_MAPPING: - if(length < 16) { - proto_tree_add_text(mpls_echo_tlv_tree, tvb, offset + 4, length, - "Error processing TLV: length is %d, should be >= 16", - length); - break; - } - dissect_mpls_echo_tlv_ds_map(tvb, offset + 4, mpls_echo_tlv_tree, length); - break; - case TLV_ERRORED_TLV: - if (in_errored) - proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_value, tvb, - offset + 4, length, ENC_NA); - else - dissect_mpls_echo_tlv_errored(tvb, offset + 4, mpls_echo_tlv_tree, length); - break; - case TLV_REPLY_TOS: - if(length != 4) { - proto_tree_add_text(mpls_echo_tlv_tree, tvb, offset + 4, length, - "Error processing TLV: length is %d, should be 4", - length); - break; - } - proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_reply_tos, tvb, - offset + 4, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_reply_tos_mbz, tvb, - offset + 5, 3, ENC_BIG_ENDIAN); - break; - case TLV_SRC_IDENTIFIER: - proto_tree_add_item (mpls_echo_tlv_tree, hf_mpls_echo_lspping_tlv_src_addr_gid, - tvb, (offset + 4), 4, ENC_BIG_ENDIAN); - proto_tree_add_item (mpls_echo_tlv_tree, hf_mpls_echo_lspping_tlv_src_addr_nid, - tvb, (offset + 8), 4, ENC_BIG_ENDIAN); - break; - case TLV_DST_IDENTIFIER: - proto_tree_add_item (mpls_echo_tlv_tree, hf_mpls_echo_lspping_tlv_src_addr_gid, - tvb, (offset + 4), 4, ENC_BIG_ENDIAN); - proto_tree_add_item (mpls_echo_tlv_tree, hf_mpls_echo_lspping_tlv_src_addr_nid, - tvb, (offset + 8), 4, ENC_BIG_ENDIAN); - break; - case TLV_REVERSE_PATH_FEC_STACK: - dissect_mpls_echo_tlv_fec (tvb, (offset + 4), mpls_echo_tlv_tree, length); - break ; - case TLV_ERROR_CODE: - default: - proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_value, tvb, - offset + 4, length, ENC_NA); - break; - } + length = MIN(length, rem); + + if (tree) { + /* Check for Vendor Private TLVs */ + saved_type = type; + if (type >= TLV_VENDOR_PRIVATE_START) /* && <= TLV_VENDOR_PRIVATE_END always true */ + type = TLV_VENDOR_PRIVATE_START; + + ti = proto_tree_add_text(tree, tvb, offset, length + 4, "%s%s", + in_errored ? "Errored TLV Type: " : "", + val_to_str(type, mpls_echo_tlv_type_names, "Unknown TLV type (0x%04X)")); + mpls_echo_tlv_tree = proto_item_add_subtree(ti, ett_mpls_echo_tlv); + if (mpls_echo_tlv_tree == NULL) return length+4; + + /* MPLS Echo TLV Type and Length */ + if (in_errored) { + proto_tree_add_uint_format(mpls_echo_tlv_tree, hf_mpls_echo_tlv_errored_type, tvb, + offset, 2, saved_type, "Errored TLV Type: %s (%u)", + val_to_str(type, mpls_echo_tlv_type_names, "Unknown TLV type"), saved_type); + } else { + proto_tree_add_uint_format(mpls_echo_tlv_tree, hf_mpls_echo_tlv_type, tvb, + offset, 2, saved_type, "Type: %s (%u)", + val_to_str(type, mpls_echo_tlv_type_names, "Unknown TLV type"), saved_type); + } + proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_len, tvb, offset + 2, 2, ENC_BIG_ENDIAN); + + /* MPLS Echo TLV Value */ + if (length == 0) + return 4; /* Empty TLV, return Type and Length consumed. */ + + switch (type) { + case TLV_TARGET_FEC_STACK: + dissect_mpls_echo_tlv_fec(tvb, offset + 4, mpls_echo_tlv_tree, length); + break; + case TLV_PAD: + proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_padaction, tvb, + offset + 4, 1, ENC_BIG_ENDIAN); + if (length > 1) + proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_padding, tvb, + offset + 5, length - 1, ENC_NA); + break; + case TLV_VENDOR_CODE: + proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_vendor, tvb, + offset + 4, 4, ENC_BIG_ENDIAN); + break; + case TLV_ILSO_IPv4: + if (length < 12) { + proto_tree_add_text(mpls_echo_tlv_tree, tvb, offset + 4, length, + "Error processing TLV: length is %d, should be >= 12", + length); + break; + } + dissect_mpls_echo_tlv_ilso(tvb, offset + 4, mpls_echo_tlv_tree, length, FALSE); + break; + case TLV_ILSO_IPv6: + if (length < 24) { + proto_tree_add_text(mpls_echo_tlv_tree, tvb, offset + 4, length, + "Error processing TLV: length is %d, should be >= 24", + length); + break; + } + dissect_mpls_echo_tlv_ilso(tvb, offset + 4, mpls_echo_tlv_tree, length, TRUE); + break; + case TLV_RTO_IPv4: + if (length != 4) { + proto_tree_add_text(mpls_echo_tlv_tree, tvb, offset + 4, length, + "Error processing TLV: length is %d, should be 4", + length); + break; + } + proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_rto_ipv4, + tvb, offset + 4, 4, ENC_BIG_ENDIAN); + break; + case TLV_RTO_IPv6: + if (length != 16) { + proto_tree_add_text(mpls_echo_tlv_tree, tvb, offset + 4, length, + "Error processing TLV: length is %d, should be 16", + length); + break; + } + proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_rto_ipv6, + tvb, offset + 4, 16, ENC_NA); + break; + case TLV_VENDOR_PRIVATE_START: + if (length < 4) { /* SMI Enterprise code */ + proto_tree_add_text(mpls_echo_tlv_tree, tvb, offset + 4, length, + "Error processing Vendor Private TLV: length is %d, should be >= 4", + length); + } else { + proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_vendor, tvb, + offset + 4, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_value, tvb, + offset + 8, length - 4, ENC_NA); + } + break; + case TLV_DOWNSTREAM_MAPPING: + if (length < 16) { + proto_tree_add_text(mpls_echo_tlv_tree, tvb, offset + 4, length, + "Error processing TLV: length is %d, should be >= 16", + length); + break; + } + dissect_mpls_echo_tlv_ds_map(tvb, offset + 4, mpls_echo_tlv_tree, length); + break; + case TLV_ERRORED_TLV: + if (in_errored) + proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_value, tvb, + offset + 4, length, ENC_NA); + else + dissect_mpls_echo_tlv_errored(tvb, offset + 4, mpls_echo_tlv_tree, length); + break; + case TLV_REPLY_TOS: + if (length != 4) { + proto_tree_add_text(mpls_echo_tlv_tree, tvb, offset + 4, length, + "Error processing TLV: length is %d, should be 4", + length); + break; + } + proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_reply_tos, tvb, + offset + 4, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_reply_tos_mbz, tvb, + offset + 5, 3, ENC_BIG_ENDIAN); + break; + case TLV_SRC_IDENTIFIER: + proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_lspping_tlv_src_addr_gid, + tvb, (offset + 4), 4, ENC_BIG_ENDIAN); + proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_lspping_tlv_src_addr_nid, + tvb, (offset + 8), 4, ENC_BIG_ENDIAN); + break; + case TLV_DST_IDENTIFIER: + proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_lspping_tlv_src_addr_gid, + tvb, (offset + 4), 4, ENC_BIG_ENDIAN); + proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_lspping_tlv_src_addr_nid, + tvb, (offset + 8), 4, ENC_BIG_ENDIAN); + break; + case TLV_REVERSE_PATH_FEC_STACK: + dissect_mpls_echo_tlv_fec (tvb, (offset + 4), mpls_echo_tlv_tree, length); + break ; + case TLV_ERROR_CODE: + default: + proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_value, tvb, + offset + 4, length, ENC_NA); + break; } - return length + 4; /* Length of the Value field + Type Length */ + } + return length + 4; /* Length of the Value field + Type Length */ } -#define MSGTYPE_MPLS_ECHO(msgtype) ((msgtype == 1) || (msgtype == 2)) -#define MSGTYPE_DATAPLANE(msgtype) ((msgtype == 3) || (msgtype == 4)) +#define MSGTYPE_MPLS_ECHO(msgtype) ((msgtype == 1) || (msgtype == 2)) +#define MSGTYPE_DATAPLANE(msgtype) ((msgtype == 3) || (msgtype == 4)) /* * Dissector for MPLS Echo (LSP PING) packets @@ -1069,107 +1069,107 @@ dissect_mpls_echo_tlv(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem, gb void dissect_mpls_echo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - int offset = 0, rem = 0, len; - proto_item *ti = NULL; - proto_tree *mpls_echo_tree = NULL, *mpls_echo_gflags = NULL; - guint8 msgtype; - - /* If version != 1 we assume it's not an mpls ping packet */ - if (tvb_length(tvb) < 5) { - return; /* Not enough information to tell version and message type. */ + int offset = 0, rem = 0, len; + proto_item *ti = NULL; + proto_tree *mpls_echo_tree = NULL, *mpls_echo_gflags = NULL; + guint8 msgtype; + + /* If version != 1 we assume it's not an mpls ping packet */ + if (tvb_length(tvb) < 5) { + return; /* Not enough information to tell version and message type. */ + } + if (tvb_get_ntohs(tvb, 0) != 1) { + return; /* Not version 1. */ + } + + col_set_str(pinfo->cinfo, COL_PROTOCOL, "MPLS ECHO"); + + rem = tvb_reported_length_remaining(tvb, offset); + + /* Get the message type and fill in the Column info */ + msgtype = tvb_get_guint8(tvb, offset + 4); + + /* The minimum fixed part of the packet is 16 Bytes or 32 Bytes depending on Msg Type */ + if ( ((!MSGTYPE_MPLS_ECHO(msgtype)) && (rem < 16)) || + ((MSGTYPE_MPLS_ECHO(msgtype)) && (rem < 32)) ) { + col_set_str(pinfo->cinfo, COL_INFO, "Malformed Message"); + if (tree) { + ti = proto_tree_add_item(tree, proto_mpls_echo, tvb, 0, -1, ENC_NA); + mpls_echo_tree = proto_item_add_subtree(ti, ett_mpls_echo); + proto_tree_add_text(mpls_echo_tree, tvb, offset, rem, + "Error processing Message: length is %d, should be >= %u", + rem, (MSGTYPE_MPLS_ECHO(msgtype)) ? 32 : 16); } - if (tvb_get_ntohs(tvb, 0) != 1) { - return; /* Not version 1. */ + return; + } + + if (check_col(pinfo->cinfo, COL_INFO)) + col_add_str(pinfo->cinfo, COL_INFO, + val_to_str(msgtype, mpls_echo_msgtype, "Unknown Message Type (0x%02X)")); + + + if (tree) { + + /* Add subtree and dissect the fixed part of the message */ + ti = proto_tree_add_item(tree, proto_mpls_echo, tvb, 0, -1, ENC_NA); + mpls_echo_tree = proto_item_add_subtree(ti, ett_mpls_echo); + + proto_tree_add_item(mpls_echo_tree, + hf_mpls_echo_version, tvb, offset, 2, ENC_BIG_ENDIAN); + + if (MSGTYPE_MPLS_ECHO(msgtype)) { + ti = proto_tree_add_item(mpls_echo_tree, + hf_mpls_echo_gflags, tvb, offset + 2, 2, ENC_BIG_ENDIAN); + mpls_echo_gflags = proto_item_add_subtree(ti, ett_mpls_echo_gflags); + proto_tree_add_item(mpls_echo_gflags, + hf_mpls_echo_flag_sbz, tvb, offset + 2, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(mpls_echo_gflags, + hf_mpls_echo_flag_v, tvb, offset + 2, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(mpls_echo_gflags, + hf_mpls_echo_flag_t, tvb, (offset + 2), 2, ENC_BIG_ENDIAN); + proto_tree_add_item(mpls_echo_gflags, + hf_mpls_echo_flag_r, tvb, (offset + 2), 2, ENC_BIG_ENDIAN); + } else { + proto_tree_add_item(mpls_echo_tree, + hf_mpls_echo_mbz, tvb, offset + 2, 2, ENC_BIG_ENDIAN); } - col_set_str(pinfo->cinfo, COL_PROTOCOL, "MPLS ECHO"); - - rem = tvb_reported_length_remaining(tvb, offset); - - /* Get the message type and fill in the Column info */ - msgtype = tvb_get_guint8(tvb, offset + 4); - - /* The minimum fixed part of the packet is 16 Bytes or 32 Bytes depending on Msg Type */ - if( ((!MSGTYPE_MPLS_ECHO(msgtype)) && (rem < 16)) || - ((MSGTYPE_MPLS_ECHO(msgtype)) && (rem < 32)) ) { - col_set_str(pinfo->cinfo, COL_INFO, "Malformed Message"); - if(tree) { - ti = proto_tree_add_item(tree, proto_mpls_echo, tvb, 0, -1, ENC_NA); - mpls_echo_tree = proto_item_add_subtree(ti, ett_mpls_echo); - proto_tree_add_text(mpls_echo_tree, tvb, offset, rem, - "Error processing Message: length is %d, should be >= %u", - rem, (MSGTYPE_MPLS_ECHO(msgtype)) ? 32 : 16); - } - return; + proto_tree_add_item(mpls_echo_tree, + hf_mpls_echo_msgtype, tvb, offset + 4, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(mpls_echo_tree, + hf_mpls_echo_replymode, tvb, offset + 5, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(mpls_echo_tree, + hf_mpls_echo_returncode, tvb, offset + 6, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(mpls_echo_tree, + hf_mpls_echo_returnsubcode, tvb, offset + 7, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(mpls_echo_tree, + hf_mpls_echo_handle, tvb, offset + 8, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(mpls_echo_tree, + hf_mpls_echo_sequence, tvb, offset + 12, 4, ENC_BIG_ENDIAN); + + if (MSGTYPE_MPLS_ECHO(msgtype)) { + proto_tree_add_item(mpls_echo_tree, hf_mpls_echo_ts_sent, tvb, + offset + 16, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN); + proto_tree_add_item(mpls_echo_tree, hf_mpls_echo_ts_rec, tvb, + offset + 24, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN); } - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, COL_INFO, - val_to_str(msgtype, mpls_echo_msgtype, "Unknown Message Type (0x%02X)")); - + } - if (tree) { + if (MSGTYPE_MPLS_ECHO(msgtype)) { + offset += 32; + rem -= 32; + } else { + offset += 16; + rem -= 16; + } - /* Add subtree and dissect the fixed part of the message */ - ti = proto_tree_add_item(tree, proto_mpls_echo, tvb, 0, -1, ENC_NA); - mpls_echo_tree = proto_item_add_subtree(ti, ett_mpls_echo); - - proto_tree_add_item(mpls_echo_tree, - hf_mpls_echo_version, tvb, offset, 2, ENC_BIG_ENDIAN); - - if(MSGTYPE_MPLS_ECHO(msgtype)){ - ti = proto_tree_add_item(mpls_echo_tree, - hf_mpls_echo_gflags, tvb, offset + 2, 2, ENC_BIG_ENDIAN); - mpls_echo_gflags = proto_item_add_subtree(ti, ett_mpls_echo_gflags); - proto_tree_add_item(mpls_echo_gflags, - hf_mpls_echo_flag_sbz, tvb, offset + 2, 2, ENC_BIG_ENDIAN); - proto_tree_add_item(mpls_echo_gflags, - hf_mpls_echo_flag_v, tvb, offset + 2, 2, ENC_BIG_ENDIAN); - proto_tree_add_item (mpls_echo_gflags, - hf_mpls_echo_flag_t, tvb, (offset + 2), 2, ENC_BIG_ENDIAN); - proto_tree_add_item (mpls_echo_gflags, - hf_mpls_echo_flag_r, tvb, (offset + 2), 2, ENC_BIG_ENDIAN); - } else { - proto_tree_add_item(mpls_echo_tree, - hf_mpls_echo_mbz, tvb, offset + 2, 2, ENC_BIG_ENDIAN); - } - - proto_tree_add_item(mpls_echo_tree, - hf_mpls_echo_msgtype, tvb, offset + 4, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(mpls_echo_tree, - hf_mpls_echo_replymode, tvb, offset + 5, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(mpls_echo_tree, - hf_mpls_echo_returncode, tvb, offset + 6, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(mpls_echo_tree, - hf_mpls_echo_returnsubcode, tvb, offset + 7, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(mpls_echo_tree, - hf_mpls_echo_handle, tvb, offset + 8, 4, ENC_BIG_ENDIAN); - proto_tree_add_item(mpls_echo_tree, - hf_mpls_echo_sequence, tvb, offset + 12, 4, ENC_BIG_ENDIAN); - - if(MSGTYPE_MPLS_ECHO(msgtype)){ - proto_tree_add_item(mpls_echo_tree, hf_mpls_echo_ts_sent, tvb, - offset + 16, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN); - proto_tree_add_item(mpls_echo_tree, hf_mpls_echo_ts_rec, tvb, - offset + 24, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN); - } - - } - - if(MSGTYPE_MPLS_ECHO(msgtype)){ - offset += 32; - rem -= 32; - } else { - offset += 16; - rem -= 16; - } - - /* Dissect all TLVs */ - while(tvb_reported_length_remaining(tvb, offset) > 0 ) { - len = dissect_mpls_echo_tlv(tvb, offset, mpls_echo_tree, rem, FALSE); - offset += len; - rem -= len; - } + /* Dissect all TLVs */ + while(tvb_reported_length_remaining(tvb, offset) > 0 ) { + len = dissect_mpls_echo_tlv(tvb, offset, mpls_echo_tree, rem, FALSE); + offset += len; + rem -= len; + } } @@ -1180,490 +1180,490 @@ void proto_register_mpls_echo(void) { - static hf_register_info hf[] = { - { &hf_mpls_echo_version, - { "Version", "mpls_echo.version", - FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO Version Number", HFILL} - }, - { &hf_mpls_echo_mbz, - { "MBZ", "mpls_echo.mbz", - FT_UINT16, BASE_HEX, NULL, 0x0, "MPLS ECHO Must be Zero", HFILL} - }, - { &hf_mpls_echo_gflags, - { "Global Flags", "mpls_echo.flags", - FT_UINT16, BASE_HEX, NULL, 0x0, "MPLS ECHO Global Flags", HFILL} - }, - { &hf_mpls_echo_flag_sbz, - { "Reserved", "mpls_echo.flag_sbz", - FT_UINT16, BASE_HEX, NULL, 0xFFF8, "MPLS ECHO Reserved Flags", HFILL} - }, - { &hf_mpls_echo_flag_v, - { "Validate FEC Stack", "mpls_echo.flag_v", - FT_BOOLEAN, 16, NULL, 0x0001, "MPLS ECHO Validate FEC Stack Flag", HFILL} - }, - { &hf_mpls_echo_flag_t, - { "Respond only if TTL expired", "mpls_echo.flag_t", - FT_BOOLEAN, 16, NULL, 0x0002, "MPLS ECHO Respond only if TTL expired Flag", HFILL} - }, - { &hf_mpls_echo_flag_r, - { "Validate Reverse Path", "mpls_echo.flag_r", - FT_BOOLEAN, 16, NULL, 0x0004, "MPLS ECHO Validate Reverse Path Flag", HFILL} - }, - { &hf_mpls_echo_msgtype, - { "Message Type", "mpls_echo.msg_type", - FT_UINT8, BASE_DEC, VALS(mpls_echo_msgtype), 0x0, "MPLS ECHO Message Type", HFILL} - }, - { &hf_mpls_echo_replymode, - { "Reply Mode", "mpls_echo.reply_mode", - FT_UINT8, BASE_DEC, VALS(mpls_echo_replymode), 0x0, "MPLS ECHO Reply Mode", HFILL} - }, - { &hf_mpls_echo_returncode, - { "Return Code", "mpls_echo.return_code", - FT_UINT8, BASE_DEC, VALS(mpls_echo_returncode), 0x0, "MPLS ECHO Return Code", HFILL} - }, - { &hf_mpls_echo_returnsubcode, - { "Return Subcode", "mpls_echo.return_subcode", - FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO Return Subcode", HFILL} - }, - { &hf_mpls_echo_handle, - { "Sender's Handle", "mpls_echo.sender_handle", - FT_UINT32, BASE_HEX, NULL, 0x0, "MPLS ECHO Sender's Handle", HFILL} - }, - { &hf_mpls_echo_sequence, - { "Sequence Number", "mpls_echo.sequence", - FT_UINT32, BASE_DEC, NULL, 0x0, "MPLS ECHO Sequence Number", HFILL} - }, - { &hf_mpls_echo_ts_sent, - { "Timestamp Sent", "mpls_echo.timestamp_sent", - FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, "MPLS ECHO Timestamp Sent", HFILL} - }, - { &hf_mpls_echo_ts_rec, - { "Timestamp Received", "mpls_echo.timestamp_rec", - FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, "MPLS ECHO Timestamp Received", HFILL} - }, - { &hf_mpls_echo_tlv_type, - { "Type", "mpls_echo.tlv.type", - FT_UINT16, BASE_DEC, VALS(mpls_echo_tlv_type_names), 0x0, - "MPLS ECHO TLV Type", HFILL} - }, - { &hf_mpls_echo_tlv_len, - { "Length", "mpls_echo.tlv.len", - FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Length", HFILL} - }, - { &hf_mpls_echo_tlv_value, - { "Value", "mpls_echo.tlv.value", - FT_BYTES, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Value", HFILL} - }, - { &hf_mpls_echo_tlv_fec_type, - { "Type", "mpls_echo.tlv.fec.type", - FT_UINT16, BASE_DEC, VALS(mpls_echo_tlv_fec_names), 0x0, - "MPLS ECHO TLV FEC Stack Type", HFILL} - }, - { &hf_mpls_echo_tlv_fec_len, - { "Length", "mpls_echo.tlv.fec.len", - FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack Length", HFILL} - }, - { &hf_mpls_echo_tlv_fec_value, - { "Value", "mpls_echo.tlv.fec.value", - FT_BYTES, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack Value", HFILL} - }, - { &hf_mpls_echo_tlv_fec_ldp_ipv4, - { "IPv4 Prefix", "mpls_echo.tlv.fec.ldp_ipv4", - FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack LDP IPv4", HFILL} - }, - { &hf_mpls_echo_tlv_fec_ldp_ipv4_mask, - { "Prefix Length", "mpls_echo.tlv.fec.ldp_ipv4_mask", - FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack LDP IPv4 Prefix Length", HFILL} - }, - { &hf_mpls_echo_tlv_fec_ldp_ipv6, - { "IPv6 Prefix", "mpls_echo.tlv.fec.ldp_ipv6", - FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack LDP IPv6", HFILL} - }, - { &hf_mpls_echo_tlv_fec_ldp_ipv6_mask, - { "Prefix Length", "mpls_echo.tlv.fec.ldp_ipv6_mask", - FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack LDP IPv6 Prefix Length", HFILL} - }, - { &hf_mpls_echo_tlv_fec_rsvp_ipv4_ipv4_endpoint, - { "IPv4 Tunnel endpoint address", "mpls_echo.tlv.fec.rsvp_ipv4_ep", - FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack RSVP IPv4 Tunnel Endpoint Address", HFILL} - }, - { &hf_mpls_echo_tlv_fec_rsvp_ipv6_ipv6_endpoint, - { "IPv6 Tunnel endpoint address", "mpls_echo.tlv.fec.rsvp_ipv6_ep", - FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack RSVP IPv6 Tunnel Endpoint Address", HFILL} - }, - { &hf_mpls_echo_tlv_fec_rsvp_ip_mbz1, - { "Must Be Zero", "mpls_echo.tlv.fec.rsvp_ip_mbz1", - FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack RSVP MBZ", HFILL} - }, - { &hf_mpls_echo_tlv_fec_rsvp_ip_tunnel_id, - { "Tunnel ID", "mpls_echo.tlv.fec.rsvp_ip_tun_id", - FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack RSVP Tunnel ID", HFILL} - }, - { &hf_mpls_echo_tlv_fec_rsvp_ipv4_ext_tunnel_id, - { "Extended Tunnel ID", "mpls_echo.tlv.fec.rsvp_ipv4_ext_tun_id", - FT_UINT32, BASE_HEX, NULL, 0x0, "MPLS ECHO TLV FEC Stack RSVP IPv4 Extended Tunnel ID", HFILL} - }, - { &hf_mpls_echo_tlv_fec_rsvp_ipv4_ipv4_sender, - { "IPv4 Tunnel sender address", "mpls_echo.tlv.fec.rsvp_ipv4_sender", - FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack RSVP IPv4 Sender", HFILL} - }, - { &hf_mpls_echo_tlv_fec_rsvp_ipv6_ext_tunnel_id, - { "Extended Tunnel ID", "mpls_echo.tlv.fec.rsvp_ipv6_ext_tun_id", - FT_BYTES, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack RSVP IPv6 Extended Tunnel ID", HFILL} - }, - { &hf_mpls_echo_tlv_fec_rsvp_ipv6_ipv6_sender, - { "IPv6 Tunnel sender address", "mpls_echo.tlv.fec.rsvp_ipv6_sender", - FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack RSVP IPv4 Sender", HFILL} - }, - { &hf_mpls_echo_tlv_fec_rsvp_ip_mbz2, - { "Must Be Zero", "mpls_echo.tlv.fec.rsvp_ip_mbz2", - FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack RSVP MBZ", HFILL} - }, - { &hf_mpls_echo_tlv_fec_rsvp_ip_lsp_id, - { "LSP ID", "mpls_echo.tlv.fec.rsvp_ip_lsp_id", - FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack RSVP LSP ID", HFILL} - }, - { &hf_mpls_echo_tlv_fec_l2cid_sender, - { "Sender's PE Address", "mpls_echo.tlv.fec.l2cid_sender", - FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack L2CID Sender", HFILL} - }, - { &hf_mpls_echo_tlv_fec_l2cid_remote, - { "Remote PE Address", "mpls_echo.tlv.fec.l2cid_remote", - FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack L2CID Remote", HFILL} - }, - { &hf_mpls_echo_tlv_fec_l2cid_vcid, - { "VC ID", "mpls_echo.tlv.fec.l2cid_vcid", - FT_UINT32, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack L2CID VCID", HFILL} - }, - { &hf_mpls_echo_tlv_fec_l2cid_encap, - { "Encapsulation", "mpls_echo.tlv.fec.l2cid_encap", - FT_UINT16, BASE_DEC, VALS(fec_vc_types_vals), 0x0, "MPLS ECHO TLV FEC Stack L2CID Encapsulation", HFILL} - }, - { &hf_mpls_echo_tlv_fec_l2cid_mbz, - { "MBZ", "mpls_echo.tlv.fec.l2cid_mbz", - FT_UINT16, BASE_HEX, NULL, 0x0, "MPLS ECHO TLV FEC Stack L2CID MBZ", HFILL} - }, - { &hf_mpls_echo_tlv_fec_bgp_nh, - { "BGP Next Hop", "mpls_echo.tlv.fec.bgp_nh", - FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack BGP Next Hop", HFILL} - }, - { &hf_mpls_echo_tlv_fec_bgp_ipv4, - { "IPv4 Prefix", "mpls_echo.tlv.fec.bgp_ipv4", - FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack BGP IPv4", HFILL} - }, - { &hf_mpls_echo_tlv_fec_bgp_len, - { "Prefix Length", "mpls_echo.tlv.fec.bgp_len", - FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack BGP Prefix Length", HFILL} - }, - { &hf_mpls_echo_tlv_fec_gen_ipv4, - { "IPv4 Prefix", "mpls_echo.tlv.fec.gen_ipv4", - FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack Generic IPv4", HFILL} - }, - { &hf_mpls_echo_tlv_fec_gen_ipv4_mask, - { "Prefix Length", "mpls_echo.tlv.fec.gen_ipv4_mask", - FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack Generic IPv4 Prefix Length", HFILL} - }, - { &hf_mpls_echo_tlv_fec_gen_ipv6, - { "IPv6 Prefix", "mpls_echo.tlv.fec.gen_ipv6", - FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack Generic IPv6", HFILL} - }, - { &hf_mpls_echo_tlv_fec_gen_ipv6_mask, - { "Prefix Length", "mpls_echo.tlv.fec.gen_ipv6_mask", - FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack Generic IPv6 Prefix Length", HFILL} - }, - { &hf_mpls_echo_tlv_fec_nil_label, - { "Label", "mpls_echo.tlv.fec.nil_label", - FT_UINT24, BASE_DEC, VALS(special_labels), 0x0, "MPLS ECHO TLV FEC Stack NIL Label", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_mtu, - { "MTU", "mpls_echo.tlv.ds_map.mtu", - FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Downstream Map MTU", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_addr_type, - { "Address Type", "mpls_echo.tlv.ds_map.addr_type", - FT_UINT8, BASE_DEC, VALS(mpls_echo_tlv_addr_type), 0x0, - "MPLS ECHO TLV Downstream Map Address Type", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_res, - { "DS Flags", "mpls_echo.tlv.ds_map.res", - FT_UINT8, BASE_HEX, NULL, 0x0, "MPLS ECHO TLV Downstream Map DS Flags", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_flag_res, - { "MBZ", "mpls_echo.tlv.ds_map.flag_res", - FT_UINT8, BASE_HEX, NULL, 0xFC, "MPLS ECHO TLV Downstream Map Reserved Flags", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_flag_i, - { "Interface and Label Stack Request", "mpls_echo.tlv.ds_map.flag_i", - FT_BOOLEAN, 8, NULL, 0x02, "MPLS ECHO TLV Downstream Map I-Flag", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_flag_n, - { "Treat as Non-IP Packet", "mpls_echo.tlv.ds_map.flag_n", - FT_BOOLEAN, 8, NULL, 0x01, "MPLS ECHO TLV Downstream Map N-Flag", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_ds_ip, - { "Downstream IP Address", "mpls_echo.tlv.ds_map.ds_ip", - FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Downstream Map IP Address", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_int_ip, - { "Downstream Interface Address", "mpls_echo.tlv.ds_map.int_ip", - FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Downstream Map Interface Address", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_if_index, - { "Upstream Interface Index", "mpls_echo.tlv.ds_map.if_index", - FT_UINT32, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Downstream Map Interface Index", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_ds_ipv6, - { "Downstream IPv6 Address", "mpls_echo.tlv.ds_map.ds_ipv6", - FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Downstream Map IPv6 Address", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_int_ipv6, - { "Downstream Interface IPv6 Address", "mpls_echo.tlv.ds_map.int_ipv6", - FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Downstream Map Interface IPv6 Address", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_hash_type, - { "Multipath Type", "mpls_echo.tlv.ds_map.hash_type", - FT_UINT8, BASE_DEC, VALS(mpls_echo_tlv_ds_map_hash_type), 0x0, - "MPLS ECHO TLV Downstream Map Multipath Type", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_depth, - { "Depth Limit", "mpls_echo.tlv.ds_map.depth", - FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Downstream Map Depth Limit", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_muti_len, - { "Multipath Length", "mpls_echo.tlv.ds_map.multi_len", - FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Downstream Map Multipath Length", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_mp_ip, - { "IP Address", "mpls_echo.tlv.ds_map_mp.ip", - FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Downstream Map Multipath IP Address", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_mp_mask, - { "Mask", "mpls_echo.tlv.ds_map_mp.mask", - FT_BYTES, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Downstream Map Multipath Mask", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_mp_ip_low, - { "IP Address Low", "mpls_echo.tlv.ds_map_mp.ip_low", - FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Downstream Map Multipath Low IP Address", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_mp_ip_high, - { "IP Address High", "mpls_echo.tlv.ds_map_mp.ip_high", - FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Downstream Map Multipath High IP Address", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_mp_value, - { "Multipath Value", "mpls_echo.tlv.ds_map_mp.value", - FT_BYTES, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Multipath Value", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_mp_label, - { "Downstream Label", "mpls_echo.tlv.ds_map.mp_label", - FT_UINT24, BASE_DEC, VALS(special_labels), 0x0, "MPLS ECHO TLV Downstream Map Downstream Label", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_mp_exp, - { "Downstream Experimental", "mpls_echo.tlv.ds_map.mp_exp", - FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Downstream Map Downstream Experimental", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_mp_bos, - { "Downstream BOS", "mpls_echo.tlv.ds_map.mp_bos", - FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Downstream Map Downstream BOS", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_mp_proto, - { "Downstream Protocol", "mpls_echo.tlv.ds_map.mp_proto", - FT_UINT8, BASE_DEC, VALS(mpls_echo_tlv_ds_map_mp_proto), 0x0, - "MPLS ECHO TLV Downstream Map Downstream Protocol", HFILL} - }, - { &hf_mpls_echo_tlv_padaction, - { "Pad Action", "mpls_echo.tlv.pad_action", - FT_UINT8, BASE_DEC, VALS(mpls_echo_tlv_pad), 0x0, "MPLS ECHO Pad TLV Action", HFILL} - }, - { &hf_mpls_echo_tlv_padding, - { "Padding", "mpls_echo.tlv.pad_padding", - FT_BYTES, BASE_NONE, NULL, 0x0, "MPLS ECHO Pad TLV Padding", HFILL} - }, - { &hf_mpls_echo_tlv_vendor, - { "Vendor Id", "mpls_echo.tlv.vendor_id", - FT_UINT32, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0x0, "MPLS ECHO Vendor Id", HFILL} - }, - { &hf_mpls_echo_tlv_ilso_addr_type, - { "Address Type", "mpls_echo.tlv.ilso.addr_type", - FT_UINT8, BASE_DEC, VALS(mpls_echo_tlv_addr_type), 0x0, - "MPLS ECHO TLV Interface and Label Stack Address Type", HFILL} - }, - { &hf_mpls_echo_tlv_ilso_mbz, - { "Must Be Zero", "mpls_echo.tlv.ilso.mbz", - FT_UINT24, BASE_HEX, NULL, 0x0, "MPLS ECHO TLV Interface and Label Stack MBZ", HFILL} - }, - { &hf_mpls_echo_tlv_ilso_ipv4_addr, - { "Downstream IPv4 Address", "mpls_echo.tlv.ilso_ipv4.addr", - FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Interface and Label Stack Address", HFILL} - }, - { &hf_mpls_echo_tlv_ilso_ipv4_int_addr, - { "Downstream Interface Address", "mpls_echo.tlv.ilso_ipv4.int_addr", - FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Interface and Label Stack Interface Address", HFILL} - }, - { &hf_mpls_echo_tlv_ilso_ipv6_addr, - { "Downstream IPv6 Address", "mpls_echo.tlv.ilso_ipv6.addr", - FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Interface and Label Stack Address", HFILL} - }, - { &hf_mpls_echo_tlv_ilso_ipv6_int_addr, - { "Downstream Interface Address", "mpls_echo.tlv.ilso_ipv6.int_addr", - FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Interface and Label Stack Interface Address", HFILL} - }, - { &hf_mpls_echo_tlv_ilso_int_index, - { "Downstream Interface Index", "mpls_echo.tlv.ilso.int_index", - FT_UINT32, BASE_HEX, NULL, 0x0, "MPLS ECHO TLV Interface and Label Stack Interface Index", HFILL} - }, - { &hf_mpls_echo_tlv_ilso_label, - { "Label", "mpls_echo.tlv.ilso_ipv4.label", - FT_UINT24, BASE_DEC, VALS(special_labels), 0x0, "MPLS ECHO TLV Interface and Label Stack Label", HFILL} - }, - { &hf_mpls_echo_tlv_ilso_exp, - { "Exp", "mpls_echo.tlv.ilso_ipv4.exp", - FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Interface and Label Stack Exp", HFILL} - }, - { &hf_mpls_echo_tlv_ilso_bos, - { "BOS", "mpls_echo.tlv.ilso_ipv4.bos", - FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Interface and Label Stack BOS", HFILL} - }, - { &hf_mpls_echo_tlv_ilso_ttl, - { "TTL", "mpls_echo.tlv.ilso_ipv4.ttl", - FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Interface and Label Stack TTL", HFILL} - }, - { &hf_mpls_echo_tlv_rto_ipv4, - { "Reply-to IPv4 Address", "mpls_echo.tlv.rto.ipv4", - FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV IPv4 Reply-To Object", HFILL} - }, - { &hf_mpls_echo_tlv_rto_ipv6, - { "Reply-to IPv6 Address", "mpls_echo.tlv.rto.ipv6", - FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV IPv6 Reply-To Object", HFILL} - }, - { &hf_mpls_echo_tlv_reply_tos, - { "Reply-TOS Byte", "mpls_echo.tlv.reply.tos", - FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Reply-TOS Byte", HFILL} - }, - { &hf_mpls_echo_tlv_reply_tos_mbz, - { "MBZ", "mpls_echo.tlv.reply.tos.mbz", - FT_UINT24, BASE_HEX, NULL, 0x0, "MPLS ECHO TLV Reply-TOS MBZ", HFILL} - }, - { &hf_mpls_echo_tlv_errored_type, - { "Errored TLV Type", "mpls_echo.tlv.errored.type", - FT_UINT16, BASE_DEC, VALS(mpls_echo_tlv_type_names), 0x0, - "MPLS ECHO TLV Errored TLV Type", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_ingress_if_num, - { "Ingress Interface Number", "mpls_echo.tlv.ds_map.ingress.if.num", - FT_UINT32, BASE_DEC, NULL, 0x0, - "MPLS ECHO TLV DownStream Map Ingress Interface Number", HFILL} - }, - { &hf_mpls_echo_tlv_ds_map_egress_if_num, - { "Egress Interface Number", "mpls_echo.tlv.ds_map.egress.if.num", - FT_UINT32, BASE_DEC, NULL, 0x0, - "MPLS ECHO TLV DownStream Map Egress Interface Number", HFILL} - }, - { &hf_mpls_echo_lspping_tlv_src_gid, - { "SRC GLOBAL ID", "mpls_echo_lspping.tlv.src.gid", - FT_UINT32, BASE_DEC, NULL, 0x0, "LSP SRC GID", HFILL} - }, - { &hf_mpls_echo_lspping_tlv_src_nid, - { "SRC NODE ID", "mpls_echo_lspping.tlv.src.nid", - FT_IPv4, BASE_NONE, NULL, 0x0, "LSP SRC NID", HFILL} - }, - { &hf_mpls_echo_lspping_tlv_src_tunnel_no, - { "SRC Tunnel Number", "mpls_echo_lspping.tlv.tunnel.no", - FT_UINT16, BASE_DEC, NULL, 0x0, "LSP FEC Tunnel Number", HFILL} - }, - { &hf_mpls_echo_lspping_tlv_lsp_no, - { "SRC LSP Number", "mpls_echo_lspping.tlv.lsp.no", - FT_UINT16, BASE_DEC, NULL, 0x0, "LSP FEC LSP Number", HFILL} - }, - { &hf_mpls_echo_lspping_tlv_dst_gid, - { "DST GLOBAL ID", "mpls_echo_lspping.tlv.dst.gid", - FT_UINT32, BASE_DEC, NULL, 0x0, "LSP FEC DST GID", HFILL} - }, - { &hf_mpls_echo_lspping_tlv_dst_nid, - { "DST NODE ID", "mpls_echo_lspping.tlv.dst.nid", - FT_IPv4, BASE_NONE, NULL, 0x0, "LSP FEC DST NID", HFILL} - }, - { &hf_mpls_echo_lspping_tlv_dst_tunnel_no, - { "DST Tunnel Number", "mpls_echo_lspping.tlv.dst.tunnel.no", - FT_UINT16, BASE_DEC, NULL, 0x0, "LSP FEC DST Tunnel Number", HFILL} - }, - { &hf_mpls_echo_lspping_tlv_resv, - { "RESERVED", "mpls_echo_lspping.tlv.resv", - FT_UINT16, BASE_DEC, NULL, 0x0, "RESERVED BITS", HFILL} - }, - { &hf_mpls_echo_lspping_tlv_src_addr_gid, - { "Global ID", "mpls_echo_lspping.tlv.src.addr.gid", - FT_UINT32, BASE_DEC, NULL, 0x0, "SRC ADDR TLV GID", HFILL} - }, - { &hf_mpls_echo_lspping_tlv_src_addr_nid, - { "Node ID", "mpls_echo_lspping.tlv.src.addr.nid", - FT_IPv4, BASE_NONE, NULL, 0x0, "SRC ADDR TLV NID", HFILL} - }, - { &hf_mpls_echo_lspping_tlv_pw_serv_identifier, - { "Service identifier", "mpls_echo_lspping.tlv.pw.serv.identifier", - FT_UINT64, BASE_DEC, NULL, 0x0, "PW FEC Service identifier", HFILL} - }, - { &hf_mpls_echo_lspping_tlv_pw_src_ac_id, - { "SRC AC ID", "mpls_echo_lspping.tlv.pw.src.ac.id", - FT_UINT32, BASE_DEC, NULL, 0x0, "PW FEC SRC AC ID", HFILL} - }, - { &hf_mpls_echo_lspping_tlv_pw_dst_ac_id, - { "DST AC ID", "mpls_echo_lspping.tlv.pw.dst.ac.id", - FT_UINT32, BASE_DEC, NULL, 0x0, "PW FEC DST AC ID", HFILL} - }, - { &hf_mpls_echo_lspping_tlv_pw_agi_type, - { "AGI TYPE", "mpls_echo_lspping.tlv.pw.agi.type", - FT_UINT8, BASE_DEC,NULL,0x0, "PW AGI TYPE",HFILL} - }, - { &hf_mpls_echo_lspping_tlv_pw_agi_len, - { "AGI Length", "mpls_echo_lspping.tlv.pw.agi.len", - FT_UINT8, BASE_DEC,NULL,0x0, "PW AGI LENGTH",HFILL} - }, - { &hf_mpls_echo_lspping_tlv_pw_agi_val, - { "AGI VALUE", "mpls_echo_lspping.tlv.pw.agi.val", - FT_STRING, BASE_NONE,NULL,0x0, "PW AGI VALUE",HFILL} - } - }; - - static gint *ett[] = { - &ett_mpls_echo, - &ett_mpls_echo_gflags, - &ett_mpls_echo_tlv, - &ett_mpls_echo_tlv_fec, - &ett_mpls_echo_tlv_ds_map, - &ett_mpls_echo_tlv_ilso - }; - - module_t *mpls_echo_module; - - proto_mpls_echo = proto_register_protocol("Multiprotocol Label Switching Echo", - "MPLS Echo", "mpls-echo"); - - proto_register_field_array(proto_mpls_echo, hf, array_length(hf)); - proto_register_subtree_array(ett, array_length(ett)); - - mpls_echo_module = prefs_register_protocol(proto_mpls_echo, proto_reg_handoff_mpls_echo); - prefs_register_uint_preference(mpls_echo_module, "udp.port", "MPLS Echo UDP Port", - "Set the UDP port for messages (if other" - " than the default of 3503)", - 10, &global_mpls_echo_udp_port); + static hf_register_info hf[] = { + { &hf_mpls_echo_version, + { "Version", "mpls_echo.version", + FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO Version Number", HFILL} + }, + { &hf_mpls_echo_mbz, + { "MBZ", "mpls_echo.mbz", + FT_UINT16, BASE_HEX, NULL, 0x0, "MPLS ECHO Must be Zero", HFILL} + }, + { &hf_mpls_echo_gflags, + { "Global Flags", "mpls_echo.flags", + FT_UINT16, BASE_HEX, NULL, 0x0, "MPLS ECHO Global Flags", HFILL} + }, + { &hf_mpls_echo_flag_sbz, + { "Reserved", "mpls_echo.flag_sbz", + FT_UINT16, BASE_HEX, NULL, 0xFFF8, "MPLS ECHO Reserved Flags", HFILL} + }, + { &hf_mpls_echo_flag_v, + { "Validate FEC Stack", "mpls_echo.flag_v", + FT_BOOLEAN, 16, NULL, 0x0001, "MPLS ECHO Validate FEC Stack Flag", HFILL} + }, + { &hf_mpls_echo_flag_t, + { "Respond only if TTL expired", "mpls_echo.flag_t", + FT_BOOLEAN, 16, NULL, 0x0002, "MPLS ECHO Respond only if TTL expired Flag", HFILL} + }, + { &hf_mpls_echo_flag_r, + { "Validate Reverse Path", "mpls_echo.flag_r", + FT_BOOLEAN, 16, NULL, 0x0004, "MPLS ECHO Validate Reverse Path Flag", HFILL} + }, + { &hf_mpls_echo_msgtype, + { "Message Type", "mpls_echo.msg_type", + FT_UINT8, BASE_DEC, VALS(mpls_echo_msgtype), 0x0, "MPLS ECHO Message Type", HFILL} + }, + { &hf_mpls_echo_replymode, + { "Reply Mode", "mpls_echo.reply_mode", + FT_UINT8, BASE_DEC, VALS(mpls_echo_replymode), 0x0, "MPLS ECHO Reply Mode", HFILL} + }, + { &hf_mpls_echo_returncode, + { "Return Code", "mpls_echo.return_code", + FT_UINT8, BASE_DEC, VALS(mpls_echo_returncode), 0x0, "MPLS ECHO Return Code", HFILL} + }, + { &hf_mpls_echo_returnsubcode, + { "Return Subcode", "mpls_echo.return_subcode", + FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO Return Subcode", HFILL} + }, + { &hf_mpls_echo_handle, + { "Sender's Handle", "mpls_echo.sender_handle", + FT_UINT32, BASE_HEX, NULL, 0x0, "MPLS ECHO Sender's Handle", HFILL} + }, + { &hf_mpls_echo_sequence, + { "Sequence Number", "mpls_echo.sequence", + FT_UINT32, BASE_DEC, NULL, 0x0, "MPLS ECHO Sequence Number", HFILL} + }, + { &hf_mpls_echo_ts_sent, + { "Timestamp Sent", "mpls_echo.timestamp_sent", + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, "MPLS ECHO Timestamp Sent", HFILL} + }, + { &hf_mpls_echo_ts_rec, + { "Timestamp Received", "mpls_echo.timestamp_rec", + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, "MPLS ECHO Timestamp Received", HFILL} + }, + { &hf_mpls_echo_tlv_type, + { "Type", "mpls_echo.tlv.type", + FT_UINT16, BASE_DEC, VALS(mpls_echo_tlv_type_names), 0x0, + "MPLS ECHO TLV Type", HFILL} + }, + { &hf_mpls_echo_tlv_len, + { "Length", "mpls_echo.tlv.len", + FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Length", HFILL} + }, + { &hf_mpls_echo_tlv_value, + { "Value", "mpls_echo.tlv.value", + FT_BYTES, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Value", HFILL} + }, + { &hf_mpls_echo_tlv_fec_type, + { "Type", "mpls_echo.tlv.fec.type", + FT_UINT16, BASE_DEC, VALS(mpls_echo_tlv_fec_names), 0x0, + "MPLS ECHO TLV FEC Stack Type", HFILL} + }, + { &hf_mpls_echo_tlv_fec_len, + { "Length", "mpls_echo.tlv.fec.len", + FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack Length", HFILL} + }, + { &hf_mpls_echo_tlv_fec_value, + { "Value", "mpls_echo.tlv.fec.value", + FT_BYTES, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack Value", HFILL} + }, + { &hf_mpls_echo_tlv_fec_ldp_ipv4, + { "IPv4 Prefix", "mpls_echo.tlv.fec.ldp_ipv4", + FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack LDP IPv4", HFILL} + }, + { &hf_mpls_echo_tlv_fec_ldp_ipv4_mask, + { "Prefix Length", "mpls_echo.tlv.fec.ldp_ipv4_mask", + FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack LDP IPv4 Prefix Length", HFILL} + }, + { &hf_mpls_echo_tlv_fec_ldp_ipv6, + { "IPv6 Prefix", "mpls_echo.tlv.fec.ldp_ipv6", + FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack LDP IPv6", HFILL} + }, + { &hf_mpls_echo_tlv_fec_ldp_ipv6_mask, + { "Prefix Length", "mpls_echo.tlv.fec.ldp_ipv6_mask", + FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack LDP IPv6 Prefix Length", HFILL} + }, + { &hf_mpls_echo_tlv_fec_rsvp_ipv4_ipv4_endpoint, + { "IPv4 Tunnel endpoint address", "mpls_echo.tlv.fec.rsvp_ipv4_ep", + FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack RSVP IPv4 Tunnel Endpoint Address", HFILL} + }, + { &hf_mpls_echo_tlv_fec_rsvp_ipv6_ipv6_endpoint, + { "IPv6 Tunnel endpoint address", "mpls_echo.tlv.fec.rsvp_ipv6_ep", + FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack RSVP IPv6 Tunnel Endpoint Address", HFILL} + }, + { &hf_mpls_echo_tlv_fec_rsvp_ip_mbz1, + { "Must Be Zero", "mpls_echo.tlv.fec.rsvp_ip_mbz1", + FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack RSVP MBZ", HFILL} + }, + { &hf_mpls_echo_tlv_fec_rsvp_ip_tunnel_id, + { "Tunnel ID", "mpls_echo.tlv.fec.rsvp_ip_tun_id", + FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack RSVP Tunnel ID", HFILL} + }, + { &hf_mpls_echo_tlv_fec_rsvp_ipv4_ext_tunnel_id, + { "Extended Tunnel ID", "mpls_echo.tlv.fec.rsvp_ipv4_ext_tun_id", + FT_UINT32, BASE_HEX, NULL, 0x0, "MPLS ECHO TLV FEC Stack RSVP IPv4 Extended Tunnel ID", HFILL} + }, + { &hf_mpls_echo_tlv_fec_rsvp_ipv4_ipv4_sender, + { "IPv4 Tunnel sender address", "mpls_echo.tlv.fec.rsvp_ipv4_sender", + FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack RSVP IPv4 Sender", HFILL} + }, + { &hf_mpls_echo_tlv_fec_rsvp_ipv6_ext_tunnel_id, + { "Extended Tunnel ID", "mpls_echo.tlv.fec.rsvp_ipv6_ext_tun_id", + FT_BYTES, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack RSVP IPv6 Extended Tunnel ID", HFILL} + }, + { &hf_mpls_echo_tlv_fec_rsvp_ipv6_ipv6_sender, + { "IPv6 Tunnel sender address", "mpls_echo.tlv.fec.rsvp_ipv6_sender", + FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack RSVP IPv4 Sender", HFILL} + }, + { &hf_mpls_echo_tlv_fec_rsvp_ip_mbz2, + { "Must Be Zero", "mpls_echo.tlv.fec.rsvp_ip_mbz2", + FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack RSVP MBZ", HFILL} + }, + { &hf_mpls_echo_tlv_fec_rsvp_ip_lsp_id, + { "LSP ID", "mpls_echo.tlv.fec.rsvp_ip_lsp_id", + FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack RSVP LSP ID", HFILL} + }, + { &hf_mpls_echo_tlv_fec_l2cid_sender, + { "Sender's PE Address", "mpls_echo.tlv.fec.l2cid_sender", + FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack L2CID Sender", HFILL} + }, + { &hf_mpls_echo_tlv_fec_l2cid_remote, + { "Remote PE Address", "mpls_echo.tlv.fec.l2cid_remote", + FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack L2CID Remote", HFILL} + }, + { &hf_mpls_echo_tlv_fec_l2cid_vcid, + { "VC ID", "mpls_echo.tlv.fec.l2cid_vcid", + FT_UINT32, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack L2CID VCID", HFILL} + }, + { &hf_mpls_echo_tlv_fec_l2cid_encap, + { "Encapsulation", "mpls_echo.tlv.fec.l2cid_encap", + FT_UINT16, BASE_DEC, VALS(fec_vc_types_vals), 0x0, "MPLS ECHO TLV FEC Stack L2CID Encapsulation", HFILL} + }, + { &hf_mpls_echo_tlv_fec_l2cid_mbz, + { "MBZ", "mpls_echo.tlv.fec.l2cid_mbz", + FT_UINT16, BASE_HEX, NULL, 0x0, "MPLS ECHO TLV FEC Stack L2CID MBZ", HFILL} + }, + { &hf_mpls_echo_tlv_fec_bgp_nh, + { "BGP Next Hop", "mpls_echo.tlv.fec.bgp_nh", + FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack BGP Next Hop", HFILL} + }, + { &hf_mpls_echo_tlv_fec_bgp_ipv4, + { "IPv4 Prefix", "mpls_echo.tlv.fec.bgp_ipv4", + FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack BGP IPv4", HFILL} + }, + { &hf_mpls_echo_tlv_fec_bgp_len, + { "Prefix Length", "mpls_echo.tlv.fec.bgp_len", + FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack BGP Prefix Length", HFILL} + }, + { &hf_mpls_echo_tlv_fec_gen_ipv4, + { "IPv4 Prefix", "mpls_echo.tlv.fec.gen_ipv4", + FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack Generic IPv4", HFILL} + }, + { &hf_mpls_echo_tlv_fec_gen_ipv4_mask, + { "Prefix Length", "mpls_echo.tlv.fec.gen_ipv4_mask", + FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack Generic IPv4 Prefix Length", HFILL} + }, + { &hf_mpls_echo_tlv_fec_gen_ipv6, + { "IPv6 Prefix", "mpls_echo.tlv.fec.gen_ipv6", + FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV FEC Stack Generic IPv6", HFILL} + }, + { &hf_mpls_echo_tlv_fec_gen_ipv6_mask, + { "Prefix Length", "mpls_echo.tlv.fec.gen_ipv6_mask", + FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV FEC Stack Generic IPv6 Prefix Length", HFILL} + }, + { &hf_mpls_echo_tlv_fec_nil_label, + { "Label", "mpls_echo.tlv.fec.nil_label", + FT_UINT24, BASE_DEC, VALS(special_labels), 0x0, "MPLS ECHO TLV FEC Stack NIL Label", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_mtu, + { "MTU", "mpls_echo.tlv.ds_map.mtu", + FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Downstream Map MTU", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_addr_type, + { "Address Type", "mpls_echo.tlv.ds_map.addr_type", + FT_UINT8, BASE_DEC, VALS(mpls_echo_tlv_addr_type), 0x0, + "MPLS ECHO TLV Downstream Map Address Type", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_res, + { "DS Flags", "mpls_echo.tlv.ds_map.res", + FT_UINT8, BASE_HEX, NULL, 0x0, "MPLS ECHO TLV Downstream Map DS Flags", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_flag_res, + { "MBZ", "mpls_echo.tlv.ds_map.flag_res", + FT_UINT8, BASE_HEX, NULL, 0xFC, "MPLS ECHO TLV Downstream Map Reserved Flags", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_flag_i, + { "Interface and Label Stack Request", "mpls_echo.tlv.ds_map.flag_i", + FT_BOOLEAN, 8, NULL, 0x02, "MPLS ECHO TLV Downstream Map I-Flag", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_flag_n, + { "Treat as Non-IP Packet", "mpls_echo.tlv.ds_map.flag_n", + FT_BOOLEAN, 8, NULL, 0x01, "MPLS ECHO TLV Downstream Map N-Flag", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_ds_ip, + { "Downstream IP Address", "mpls_echo.tlv.ds_map.ds_ip", + FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Downstream Map IP Address", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_int_ip, + { "Downstream Interface Address", "mpls_echo.tlv.ds_map.int_ip", + FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Downstream Map Interface Address", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_if_index, + { "Upstream Interface Index", "mpls_echo.tlv.ds_map.if_index", + FT_UINT32, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Downstream Map Interface Index", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_ds_ipv6, + { "Downstream IPv6 Address", "mpls_echo.tlv.ds_map.ds_ipv6", + FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Downstream Map IPv6 Address", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_int_ipv6, + { "Downstream Interface IPv6 Address", "mpls_echo.tlv.ds_map.int_ipv6", + FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Downstream Map Interface IPv6 Address", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_hash_type, + { "Multipath Type", "mpls_echo.tlv.ds_map.hash_type", + FT_UINT8, BASE_DEC, VALS(mpls_echo_tlv_ds_map_hash_type), 0x0, + "MPLS ECHO TLV Downstream Map Multipath Type", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_depth, + { "Depth Limit", "mpls_echo.tlv.ds_map.depth", + FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Downstream Map Depth Limit", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_muti_len, + { "Multipath Length", "mpls_echo.tlv.ds_map.multi_len", + FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Downstream Map Multipath Length", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_mp_ip, + { "IP Address", "mpls_echo.tlv.ds_map_mp.ip", + FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Downstream Map Multipath IP Address", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_mp_mask, + { "Mask", "mpls_echo.tlv.ds_map_mp.mask", + FT_BYTES, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Downstream Map Multipath Mask", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_mp_ip_low, + { "IP Address Low", "mpls_echo.tlv.ds_map_mp.ip_low", + FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Downstream Map Multipath Low IP Address", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_mp_ip_high, + { "IP Address High", "mpls_echo.tlv.ds_map_mp.ip_high", + FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Downstream Map Multipath High IP Address", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_mp_value, + { "Multipath Value", "mpls_echo.tlv.ds_map_mp.value", + FT_BYTES, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Multipath Value", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_mp_label, + { "Downstream Label", "mpls_echo.tlv.ds_map.mp_label", + FT_UINT24, BASE_DEC, VALS(special_labels), 0x0, "MPLS ECHO TLV Downstream Map Downstream Label", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_mp_exp, + { "Downstream Experimental", "mpls_echo.tlv.ds_map.mp_exp", + FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Downstream Map Downstream Experimental", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_mp_bos, + { "Downstream BOS", "mpls_echo.tlv.ds_map.mp_bos", + FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Downstream Map Downstream BOS", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_mp_proto, + { "Downstream Protocol", "mpls_echo.tlv.ds_map.mp_proto", + FT_UINT8, BASE_DEC, VALS(mpls_echo_tlv_ds_map_mp_proto), 0x0, + "MPLS ECHO TLV Downstream Map Downstream Protocol", HFILL} + }, + { &hf_mpls_echo_tlv_padaction, + { "Pad Action", "mpls_echo.tlv.pad_action", + FT_UINT8, BASE_DEC, VALS(mpls_echo_tlv_pad), 0x0, "MPLS ECHO Pad TLV Action", HFILL} + }, + { &hf_mpls_echo_tlv_padding, + { "Padding", "mpls_echo.tlv.pad_padding", + FT_BYTES, BASE_NONE, NULL, 0x0, "MPLS ECHO Pad TLV Padding", HFILL} + }, + { &hf_mpls_echo_tlv_vendor, + { "Vendor Id", "mpls_echo.tlv.vendor_id", + FT_UINT32, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0x0, "MPLS ECHO Vendor Id", HFILL} + }, + { &hf_mpls_echo_tlv_ilso_addr_type, + { "Address Type", "mpls_echo.tlv.ilso.addr_type", + FT_UINT8, BASE_DEC, VALS(mpls_echo_tlv_addr_type), 0x0, + "MPLS ECHO TLV Interface and Label Stack Address Type", HFILL} + }, + { &hf_mpls_echo_tlv_ilso_mbz, + { "Must Be Zero", "mpls_echo.tlv.ilso.mbz", + FT_UINT24, BASE_HEX, NULL, 0x0, "MPLS ECHO TLV Interface and Label Stack MBZ", HFILL} + }, + { &hf_mpls_echo_tlv_ilso_ipv4_addr, + { "Downstream IPv4 Address", "mpls_echo.tlv.ilso_ipv4.addr", + FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Interface and Label Stack Address", HFILL} + }, + { &hf_mpls_echo_tlv_ilso_ipv4_int_addr, + { "Downstream Interface Address", "mpls_echo.tlv.ilso_ipv4.int_addr", + FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Interface and Label Stack Interface Address", HFILL} + }, + { &hf_mpls_echo_tlv_ilso_ipv6_addr, + { "Downstream IPv6 Address", "mpls_echo.tlv.ilso_ipv6.addr", + FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Interface and Label Stack Address", HFILL} + }, + { &hf_mpls_echo_tlv_ilso_ipv6_int_addr, + { "Downstream Interface Address", "mpls_echo.tlv.ilso_ipv6.int_addr", + FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Interface and Label Stack Interface Address", HFILL} + }, + { &hf_mpls_echo_tlv_ilso_int_index, + { "Downstream Interface Index", "mpls_echo.tlv.ilso.int_index", + FT_UINT32, BASE_HEX, NULL, 0x0, "MPLS ECHO TLV Interface and Label Stack Interface Index", HFILL} + }, + { &hf_mpls_echo_tlv_ilso_label, + { "Label", "mpls_echo.tlv.ilso_ipv4.label", + FT_UINT24, BASE_DEC, VALS(special_labels), 0x0, "MPLS ECHO TLV Interface and Label Stack Label", HFILL} + }, + { &hf_mpls_echo_tlv_ilso_exp, + { "Exp", "mpls_echo.tlv.ilso_ipv4.exp", + FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Interface and Label Stack Exp", HFILL} + }, + { &hf_mpls_echo_tlv_ilso_bos, + { "BOS", "mpls_echo.tlv.ilso_ipv4.bos", + FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Interface and Label Stack BOS", HFILL} + }, + { &hf_mpls_echo_tlv_ilso_ttl, + { "TTL", "mpls_echo.tlv.ilso_ipv4.ttl", + FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Interface and Label Stack TTL", HFILL} + }, + { &hf_mpls_echo_tlv_rto_ipv4, + { "Reply-to IPv4 Address", "mpls_echo.tlv.rto.ipv4", + FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV IPv4 Reply-To Object", HFILL} + }, + { &hf_mpls_echo_tlv_rto_ipv6, + { "Reply-to IPv6 Address", "mpls_echo.tlv.rto.ipv6", + FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV IPv6 Reply-To Object", HFILL} + }, + { &hf_mpls_echo_tlv_reply_tos, + { "Reply-TOS Byte", "mpls_echo.tlv.reply.tos", + FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Reply-TOS Byte", HFILL} + }, + { &hf_mpls_echo_tlv_reply_tos_mbz, + { "MBZ", "mpls_echo.tlv.reply.tos.mbz", + FT_UINT24, BASE_HEX, NULL, 0x0, "MPLS ECHO TLV Reply-TOS MBZ", HFILL} + }, + { &hf_mpls_echo_tlv_errored_type, + { "Errored TLV Type", "mpls_echo.tlv.errored.type", + FT_UINT16, BASE_DEC, VALS(mpls_echo_tlv_type_names), 0x0, + "MPLS ECHO TLV Errored TLV Type", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_ingress_if_num, + { "Ingress Interface Number", "mpls_echo.tlv.ds_map.ingress.if.num", + FT_UINT32, BASE_DEC, NULL, 0x0, + "MPLS ECHO TLV DownStream Map Ingress Interface Number", HFILL} + }, + { &hf_mpls_echo_tlv_ds_map_egress_if_num, + { "Egress Interface Number", "mpls_echo.tlv.ds_map.egress.if.num", + FT_UINT32, BASE_DEC, NULL, 0x0, + "MPLS ECHO TLV DownStream Map Egress Interface Number", HFILL} + }, + { &hf_mpls_echo_lspping_tlv_src_gid, + { "SRC GLOBAL ID", "mpls_echo_lspping.tlv.src.gid", + FT_UINT32, BASE_DEC, NULL, 0x0, "LSP SRC GID", HFILL} + }, + { &hf_mpls_echo_lspping_tlv_src_nid, + { "SRC NODE ID", "mpls_echo_lspping.tlv.src.nid", + FT_IPv4, BASE_NONE, NULL, 0x0, "LSP SRC NID", HFILL} + }, + { &hf_mpls_echo_lspping_tlv_src_tunnel_no, + { "SRC Tunnel Number", "mpls_echo_lspping.tlv.tunnel.no", + FT_UINT16, BASE_DEC, NULL, 0x0, "LSP FEC Tunnel Number", HFILL} + }, + { &hf_mpls_echo_lspping_tlv_lsp_no, + { "SRC LSP Number", "mpls_echo_lspping.tlv.lsp.no", + FT_UINT16, BASE_DEC, NULL, 0x0, "LSP FEC LSP Number", HFILL} + }, + { &hf_mpls_echo_lspping_tlv_dst_gid, + { "DST GLOBAL ID", "mpls_echo_lspping.tlv.dst.gid", + FT_UINT32, BASE_DEC, NULL, 0x0, "LSP FEC DST GID", HFILL} + }, + { &hf_mpls_echo_lspping_tlv_dst_nid, + { "DST NODE ID", "mpls_echo_lspping.tlv.dst.nid", + FT_IPv4, BASE_NONE, NULL, 0x0, "LSP FEC DST NID", HFILL} + }, + { &hf_mpls_echo_lspping_tlv_dst_tunnel_no, + { "DST Tunnel Number", "mpls_echo_lspping.tlv.dst.tunnel.no", + FT_UINT16, BASE_DEC, NULL, 0x0, "LSP FEC DST Tunnel Number", HFILL} + }, + { &hf_mpls_echo_lspping_tlv_resv, + { "RESERVED", "mpls_echo_lspping.tlv.resv", + FT_UINT16, BASE_DEC, NULL, 0x0, "RESERVED BITS", HFILL} + }, + { &hf_mpls_echo_lspping_tlv_src_addr_gid, + { "Global ID", "mpls_echo_lspping.tlv.src.addr.gid", + FT_UINT32, BASE_DEC, NULL, 0x0, "SRC ADDR TLV GID", HFILL} + }, + { &hf_mpls_echo_lspping_tlv_src_addr_nid, + { "Node ID", "mpls_echo_lspping.tlv.src.addr.nid", + FT_IPv4, BASE_NONE, NULL, 0x0, "SRC ADDR TLV NID", HFILL} + }, + { &hf_mpls_echo_lspping_tlv_pw_serv_identifier, + { "Service identifier", "mpls_echo_lspping.tlv.pw.serv.identifier", + FT_UINT64, BASE_DEC, NULL, 0x0, "PW FEC Service identifier", HFILL} + }, + { &hf_mpls_echo_lspping_tlv_pw_src_ac_id, + { "SRC AC ID", "mpls_echo_lspping.tlv.pw.src.ac.id", + FT_UINT32, BASE_DEC, NULL, 0x0, "PW FEC SRC AC ID", HFILL} + }, + { &hf_mpls_echo_lspping_tlv_pw_dst_ac_id, + { "DST AC ID", "mpls_echo_lspping.tlv.pw.dst.ac.id", + FT_UINT32, BASE_DEC, NULL, 0x0, "PW FEC DST AC ID", HFILL} + }, + { &hf_mpls_echo_lspping_tlv_pw_agi_type, + { "AGI TYPE", "mpls_echo_lspping.tlv.pw.agi.type", + FT_UINT8, BASE_DEC,NULL,0x0, "PW AGI TYPE",HFILL} + }, + { &hf_mpls_echo_lspping_tlv_pw_agi_len, + { "AGI Length", "mpls_echo_lspping.tlv.pw.agi.len", + FT_UINT8, BASE_DEC,NULL,0x0, "PW AGI LENGTH",HFILL} + }, + { &hf_mpls_echo_lspping_tlv_pw_agi_val, + { "AGI VALUE", "mpls_echo_lspping.tlv.pw.agi.val", + FT_STRING, BASE_NONE,NULL,0x0, "PW AGI VALUE",HFILL} + } + }; + + static gint *ett[] = { + &ett_mpls_echo, + &ett_mpls_echo_gflags, + &ett_mpls_echo_tlv, + &ett_mpls_echo_tlv_fec, + &ett_mpls_echo_tlv_ds_map, + &ett_mpls_echo_tlv_ilso + }; + + module_t *mpls_echo_module; + + proto_mpls_echo = proto_register_protocol("Multiprotocol Label Switching Echo", + "MPLS Echo", "mpls-echo"); + + proto_register_field_array(proto_mpls_echo, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + + mpls_echo_module = prefs_register_protocol(proto_mpls_echo, proto_reg_handoff_mpls_echo); + prefs_register_uint_preference(mpls_echo_module, "udp.port", "MPLS Echo UDP Port", + "Set the UDP port for messages (if other" + " than the default of 3503)", + 10, &global_mpls_echo_udp_port); } void proto_reg_handoff_mpls_echo(void) { - static gboolean mpls_echo_prefs_initialized = FALSE; - static dissector_handle_t mpls_echo_handle; - static guint mpls_echo_udp_port; - - if(!mpls_echo_prefs_initialized) { - mpls_echo_handle = create_dissector_handle(dissect_mpls_echo, - proto_mpls_echo); - mpls_echo_prefs_initialized = TRUE; - } else { - dissector_delete_uint("udp.port", mpls_echo_udp_port, mpls_echo_handle); - } - - mpls_echo_udp_port = global_mpls_echo_udp_port; - dissector_add_uint("udp.port", global_mpls_echo_udp_port, mpls_echo_handle); + static gboolean mpls_echo_prefs_initialized = FALSE; + static dissector_handle_t mpls_echo_handle; + static guint mpls_echo_udp_port; + + if (!mpls_echo_prefs_initialized) { + mpls_echo_handle = create_dissector_handle(dissect_mpls_echo, + proto_mpls_echo); + mpls_echo_prefs_initialized = TRUE; + } else { + dissector_delete_uint("udp.port", mpls_echo_udp_port, mpls_echo_handle); + } + + mpls_echo_udp_port = global_mpls_echo_udp_port; + dissector_add_uint("udp.port", global_mpls_echo_udp_port, mpls_echo_handle); } diff --git a/epan/dissectors/packet-mpls-pm.c b/epan/dissectors/packet-mpls-pm.c index 76257cdb16..217becdc8d 100644 --- a/epan/dissectors/packet-mpls-pm.c +++ b/epan/dissectors/packet-mpls-pm.c @@ -32,8 +32,6 @@ # include "config.h" #endif -#include -#include #include #include diff --git a/epan/dissectors/packet-mpls-psc.c b/epan/dissectors/packet-mpls-psc.c index 94b7bca272..10ac0f16b1 100644 --- a/epan/dissectors/packet-mpls-psc.c +++ b/epan/dissectors/packet-mpls-psc.c @@ -32,8 +32,6 @@ # include "config.h" #endif -#include -#include #include #include diff --git a/epan/dissectors/packet-mpls-y1711.c b/epan/dissectors/packet-mpls-y1711.c index 4b1766bc22..8260043834 100644 --- a/epan/dissectors/packet-mpls-y1711.c +++ b/epan/dissectors/packet-mpls-y1711.c @@ -41,8 +41,8 @@ #include "config.h" #endif -#include #include + #include #include diff --git a/epan/dissectors/packet-msdp.c b/epan/dissectors/packet-msdp.c index 050c7343ad..27b14cb510 100644 --- a/epan/dissectors/packet-msdp.c +++ b/epan/dissectors/packet-msdp.c @@ -29,8 +29,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-mstp.c b/epan/dissectors/packet-mstp.c index c3d87da0c4..e71c1591fa 100644 --- a/epan/dissectors/packet-mstp.c +++ b/epan/dissectors/packet-mstp.c @@ -35,8 +35,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-mstp.h b/epan/dissectors/packet-mstp.h index 9ab2aad1d1..d3b3b21ce5 100644 --- a/epan/dissectors/packet-mstp.h +++ b/epan/dissectors/packet-mstp.h @@ -26,15 +26,6 @@ #ifndef __MSTP_H__ #define __MSTP_H__ -#include -#include -#include - -#include - -#include - - /** * Returns a value string for the BACnet MS/TP Frame Type. * @param val diff --git a/epan/dissectors/packet-multipart.c b/epan/dissectors/packet-multipart.c index 06d7fc6a47..d7f01a1040 100644 --- a/epan/dissectors/packet-multipart.c +++ b/epan/dissectors/packet-multipart.c @@ -60,15 +60,15 @@ #include "config.h" #endif -#include #include -#include -#include #include -#include -#include + +#include #include +#include +#include +#include #include "packet-imf.h" diff --git a/epan/dissectors/packet-nbd.c b/epan/dissectors/packet-nbd.c index e373b98d8a..936c754181 100644 --- a/epan/dissectors/packet-nbd.c +++ b/epan/dissectors/packet-nbd.c @@ -28,18 +28,15 @@ # include "config.h" #endif -#include -#include - -#include - #include + #include +#include #include #include #include "packet-tcp.h" -static gint proto_nbd = -1; +static gint proto_nbd = -1; static int hf_nbd_magic = -1; static int hf_nbd_type = -1; static int hf_nbd_error = -1; diff --git a/epan/dissectors/packet-ndp.c b/epan/dissectors/packet-ndp.c index 142c782d27..74201e049c 100644 --- a/epan/dissectors/packet-ndp.c +++ b/epan/dissectors/packet-ndp.c @@ -32,11 +32,12 @@ * */ +#ifdef HAVE_CONFIG_H #include "config.h" - -#include +#endif #include + #include #include diff --git a/epan/dissectors/packet-netdump.c b/epan/dissectors/packet-netdump.c index ab70ea2af6..11dd1c6990 100644 --- a/epan/dissectors/packet-netdump.c +++ b/epan/dissectors/packet-netdump.c @@ -28,8 +28,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-netsync.c b/epan/dissectors/packet-netsync.c index 5eb92df4a9..98ace57722 100644 --- a/epan/dissectors/packet-netsync.c +++ b/epan/dissectors/packet-netsync.c @@ -30,9 +30,8 @@ #include "config.h" #endif -#include -#include -#include +#include + #include #include #include diff --git a/epan/dissectors/packet-nhrp.c b/epan/dissectors/packet-nhrp.c index 2bf2041164..e0b5de57d2 100644 --- a/epan/dissectors/packet-nhrp.c +++ b/epan/dissectors/packet-nhrp.c @@ -32,10 +32,10 @@ # include "config.h" #endif -#include #include -#include + #include + #include #include #include diff --git a/epan/dissectors/packet-nt-tpcp.c b/epan/dissectors/packet-nt-tpcp.c index dbb73331d5..e457f63e74 100644 --- a/epan/dissectors/packet-nt-tpcp.c +++ b/epan/dissectors/packet-nt-tpcp.c @@ -27,10 +27,10 @@ # include "config.h" #endif -#include #include #include + #include #include /* this is for get_hostname and get_udp_port */ @@ -77,6 +77,7 @@ static const value_string type_vals[] = { /* Version info */ #define TPCP_VER_1 1 #define TPCP_VER_2 2 + #define TPCP_VER_1_LENGTH 16 #define TPCP_VER_2_LENGTH 28 @@ -103,10 +104,10 @@ static gint ett_tpcp_flags = -1; static void dissect_tpcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - tpcpdu_t tpcph; + tpcpdu_t tpcph; proto_tree *tpcp_tree = NULL, *field_tree = NULL; proto_item *ti, *tf; - guint8 length = TPCP_VER_1_LENGTH; + guint8 length = TPCP_VER_1_LENGTH; col_set_str(pinfo->cinfo, COL_PROTOCOL, "TPCP"); col_clear(pinfo->cinfo, COL_INFO); @@ -114,7 +115,7 @@ dissect_tpcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* need to find out which version!! */ tpcph.version = tvb_get_guint8(tvb, 0); /* as version 1 and 2 are so similar use the same structure, just don't use as much for version 1*/ - /* XXX: Doing a memcpy into a struct is *not* kosher */ + /* XXX: Doing a memcpy into a struct is *not* kosher */ if (tpcph.version == TPCP_VER_1) { length = TPCP_VER_1_LENGTH; tvb_memcpy(tvb, (guint8 *) &tpcph, 0, length); @@ -129,7 +130,7 @@ dissect_tpcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tpcph.id = g_ntohs(tpcph.id); tpcph.flags = g_ntohs(tpcph.flags); tpcph.cport = g_ntohs(tpcph.cport); - tpcph.signature = g_ntohl(tpcph.signature); + tpcph.signature = g_ntohl(tpcph.signature); if (check_col(pinfo->cinfo, COL_INFO)) col_add_fstr(pinfo->cinfo, COL_INFO,"%s id %d CPort %s CIP %s SIP %s", @@ -233,22 +234,22 @@ proto_register_tpcp(void) }; - static gint *ett[] = { - &ett_tpcp, - &ett_tpcp_flags, - }; + static gint *ett[] = { + &ett_tpcp, + &ett_tpcp_flags, + }; - proto_tpcp = proto_register_protocol("Alteon - Transparent Proxy Cache Protocol", - "TPCP", "tpcp"); - proto_register_field_array(proto_tpcp, hf, array_length(hf)); - proto_register_subtree_array(ett, array_length(ett)); + proto_tpcp = proto_register_protocol("Alteon - Transparent Proxy Cache Protocol", + "TPCP", "tpcp"); + proto_register_field_array(proto_tpcp, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } void proto_reg_handoff_tpcp(void) { - dissector_handle_t tpcp_handle; + dissector_handle_t tpcp_handle; - tpcp_handle = create_dissector_handle(dissect_tpcp, proto_tpcp); - dissector_add_uint("udp.port", UDP_PORT_TPCP, tpcp_handle); + tpcp_handle = create_dissector_handle(dissect_tpcp, proto_tpcp); + dissector_add_uint("udp.port", UDP_PORT_TPCP, tpcp_handle); } diff --git a/epan/dissectors/packet-olsr.c b/epan/dissectors/packet-olsr.c index 97542eaaa3..3d6fbd2540 100644 --- a/epan/dissectors/packet-olsr.c +++ b/epan/dissectors/packet-olsr.c @@ -34,7 +34,6 @@ # include "config.h" #endif -#include #include #include diff --git a/epan/dissectors/packet-openwire.c b/epan/dissectors/packet-openwire.c index 236155c377..66954d6286 100644 --- a/epan/dissectors/packet-openwire.c +++ b/epan/dissectors/packet-openwire.c @@ -44,12 +44,12 @@ #endif #include + #include #include #include #include #include "packet-tcp.h" -#include static int proto_openwire = -1; static int hf_openwire_none = -1; diff --git a/epan/dissectors/packet-opsi.c b/epan/dissectors/packet-opsi.c index 9904200d22..cc13559392 100644 --- a/epan/dissectors/packet-opsi.c +++ b/epan/dissectors/packet-opsi.c @@ -27,8 +27,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-pcli.c b/epan/dissectors/packet-pcli.c index 0148a29327..f010a1680f 100644 --- a/epan/dissectors/packet-pcli.c +++ b/epan/dissectors/packet-pcli.c @@ -33,11 +33,8 @@ #include "config.h" #endif -#include -#include -#include - #include + #include #include #include diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c index 3f9ed29bb1..d7c6c47cae 100644 --- a/epan/dissectors/packet-per.c +++ b/epan/dissectors/packet-per.c @@ -32,13 +32,12 @@ proper helper routines # include "config.h" #endif -#include -#include - -#include #include #include +#include + +#include #include #include #include diff --git a/epan/dissectors/packet-pktgen.c b/epan/dissectors/packet-pktgen.c index 6f65874046..553dc9aa0f 100644 --- a/epan/dissectors/packet-pktgen.c +++ b/epan/dissectors/packet-pktgen.c @@ -33,10 +33,6 @@ # include "config.h" #endif -#if 0 -#include -#endif - #include #include diff --git a/epan/dissectors/packet-ptp.c b/epan/dissectors/packet-ptp.c index a02090c191..8ff49a6731 100644 --- a/epan/dissectors/packet-ptp.c +++ b/epan/dissectors/packet-ptp.c @@ -45,10 +45,8 @@ # include "config.h" #endif -#include #include - #include #include diff --git a/epan/dissectors/packet-pvfs2.c b/epan/dissectors/packet-pvfs2.c index 9642c92749..3076e90bc5 100644 --- a/epan/dissectors/packet-pvfs2.c +++ b/epan/dissectors/packet-pvfs2.c @@ -35,7 +35,6 @@ # include "config.h" #endif -#include #include #include diff --git a/epan/dissectors/packet-pw-cesopsn.c b/epan/dissectors/packet-pw-cesopsn.c index 85a2c2da07..c07aeaefbe 100644 --- a/epan/dissectors/packet-pw-cesopsn.c +++ b/epan/dissectors/packet-pw-cesopsn.c @@ -36,8 +36,8 @@ # include "config.h" #endif -#include #include + #include #include diff --git a/epan/dissectors/packet-pw-eth.c b/epan/dissectors/packet-pw-eth.c index 58cb88c199..19de8ca4d7 100644 --- a/epan/dissectors/packet-pw-eth.c +++ b/epan/dissectors/packet-pw-eth.c @@ -30,8 +30,8 @@ # include "config.h" #endif -#include #include + #include #include diff --git a/epan/dissectors/packet-pw-hdlc.c b/epan/dissectors/packet-pw-hdlc.c index 10fd560d59..791c39808b 100644 --- a/epan/dissectors/packet-pw-hdlc.c +++ b/epan/dissectors/packet-pw-hdlc.c @@ -38,8 +38,8 @@ # include "config.h" #endif -#include #include + #include #include "packet-mpls.h" diff --git a/epan/dissectors/packet-pw-satop.c b/epan/dissectors/packet-pw-satop.c index c41d5a40b0..eca18f0a0b 100644 --- a/epan/dissectors/packet-pw-satop.c +++ b/epan/dissectors/packet-pw-satop.c @@ -35,8 +35,8 @@ # include "config.h" #endif -#include #include + #include #include diff --git a/epan/dissectors/packet-redbackli.c b/epan/dissectors/packet-redbackli.c index 2a9660c267..f2cd3a2d16 100644 --- a/epan/dissectors/packet-redbackli.c +++ b/epan/dissectors/packet-redbackli.c @@ -29,11 +29,8 @@ #include "config.h" #endif -#include -#include -#include - #include + #include #include #include diff --git a/epan/dissectors/packet-rlm.c b/epan/dissectors/packet-rlm.c index dd3f2b82bd..0ea593a6bf 100644 --- a/epan/dissectors/packet-rlm.c +++ b/epan/dissectors/packet-rlm.c @@ -51,9 +51,8 @@ # include "config.h" #endif -#include - #include + #include #include diff --git a/epan/dissectors/packet-rmi.c b/epan/dissectors/packet-rmi.c index 5840c39f7c..9fb34e149f 100644 --- a/epan/dissectors/packet-rmi.c +++ b/epan/dissectors/packet-rmi.c @@ -27,7 +27,6 @@ # include "config.h" #endif -#include #include #include diff --git a/epan/dissectors/packet-rmt-alc.c b/epan/dissectors/packet-rmt-alc.c index 09b44e09ad..7c1850d5eb 100644 --- a/epan/dissectors/packet-rmt-alc.c +++ b/epan/dissectors/packet-rmt-alc.c @@ -42,7 +42,6 @@ # include "config.h" #endif -#include #include #include diff --git a/epan/dissectors/packet-rmt-common.c b/epan/dissectors/packet-rmt-common.c index e0b12d7567..c65b8f7029 100644 --- a/epan/dissectors/packet-rmt-common.c +++ b/epan/dissectors/packet-rmt-common.c @@ -28,7 +28,6 @@ # include "config.h" #endif -#include #include #include diff --git a/epan/dissectors/packet-rmt-fec.c b/epan/dissectors/packet-rmt-fec.c index 440f027527..aa45702952 100644 --- a/epan/dissectors/packet-rmt-fec.c +++ b/epan/dissectors/packet-rmt-fec.c @@ -42,8 +42,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-rmt-lct.c b/epan/dissectors/packet-rmt-lct.c index c8e96b31a7..d5799c8d7f 100644 --- a/epan/dissectors/packet-rmt-lct.c +++ b/epan/dissectors/packet-rmt-lct.c @@ -42,8 +42,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-rmt-norm.c b/epan/dissectors/packet-rmt-norm.c index 58d0072a6c..02e1c4e8e4 100644 --- a/epan/dissectors/packet-rmt-norm.c +++ b/epan/dissectors/packet-rmt-norm.c @@ -43,7 +43,6 @@ # include "config.h" #endif -#include #include #include @@ -59,38 +58,38 @@ /* String tables */ static const value_string string_norm_type[] = { - { NORM_INFO, "INFO" }, - { NORM_DATA, "DATA" }, - { NORM_CMD, "CMD" }, - { NORM_NACK, "NACK" }, - { NORM_ACK, "ACK" }, + { NORM_INFO, "INFO" }, + { NORM_DATA, "DATA" }, + { NORM_CMD, "CMD" }, + { NORM_NACK, "NACK" }, + { NORM_ACK, "ACK" }, { NORM_REPORT, "REPORT" }, { 0, NULL } }; static const value_string string_norm_cmd_type[] = { - { NORM_CMD_FLUSH, "FLUSH" }, - { NORM_CMD_EOT, "EOT" }, - { NORM_CMD_SQUELCH, "SQUELCH" }, - { NORM_CMD_CC, "CC" }, - { NORM_CMD_REPAIR_ADV, "REPAIR_ADV" }, - { NORM_CMD_ACK_REQ, "ACK_REQ" }, + { NORM_CMD_FLUSH, "FLUSH" }, + { NORM_CMD_EOT, "EOT" }, + { NORM_CMD_SQUELCH, "SQUELCH" }, + { NORM_CMD_CC, "CC" }, + { NORM_CMD_REPAIR_ADV, "REPAIR_ADV" }, + { NORM_CMD_ACK_REQ, "ACK_REQ" }, { NORM_CMD_APPLICATION, "APPLICATION" }, { 0, NULL } }; static const value_string string_norm_ack_type[] = { - { NORM_ACK_CC, "ACK CC" }, + { NORM_ACK_CC, "ACK CC" }, { NORM_ACK_FLUSH, "ACK FLUSH" }, { 0, NULL } }; static const value_string string_norm_nack_form[] = { - { NORM_NACK_ITEMS, "Items" }, - { NORM_NACK_RANGES, "Ranges" }, + { NORM_NACK_ITEMS, "Items" }, + { NORM_NACK_RANGES, "Ranges" }, { NORM_NACK_ERASURES, "Erasures" }, { 0, NULL } }; diff --git a/epan/dissectors/packet-rsh.c b/epan/dissectors/packet-rsh.c index 683a49c0b0..478e6f5907 100644 --- a/epan/dissectors/packet-rsh.c +++ b/epan/dissectors/packet-rsh.c @@ -32,15 +32,13 @@ # include "config.h" #endif -#include - -#include -#include #include +#include + +#include #include #include -#include #include #include diff --git a/epan/dissectors/packet-rsync.c b/epan/dissectors/packet-rsync.c index 7e44e0cee6..c7b6b30d21 100644 --- a/epan/dissectors/packet-rsync.c +++ b/epan/dissectors/packet-rsync.c @@ -28,10 +28,8 @@ # include "config.h" #endif -#include - #include -#include + #include #include diff --git a/epan/dissectors/packet-rtnet.c b/epan/dissectors/packet-rtnet.c index 951df552f0..ff8849bf31 100644 --- a/epan/dissectors/packet-rtnet.c +++ b/epan/dissectors/packet-rtnet.c @@ -31,11 +31,8 @@ #include "config.h" #endif -#include -#include -#include - #include + #include #include #include diff --git a/epan/dissectors/packet-sccpmg.c b/epan/dissectors/packet-sccpmg.c index 049205a92b..02a5d0d787 100644 --- a/epan/dissectors/packet-sccpmg.c +++ b/epan/dissectors/packet-sccpmg.c @@ -37,8 +37,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-sita.c b/epan/dissectors/packet-sita.c index f5964e988c..bea11cb2b1 100644 --- a/epan/dissectors/packet-sita.c +++ b/epan/dissectors/packet-sita.c @@ -25,279 +25,381 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* Use tabstops = 4 */ +/* Use indentation = 4 */ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include #include + #include + #include #include #include -static dissector_table_t sita_dissector_table; -static dissector_handle_t data_handle; -static gint ett_sita = -1; -static gint ett_sita_flags = -1; -static gint ett_sita_signals = -1; -static gint ett_sita_errors1 = -1; -static gint ett_sita_errors2 = -1; -static int proto_sita = -1; /* Initialize the protocol and registered fields */ -static int hf_dir = -1; -static int hf_framing = -1; -static int hf_parity = -1; -static int hf_collision = -1; -static int hf_longframe = -1; -static int hf_shortframe = -1; -static int hf_droppedframe = -1; -static int hf_nonaligned = -1; -static int hf_abort = -1; -static int hf_lostcd = -1; -static int hf_lostcts = -1; -static int hf_rxdpll = -1; -static int hf_overrun = -1; -static int hf_length = -1; -static int hf_crc = -1; -static int hf_break = -1; -static int hf_underrun = -1; -static int hf_uarterror = -1; -static int hf_rtxlimit = -1; -static int hf_proto = -1; -static int hf_dsr = -1; -static int hf_dtr = -1; -static int hf_cts = -1; -static int hf_rts = -1; -static int hf_dcd = -1; - -#define MAX_FLAGS_LEN 64 /* max size of a 'flags' decoded string */ -#define IOP "Local" -#define REMOTE "Remote" +static dissector_table_t sita_dissector_table; +static dissector_handle_t data_handle; +static gint ett_sita = -1; +static gint ett_sita_flags = -1; +static gint ett_sita_signals = -1; +static gint ett_sita_errors1 = -1; +static gint ett_sita_errors2 = -1; +static int proto_sita = -1; /* Initialize the protocol and registered fields */ +static int hf_dir = -1; +static int hf_framing = -1; +static int hf_parity = -1; +static int hf_collision = -1; +static int hf_longframe = -1; +static int hf_shortframe = -1; +static int hf_droppedframe = -1; +static int hf_nonaligned = -1; +static int hf_abort = -1; +static int hf_lostcd = -1; +static int hf_lostcts = -1; +static int hf_rxdpll = -1; +static int hf_overrun = -1; +static int hf_length = -1; +static int hf_crc = -1; +static int hf_break = -1; +static int hf_underrun = -1; +static int hf_uarterror = -1; +static int hf_rtxlimit = -1; +static int hf_proto = -1; +static int hf_dsr = -1; +static int hf_dtr = -1; +static int hf_cts = -1; +static int hf_rts = -1; +static int hf_dcd = -1; + +#define MAX_FLAGS_LEN 64 /* max size of a 'flags' decoded string */ +#define IOP "Local" +#define REMOTE "Remote" static gchar * format_flags_string(guchar value, const gchar *array[]) { - int i; - guint bpos; - emem_strbuf_t *buf; - const char *sep = ""; - - buf = ep_strbuf_sized_new(MAX_FLAGS_LEN, MAX_FLAGS_LEN); - for (i = 0; i < 8; i++) { - bpos = 1 << i; - if (value & bpos) { - if (array[i][0]) { - /* there is a string to emit... */ - ep_strbuf_append_printf(buf, "%s%s", sep, - array[i]); - sep = ", "; - } - } - } - return buf->str; + int i; + guint bpos; + emem_strbuf_t *buf; + const char *sep = ""; + + buf = ep_strbuf_sized_new(MAX_FLAGS_LEN, MAX_FLAGS_LEN); + for (i = 0; i < 8; i++) { + bpos = 1 << i; + if (value & bpos) { + if (array[i][0]) { + /* there is a string to emit... */ + ep_strbuf_append_printf(buf, "%s%s", sep, + array[i]); + sep = ", "; + } + } + } + return buf->str; } static void dissect_sita(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_item *ti; - guchar flags, signals, errors1, errors2, proto; - gchar *errors1_string, *errors2_string, *signals_string, *flags_string; - proto_tree *sita_tree = NULL; - proto_tree *sita_flags_tree = NULL; - proto_tree *sita_errors1_tree = NULL; - proto_tree *sita_errors2_tree = NULL; - proto_tree *sita_signals_tree = NULL; - const gchar *rx_errors1_str[] = {"Framing", "Parity", "Collision", "Long-frame", "Short-frame", "", "", "" }; - const gchar *rx_errors2_str[] = {"Non-Aligned", "Abort", "CD-lost", "DPLL", "Overrun", "Length", "CRC", "Break" }; - /*const gchar *tx_errors1_str[] = {"", "", "", "", "", "", "", "" }; */ - const gchar *tx_errors2_str[] = {"Underrun", "CTS-lost", "UART", "ReTx-limit", "", "", "", "" }; - const gchar *signals_str[] = {"DSR", "DTR", "CTS", "RTS", "DCD", "", "", "" }; - const gchar *flags_str[] = {"", "", "", "", "", "", "", "No-buffers" }; - - col_clear(pinfo->cinfo, COL_PROTOCOL); /* erase the protocol */ - col_clear(pinfo->cinfo, COL_INFO); /* and info columns so that the next decoder can fill them in */ - - flags = pinfo->pseudo_header->sita.sita_flags; - signals = pinfo->pseudo_header->sita.sita_signals; - errors1 = pinfo->pseudo_header->sita.sita_errors1; - errors2 = pinfo->pseudo_header->sita.sita_errors2; - proto = pinfo->pseudo_header->sita.sita_proto; - - if (check_col(pinfo->cinfo, COL_DEF_SRC)) { - if ((flags & SITA_FRAME_DIR) == SITA_FRAME_DIR_TXED) { - col_set_str(pinfo->cinfo, COL_DEF_SRC, IOP); /* set the source (direction) column accordingly */ - } else { - col_set_str(pinfo->cinfo, COL_DEF_SRC, REMOTE); - } - } - - if (check_col(pinfo->cinfo, COL_INFO)) - col_set_str(pinfo->cinfo, COL_INFO, ""); - - if (tree) { - ti = proto_tree_add_protocol_format(tree, proto_sita, tvb, 0, 0, "Link Layer"); - sita_tree = proto_item_add_subtree(ti, ett_sita); - - proto_tree_add_uint(sita_tree, hf_proto, tvb, 0, 0, proto); - - flags_string = format_flags_string(flags, flags_str); - ti = proto_tree_add_text(sita_tree, tvb, 0, 0, "Flags: 0x%02x (From %s)%s%s", - flags, - ((flags & SITA_FRAME_DIR) == SITA_FRAME_DIR_TXED) ? IOP : REMOTE, - strlen(flags_string) ? ", " : "", - flags_string); - sita_flags_tree = proto_item_add_subtree(ti, ett_sita_flags); - proto_tree_add_boolean(sita_flags_tree, hf_droppedframe, tvb, 0, 0, flags); - proto_tree_add_boolean(sita_flags_tree, hf_dir, tvb, 0, 0, flags); - - signals_string = format_flags_string(signals, signals_str); - ti = proto_tree_add_text(sita_tree, tvb, 0, 0, "Signals: 0x%02x %s", signals, signals_string); - sita_signals_tree = proto_item_add_subtree(ti, ett_sita_signals); - proto_tree_add_boolean(sita_signals_tree, hf_dcd, tvb, 0, 0, signals); - proto_tree_add_boolean(sita_signals_tree, hf_rts, tvb, 0, 0, signals); - proto_tree_add_boolean(sita_signals_tree, hf_cts, tvb, 0, 0, signals); - proto_tree_add_boolean(sita_signals_tree, hf_dtr, tvb, 0, 0, signals); - proto_tree_add_boolean(sita_signals_tree, hf_dsr, tvb, 0, 0, signals); - - if ((flags & SITA_FRAME_DIR) == SITA_FRAME_DIR_RXED) { - errors1_string = format_flags_string(errors1, rx_errors1_str); - ti = proto_tree_add_text(sita_tree, tvb, 0, 0, "Receive Status: 0x%02x %s", errors1, errors1_string); - sita_errors1_tree = proto_item_add_subtree(ti, ett_sita_errors1); - proto_tree_add_boolean(sita_errors1_tree, hf_shortframe, tvb, 0, 0, errors1); - proto_tree_add_boolean(sita_errors1_tree, hf_longframe, tvb, 0, 0, errors1); - proto_tree_add_boolean(sita_errors1_tree, hf_collision, tvb, 0, 0, errors1); - proto_tree_add_boolean(sita_errors1_tree, hf_parity, tvb, 0, 0, errors1); - proto_tree_add_boolean(sita_errors1_tree, hf_framing, tvb, 0, 0, errors1); - - errors2_string = format_flags_string(errors2, rx_errors2_str); - ti = proto_tree_add_text(sita_tree, tvb, 0, 0, "Receive Status: 0x%02x %s", errors2, errors2_string); - sita_errors2_tree = proto_item_add_subtree(ti, ett_sita_errors2); - proto_tree_add_boolean(sita_errors2_tree, hf_break, tvb, 0, 0, errors2); - proto_tree_add_boolean(sita_errors2_tree, hf_crc, tvb, 0, 0, errors2); - proto_tree_add_boolean(sita_errors2_tree, hf_length, tvb, 0, 0, errors2); - proto_tree_add_boolean(sita_errors2_tree, hf_overrun, tvb, 0, 0, errors2); - proto_tree_add_boolean(sita_errors2_tree, hf_rxdpll, tvb, 0, 0, errors2); - proto_tree_add_boolean(sita_errors2_tree, hf_lostcd, tvb, 0, 0, errors2); - proto_tree_add_boolean(sita_errors2_tree, hf_abort, tvb, 0, 0, errors2); - proto_tree_add_boolean(sita_errors2_tree, hf_nonaligned, tvb, 0, 0, errors2); - } else { - errors2_string = format_flags_string(errors2, tx_errors2_str); - ti = proto_tree_add_text(sita_tree, tvb, 0, 0, "Transmit Status: 0x%02x %s", errors2, errors2_string); - sita_errors1_tree = proto_item_add_subtree(ti, ett_sita_errors1); - proto_tree_add_boolean(sita_errors1_tree, hf_rtxlimit, tvb, 0, 0, errors2); - proto_tree_add_boolean(sita_errors1_tree, hf_uarterror, tvb, 0, 0, errors2); - proto_tree_add_boolean(sita_errors1_tree, hf_lostcts, tvb, 0, 0, errors2); - proto_tree_add_boolean(sita_errors1_tree, hf_underrun, tvb, 0, 0, errors2); - } - } - - if (!dissector_try_uint(sita_dissector_table, pinfo->pseudo_header->sita.sita_proto, tvb, pinfo, tree)) { /* try to find and run an applicable dissector */ - if (check_col(pinfo->cinfo, COL_PROTOCOL)) /* if one can't be found... tell them we don't */ - col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNKNOWN"); /* know how to decode this protocol */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "IOP protocol number: %u", pinfo->pseudo_header->sita.sita_proto); /* and give them the details then */ - call_dissector(data_handle, tvb, pinfo, tree); /* call the generic (hex display) decoder instead */ - } + proto_item *ti; + guchar flags, signals, errors1, errors2, proto; + gchar *errors1_string, *errors2_string, *signals_string, *flags_string; + proto_tree *sita_tree = NULL; + proto_tree *sita_flags_tree = NULL; + proto_tree *sita_errors1_tree = NULL; + proto_tree *sita_errors2_tree = NULL; + proto_tree *sita_signals_tree = NULL; + const gchar *rx_errors1_str[] = {"Framing", "Parity", "Collision", "Long-frame", "Short-frame", "", "", "" }; + const gchar *rx_errors2_str[] = {"Non-Aligned", "Abort", "CD-lost", "DPLL", "Overrun", "Length", "CRC", "Break" }; + /*const gchar *tx_errors1_str[] = {"", "", "", "", "", "", "", "" }; */ + const gchar *tx_errors2_str[] = {"Underrun", "CTS-lost", "UART", "ReTx-limit", "", "", "", "" }; + const gchar *signals_str[] = {"DSR", "DTR", "CTS", "RTS", "DCD", "", "", "" }; + const gchar *flags_str[] = {"", "", "", "", "", "", "", "No-buffers" }; + + col_clear(pinfo->cinfo, COL_PROTOCOL); /* erase the protocol */ + col_clear(pinfo->cinfo, COL_INFO); /* and info columns so that the next decoder can fill them in */ + + flags = pinfo->pseudo_header->sita.sita_flags; + signals = pinfo->pseudo_header->sita.sita_signals; + errors1 = pinfo->pseudo_header->sita.sita_errors1; + errors2 = pinfo->pseudo_header->sita.sita_errors2; + proto = pinfo->pseudo_header->sita.sita_proto; + + if (check_col(pinfo->cinfo, COL_DEF_SRC)) { + if ((flags & SITA_FRAME_DIR) == SITA_FRAME_DIR_TXED) { + col_set_str(pinfo->cinfo, COL_DEF_SRC, IOP); /* set the source (direction) column accordingly */ + } else { + col_set_str(pinfo->cinfo, COL_DEF_SRC, REMOTE); + } + } + + if (check_col(pinfo->cinfo, COL_INFO)) + col_set_str(pinfo->cinfo, COL_INFO, ""); + + if (tree) { + ti = proto_tree_add_protocol_format(tree, proto_sita, tvb, 0, 0, "Link Layer"); + sita_tree = proto_item_add_subtree(ti, ett_sita); + + proto_tree_add_uint(sita_tree, hf_proto, tvb, 0, 0, proto); + + flags_string = format_flags_string(flags, flags_str); + ti = proto_tree_add_text(sita_tree, tvb, 0, 0, "Flags: 0x%02x (From %s)%s%s", + flags, + ((flags & SITA_FRAME_DIR) == SITA_FRAME_DIR_TXED) ? IOP : REMOTE, + strlen(flags_string) ? ", " : "", + flags_string); + sita_flags_tree = proto_item_add_subtree(ti, ett_sita_flags); + proto_tree_add_boolean(sita_flags_tree, hf_droppedframe, tvb, 0, 0, flags); + proto_tree_add_boolean(sita_flags_tree, hf_dir, tvb, 0, 0, flags); + + signals_string = format_flags_string(signals, signals_str); + ti = proto_tree_add_text(sita_tree, tvb, 0, 0, "Signals: 0x%02x %s", signals, signals_string); + sita_signals_tree = proto_item_add_subtree(ti, ett_sita_signals); + proto_tree_add_boolean(sita_signals_tree, hf_dcd, tvb, 0, 0, signals); + proto_tree_add_boolean(sita_signals_tree, hf_rts, tvb, 0, 0, signals); + proto_tree_add_boolean(sita_signals_tree, hf_cts, tvb, 0, 0, signals); + proto_tree_add_boolean(sita_signals_tree, hf_dtr, tvb, 0, 0, signals); + proto_tree_add_boolean(sita_signals_tree, hf_dsr, tvb, 0, 0, signals); + + if ((flags & SITA_FRAME_DIR) == SITA_FRAME_DIR_RXED) { + errors1_string = format_flags_string(errors1, rx_errors1_str); + ti = proto_tree_add_text(sita_tree, tvb, 0, 0, "Receive Status: 0x%02x %s", errors1, errors1_string); + sita_errors1_tree = proto_item_add_subtree(ti, ett_sita_errors1); + proto_tree_add_boolean(sita_errors1_tree, hf_shortframe, tvb, 0, 0, errors1); + proto_tree_add_boolean(sita_errors1_tree, hf_longframe, tvb, 0, 0, errors1); + proto_tree_add_boolean(sita_errors1_tree, hf_collision, tvb, 0, 0, errors1); + proto_tree_add_boolean(sita_errors1_tree, hf_parity, tvb, 0, 0, errors1); + proto_tree_add_boolean(sita_errors1_tree, hf_framing, tvb, 0, 0, errors1); + + errors2_string = format_flags_string(errors2, rx_errors2_str); + ti = proto_tree_add_text(sita_tree, tvb, 0, 0, "Receive Status: 0x%02x %s", errors2, errors2_string); + sita_errors2_tree = proto_item_add_subtree(ti, ett_sita_errors2); + proto_tree_add_boolean(sita_errors2_tree, hf_break, tvb, 0, 0, errors2); + proto_tree_add_boolean(sita_errors2_tree, hf_crc, tvb, 0, 0, errors2); + proto_tree_add_boolean(sita_errors2_tree, hf_length, tvb, 0, 0, errors2); + proto_tree_add_boolean(sita_errors2_tree, hf_overrun, tvb, 0, 0, errors2); + proto_tree_add_boolean(sita_errors2_tree, hf_rxdpll, tvb, 0, 0, errors2); + proto_tree_add_boolean(sita_errors2_tree, hf_lostcd, tvb, 0, 0, errors2); + proto_tree_add_boolean(sita_errors2_tree, hf_abort, tvb, 0, 0, errors2); + proto_tree_add_boolean(sita_errors2_tree, hf_nonaligned, tvb, 0, 0, errors2); + } else { + errors2_string = format_flags_string(errors2, tx_errors2_str); + ti = proto_tree_add_text(sita_tree, tvb, 0, 0, "Transmit Status: 0x%02x %s", errors2, errors2_string); + sita_errors1_tree = proto_item_add_subtree(ti, ett_sita_errors1); + proto_tree_add_boolean(sita_errors1_tree, hf_rtxlimit, tvb, 0, 0, errors2); + proto_tree_add_boolean(sita_errors1_tree, hf_uarterror, tvb, 0, 0, errors2); + proto_tree_add_boolean(sita_errors1_tree, hf_lostcts, tvb, 0, 0, errors2); + proto_tree_add_boolean(sita_errors1_tree, hf_underrun, tvb, 0, 0, errors2); + } + } + + /* try to find and run an applicable dissector */ + if (!dissector_try_uint(sita_dissector_table, pinfo->pseudo_header->sita.sita_proto, tvb, pinfo, tree)) { + if (check_col(pinfo->cinfo, COL_PROTOCOL)) /* if one can't be found... tell them we don't */ + col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNKNOWN"); /* know how to decode this protocol */ + if (check_col(pinfo->cinfo, COL_INFO)) /* and give them the details then */ + col_add_fstr(pinfo->cinfo, COL_INFO, "IOP protocol number: %u", pinfo->pseudo_header->sita.sita_proto); + call_dissector(data_handle, tvb, pinfo, tree); /* call the generic (hex display) decoder instead */ + } } -static const true_false_string tfs_sita_flags = { "From Remote", "From Local" }; -static const true_false_string tfs_sita_error = { "Error", "" }; -static const true_false_string tfs_sita_violation = { "Violation", "" }; -static const true_false_string tfs_sita_received = { "Received", "" }; -static const true_false_string tfs_sita_lost = { "Lost", "" }; -static const true_false_string tfs_sita_exceeded = { "Exceeded", "" }; -static const true_false_string tfs_sita_on_off = { "On", "Off" }; +static const true_false_string tfs_sita_flags = { "From Remote", "From Local" }; +static const true_false_string tfs_sita_error = { "Error", "" }; +static const true_false_string tfs_sita_violation = { "Violation", "" }; +static const true_false_string tfs_sita_received = { "Received", "" }; +static const true_false_string tfs_sita_lost = { "Lost", "" }; +static const true_false_string tfs_sita_exceeded = { "Exceeded", "" }; +static const true_false_string tfs_sita_on_off = { "On", "Off" }; static const value_string tfs_sita_proto[] = { - { SITA_PROTO_UNUSED, "Unused" }, - { SITA_PROTO_BOP_LAPB, "LAPB" }, - { SITA_PROTO_ETHERNET, "Ethernet" }, - { SITA_PROTO_ASYNC_INTIO, "Async (Interrupt I/O)" }, - { SITA_PROTO_ASYNC_BLKIO, "Async (Block I/O)" }, - { SITA_PROTO_ALC, "IPARS" }, - { SITA_PROTO_UTS, "UTS" }, - { SITA_PROTO_PPP_HDLC, "PPP/HDLC" }, - { SITA_PROTO_SDLC, "SDLC" }, - { SITA_PROTO_TOKENRING, "Token Ring" }, - { SITA_PROTO_I2C, "I2C" }, - { SITA_PROTO_DPM_LINK, "DPM Link" }, - { SITA_PROTO_BOP_FRL, "Frame Relay" }, - { 0, NULL } + { SITA_PROTO_UNUSED, "Unused" }, + { SITA_PROTO_BOP_LAPB, "LAPB" }, + { SITA_PROTO_ETHERNET, "Ethernet" }, + { SITA_PROTO_ASYNC_INTIO, "Async (Interrupt I/O)" }, + { SITA_PROTO_ASYNC_BLKIO, "Async (Block I/O)" }, + { SITA_PROTO_ALC, "IPARS" }, + { SITA_PROTO_UTS, "UTS" }, + { SITA_PROTO_PPP_HDLC, "PPP/HDLC" }, + { SITA_PROTO_SDLC, "SDLC" }, + { SITA_PROTO_TOKENRING, "Token Ring" }, + { SITA_PROTO_I2C, "I2C" }, + { SITA_PROTO_DPM_LINK, "DPM Link" }, + { SITA_PROTO_BOP_FRL, "Frame Relay" }, + { 0, NULL } }; void proto_register_sita(void) { - static hf_register_info hf[] = { - { &hf_proto, { "Protocol", "sita.errors.protocol", FT_UINT8, BASE_HEX, VALS(tfs_sita_proto), 0, "Protocol value", HFILL }}, - - { &hf_dir, { "Direction", "sita.flags.flags", FT_BOOLEAN, 8, TFS(&tfs_sita_flags), SITA_FRAME_DIR, "TRUE 'from Remote', FALSE 'from Local'", HFILL }}, - { &hf_droppedframe, { "No Buffers", "sita.flags.droppedframe", FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_NO_BUFFER, "TRUE if Buffer Failure", HFILL }}, - - { &hf_framing, { "Framing", "sita.errors.framing", FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_RX_FRAMING, "TRUE if Framing Error", HFILL }}, - { &hf_parity, { "Parity", "sita.errors.parity", FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_RX_PARITY, "TRUE if Parity Error", HFILL }}, - { &hf_collision, { "Collision", "sita.errors.collision", FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_RX_COLLISION, "TRUE if Collision", HFILL }}, - { &hf_longframe, { "Long Frame", "sita.errors.longframe", FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_RX_FRAME_LONG, "TRUE if Long Frame Received", HFILL }}, - { &hf_shortframe, { "Short Frame", "sita.errors.shortframe", FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_RX_FRAME_SHORT, "TRUE if Short Frame", HFILL }}, - { &hf_nonaligned, { "NonAligned", "sita.errors.nonaligned", FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_RX_NONOCTET_ALIGNED, "TRUE if NonAligned Frame", HFILL }}, - { &hf_abort, { "Abort", "sita.errors.abort", FT_BOOLEAN, 8, TFS(&tfs_sita_received), SITA_ERROR_RX_ABORT, "TRUE if Abort Received", HFILL }}, - { &hf_lostcd, { "Carrier", "sita.errors.lostcd", FT_BOOLEAN, 8, TFS(&tfs_sita_lost), SITA_ERROR_RX_CD_LOST, "TRUE if Carrier Lost", HFILL }}, - { &hf_rxdpll, { "DPLL", "sita.errors.rxdpll", FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_RX_DPLL, "TRUE if DPLL Error", HFILL }}, - { &hf_overrun, { "Overrun", "sita.errors.overrun", FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_RX_OVERRUN, "TRUE if Overrun Error", HFILL }}, - { &hf_length, { "Length", "sita.errors.length", FT_BOOLEAN, 8, TFS(&tfs_sita_violation),SITA_ERROR_RX_FRAME_LEN_VIOL, "TRUE if Length Violation", HFILL }}, - { &hf_crc, { "CRC", "sita.errors.crc", FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_RX_CRC, "TRUE if CRC Error", HFILL }}, - { &hf_break, { "Break", "sita.errors.break", FT_BOOLEAN, 8, TFS(&tfs_sita_received), SITA_ERROR_RX_BREAK, "TRUE if Break Received", HFILL }}, - - { &hf_underrun, { "Underrun", "sita.errors.underrun", FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_TX_UNDERRUN, "TRUE if Tx Underrun", HFILL }}, - { &hf_lostcts, { "Clear To Send", "sita.errors.lostcts", FT_BOOLEAN, 8, TFS(&tfs_sita_lost), SITA_ERROR_TX_CTS_LOST, "TRUE if Clear To Send Lost", HFILL }}, - { &hf_uarterror, { "UART", "sita.errors.uarterror", FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_TX_UART_ERROR, "TRUE if UART Error", HFILL }}, - { &hf_rtxlimit, { "Retx Limit", "sita.errors.rtxlimit", FT_BOOLEAN, 8, TFS(&tfs_sita_exceeded), SITA_ERROR_TX_RETX_LIMIT, "TRUE if Retransmit Limit reached", HFILL }}, - - { &hf_dsr, { "DSR", "sita.signals.dsr", FT_BOOLEAN, 8, TFS(&tfs_sita_on_off), SITA_SIG_DSR, "TRUE if Data Set Ready", HFILL }}, - { &hf_dtr, { "DTR", "sita.signals.dtr", FT_BOOLEAN, 8, TFS(&tfs_sita_on_off), SITA_SIG_DTR, "TRUE if Data Terminal Ready", HFILL }}, - { &hf_cts, { "CTS", "sita.signals.cts", FT_BOOLEAN, 8, TFS(&tfs_sita_on_off), SITA_SIG_CTS, "TRUE if Clear To Send", HFILL }}, - { &hf_rts, { "RTS", "sita.signals.rts", FT_BOOLEAN, 8, TFS(&tfs_sita_on_off), SITA_SIG_RTS, "TRUE if Request To Send", HFILL }}, - { &hf_dcd, { "DCD", "sita.signals.dcd", FT_BOOLEAN, 8, TFS(&tfs_sita_on_off), SITA_SIG_DCD, "TRUE if Data Carrier Detect", HFILL }}, - - }; - - static gint *ett[] = { - &ett_sita, - &ett_sita_flags, - &ett_sita_signals, - &ett_sita_errors1, - &ett_sita_errors2, - }; - - proto_sita = proto_register_protocol("Societe Internationale de Telecommunications Aeronautiques", "SITA", "sita"); /* name, short name,abbreviation */ - sita_dissector_table = register_dissector_table("sita.proto", "SITA protocol number", FT_UINT8, BASE_HEX); - proto_register_field_array(proto_sita, hf, array_length(hf)); - proto_register_subtree_array(ett, array_length(ett)); - register_dissector("sita", dissect_sita, proto_sita); + static hf_register_info hf[] = { + { &hf_proto, + { "Protocol", "sita.errors.protocol", + FT_UINT8, BASE_HEX, VALS(tfs_sita_proto), 0, + "Protocol value", HFILL } + }, + + { &hf_dir, + { "Direction", "sita.flags.flags", + FT_BOOLEAN, 8, TFS(&tfs_sita_flags), SITA_FRAME_DIR, + "TRUE 'from Remote', FALSE 'from Local'", HFILL } + }, + { &hf_droppedframe, + { "No Buffers", "sita.flags.droppedframe", + FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_NO_BUFFER, + "TRUE if Buffer Failure", HFILL } + }, + + { &hf_framing, + { "Framing", "sita.errors.framing", + FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_RX_FRAMING, + "TRUE if Framing Error", HFILL } + }, + { &hf_parity, + { "Parity", "sita.errors.parity", + FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_RX_PARITY, + "TRUE if Parity Error", HFILL } + }, + { &hf_collision, + { "Collision", "sita.errors.collision", + FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_RX_COLLISION, + "TRUE if Collision", HFILL } + }, + { &hf_longframe, + { "Long Frame", "sita.errors.longframe", + FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_RX_FRAME_LONG, + "TRUE if Long Frame Received", HFILL } + }, + { &hf_shortframe, + { "Short Frame", "sita.errors.shortframe", + FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_RX_FRAME_SHORT, + "TRUE if Short Frame", HFILL } + }, + { &hf_nonaligned, + { "NonAligned", "sita.errors.nonaligned", + FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_RX_NONOCTET_ALIGNED, + "TRUE if NonAligned Frame", HFILL } + }, + { &hf_abort, + { "Abort", "sita.errors.abort", + FT_BOOLEAN, 8, TFS(&tfs_sita_received), SITA_ERROR_RX_ABORT, + "TRUE if Abort Received", HFILL } + }, + { &hf_lostcd, + { "Carrier", "sita.errors.lostcd", + FT_BOOLEAN, 8, TFS(&tfs_sita_lost), SITA_ERROR_RX_CD_LOST, + "TRUE if Carrier Lost", HFILL } + }, + { &hf_rxdpll, + { "DPLL", "sita.errors.rxdpll", + FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_RX_DPLL, + "TRUE if DPLL Error", HFILL } + }, + { &hf_overrun, + { "Overrun", "sita.errors.overrun", + FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_RX_OVERRUN, + "TRUE if Overrun Error", HFILL } + }, + { &hf_length, + { "Length", "sita.errors.length", + FT_BOOLEAN, 8, TFS(&tfs_sita_violation), SITA_ERROR_RX_FRAME_LEN_VIOL, + "TRUE if Length Violation", HFILL } + }, + { &hf_crc, + { "CRC", "sita.errors.crc", + FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_RX_CRC, + "TRUE if CRC Error", HFILL } + }, + { &hf_break, + { "Break", "sita.errors.break", + FT_BOOLEAN, 8, TFS(&tfs_sita_received), SITA_ERROR_RX_BREAK, + "TRUE if Break Received", HFILL } + }, + + { &hf_underrun, + { "Underrun", "sita.errors.underrun", + FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_TX_UNDERRUN, + "TRUE if Tx Underrun", HFILL } + }, + { &hf_lostcts, + { "Clear To Send", "sita.errors.lostcts", + FT_BOOLEAN, 8, TFS(&tfs_sita_lost), SITA_ERROR_TX_CTS_LOST, + "TRUE if Clear To Send Lost", HFILL } + }, + { &hf_uarterror, + { "UART", "sita.errors.uarterror", + FT_BOOLEAN, 8, TFS(&tfs_sita_error), SITA_ERROR_TX_UART_ERROR, + "TRUE if UART Error", HFILL } + }, + { &hf_rtxlimit, + { "Retx Limit", "sita.errors.rtxlimit", + FT_BOOLEAN, 8, TFS(&tfs_sita_exceeded), SITA_ERROR_TX_RETX_LIMIT, + "TRUE if Retransmit Limit reached", HFILL } + }, + + { &hf_dsr, + { "DSR", "sita.signals.dsr", + FT_BOOLEAN, 8, TFS(&tfs_sita_on_off), SITA_SIG_DSR, + "TRUE if Data Set Ready", HFILL } + }, + { &hf_dtr, + { "DTR", "sita.signals.dtr", + FT_BOOLEAN, 8, TFS(&tfs_sita_on_off), SITA_SIG_DTR, + "TRUE if Data Terminal Ready", HFILL } + }, + { &hf_cts, + { "CTS", "sita.signals.cts", + FT_BOOLEAN, 8, TFS(&tfs_sita_on_off), SITA_SIG_CTS, + "TRUE if Clear To Send", HFILL } + }, + { &hf_rts, + { "RTS", "sita.signals.rts", + FT_BOOLEAN, 8, TFS(&tfs_sita_on_off), SITA_SIG_RTS, + "TRUE if Request To Send", HFILL } + }, + { &hf_dcd, + { "DCD", "sita.signals.dcd", + FT_BOOLEAN, 8, TFS(&tfs_sita_on_off), SITA_SIG_DCD, + "TRUE if Data Carrier Detect", HFILL } + }, + + }; + + static gint *ett[] = { + &ett_sita, + &ett_sita_flags, + &ett_sita_signals, + &ett_sita_errors1, + &ett_sita_errors2, + }; + + proto_sita = proto_register_protocol("Societe Internationale de Telecommunications Aeronautiques", "SITA", "sita"); /* name, short name,abbreviation */ + sita_dissector_table = register_dissector_table("sita.proto", "SITA protocol number", FT_UINT8, BASE_HEX); + proto_register_field_array(proto_sita, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + register_dissector("sita", dissect_sita, proto_sita); } void proto_reg_handoff_sita(void) { - dissector_handle_t lapb_handle; - dissector_handle_t frame_relay_handle; - dissector_handle_t uts_handle; - dissector_handle_t ipars_handle; - dissector_handle_t sita_handle; - - lapb_handle = find_dissector("lapb"); - frame_relay_handle = find_dissector("fr"); - uts_handle = find_dissector("uts"); - ipars_handle = find_dissector("ipars"); - sita_handle = find_dissector("sita"); - data_handle = find_dissector("data"); - - dissector_add_uint("sita.proto", SITA_PROTO_BOP_LAPB, lapb_handle); - dissector_add_uint("sita.proto", SITA_PROTO_BOP_FRL, frame_relay_handle); - dissector_add_uint("sita.proto", SITA_PROTO_UTS, uts_handle); - dissector_add_uint("sita.proto", SITA_PROTO_ALC, ipars_handle); - dissector_add_uint("wtap_encap", WTAP_ENCAP_SITA, sita_handle); + dissector_handle_t lapb_handle; + dissector_handle_t frame_relay_handle; + dissector_handle_t uts_handle; + dissector_handle_t ipars_handle; + dissector_handle_t sita_handle; + + lapb_handle = find_dissector("lapb"); + frame_relay_handle = find_dissector("fr"); + uts_handle = find_dissector("uts"); + ipars_handle = find_dissector("ipars"); + sita_handle = find_dissector("sita"); + data_handle = find_dissector("data"); + + dissector_add_uint("sita.proto", SITA_PROTO_BOP_LAPB, lapb_handle); + dissector_add_uint("sita.proto", SITA_PROTO_BOP_FRL, frame_relay_handle); + dissector_add_uint("sita.proto", SITA_PROTO_UTS, uts_handle); + dissector_add_uint("sita.proto", SITA_PROTO_ALC, ipars_handle); + dissector_add_uint("wtap_encap", WTAP_ENCAP_SITA, sita_handle); } diff --git a/epan/dissectors/packet-sndcp-xid.c b/epan/dissectors/packet-sndcp-xid.c index 2f1f37c1b8..2c69147793 100644 --- a/epan/dissectors/packet-sndcp-xid.c +++ b/epan/dissectors/packet-sndcp-xid.c @@ -28,8 +28,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-synergy.c b/epan/dissectors/packet-synergy.c index 84a408f87d..4dac3484dc 100644 --- a/epan/dissectors/packet-synergy.c +++ b/epan/dissectors/packet-synergy.c @@ -28,7 +28,6 @@ # include "config.h" #endif -#include #include #include diff --git a/epan/dissectors/packet-syslog.c b/epan/dissectors/packet-syslog.c index a56a7c9844..b2388afa1e 100644 --- a/epan/dissectors/packet-syslog.c +++ b/epan/dissectors/packet-syslog.c @@ -32,11 +32,11 @@ # include "config.h" #endif -#include +#include #include -#include #include + #include #include diff --git a/epan/dissectors/packet-tds.c b/epan/dissectors/packet-tds.c index 7f9f658a89..7b4bbcfb58 100644 --- a/epan/dissectors/packet-tds.c +++ b/epan/dissectors/packet-tds.c @@ -148,14 +148,13 @@ # include "config.h" #endif -#include #include #include -#include - #include "isprint.h" +#include + #include #include #include diff --git a/epan/dissectors/packet-teamspeak2.c b/epan/dissectors/packet-teamspeak2.c index 7b9200c5db..c6b2607746 100644 --- a/epan/dissectors/packet-teamspeak2.c +++ b/epan/dissectors/packet-teamspeak2.c @@ -28,13 +28,13 @@ # include "config.h" #endif +#include + #include #include #include #include #include -#include - /* Packet Classes */ #define TS2C_STANDARD 0xbef0 diff --git a/epan/dissectors/packet-teredo.c b/epan/dissectors/packet-teredo.c index 690cdb06ac..504e33b88c 100644 --- a/epan/dissectors/packet-teredo.c +++ b/epan/dissectors/packet-teredo.c @@ -31,9 +31,8 @@ # include "config.h" #endif -#include - #include + #include #include #include diff --git a/epan/dissectors/packet-tivoconnect.c b/epan/dissectors/packet-tivoconnect.c index 12f1e8f76c..f573f69adf 100644 --- a/epan/dissectors/packet-tivoconnect.c +++ b/epan/dissectors/packet-tivoconnect.c @@ -41,7 +41,6 @@ # include "config.h" #endif -#include #include #include diff --git a/epan/dissectors/packet-tnef.c b/epan/dissectors/packet-tnef.c index 8fa82310c9..6f474f4bf8 100644 --- a/epan/dissectors/packet-tnef.c +++ b/epan/dissectors/packet-tnef.c @@ -28,9 +28,6 @@ #include "config.h" #endif -#include -#include -#include #include #include diff --git a/epan/dissectors/packet-tte-pcf.c b/epan/dissectors/packet-tte-pcf.c index 9a15357630..2c8023cda0 100644 --- a/epan/dissectors/packet-tte-pcf.c +++ b/epan/dissectors/packet-tte-pcf.c @@ -33,7 +33,6 @@ #include "config.h" #endif -#include #include #include diff --git a/epan/dissectors/packet-turbocell.c b/epan/dissectors/packet-turbocell.c index b34b61a4b2..5ea32ea82b 100644 --- a/epan/dissectors/packet-turbocell.c +++ b/epan/dissectors/packet-turbocell.c @@ -39,8 +39,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-turnchannel.c b/epan/dissectors/packet-turnchannel.c index 3e4f8709cf..d856ea0061 100644 --- a/epan/dissectors/packet-turnchannel.c +++ b/epan/dissectors/packet-turnchannel.c @@ -35,8 +35,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-udld.c b/epan/dissectors/packet-udld.c index bb08f43c3d..ad92f14bde 100644 --- a/epan/dissectors/packet-udld.c +++ b/epan/dissectors/packet-udld.c @@ -26,9 +26,8 @@ # include "config.h" #endif -#include - #include + #include #include diff --git a/epan/dissectors/packet-udp.c b/epan/dissectors/packet-udp.c index f7a391fbcf..693940f363 100644 --- a/epan/dissectors/packet-udp.c +++ b/epan/dissectors/packet-udp.c @@ -29,10 +29,10 @@ # include "config.h" #endif -#include #include #include + #include #include #include diff --git a/epan/dissectors/packet-uma.c b/epan/dissectors/packet-uma.c index 8f7c23368a..396a8d3578 100644 --- a/epan/dissectors/packet-uma.c +++ b/epan/dissectors/packet-uma.c @@ -57,15 +57,12 @@ # include "config.h" #endif -#include - #include -#include #include -#include - +#include #include +#include #include "packet-bssap.h" #include "packet-gsm_a_common.h" #include "packet-gsm_map.h" diff --git a/epan/dissectors/packet-v5ua.c b/epan/dissectors/packet-v5ua.c index 137293ae84..6ba53b108a 100644 --- a/epan/dissectors/packet-v5ua.c +++ b/epan/dissectors/packet-v5ua.c @@ -45,9 +45,6 @@ # include "config.h" #endif -#include -#include - #include #include diff --git a/epan/dissectors/packet-vtp.c b/epan/dissectors/packet-vtp.c index 912f716716..137da6d0f2 100644 --- a/epan/dissectors/packet-vtp.c +++ b/epan/dissectors/packet-vtp.c @@ -22,11 +22,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H #include "config.h" - -#include +#endif #include + #include /* diff --git a/epan/dissectors/packet-wbxml.c b/epan/dissectors/packet-wbxml.c index 12f51637cc..33621599e9 100644 --- a/epan/dissectors/packet-wbxml.c +++ b/epan/dissectors/packet-wbxml.c @@ -48,14 +48,11 @@ # include "config.h" #endif -#include -#include #include #include #include - #include #include diff --git a/epan/dissectors/packet-wlccp.c b/epan/dissectors/packet-wlccp.c index 85a1ebd7e5..7e27c0dfc8 100644 --- a/epan/dissectors/packet-wlccp.c +++ b/epan/dissectors/packet-wlccp.c @@ -63,8 +63,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-wol.c b/epan/dissectors/packet-wol.c index dadee7046a..6fd6fafe98 100644 --- a/epan/dissectors/packet-wol.c +++ b/epan/dissectors/packet-wol.c @@ -58,13 +58,10 @@ # include "config.h" #endif -#include -#include - #include -#include #include +#include #include /* IF PROTO exposes code to other dissectors, then it must be exported diff --git a/epan/dissectors/packet-wow.c b/epan/dissectors/packet-wow.c index 3751c4765f..0e0ad5b60b 100644 --- a/epan/dissectors/packet-wow.c +++ b/epan/dissectors/packet-wow.c @@ -32,8 +32,6 @@ # include "config.h" #endif -#include - #include #include diff --git a/epan/dissectors/packet-wsmp.c b/epan/dissectors/packet-wsmp.c index 95db12ca2d..30ceaf12c6 100644 --- a/epan/dissectors/packet-wsmp.c +++ b/epan/dissectors/packet-wsmp.c @@ -29,7 +29,7 @@ # include "config.h" #endif -#include +#include #include #include diff --git a/epan/dissectors/packet-wtls.c b/epan/dissectors/packet-wtls.c index d16fbc6e77..ea25caec07 100644 --- a/epan/dissectors/packet-wtls.c +++ b/epan/dissectors/packet-wtls.c @@ -31,78 +31,80 @@ # include "config.h" #endif +#ifdef DEBUG #include -#include +#endif #include + #include #include "packet-wap.h" #include "packet-wtls.h" /* File scoped variables for the protocol and registered fields */ -static int proto_wtls = HF_EMPTY; +static int proto_wtls = HF_EMPTY; /* These fields used by fixed part of header */ -static int hf_wtls_record = HF_EMPTY; -static int hf_wtls_record_type = HF_EMPTY; -static int hf_wtls_record_length = HF_EMPTY; -static int hf_wtls_record_sequence = HF_EMPTY; -static int hf_wtls_record_ciphered = HF_EMPTY; -static int hf_wtls_hands = HF_EMPTY; -static int hf_wtls_hands_type = HF_EMPTY; -static int hf_wtls_hands_length = HF_EMPTY; -static int hf_wtls_hands_cli_hello = HF_EMPTY; -static int hf_wtls_hands_cli_hello_version = HF_EMPTY; -static int hf_wtls_hands_cli_hello_gmt = HF_EMPTY; -static int hf_wtls_hands_cli_hello_random = HF_EMPTY; -static int hf_wtls_hands_cli_hello_session = HF_EMPTY; -static int hf_wtls_hands_cli_hello_session_str = HF_EMPTY; -static int hf_wtls_hands_cli_hello_cli_key_id = HF_EMPTY; -static int hf_wtls_hands_cli_hello_cli_key_len = HF_EMPTY; -static int hf_wtls_hands_cli_hello_trust_key_id = HF_EMPTY; -static int hf_wtls_hands_cli_hello_key_exchange =HF_EMPTY; -static int hf_wtls_hands_cli_hello_key_exchange_suite =HF_EMPTY; -static int hf_wtls_hands_cli_hello_key_parameter_index =HF_EMPTY; -static int hf_wtls_hands_cli_hello_key_parameter_set =HF_EMPTY; -static int hf_wtls_hands_cli_hello_key_identifier_type =HF_EMPTY; -static int hf_wtls_hands_cli_hello_key_identifier_charset =HF_EMPTY; -static int hf_wtls_hands_cli_hello_key_identifier_size =HF_EMPTY; -static int hf_wtls_hands_cli_hello_key_identifier =HF_EMPTY; -static int hf_wtls_hands_cli_hello_key_identifier_str =HF_EMPTY; -static int hf_wtls_hands_cli_hello_cipher_suite =HF_EMPTY; -static int hf_wtls_hands_cli_hello_cipher_suite_item =HF_EMPTY; -static int hf_wtls_hands_cli_hello_compression_methods =HF_EMPTY; -static int hf_wtls_hands_cli_hello_compression =HF_EMPTY; -static int hf_wtls_hands_cli_hello_sequence_mode =HF_EMPTY; -static int hf_wtls_hands_cli_hello_key_refresh =HF_EMPTY; -static int hf_wtls_hands_serv_hello = HF_EMPTY; -static int hf_wtls_hands_serv_hello_version = HF_EMPTY; -static int hf_wtls_hands_serv_hello_gmt = HF_EMPTY; -static int hf_wtls_hands_serv_hello_random = HF_EMPTY; -static int hf_wtls_hands_serv_hello_session = HF_EMPTY; -static int hf_wtls_hands_serv_hello_session_str = HF_EMPTY; -static int hf_wtls_hands_serv_hello_cli_key_id =HF_EMPTY; -static int hf_wtls_hands_serv_hello_cipher_suite_item =HF_EMPTY; -static int hf_wtls_hands_serv_hello_cipher_bulk =HF_EMPTY; -static int hf_wtls_hands_serv_hello_cipher_mac =HF_EMPTY; -static int hf_wtls_hands_serv_hello_compression =HF_EMPTY; -static int hf_wtls_hands_serv_hello_sequence_mode =HF_EMPTY; -static int hf_wtls_hands_serv_hello_key_refresh =HF_EMPTY; -static int hf_wtls_hands_certificates =HF_EMPTY; -static int hf_wtls_hands_certificate =HF_EMPTY; -static int hf_wtls_hands_certificate_type =HF_EMPTY; -static int hf_wtls_hands_certificate_wtls_version =HF_EMPTY; -static int hf_wtls_hands_certificate_wtls_signature_type =HF_EMPTY; -static int hf_wtls_hands_certificate_wtls_issuer_type =HF_EMPTY; -static int hf_wtls_hands_certificate_wtls_issuer_charset =HF_EMPTY; -static int hf_wtls_hands_certificate_wtls_issuer_size =HF_EMPTY; -static int hf_wtls_hands_certificate_wtls_issuer_name =HF_EMPTY; -static int hf_wtls_hands_certificate_wtls_valid_not_before =HF_EMPTY; -static int hf_wtls_hands_certificate_wtls_valid_not_after =HF_EMPTY; -static int hf_wtls_hands_certificate_wtls_subject_type =HF_EMPTY; -static int hf_wtls_hands_certificate_wtls_subject_charset =HF_EMPTY; -static int hf_wtls_hands_certificate_wtls_subject_size = HF_EMPTY; -static int hf_wtls_hands_certificate_wtls_subject_name = HF_EMPTY; +static int hf_wtls_record = HF_EMPTY; +static int hf_wtls_record_type = HF_EMPTY; +static int hf_wtls_record_length = HF_EMPTY; +static int hf_wtls_record_sequence = HF_EMPTY; +static int hf_wtls_record_ciphered = HF_EMPTY; +static int hf_wtls_hands = HF_EMPTY; +static int hf_wtls_hands_type = HF_EMPTY; +static int hf_wtls_hands_length = HF_EMPTY; +static int hf_wtls_hands_cli_hello = HF_EMPTY; +static int hf_wtls_hands_cli_hello_version = HF_EMPTY; +static int hf_wtls_hands_cli_hello_gmt = HF_EMPTY; +static int hf_wtls_hands_cli_hello_random = HF_EMPTY; +static int hf_wtls_hands_cli_hello_session = HF_EMPTY; +static int hf_wtls_hands_cli_hello_session_str = HF_EMPTY; +static int hf_wtls_hands_cli_hello_cli_key_id = HF_EMPTY; +static int hf_wtls_hands_cli_hello_cli_key_len = HF_EMPTY; +static int hf_wtls_hands_cli_hello_trust_key_id = HF_EMPTY; +static int hf_wtls_hands_cli_hello_key_exchange = HF_EMPTY; +static int hf_wtls_hands_cli_hello_key_exchange_suite = HF_EMPTY; +static int hf_wtls_hands_cli_hello_key_parameter_index = HF_EMPTY; +static int hf_wtls_hands_cli_hello_key_parameter_set = HF_EMPTY; +static int hf_wtls_hands_cli_hello_key_identifier_type = HF_EMPTY; +static int hf_wtls_hands_cli_hello_key_identifier_charset = HF_EMPTY; +static int hf_wtls_hands_cli_hello_key_identifier_size = HF_EMPTY; +static int hf_wtls_hands_cli_hello_key_identifier = HF_EMPTY; +static int hf_wtls_hands_cli_hello_key_identifier_str = HF_EMPTY; +static int hf_wtls_hands_cli_hello_cipher_suite = HF_EMPTY; +static int hf_wtls_hands_cli_hello_cipher_suite_item = HF_EMPTY; +static int hf_wtls_hands_cli_hello_compression_methods = HF_EMPTY; +static int hf_wtls_hands_cli_hello_compression = HF_EMPTY; +static int hf_wtls_hands_cli_hello_sequence_mode = HF_EMPTY; +static int hf_wtls_hands_cli_hello_key_refresh = HF_EMPTY; +static int hf_wtls_hands_serv_hello = HF_EMPTY; +static int hf_wtls_hands_serv_hello_version = HF_EMPTY; +static int hf_wtls_hands_serv_hello_gmt = HF_EMPTY; +static int hf_wtls_hands_serv_hello_random = HF_EMPTY; +static int hf_wtls_hands_serv_hello_session = HF_EMPTY; +static int hf_wtls_hands_serv_hello_session_str = HF_EMPTY; +static int hf_wtls_hands_serv_hello_cli_key_id = HF_EMPTY; +static int hf_wtls_hands_serv_hello_cipher_suite_item = HF_EMPTY; +static int hf_wtls_hands_serv_hello_cipher_bulk = HF_EMPTY; +static int hf_wtls_hands_serv_hello_cipher_mac = HF_EMPTY; +static int hf_wtls_hands_serv_hello_compression = HF_EMPTY; +static int hf_wtls_hands_serv_hello_sequence_mode = HF_EMPTY; +static int hf_wtls_hands_serv_hello_key_refresh = HF_EMPTY; +static int hf_wtls_hands_certificates = HF_EMPTY; +static int hf_wtls_hands_certificate = HF_EMPTY; +static int hf_wtls_hands_certificate_type = HF_EMPTY; +static int hf_wtls_hands_certificate_wtls_version = HF_EMPTY; +static int hf_wtls_hands_certificate_wtls_signature_type = HF_EMPTY; +static int hf_wtls_hands_certificate_wtls_issuer_type = HF_EMPTY; +static int hf_wtls_hands_certificate_wtls_issuer_charset = HF_EMPTY; +static int hf_wtls_hands_certificate_wtls_issuer_size = HF_EMPTY; +static int hf_wtls_hands_certificate_wtls_issuer_name = HF_EMPTY; +static int hf_wtls_hands_certificate_wtls_valid_not_before = HF_EMPTY; +static int hf_wtls_hands_certificate_wtls_valid_not_after = HF_EMPTY; +static int hf_wtls_hands_certificate_wtls_subject_type = HF_EMPTY; +static int hf_wtls_hands_certificate_wtls_subject_charset = HF_EMPTY; +static int hf_wtls_hands_certificate_wtls_subject_size = HF_EMPTY; +static int hf_wtls_hands_certificate_wtls_subject_name = HF_EMPTY; static int hf_wtls_hands_certificate_wtls_public_key_type = HF_EMPTY; static int hf_wtls_hands_certificate_wtls_key_parameter_index = HF_EMPTY; static int hf_wtls_hands_certificate_wtls_key_parameter_set = HF_EMPTY; @@ -114,12 +116,12 @@ static int hf_wtls_alert_level = HF_EMPTY; static int hf_wtls_alert_description = HF_EMPTY; /* Initialize the subtree pointers */ -static gint ett_wtls = ETT_EMPTY; -static gint ett_wtls_rec = ETT_EMPTY; -static gint ett_wtls_msg_type = ETT_EMPTY; -static gint ett_wtls_msg_type_item = ETT_EMPTY; -static gint ett_wtls_msg_type_item_sub = ETT_EMPTY; -static gint ett_wtls_msg_type_item_sub_sub = ETT_EMPTY; +static gint ett_wtls = ETT_EMPTY; +static gint ett_wtls_rec = ETT_EMPTY; +static gint ett_wtls_msg_type = ETT_EMPTY; +static gint ett_wtls_msg_type_item = ETT_EMPTY; +static gint ett_wtls_msg_type_item_sub = ETT_EMPTY; +static gint ett_wtls_msg_type_item_sub_sub = ETT_EMPTY; static const value_string wtls_vals_record_type[] = { { 1, "change_cipher_data" }, @@ -159,9 +161,9 @@ static const value_string wtls_vals_cipher_mac[] = { static value_string_ext wtls_vals_cipher_mac_ext = VALUE_STRING_EXT_INIT(wtls_vals_cipher_mac); static const value_string wtls_vals_handshake_type[] = { - { 0, "Hello Request" }, - { 1, "Client Hello" }, - { 2, "Server Hello" }, + { 0, "Hello Request" }, + { 1, "Client Hello" }, + { 2, "Server Hello" }, { 11, "Certificate" }, { 12, "Server Key Exchange" }, { 13, "Certificate Request" }, @@ -169,21 +171,21 @@ static const value_string wtls_vals_handshake_type[] = { { 15, "Certificate Verify" }, { 16, "Client Key Exchange" }, { 20, "Finished" }, - { 0x00, NULL } + { 0, NULL } }; static value_string_ext wtls_vals_handshake_type_ext = VALUE_STRING_EXT_INIT(wtls_vals_handshake_type); static const value_string wtls_vals_key_exchange_suite[] = { - { 0, "NULL" }, - { 1, "Shared Secret" }, - { 2, "Diffie Hellman Anonymous" }, - { 3, "Diffie Hellman Anonymous 512" }, - { 4, "Diffie Hellman Anonymous 768" }, - { 5, "RSA Anonymous" }, - { 6, "RSA Anonymous 512" }, - { 7, "RSA Anonymous 768" }, - { 8, "RSA" }, - { 9, "RSA 512" }, + { 0, "NULL" }, + { 1, "Shared Secret" }, + { 2, "Diffie Hellman Anonymous" }, + { 3, "Diffie Hellman Anonymous 512" }, + { 4, "Diffie Hellman Anonymous 768" }, + { 5, "RSA Anonymous" }, + { 6, "RSA Anonymous 512" }, + { 7, "RSA Anonymous 768" }, + { 8, "RSA" }, + { 9, "RSA 512" }, { 10, "RSA 768" }, { 11, "EC Diffie Hellman Anonymous" }, { 12, "EC Diffie Hellman Anonymous 113" }, @@ -198,12 +200,12 @@ static const value_string wtls_vals_key_exchange_suite[] = { static value_string_ext wtls_vals_key_exchange_suite_ext = VALUE_STRING_EXT_INIT(wtls_vals_key_exchange_suite); static const value_string wtls_vals_identifier_type[] = { - { 0, "No identifier" }, - { 1, "Textual Name" }, - { 2, "Binary Name" }, + { 0, "No identifier" }, + { 1, "Textual Name" }, + { 2, "Binary Name" }, { 254, "SHA-1 Hash of Public Key" }, { 255, "x509 Distinguished Name" }, - { 0x00, NULL } + { 0, NULL } }; static value_string_ext wtls_vals_identifier_type_ext = VALUE_STRING_EXT_INIT(wtls_vals_identifier_type); @@ -212,77 +214,77 @@ static const value_string wtls_vals_certificate_type[] = { { 2, "X.509" }, { 3, "X.968" }, { 4, "URL" }, - { 0x00, NULL } + { 0, NULL } }; static value_string_ext wtls_vals_certificate_type_ext = VALUE_STRING_EXT_INIT(wtls_vals_certificate_type); static const value_string wtls_vals_compression[] = { { 0, "Null" }, - { 0x00, NULL } + { 0, NULL } }; static const value_string wtls_vals_sequence_mode[] = { { 0, "Off" }, { 1, "Implicit" }, { 2, "Explicit" }, - { 0x00, NULL } + { 0, NULL } }; static const value_string wtls_vals_certificate_signature[] = { { 0, "Anonymous" }, { 1, "ECDSA_SHA" }, { 2, "RSA_SHA" }, - { 0x00, NULL } + { 0, NULL } }; static const value_string wtls_vals_public_key_type[] = { { 2, "RSA" }, { 3, "ECDH" }, { 4, "ECSA" }, - { 0x00, NULL } + { 0, NULL } }; static const value_string wtls_vals_alert_level[] = { { 1, "Warning" }, { 2, "Critical" }, { 3, "Fatal" }, - { 0x00, NULL } + { 0, NULL } }; static const value_string wtls_vals_alert_description[] = { - { 0,"connection_close_notify"}, - { 1,"session_close_notify"}, - { 5,"no_connection"}, - { 10,"unexpected_message"}, - { 11,"time_required"}, - { 20,"bad_record_mac"}, - { 21,"decryption_failed"}, - { 22,"record_overflow"}, - { 30,"decompression_failure"}, - { 40,"handshake_failure"}, - { 42,"bad_certificate"}, - { 43,"unsupported_certificate"}, - { 44,"certificate_revoked"}, - { 45,"certificate_expired"}, - { 46,"certificate_unknown"}, - { 47,"illegal_parameter"}, - { 48,"unknown_ca"}, - { 49,"access_denied"}, - { 50,"decode_error"}, - { 51,"decrypt_error"}, - { 52,"unknown_key_id"}, - { 53,"disabled_key_id"}, - { 54,"key_exchange_disabled"}, - { 55,"session_not_ready"}, - { 56,"unknown_parameter_index"}, - { 57,"duplicate_finished_received"}, - { 60,"export_restriction"}, - { 70,"protocol_version"}, - { 71,"insufficient_security"}, - { 80,"internal_error"}, - { 90,"user_canceled"}, - { 100,"no_renegotiation"}, - { 0x00, NULL } + { 0, "connection_close_notify"}, + { 1, "session_close_notify"}, + { 5, "no_connection"}, + { 10, "unexpected_message"}, + { 11, "time_required"}, + { 20, "bad_record_mac"}, + { 21, "decryption_failed"}, + { 22, "record_overflow"}, + { 30, "decompression_failure"}, + { 40, "handshake_failure"}, + { 42, "bad_certificate"}, + { 43, "unsupported_certificate"}, + { 44, "certificate_revoked"}, + { 45, "certificate_expired"}, + { 46, "certificate_unknown"}, + { 47, "illegal_parameter"}, + { 48, "unknown_ca"}, + { 49, "access_denied"}, + { 50, "decode_error"}, + { 51, "decrypt_error"}, + { 52, "unknown_key_id"}, + { 53, "disabled_key_id"}, + { 54, "key_exchange_disabled"}, + { 55, "session_not_ready"}, + { 56, "unknown_parameter_index"}, + { 57, "duplicate_finished_received"}, + { 60, "export_restriction"}, + { 70, "protocol_version"}, + { 71, "insufficient_security"}, + { 80, "internal_error"}, + { 90, "user_canceled"}, + { 100, "no_renegotiation"}, + { 0, NULL } }; static value_string_ext wtls_vals_alert_description_ext = VALUE_STRING_EXT_INIT(wtls_vals_alert_description); @@ -294,24 +296,24 @@ static value_string_ext wtls_vals_alert_description_ext = VALUE_STRING_EXT_INIT( #define WTLS_ALERT 0x02 #define WTLS_PLAIN_HANDSHAKE 0x03 -#define WTLS_HANDSHAKE_CLIENT_HELLO 1 -#define WTLS_HANDSHAKE_SERVER_HELLO 2 +#define WTLS_HANDSHAKE_CLIENT_HELLO 1 +#define WTLS_HANDSHAKE_SERVER_HELLO 2 #define WTLS_HANDSHAKE_CERTIFICATE 11 -#define CERTIFICATE_WTLS 1 -#define CERTIFICATE_X509 2 -#define CERTIFICATE_X968 3 -#define CERTIFICATE_URL 4 +#define CERTIFICATE_WTLS 1 +#define CERTIFICATE_X509 2 +#define CERTIFICATE_X968 3 +#define CERTIFICATE_URL 4 -#define IDENTIFIER_NULL 0 -#define IDENTIFIER_TEXT 1 -#define IDENTIFIER_BIN 2 -#define IDENTIFIER_SHA_1 254 -#define IDENTIFIER_X509 255 +#define IDENTIFIER_NULL 0 +#define IDENTIFIER_TEXT 1 +#define IDENTIFIER_BIN 2 +#define IDENTIFIER_SHA_1 254 +#define IDENTIFIER_X509 255 -#define PUBLIC_KEY_RSA 2 -#define PUBLIC_KEY_ECDH 3 -#define PUBLIC_KEY_ECDSA 4 +#define PUBLIC_KEY_RSA 2 +#define PUBLIC_KEY_ECDH 3 +#define PUBLIC_KEY_ECDSA 4 static void dissect_wtls_handshake (proto_tree *, tvbuff_t *, guint, guint); diff --git a/epan/dissectors/packet-wtp.c b/epan/dissectors/packet-wtp.c index 7370f63cbf..cf2df5a924 100644 --- a/epan/dissectors/packet-wtp.c +++ b/epan/dissectors/packet-wtp.c @@ -31,10 +31,12 @@ # include "config.h" #endif +#ifdef DEBUG #include -#include +#endif #include + #include #include #include diff --git a/epan/dissectors/packet-x11.c b/epan/dissectors/packet-x11.c index 480df6a18a..b72fc43e37 100644 --- a/epan/dissectors/packet-x11.c +++ b/epan/dissectors/packet-x11.c @@ -55,12 +55,11 @@ #endif #include +#include #include -#include -#include -#include #include + #include #include #include diff --git a/epan/dissectors/packet-x25.c b/epan/dissectors/packet-x25.c index a361cd5df6..4088c4888e 100644 --- a/epan/dissectors/packet-x25.c +++ b/epan/dissectors/packet-x25.c @@ -27,11 +27,12 @@ # include "config.h" #endif -#include -#include #include -#include + +#include + #include +#include #include #include #include diff --git a/epan/dissectors/packet-xdmcp.c b/epan/dissectors/packet-xdmcp.c index 8238b4157b..dc59f9c22e 100644 --- a/epan/dissectors/packet-xdmcp.c +++ b/epan/dissectors/packet-xdmcp.c @@ -27,10 +27,10 @@ # include "config.h" #endif -#include #include #include + #include #define UDP_PORT_XDMCP 177 diff --git a/epan/dissectors/packet-xot.c b/epan/dissectors/packet-xot.c index 66a157db19..66fa0da966 100644 --- a/epan/dissectors/packet-xot.c +++ b/epan/dissectors/packet-xot.c @@ -28,10 +28,8 @@ # include "config.h" #endif -#include -#include - #include + #include #include "packet-tcp.h" #include -- cgit v1.2.3