From Wes Hardaker:
[obnox/wireshark/wip.git] / packet-gtp.c
index 3fffd2a9e9fe6d7da43cbb0bade38101df7bf9b5..8aa6f7fcd1e578d3d9e47a143aa817165e7d543b 100644 (file)
@@ -1,10 +1,10 @@
 /* packet-gtp.c
- * 
+ *
  * Routines for GTP dissection
  * Copyright 2001, Michal Melerowicz <michal.melerowicz@nokia.com>
  *                 Nicolas Balkota <balkota@mac.com>
  *
- * $Id: packet-gtp.c,v 1.13 2001/10/30 21:31:15 guy Exp $
+ * $Id: packet-gtp.c,v 1.38 2002/08/30 10:14:03 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #include <stdlib.h>
 #include <string.h>
 
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
-#include "packet.h"
+#include <epan/packet.h>
+#include "packet-gtp.h"
 #include "packet-ipv6.h"
+#include "ppptypes.h"
 #include "prefs.h"
 
-/* 
+/*
  * All data related to GTP v0 (GPRS) uses "gtpv0" or "GTPv0",
  * all data related to GTP v1 (UMTS) uses "gtpv1" or "GTPv1",
- * if there is any gtp alone statement it means that this data is common 
+ * if there is any gtp alone statement it means that this data is common
  * for both: GPRS and UMTS
  */
 
 
 #define GTPv0_HDR_LENGTH 20
 #define GTPv1_HDR_LENGTH 12
+#define GTP_PRIME_HDR_LENGTH 6
 
 /* for function checking compliance with ETSI  */
-#define MANDATORY      1                       
-#define OPTIONAL       2 
-#define CONDITIONAL    4
+#define GTP_MANDATORY  1
+#define GTP_OPTIONAL   2
+#define GTP_CONDITIONAL        4
 
 static int g_gtpv0_port                        = GTPv0_PORT;
 static int g_gtpv1c_port               = GTPv1C_PORT;
@@ -76,6 +67,7 @@ static int g_gtpv1u_port              = GTPv1U_PORT;
 
 void proto_reg_handoff_gtp(void);
 
+static int proto_gtp                   = -1;
 static int proto_gtpv0                 = -1;
 static int proto_gtpv1                 = -1;
 
@@ -83,19 +75,25 @@ static int hf_gtpv0_flags                   = -1;
 static int hf_gtpv0_flags_ver          = -1;
 static int hf_gtpv0_flags_pt           = -1;
 static int hf_gtpv0_flags_spare                = -1;
+#ifdef GTP_UNUSED_HANDLES
 static int hf_gtpv0_flags_e            = -1;
 static int hf_gtpv0_flags_s            = -1;
 static int hf_gtpv0_flags_pn           = -1;
+#endif
 static int hf_gtpv0_flags_snn          = -1;
 static int hf_gtpv0_message_type               = -1;
 static int hf_gtpv0_length             = -1;
 static int hf_gtpv0_seq_number         = -1;
 static int hf_gtpv0_flow_label         = -1;
 static int hf_gtpv0_sndcp_number               = -1;
+#ifdef GTP_UNUSED_HANDLES
 static int hf_gtpv0_npdu_number                = -1;
+#endif
 static int hf_gtpv0_tid                        = -1;
+#ifdef GTP_UNUSED_HANDLES
 static int hf_gtpv0_teid                       = -1;
 static int hf_gtpv0_next                       = -1;
+#endif
 static int hf_gtpv0_cause                      = -1;
 static int hf_gtpv0_imsi                       = -1;
 static int hf_gtpv0_rai_mcc            = -1;
@@ -119,13 +117,20 @@ static int hf_gtpv0_ms_valid              = -1;
 static int hf_gtpv0_recovery           = -1;
 static int hf_gtpv0_sel_mode           = -1;
 static int hf_gtpv0_ext_flow_label     = -1;
+#ifdef GTP_UNUSED_HANDLES
 static int hf_gtpv0_teid_data          = -1;   /* 3G */
+#endif
 static int hf_gtpv0_flow_sig           = -1;
+#ifdef GTP_UNUSED_HANDLES
 static int hf_gtpv0_teid_cp            = -1;   /* 3G */
+#endif
 static int hf_gtpv0_nsapi                      = -1;
 static int hf_gtpv0_flow_ii            = -1;
+#ifdef GTP_UNUSED_HANDLES
 static int hf_gtpv0_teid_ii            = -1;   /* 3G */
+#endif
 static int hf_gtpv0_ms_reason          = -1;
+#ifdef GTP_UNUSED_HANDLES
 static int hf_gtpv0_tear_ind           = -1;   /* 3G */
 static int hf_gtpv0_ranap_cause                = -1;   /* 3G */
 static int hf_gtpv0_rab_gtpu_dn                = -1;   /* 3G */
@@ -145,6 +150,7 @@ static int hf_gtpv0_chrg_char_h             = -1;   /* 3G */
 static int hf_gtpv0_chrg_char_r                = -1;   /* 3G */
 static int hf_gtpv0_trace_ref          = -1;   /* 3G */
 static int hf_gtpv0_trace_type         = -1;   /* 3G */
+#endif
 static int hf_gtpv0_tr_comm            = -1;   /* charging */
 static int hf_gtpv0_chrg_id            = -1;
 static int hf_gtpv0_user_ipv4          = -1;
@@ -157,6 +163,7 @@ static int hf_gtpv0_gsn_ipv6                = -1;
 static int hf_gtpv0_gsn_addr_type              = -1;
 static int hf_gtpv0_gsn_addr_len               = -1;
 static int hf_gtpv0_msisdn             = -1;
+#ifdef GTP_UNUSED_HANDLES
 static int hf_gtpv0_qos_al_ret_priority        = -1;
 static int hf_gtpv0_qos_traf_class     = -1;
 static int hf_gtpv0_qos_del_order              = -1;
@@ -172,6 +179,7 @@ static int hf_gtpv0_qos_guar_ul             = -1;
 static int hf_gtpv0_qos_guar_dl                = -1;
 static int hf_gtpv0_rnc_ipv4           = -1;
 static int hf_gtpv0_rnc_ipv6           = -1;
+#endif
 static int hf_gtpv0_chrg_ipv4          = -1;
 static int hf_gtpv0_chrg_ipv6          = -1;
 static int hf_gtpv0_node_ipv4          = -1;
@@ -187,14 +195,20 @@ static int hf_gtpv1_flags_spare           = -1;
 static int hf_gtpv1_flags_e            = -1;
 static int hf_gtpv1_flags_s            = -1;
 static int hf_gtpv1_flags_pn           = -1;
+#ifdef GTP_UNUSED_HANDLES
 static int hf_gtpv1_flags_snn          = -1;
+#endif
 static int hf_gtpv1_message_type               = -1;
 static int hf_gtpv1_length             = -1;
 static int hf_gtpv1_seq_number         = -1;
+#ifdef GTP_UNUSED_HANDLES
 static int hf_gtpv1_flow_label         = -1;
 static int hf_gtpv1_sndcp_number               = -1;
+#endif
 static int hf_gtpv1_npdu_number                = -1;
+#ifdef GTP_UNUSED_HANDLES
 static int hf_gtpv1_tid                        = -1;
+#endif
 static int hf_gtpv1_teid                       = -1;
 static int hf_gtpv1_next                       = -1;
 static int hf_gtpv1_cause                      = -1;
@@ -219,12 +233,18 @@ static int hf_gtpv1_ptmsi_sig             = -1;
 static int hf_gtpv1_ms_valid           = -1;
 static int hf_gtpv1_recovery           = -1;
 static int hf_gtpv1_sel_mode           = -1;
+#ifdef GTP_UNUSED_HANDLES
 static int hf_gtpv1_ext_flow_label     = -1;
+#endif
 static int hf_gtpv1_teid_data          = -1;   /* 3G */
+#ifdef GTP_UNUSED_HANDLES
 static int hf_gtpv1_flow_sig           = -1;
+#endif
 static int hf_gtpv1_teid_cp            = -1;   /* 3G */
 static int hf_gtpv1_nsapi                      = -1;
+#ifdef GTP_UNUSED_HANDLES
 static int hf_gtpv1_flow_ii            = -1;
+#endif
 static int hf_gtpv1_teid_ii            = -1;   /* 3G */
 static int hf_gtpv1_ms_reason          = -1;
 static int hf_gtpv1_tear_ind           = -1;   /* 3G */
@@ -271,6 +291,10 @@ static int hf_gtpv1_qos_trans_delay        = -1;
 static int hf_gtpv1_qos_traf_handl_prio        = -1;
 static int hf_gtpv1_qos_guar_ul                = -1;
 static int hf_gtpv1_qos_guar_dl                = -1;
+static int hf_gtpv1_tft_code           = -1;
+static int hf_gtpv1_tft_spare          = -1;
+static int hf_gtpv1_tft_number         = -1;
+static int hf_gtpv1_tft_eval           = -1;
 static int hf_gtpv1_rnc_ipv4           = -1;
 static int hf_gtpv1_rnc_ipv6           = -1;
 static int hf_gtpv1_chrg_ipv4          = -1;
@@ -303,6 +327,7 @@ static gint ett_gtp_proto           = -1;
 static gint ett_gtp_gsn_addr           = -1;
 static gint ett_gtp_tft                        = -1;
 static gint ett_gtp_tft_pf             = -1;
+static gint ett_gtp_tft_flags          = -1;
 static gint ett_gtp_rab_setup          = -1;
 static gint ett_gtp_hdr_list           = -1;
 static gint ett_gtp_chrg_addr          = -1;
@@ -355,6 +380,10 @@ static const value_string ver_types[] = {
 #define GTP_MASK_CHRG_CHAR_H   0x0100
 #define GTP_MASK_CHRG_CHAR_R   0x00FF
 
+/* Traffic Flow Templates  mask */
+#define GTPv1_TFT_CODE_MASK    0xE0
+#define GTPv1_TFT_SPARE_MASK   0x10
+#define GTPv1_TFT_NUMBER_MASK  0x0F
 
 /* Definition of GSN Address masks */
 #define GTP_EXT_GSN_ADDR_TYPE_MASK             0xC0
@@ -430,6 +459,12 @@ static const value_string ver_types[] = {
 #define GTP_MSG_DATA_TRANSF_RESP       0xF1
 #define GTP_MSG_TPDU                   0xFF
 
+#define GTP_PPP_0x00                   0x00
+#define GTP_PPP_0xC0                   0xC0
+#define GTP_PPP_0x80                   0x80
+#define GTP_PPP_0xC2                   0xC2
+#define GTP_PPP_REQ_ERROR              0xFF
+
 static const value_string message_type[] = {
        { GTP_MSG_UNKNOWN,              "For future use" },
        { GTP_MSG_ECHO_REQ,             "Echo request" },
@@ -496,15 +531,15 @@ static const value_string message_type[] = {
 #define GTP_EXT_SEL_MODE       0x0F
 
 #define GTP_EXT_16             0x10
-#define GTP_EXT_FLOW_LABEL     0x10    
+#define GTP_EXT_FLOW_LABEL     0x10
 #define GTP_EXT_TEID           0x10    /* 0xFF10 3G */
 
 #define GTP_EXT_17             0x11
-#define GTP_EXT_FLOW_SIG       0x11    
+#define GTP_EXT_FLOW_SIG       0x11
 #define GTP_EXT_TEID_CP                0x11    /* 0xFF11 3G */
 
 #define GTP_EXT_18             0x12
-#define GTP_EXT_FLOW_II                0x12    
+#define GTP_EXT_FLOW_II                0x12
 #define GTP_EXT_TEID_II                0x12    /* 0xFF12 3G*/
 
 #define GTP_EXT_19             0x13
@@ -565,19 +600,19 @@ static const value_string gtp_val[] = {
        { GTP_EXT_16,           "Flow label data I" },
        { GTP_EXT_FLOW_LABEL,   "Flow label data I" },
        { GTP_EXT_TEID,         "Tunnel Endpoint Identifier Data I" },          /* 3G */
-       
+
        { GTP_EXT_17,           "Flow label signalling" },
        { GTP_EXT_FLOW_SIG,     "Flow label signalling" },
        { GTP_EXT_TEID_CP,      "Tunnel Endpoint Identifier Data Control Plane" },      /* 3G */
-       
+
        { GTP_EXT_18,           "Flow label data II" },
        { GTP_EXT_FLOW_II,      "Flow label data II" },
        { GTP_EXT_TEID_II,      "Tunnel Endpoint Identifier Data II" },         /* 3G */
-       
+
        { GTP_EXT_19,           "MS not reachable reason" },
        { GTP_EXT_MS_REASON,    "MS not reachable reason" },
        { GTP_EXT_TEAR_IND,     "Teardown ID" },                                        /* 3G */
-       
+
        { GTP_EXT_NSAPI,        "NSAPI" },                                              /* 3G */
        { GTP_EXT_RANAP_CAUSE,  "RANAP cause" },                                        /* 3G */
        { GTP_EXT_RAB_CNTXT,    "RAB context" },                                        /* 3G */
@@ -617,7 +652,7 @@ static const value_string gtp_val[] = {
 };
 
 /* GPRS:       9.60 v7.6.0, page 37
- * UMTS:       29.060 v4.0, page 45 
+ * UMTS:       29.060 v4.0, page 45
  */
 static const value_string cause_type[] = {
        { 0,    "Request IMSI" },
@@ -746,7 +781,7 @@ static const value_string qos_peak_type[] = {
        { 0x07, "Up to 64 000 oct/s" },
        { 0x08, "Up to 128 000 oct/s" },
        { 0x09, "Up to 256 000 oct/s" },
-/* QoS Peak throughput classes from 0x0A to 0x0F (from 10 to 15) are subscribed */ 
+/* QoS Peak throughput classes from 0x0A to 0x0F (from 10 to 15) are subscribed */
        { 0x0A, "Reserved" },
        { 0x0B, "Reserved" },
        { 0x0C, "Reserved" },
@@ -831,7 +866,7 @@ static const value_string qos_traf_class[] = {
 
 static const value_string qos_max_sdu_size[] = {
        { 0x00, "Subscribed maximum SDU size (in MS to network direction" },
-       /* For values from 0x01 to 0x96 (from 1 to 150), use a granularity of 10 octets */ 
+       /* For values from 0x01 to 0x96 (from 1 to 150), use a granularity of 10 octets */
        { 0x97, "1502 octets" },
        { 0x98, "1510 octets" },
        { 0x99, "1520 octets" },
@@ -882,7 +917,7 @@ static const value_string qos_sdu_err_ratio[] = {
        { 0x07, "1/10 = 1x10^-1" },
        { 0x0F, "Reserved" },           /* All other values are reserved */
        { 0, NULL }
-}; 
+};
 
 static const value_string qos_traf_handl_prio[] = {
        { 0x00, "Subscribed traffic handling priority (in MS to network direction)" },
@@ -979,7 +1014,7 @@ static const value_string qos_guar_dl[] = {
 };
 
 static const value_string sel_mode_type[] = {
-       { 0,    "MS or network provided APN, subscriber verified" },
+       { 0,    "MS or network provided APN, subscribed verified" },
        { 1,    "MS provided APN, subscription not verified" },
        { 2,    "Network provided APN, subscription not verified" },
        { 3,    "For future use (Network provided APN, subscription not verified" },/* Shall not be sent. If received, shall be sent as value 2 */
@@ -1119,7 +1154,7 @@ static const value_string mm_rr_mess[] = {
        { 0x30, "Configuration change command" },
        { 0x31, "Configuration change ack" },
        { 0x33, "Configuration change reject" },
-       
+
        { 0x2E, "Assignment command" },
        { 0x29, "Assignment complete" },
        { 0x2F, "Assigment failure" },
@@ -1210,7 +1245,7 @@ static const value_string mm_mm_mess[] = {
        { 0, NULL }
 };
 
-static const value_string mm_cc_mess[] = {                     
+static const value_string mm_cc_mess[] = {
        { 0x00, "escape to nationally specific" },
 /*{ 0 x 0 0, "- - - Call establishment messages:" },*/
        { 0x01, "ALERTING" },
@@ -1299,7 +1334,7 @@ static const value_string cdr_close_type[] = {
        { 7, "Abnormal" },
        { 0, NULL }
 };
-                       
+
 static dissector_handle_t ip_handle;
 static dissector_handle_t ppp_handle;
 
@@ -1358,7 +1393,7 @@ static int decode_gtp_priv_ext            (tvbuff_t *tvb, int offset, packet_info *pinfo,
 static int decode_gtp_unknown          (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
 
 typedef struct _gtp_opt {
-       int   optcode; 
+       int   optcode;
 /*     char  *name; */
        int  (*decode)(tvbuff_t  *, int, packet_info *, proto_tree *);
 } gtp_opt_t;
@@ -1437,7 +1472,7 @@ typedef struct {
        guint32         teid;
 } _gtpv1_hdr;
 
-struct gcdr_ {                                 /* GCDR 118B */
+static struct gcdr_ {                          /* GCDR 118B */
        guint8          imsi[8];
        guint32         ggsnaddr;
        guint32         chrgid;
@@ -1455,6 +1490,7 @@ struct gcdr_ {                                    /* GCDR 118B */
        guint32         duration;
        guint8          closecause;
        guint32         seqno;
+       guint8          msisdn[9];
 } gcdr;
 
 typedef struct change_ {
@@ -1467,7 +1503,7 @@ typedef struct change_ {
        guint8          qos_neg[3];
 } change_t;
 
-struct _scdr {                                 /* SCDR 277B */
+static struct _scdr {                          /* SCDR 277B */
        guint16         len;
        guint8          netini;
        guint8          anon;
@@ -1512,7 +1548,7 @@ typedef struct mmchange_ {
        guint8          omit[8];
 } mmchange_t;
 
-struct _mcdr {                                 /* MCDR 147B */
+static struct _mcdr {                          /* MCDR 147B */
        guint16         len;
        guint8          imsilen;
        guint8          imsi[8];
@@ -1543,7 +1579,7 @@ struct _mcdr {                                    /* MCDR 147B */
        guint32         seqno;
 } mcdr;
 
-struct _socdr {                                                /* SOCDR 80B */
+static struct _socdr {                                 /* SOCDR 80B */
        guint16         len;
        guint8          imsilen;
        guint8          imsi[8];
@@ -1566,7 +1602,7 @@ struct _socdr {                                           /* SOCDR 80B */
 } socdr;
 
 
-struct _stcdr {                                                /* STCDR 79B */
+static struct _stcdr {                                 /* STCDR 79B */
        guint16         len;
        guint8          imsilen;
        guint8          imsi[8];
@@ -1586,42 +1622,42 @@ struct _stcdr {                                         /* STCDR 79B */
        guint32         time2;
        guint16         smsres;
 } stcdr;
-       
-       guint8          gtp_version = 0;
-       char            *yesno[] = { "False", "True" };
-       
+
+static guint8          gtp_version = 0;
+static char            *yesno[] = { "False", "True" };
+
 static void
-col_append_str_gtp(frame_data *fd, gint el, gchar *proto_name) {
-       
+col_append_str_gtp(column_info *cinfo, gint el, gchar *proto_name) {
+
        int     i;
        int     max_len;
        gchar   _tmp[COL_MAX_LEN];
 
        max_len = COL_MAX_LEN;
 
-       for (i = 0; i < fd->cinfo->num_cols; i++) {
-               if (fd->cinfo->fmt_matx[i][el]) {
-                       if (fd->cinfo->col_data[i] != fd->cinfo->col_buf[i]) {
-                               
-                               strncpy(fd->cinfo->col_buf[i], fd->cinfo->col_data[i], max_len);
-                               fd->cinfo->col_buf[i][max_len - 1] = '\0';
+       for (i = 0; i < cinfo->num_cols; i++) {
+               if (cinfo->fmt_matx[i][el]) {
+                       if (cinfo->col_data[i] != cinfo->col_buf[i]) {
+
+                               strncpy(cinfo->col_buf[i], cinfo->col_data[i], max_len);
+                               cinfo->col_buf[i][max_len - 1] = '\0';
                        }
-       
+
                        _tmp[0] = '\0';
                        strcat(_tmp, proto_name);
                        strcat(_tmp, " <");
-                       strcat(_tmp, fd->cinfo->col_buf[i]);
+                       strcat(_tmp, cinfo->col_buf[i]);
                        strcat(_tmp, ">");
-                       fd->cinfo->col_buf[i][0] = '\0';
-                       strcat(fd->cinfo->col_buf[i], _tmp);
-                       fd->cinfo->col_data[i] = fd->cinfo->col_buf[i];
+                       cinfo->col_buf[i][0] = '\0';
+                       strcat(cinfo->col_buf[i], _tmp);
+                       cinfo->col_data[i] = cinfo->col_buf[i];
                }
        }
 }
 
 static gchar *
 id_to_str(const guint8 *ad) {
-               
+
        static gchar    *str[17];
        gchar           *p;
        guint8          bits8to5, bits4to1, i;
@@ -1633,7 +1669,7 @@ id_to_str(const guint8 *ad) {
        for (;;) {
                bits8to5 = (ad[i] >> 4) & 0x0F;
                bits4to1 = ad[i] & 0x0F;
-               if (bits8to5 < 0xA) *--p = hex_digits[bits8to5]; 
+               if (bits8to5 < 0xA) *--p = hex_digits[bits8to5];
                if (bits4to1 < 0xA) *--p = hex_digits[bits4to1];
                if (i == 0) break;
                i--;
@@ -1643,7 +1679,7 @@ id_to_str(const guint8 *ad) {
 
 static gchar *
 msisdn_to_str(const guint8 *ad, int len) {
-               
+
        static gchar    *str[17];
        gchar           *p;
        guint8          bits8to5, bits4to1, i;
@@ -1664,57 +1700,32 @@ msisdn_to_str(const guint8 *ad, int len) {
        return (gchar *)&str[0];
 }
 
-gchar *
+static gchar *
 time_int_to_str (guint32 time)
 {
-       guint   hours, mins, secs, month, days;
-       guint   mths_n[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-       guint   mths_s[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-       static gchar    *cur, *p, str[3][2+1+2+1+2+1+4+1+2+1+2+2];
-       
-       if (cur == &str[0][0]) { 
-               cur = &str[1][0]; 
-       } else if (cur == &str[1][0]) { 
-               cur = &str[2][0]; 
-       } else { 
-               cur = &str[0][0]; 
-       }
-       
-       if (time == 0) { 
-               sprintf (cur, "00:00:00 1970-01-01"); 
-               return cur; 
-       }
-       
-       secs = time % 60; 
-       time /= 60; 
-       mins = time % 60; 
-       time /= 60; 
-       hours = time % 24; 
-       time /= 24; 
-       days = time % 366; 
-       time /= 366; 
-       days += time - (time + 2) / 4; 
-       
-       if ((time + 2) % 4) { 
-               for (month=0; month<12; month++) if (days > mths_n[month]) days -= mths_n[month]; 
-                       else break; 
-       } else { 
-               for (month=0; month<12; month++) 
-                       if (days > mths_s[month]) days -= mths_s[month]; 
-                       else break; 
-       } 
-                       
-       month++; 
-       days++; 
-       time += 1970; 
-       p = cur; 
-       sprintf (p, "%02d:%02d:%02d %u-%02d-%02d", hours, mins, secs, time, month, days); 
-       
-       return  cur;
+
+       nstime_t        nstime;
+
+       nstime.secs = time;
+       nstime.nsecs = 0;
+
+       return abs_time_to_str (&nstime);
+}
+
+static gchar *
+rel_time_int_to_str (guint32 time)
+{
+
+       nstime_t        nstime;
+
+       nstime.secs = time;
+       nstime.nsecs = 0;
+
+       return rel_time_to_str (&nstime);
 }
 
-/* Next definitions and function check_field_presence checks if given field 
- * in GTP packet is compliant with ETSI 
+/* Next definitions and function check_field_presence checks if given field
+ * in GTP packet is compliant with ETSI
  */
 typedef struct _header {
        guint8          code;
@@ -1727,20 +1738,20 @@ typedef struct _message {
 } _gtp_mess_items;
 
 /* ---------------------
- * GPRS messages 
+ * GPRS messages
  * ---------------------*/
-_gtp_mess_items gprs_mess_items[] = {
+static _gtp_mess_items gprs_mess_items[] = {
 
 {
-       GTP_MSG_ECHO_REQ, {                                     
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+       GTP_MSG_ECHO_REQ, {
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_ECHO_RESP, {
-               { GTP_EXT_RECOVER,      MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_RECOVER,      GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
@@ -1751,302 +1762,302 @@ _gtp_mess_items gprs_mess_items[] = {
 },
 {
        GTP_MSG_NODE_ALIVE_REQ, {
-               { GTP_EXT_NODE_ADDR,    MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_NODE_ADDR,    GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_NODE_ALIVE_RESP, {
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_REDIR_REQ, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_NODE_ADDR,    OPTIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_NODE_ADDR,    GTP_OPTIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_REDIR_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
-{ 
+{
        GTP_MSG_CREATE_PDP_REQ, {
-               { GTP_EXT_QOS_GPRS,     MANDATORY },
-               { GTP_EXT_RECOVER,      OPTIONAL },
-               { GTP_EXT_SEL_MODE,     MANDATORY },
-               { GTP_EXT_FLOW_LABEL,   MANDATORY },
-               { GTP_EXT_FLOW_SIG,     MANDATORY },
-               { GTP_EXT_MSISDN,       MANDATORY },
-               { GTP_EXT_USER_ADDR,    MANDATORY },
-               { GTP_EXT_APN,          MANDATORY },
-               { GTP_EXT_PROTO_CONF,   OPTIONAL },
-               { GTP_EXT_GSN_ADDR,     MANDATORY },
-               { GTP_EXT_GSN_ADDR,     MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_QOS_GPRS,     GTP_MANDATORY },
+               { GTP_EXT_RECOVER,      GTP_OPTIONAL },
+               { GTP_EXT_SEL_MODE,     GTP_MANDATORY },
+               { GTP_EXT_FLOW_LABEL,   GTP_MANDATORY },
+               { GTP_EXT_FLOW_SIG,     GTP_MANDATORY },
+               { GTP_EXT_MSISDN,       GTP_MANDATORY },
+               { GTP_EXT_USER_ADDR,    GTP_MANDATORY },
+               { GTP_EXT_APN,          GTP_MANDATORY },
+               { GTP_EXT_PROTO_CONF,   GTP_OPTIONAL },
+               { GTP_EXT_GSN_ADDR,     GTP_MANDATORY },
+               { GTP_EXT_GSN_ADDR,     GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
-{ 
+{
        GTP_MSG_CREATE_PDP_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_QOS_GPRS,     CONDITIONAL },
-               { GTP_EXT_REORDER,      CONDITIONAL },
-               { GTP_EXT_RECOVER,      OPTIONAL },
-               { GTP_EXT_FLOW_LABEL,   CONDITIONAL },
-               { GTP_EXT_FLOW_SIG,     CONDITIONAL },
-               { GTP_EXT_CHRG_ID,      CONDITIONAL },
-               { GTP_EXT_USER_ADDR,    CONDITIONAL },
-               { GTP_EXT_PROTO_CONF,   OPTIONAL },
-               { GTP_EXT_GSN_ADDR,     CONDITIONAL },
-               { GTP_EXT_GSN_ADDR,     CONDITIONAL },
-               { GTP_EXT_CHRG_ADDR,    OPTIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_QOS_GPRS,     GTP_CONDITIONAL },
+               { GTP_EXT_REORDER,      GTP_CONDITIONAL },
+               { GTP_EXT_RECOVER,      GTP_OPTIONAL },
+               { GTP_EXT_FLOW_LABEL,   GTP_CONDITIONAL },
+               { GTP_EXT_FLOW_SIG,     GTP_CONDITIONAL },
+               { GTP_EXT_CHRG_ID,      GTP_CONDITIONAL },
+               { GTP_EXT_USER_ADDR,    GTP_CONDITIONAL },
+               { GTP_EXT_PROTO_CONF,   GTP_OPTIONAL },
+               { GTP_EXT_GSN_ADDR,     GTP_CONDITIONAL },
+               { GTP_EXT_GSN_ADDR,     GTP_CONDITIONAL },
+               { GTP_EXT_CHRG_ADDR,    GTP_OPTIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
-{      
+{
        GTP_MSG_UPDATE_PDP_REQ, {
-               { GTP_EXT_QOS_GPRS,     MANDATORY },
-               { GTP_EXT_RECOVER,      OPTIONAL },
-               { GTP_EXT_FLOW_LABEL,   MANDATORY },
-               { GTP_EXT_FLOW_SIG,     MANDATORY },
-               { GTP_EXT_GSN_ADDR,     MANDATORY },
-               { GTP_EXT_GSN_ADDR,     MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_QOS_GPRS,     GTP_MANDATORY },
+               { GTP_EXT_RECOVER,      GTP_OPTIONAL },
+               { GTP_EXT_FLOW_LABEL,   GTP_MANDATORY },
+               { GTP_EXT_FLOW_SIG,     GTP_MANDATORY },
+               { GTP_EXT_GSN_ADDR,     GTP_MANDATORY },
+               { GTP_EXT_GSN_ADDR,     GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 },
        }
 },
 {
        GTP_MSG_UPDATE_PDP_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_QOS_GPRS,     CONDITIONAL },
-               { GTP_EXT_RECOVER,      OPTIONAL },
-               { GTP_EXT_FLOW_LABEL,   CONDITIONAL },
-               { GTP_EXT_FLOW_SIG,     CONDITIONAL },
-               { GTP_EXT_CHRG_ID,      CONDITIONAL },
-               { GTP_EXT_GSN_ADDR,     CONDITIONAL },
-               { GTP_EXT_GSN_ADDR,     CONDITIONAL },
-               { GTP_EXT_CHRG_ADDR,    OPTIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_QOS_GPRS,     GTP_CONDITIONAL },
+               { GTP_EXT_RECOVER,      GTP_OPTIONAL },
+               { GTP_EXT_FLOW_LABEL,   GTP_CONDITIONAL },
+               { GTP_EXT_FLOW_SIG,     GTP_CONDITIONAL },
+               { GTP_EXT_CHRG_ID,      GTP_CONDITIONAL },
+               { GTP_EXT_GSN_ADDR,     GTP_CONDITIONAL },
+               { GTP_EXT_GSN_ADDR,     GTP_CONDITIONAL },
+               { GTP_EXT_CHRG_ADDR,    GTP_OPTIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_DELETE_PDP_REQ, {
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_DELETE_PDP_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 },
        }
 },
 {
        GTP_MSG_CREATE_AA_PDP_REQ, {
-               { GTP_EXT_QOS_GPRS,     MANDATORY },
-               { GTP_EXT_RECOVER,      OPTIONAL },
-               { GTP_EXT_SEL_MODE,     MANDATORY },
-               { GTP_EXT_FLOW_LABEL,   MANDATORY },
-               { GTP_EXT_FLOW_SIG,     MANDATORY },
-               { GTP_EXT_USER_ADDR,    MANDATORY },
-               { GTP_EXT_APN,          MANDATORY },
-               { GTP_EXT_PROTO_CONF,   OPTIONAL },
-               { GTP_EXT_GSN_ADDR,     MANDATORY },
-               { GTP_EXT_GSN_ADDR,     MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_QOS_GPRS,     GTP_MANDATORY },
+               { GTP_EXT_RECOVER,      GTP_OPTIONAL },
+               { GTP_EXT_SEL_MODE,     GTP_MANDATORY },
+               { GTP_EXT_FLOW_LABEL,   GTP_MANDATORY },
+               { GTP_EXT_FLOW_SIG,     GTP_MANDATORY },
+               { GTP_EXT_USER_ADDR,    GTP_MANDATORY },
+               { GTP_EXT_APN,          GTP_MANDATORY },
+               { GTP_EXT_PROTO_CONF,   GTP_OPTIONAL },
+               { GTP_EXT_GSN_ADDR,     GTP_MANDATORY },
+               { GTP_EXT_GSN_ADDR,     GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
-       GTP_MSG_CREATE_AA_PDP_RESP, {                                   
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_QOS_GPRS,     CONDITIONAL },
-               { GTP_EXT_REORDER,      CONDITIONAL },
-               { GTP_EXT_RECOVER,      OPTIONAL },
-               { GTP_EXT_FLOW_LABEL,   CONDITIONAL },
-               { GTP_EXT_FLOW_SIG,     CONDITIONAL },
-               { GTP_EXT_CHRG_ID,      CONDITIONAL },
-               { GTP_EXT_USER_ADDR,    CONDITIONAL },
-               { GTP_EXT_PROTO_CONF,   OPTIONAL },
-               { GTP_EXT_GSN_ADDR,     CONDITIONAL },
-               { GTP_EXT_GSN_ADDR,     CONDITIONAL },
-               { GTP_EXT_CHRG_ADDR,    OPTIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+       GTP_MSG_CREATE_AA_PDP_RESP, {
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_QOS_GPRS,     GTP_CONDITIONAL },
+               { GTP_EXT_REORDER,      GTP_CONDITIONAL },
+               { GTP_EXT_RECOVER,      GTP_OPTIONAL },
+               { GTP_EXT_FLOW_LABEL,   GTP_CONDITIONAL },
+               { GTP_EXT_FLOW_SIG,     GTP_CONDITIONAL },
+               { GTP_EXT_CHRG_ID,      GTP_CONDITIONAL },
+               { GTP_EXT_USER_ADDR,    GTP_CONDITIONAL },
+               { GTP_EXT_PROTO_CONF,   GTP_OPTIONAL },
+               { GTP_EXT_GSN_ADDR,     GTP_CONDITIONAL },
+               { GTP_EXT_GSN_ADDR,     GTP_CONDITIONAL },
+               { GTP_EXT_CHRG_ADDR,    GTP_OPTIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_DELETE_AA_PDP_REQ, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_DELETE_AA_PDP_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_ERR_IND, {
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_PDU_NOTIFY_REQ, {
-               { GTP_EXT_USER_ADDR,    MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_USER_ADDR,    GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
-{      
+{
        GTP_MSG_PDU_NOTIFY_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_PDU_NOTIFY_REJ_REQ, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_USER_ADDR,    MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_USER_ADDR,    GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_PDU_NOTIFY_REJ_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_SEND_ROUT_INFO_REQ, {
-               { GTP_EXT_IMSI,         MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_IMSI,         GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_SEND_ROUT_INFO_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_IMSI,         MANDATORY },
-               { GTP_EXT_MAP_CAUSE,    OPTIONAL },
-               { GTP_EXT_MS_REASON,    OPTIONAL },
-               { GTP_EXT_GSN_ADDR,     OPTIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_IMSI,         GTP_MANDATORY },
+               { GTP_EXT_MAP_CAUSE,    GTP_OPTIONAL },
+               { GTP_EXT_MS_REASON,    GTP_OPTIONAL },
+               { GTP_EXT_GSN_ADDR,     GTP_OPTIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_FAIL_REP_REQ, {
-               { GTP_EXT_IMSI,         MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_IMSI,         GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_FAIL_REP_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_MAP_CAUSE,    OPTIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_MAP_CAUSE,    GTP_OPTIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_MS_PRESENT_REQ, {
-               { GTP_EXT_IMSI,         MANDATORY },
-               { GTP_EXT_GSN_ADDR,     MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_IMSI,         GTP_MANDATORY },
+               { GTP_EXT_GSN_ADDR,     GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_MS_PRESENT_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_IDENT_REQ, {
-               { GTP_EXT_RAI,          MANDATORY },
-               { GTP_EXT_PTMSI,        MANDATORY },
-               { GTP_EXT_PTMSI_SIG,    OPTIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_RAI,          GTP_MANDATORY },
+               { GTP_EXT_PTMSI,        GTP_MANDATORY },
+               { GTP_EXT_PTMSI_SIG,    GTP_OPTIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_IDENT_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_IMSI,         CONDITIONAL },
-               { GTP_EXT_AUTH_TRI,     OPTIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_IMSI,         GTP_CONDITIONAL },
+               { GTP_EXT_AUTH_TRI,     GTP_OPTIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_SGSN_CNTXT_REQ, {
-               { GTP_EXT_IMSI,         CONDITIONAL },
-               { GTP_EXT_RAI,          MANDATORY },
-               { GTP_EXT_TLLI,         MANDATORY },
-               { GTP_EXT_PTMSI_SIG,    OPTIONAL },
-               { GTP_EXT_MS_VALID,     OPTIONAL },
-               { GTP_EXT_FLOW_SIG,     MANDATORY },
+               { GTP_EXT_IMSI,         GTP_CONDITIONAL },
+               { GTP_EXT_RAI,          GTP_MANDATORY },
+               { GTP_EXT_TLLI,         GTP_MANDATORY },
+               { GTP_EXT_PTMSI_SIG,    GTP_OPTIONAL },
+               { GTP_EXT_MS_VALID,     GTP_OPTIONAL },
+               { GTP_EXT_FLOW_SIG,     GTP_MANDATORY },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_SGSN_CNTXT_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_IMSI,         CONDITIONAL },
-               { GTP_EXT_FLOW_SIG,     CONDITIONAL },
-               { GTP_EXT_MM_CNTXT,     CONDITIONAL },
-               { GTP_EXT_PDP_CNTXT,    CONDITIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_IMSI,         GTP_CONDITIONAL },
+               { GTP_EXT_FLOW_SIG,     GTP_CONDITIONAL },
+               { GTP_EXT_MM_CNTXT,     GTP_CONDITIONAL },
+               { GTP_EXT_PDP_CNTXT,    GTP_CONDITIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_SGSN_CNTXT_ACK, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_FLOW_II,      CONDITIONAL },
-               { GTP_EXT_GSN_ADDR,     CONDITIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_FLOW_II,      GTP_CONDITIONAL },
+               { GTP_EXT_GSN_ADDR,     GTP_CONDITIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_DATA_TRANSF_REQ, {
-               { GTP_EXT_TR_COMM,      MANDATORY },
-               { GTP_EXT_DATA_REQ,     CONDITIONAL },
-               { GTP_EXT_REL_PACK,     CONDITIONAL },
-               { GTP_EXT_CAN_PACK,     CONDITIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_TR_COMM,      GTP_MANDATORY },
+               { GTP_EXT_DATA_REQ,     GTP_CONDITIONAL },
+               { GTP_EXT_REL_PACK,     GTP_CONDITIONAL },
+               { GTP_EXT_CAN_PACK,     GTP_CONDITIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_DATA_TRANSF_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_DATA_RESP,    MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_DATA_RESP,    GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
@@ -2058,20 +2069,20 @@ _gtp_mess_items gprs_mess_items[] = {
 };
 
 /* -----------------------------
- * UMTS messages 
+ * UMTS messages
  * -----------------------------*/
-_gtp_mess_items umts_mess_items[] = {
+static _gtp_mess_items umts_mess_items[] = {
 
 {
-       GTP_MSG_ECHO_REQ, {                                     
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+       GTP_MSG_ECHO_REQ, {
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_ECHO_RESP, {
-               { GTP_EXT_RECOVER,      MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_RECOVER,      GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
@@ -2082,22 +2093,22 @@ _gtp_mess_items umts_mess_items[] = {
 },
 {
        GTP_MSG_NODE_ALIVE_REQ, {
-               { GTP_EXT_NODE_ADDR,    MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_NODE_ADDR,    GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_NODE_ALIVE_RESP, {
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_REDIR_REQ, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_NODE_ADDR,    OPTIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_NODE_ADDR,    GTP_OPTIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
@@ -2108,314 +2119,314 @@ _gtp_mess_items umts_mess_items[] = {
 },
 {
        GTP_MSG_CREATE_PDP_REQ, {
-               { GTP_EXT_IMSI,         CONDITIONAL },
-               { GTP_EXT_RECOVER,      OPTIONAL },
-               { GTP_EXT_SEL_MODE,     CONDITIONAL },
-               { GTP_EXT_TEID,         MANDATORY },
-               { GTP_EXT_TEID_CP,      CONDITIONAL },
-               { GTP_EXT_NSAPI,        MANDATORY },
-               { GTP_EXT_NSAPI,        CONDITIONAL },
-               { GTP_EXT_CHRG_CHAR,    OPTIONAL },
-               { GTP_EXT_TRACE_REF,    OPTIONAL },
-               { GTP_EXT_TRACE_TYPE,   OPTIONAL },
-               { GTP_EXT_USER_ADDR,    CONDITIONAL },
-               { GTP_EXT_APN,          CONDITIONAL },
-               { GTP_EXT_PROTO_CONF,   CONDITIONAL },
-               { GTP_EXT_GSN_ADDR,     MANDATORY },
-               { GTP_EXT_GSN_ADDR,     MANDATORY },
-               { GTP_EXT_MSISDN,       CONDITIONAL },
-               { GTP_EXT_QOS_UMTS,     MANDATORY },
-               { GTP_EXT_TFT,          CONDITIONAL },
-               { GTP_EXT_TRIGGER_ID,   OPTIONAL },
-               { GTP_EXT_OMC_ID,       OPTIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_IMSI,         GTP_CONDITIONAL },
+               { GTP_EXT_RECOVER,      GTP_OPTIONAL },
+               { GTP_EXT_SEL_MODE,     GTP_CONDITIONAL },
+               { GTP_EXT_TEID,         GTP_MANDATORY },
+               { GTP_EXT_TEID_CP,      GTP_CONDITIONAL },
+               { GTP_EXT_NSAPI,        GTP_MANDATORY },
+               { GTP_EXT_NSAPI,        GTP_CONDITIONAL },
+               { GTP_EXT_CHRG_CHAR,    GTP_OPTIONAL },
+               { GTP_EXT_TRACE_REF,    GTP_OPTIONAL },
+               { GTP_EXT_TRACE_TYPE,   GTP_OPTIONAL },
+               { GTP_EXT_USER_ADDR,    GTP_CONDITIONAL },
+               { GTP_EXT_APN,          GTP_CONDITIONAL },
+               { GTP_EXT_PROTO_CONF,   GTP_CONDITIONAL },
+               { GTP_EXT_GSN_ADDR,     GTP_MANDATORY },
+               { GTP_EXT_GSN_ADDR,     GTP_MANDATORY },
+               { GTP_EXT_MSISDN,       GTP_CONDITIONAL },
+               { GTP_EXT_QOS_UMTS,     GTP_MANDATORY },
+               { GTP_EXT_TFT,          GTP_CONDITIONAL },
+               { GTP_EXT_TRIGGER_ID,   GTP_OPTIONAL },
+               { GTP_EXT_OMC_ID,       GTP_OPTIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_CREATE_PDP_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_REORDER,      CONDITIONAL },
-               { GTP_EXT_RECOVER,      OPTIONAL },
-               { GTP_EXT_TEID,         CONDITIONAL },
-               { GTP_EXT_TEID_CP,      CONDITIONAL },
-               { GTP_EXT_CHRG_ID,      CONDITIONAL },
-               { GTP_EXT_USER_ADDR,    CONDITIONAL },
-               { GTP_EXT_PROTO_CONF,   OPTIONAL },
-               { GTP_EXT_GSN_ADDR,     CONDITIONAL },
-               { GTP_EXT_GSN_ADDR,     CONDITIONAL },
-               { GTP_EXT_QOS_UMTS,     CONDITIONAL },
-               { GTP_EXT_CHRG_ADDR,    OPTIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_REORDER,      GTP_CONDITIONAL },
+               { GTP_EXT_RECOVER,      GTP_OPTIONAL },
+               { GTP_EXT_TEID,         GTP_CONDITIONAL },
+               { GTP_EXT_TEID_CP,      GTP_CONDITIONAL },
+               { GTP_EXT_CHRG_ID,      GTP_CONDITIONAL },
+               { GTP_EXT_USER_ADDR,    GTP_CONDITIONAL },
+               { GTP_EXT_PROTO_CONF,   GTP_OPTIONAL },
+               { GTP_EXT_GSN_ADDR,     GTP_CONDITIONAL },
+               { GTP_EXT_GSN_ADDR,     GTP_CONDITIONAL },
+               { GTP_EXT_QOS_UMTS,     GTP_CONDITIONAL },
+               { GTP_EXT_CHRG_ADDR,    GTP_OPTIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {      /* checked, SGSN -> GGSN */
        GTP_MSG_UPDATE_PDP_REQ, {
-               { GTP_EXT_IMSI,         CONDITIONAL },
-               { GTP_EXT_RECOVER,      OPTIONAL },
-               { GTP_EXT_TEID,         MANDATORY },
-               { GTP_EXT_TEID_CP,      CONDITIONAL },
-               { GTP_EXT_NSAPI,        MANDATORY },
-               { GTP_EXT_TRACE_REF,    OPTIONAL },
-               { GTP_EXT_TRACE_TYPE,   OPTIONAL },
-               { GTP_EXT_GSN_ADDR,     MANDATORY },
-               { GTP_EXT_GSN_ADDR,     MANDATORY },
-               { GTP_EXT_QOS_UMTS,     MANDATORY },
-               { GTP_EXT_TFT,          OPTIONAL },
-               { GTP_EXT_TRIGGER_ID,   OPTIONAL },
-               { GTP_EXT_OMC_ID,       OPTIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_IMSI,         GTP_CONDITIONAL },
+               { GTP_EXT_RECOVER,      GTP_OPTIONAL },
+               { GTP_EXT_TEID,         GTP_MANDATORY },
+               { GTP_EXT_TEID_CP,      GTP_CONDITIONAL },
+               { GTP_EXT_NSAPI,        GTP_MANDATORY },
+               { GTP_EXT_TRACE_REF,    GTP_OPTIONAL },
+               { GTP_EXT_TRACE_TYPE,   GTP_OPTIONAL },
+               { GTP_EXT_GSN_ADDR,     GTP_MANDATORY },
+               { GTP_EXT_GSN_ADDR,     GTP_MANDATORY },
+               { GTP_EXT_QOS_UMTS,     GTP_MANDATORY },
+               { GTP_EXT_TFT,          GTP_OPTIONAL },
+               { GTP_EXT_TRIGGER_ID,   GTP_OPTIONAL },
+               { GTP_EXT_OMC_ID,       GTP_OPTIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {      /* checked, GGSN -> SGSN */
        GTP_MSG_UPDATE_PDP_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_RECOVER,      OPTIONAL },
-               { GTP_EXT_TEID,         CONDITIONAL },
-               { GTP_EXT_TEID_CP,      CONDITIONAL },
-               { GTP_EXT_CHRG_ID,      CONDITIONAL },
-               { GTP_EXT_GSN_ADDR,     CONDITIONAL },
-               { GTP_EXT_GSN_ADDR,     CONDITIONAL },
-               { GTP_EXT_QOS_UMTS,     CONDITIONAL },
-               { GTP_EXT_CHRG_ADDR,    OPTIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_RECOVER,      GTP_OPTIONAL },
+               { GTP_EXT_TEID,         GTP_CONDITIONAL },
+               { GTP_EXT_TEID_CP,      GTP_CONDITIONAL },
+               { GTP_EXT_CHRG_ID,      GTP_CONDITIONAL },
+               { GTP_EXT_GSN_ADDR,     GTP_CONDITIONAL },
+               { GTP_EXT_GSN_ADDR,     GTP_CONDITIONAL },
+               { GTP_EXT_QOS_UMTS,     GTP_CONDITIONAL },
+               { GTP_EXT_CHRG_ADDR,    GTP_OPTIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_DELETE_PDP_REQ, {
-               { GTP_EXT_TEAR_IND,     CONDITIONAL },
-               { GTP_EXT_NSAPI,        MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_TEAR_IND,     GTP_CONDITIONAL },
+               { GTP_EXT_NSAPI,        GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_DELETE_PDP_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_ERR_IND, {
-               { GTP_EXT_TEID,         MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_TEID,         GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_PDU_NOTIFY_REQ, {
-               { GTP_EXT_IMSI,         MANDATORY },
-               { GTP_EXT_TEID_CP,      MANDATORY },
-               { GTP_EXT_USER_ADDR,    MANDATORY },
-               { GTP_EXT_APN,          MANDATORY },
-               { GTP_EXT_GSN_ADDR,     MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_IMSI,         GTP_MANDATORY },
+               { GTP_EXT_TEID_CP,      GTP_MANDATORY },
+               { GTP_EXT_USER_ADDR,    GTP_MANDATORY },
+               { GTP_EXT_APN,          GTP_MANDATORY },
+               { GTP_EXT_GSN_ADDR,     GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_PDU_NOTIFY_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_PDU_NOTIFY_REJ_REQ, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_TEID_CP,      MANDATORY },
-               { GTP_EXT_USER_ADDR,    MANDATORY },
-               { GTP_EXT_APN,          MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_TEID_CP,      GTP_MANDATORY },
+               { GTP_EXT_USER_ADDR,    GTP_MANDATORY },
+               { GTP_EXT_APN,          GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_PDU_NOTIFY_REJ_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_SUPP_EXT_HDR, {
-               { GTP_EXT_HDR_LIST,     MANDATORY },
+               { GTP_EXT_HDR_LIST,     GTP_MANDATORY },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_SEND_ROUT_INFO_REQ, {
-               { GTP_EXT_IMSI,         MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_IMSI,         GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_SEND_ROUT_INFO_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_IMSI,         MANDATORY },
-               { GTP_EXT_MAP_CAUSE,    OPTIONAL },
-               { GTPv1_EXT_MS_REASON,  OPTIONAL },
-               { GTP_EXT_GSN_ADDR,     OPTIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_IMSI,         GTP_MANDATORY },
+               { GTP_EXT_MAP_CAUSE,    GTP_OPTIONAL },
+               { GTPv1_EXT_MS_REASON,  GTP_OPTIONAL },
+               { GTP_EXT_GSN_ADDR,     GTP_OPTIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_FAIL_REP_REQ, {
-               { GTP_EXT_IMSI,         MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_IMSI,         GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_FAIL_REP_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_MAP_CAUSE,    OPTIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_MAP_CAUSE,    GTP_OPTIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_MS_PRESENT_REQ, {
-               { GTP_EXT_IMSI,         MANDATORY },
-               { GTP_EXT_GSN_ADDR,     MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_IMSI,         GTP_MANDATORY },
+               { GTP_EXT_GSN_ADDR,     GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_MS_PRESENT_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_IDENT_REQ, {
-               { GTP_EXT_RAI,          MANDATORY },
-               { GTP_EXT_PTMSI,        MANDATORY },
-               { GTP_EXT_PTMSI_SIG,    CONDITIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_RAI,          GTP_MANDATORY },
+               { GTP_EXT_PTMSI,        GTP_MANDATORY },
+               { GTP_EXT_PTMSI_SIG,    GTP_CONDITIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_IDENT_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_IMSI,         CONDITIONAL },
-               { GTP_EXT_AUTH_TRI,     CONDITIONAL },
-               { GTP_EXT_AUTH_QUI,     CONDITIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_IMSI,         GTP_CONDITIONAL },
+               { GTP_EXT_AUTH_TRI,     GTP_CONDITIONAL },
+               { GTP_EXT_AUTH_QUI,     GTP_CONDITIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_SGSN_CNTXT_REQ, {
-               { GTP_EXT_IMSI,         CONDITIONAL },
-               { GTP_EXT_RAI,          MANDATORY },
-               { GTP_EXT_TLLI,         CONDITIONAL },
-               { GTP_EXT_PTMSI,        CONDITIONAL },
-               { GTP_EXT_PTMSI_SIG,    CONDITIONAL },
-               { GTP_EXT_MS_VALID,     OPTIONAL },
-               { GTP_EXT_TEID_CP,      MANDATORY },
-               { GTP_EXT_GSN_ADDR,     MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_IMSI,         GTP_CONDITIONAL },
+               { GTP_EXT_RAI,          GTP_MANDATORY },
+               { GTP_EXT_TLLI,         GTP_CONDITIONAL },
+               { GTP_EXT_PTMSI,        GTP_CONDITIONAL },
+               { GTP_EXT_PTMSI_SIG,    GTP_CONDITIONAL },
+               { GTP_EXT_MS_VALID,     GTP_OPTIONAL },
+               { GTP_EXT_TEID_CP,      GTP_MANDATORY },
+               { GTP_EXT_GSN_ADDR,     GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_SGSN_CNTXT_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_IMSI,         CONDITIONAL },
-               { GTP_EXT_TEID_CP,      CONDITIONAL },
-               { GTP_EXT_RP_SMS,       OPTIONAL },
-               { GTP_EXT_RP,           OPTIONAL },
-               { GTP_EXT_PKT_FLOW_ID,  OPTIONAL },
-               { GTP_EXT_MM_CNTXT,     CONDITIONAL },
-               { GTP_EXT_PDP_CNTXT,    CONDITIONAL },
-               { GTP_EXT_GSN_ADDR,     CONDITIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_IMSI,         GTP_CONDITIONAL },
+               { GTP_EXT_TEID_CP,      GTP_CONDITIONAL },
+               { GTP_EXT_RP_SMS,       GTP_OPTIONAL },
+               { GTP_EXT_RP,           GTP_OPTIONAL },
+               { GTP_EXT_PKT_FLOW_ID,  GTP_OPTIONAL },
+               { GTP_EXT_MM_CNTXT,     GTP_CONDITIONAL },
+               { GTP_EXT_PDP_CNTXT,    GTP_CONDITIONAL },
+               { GTP_EXT_GSN_ADDR,     GTP_CONDITIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_SGSN_CNTXT_ACK, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_TEID_II,      CONDITIONAL },
-               { GTP_EXT_GSN_ADDR,     CONDITIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_TEID_II,      GTP_CONDITIONAL },
+               { GTP_EXT_GSN_ADDR,     GTP_CONDITIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_FORW_RELOC_REQ, {
-               { GTP_EXT_IMSI,         MANDATORY },
-               { GTP_EXT_TEID_CP,      MANDATORY },
-               { GTP_EXT_RANAP_CAUSE,  MANDATORY },
-               { GTP_EXT_MM_CNTXT,     MANDATORY },
-               { GTP_EXT_PDP_CNTXT,    CONDITIONAL },
-               { GTP_EXT_GSN_ADDR,     MANDATORY },
-               { GTP_EXT_TARGET_ID,    MANDATORY },
-               { GTP_EXT_UTRAN_CONT,   MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_IMSI,         GTP_MANDATORY },
+               { GTP_EXT_TEID_CP,      GTP_MANDATORY },
+               { GTP_EXT_RANAP_CAUSE,  GTP_MANDATORY },
+               { GTP_EXT_MM_CNTXT,     GTP_MANDATORY },
+               { GTP_EXT_PDP_CNTXT,    GTP_CONDITIONAL },
+               { GTP_EXT_GSN_ADDR,     GTP_MANDATORY },
+               { GTP_EXT_TARGET_ID,    GTP_MANDATORY },
+               { GTP_EXT_UTRAN_CONT,   GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_FORW_RELOC_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_TEID_CP,      CONDITIONAL },
-               { GTP_EXT_RANAP_CAUSE,  CONDITIONAL },
-               { GTP_EXT_GSN_ADDR,     CONDITIONAL },
-               { GTP_EXT_UTRAN_CONT,   OPTIONAL },
-               { GTP_EXT_RAB_SETUP,    CONDITIONAL },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_TEID_CP,      GTP_CONDITIONAL },
+               { GTP_EXT_RANAP_CAUSE,  GTP_CONDITIONAL },
+               { GTP_EXT_GSN_ADDR,     GTP_CONDITIONAL },
+               { GTP_EXT_UTRAN_CONT,   GTP_OPTIONAL },
+               { GTP_EXT_RAB_SETUP,    GTP_CONDITIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_FORW_RELOC_COMP, {
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_RELOC_CANCEL_REQ, {
-               { GTP_EXT_IMSI,         MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_IMSI,         GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_RELOC_CANCEL_RESP, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_FORW_RELOC_ACK, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_FORW_SRNS_CNTXT, {
-               { GTP_EXT_RAB_CNTXT,    MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_RAB_CNTXT,    GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
 {
        GTP_MSG_FORW_SRNS_CNTXT_ACK, {
-               { GTP_EXT_CAUSE,        MANDATORY },
-               { GTP_EXT_PRIV_EXT,     OPTIONAL },
+               { GTP_EXT_CAUSE,        GTP_MANDATORY },
+               { GTP_EXT_PRIV_EXT,     GTP_OPTIONAL },
                { 0,                    0 }
        }
 },
@@ -2426,17 +2437,17 @@ _gtp_mess_items umts_mess_items[] = {
 }
 };
 
-static int 
+static int
 check_field_presence(guint8 message, guint8 field, int *position) {
-       
+
        guint                   i = 0;
        _gtp_mess_items         *mess_items;
 
        switch(gtp_version) {
-               case 0: 
+               case 0:
                        mess_items = gprs_mess_items;
                        break;
-               case 1: 
+               case 1:
                        mess_items = umts_mess_items;
                        break;
                default:
@@ -2445,13 +2456,13 @@ check_field_presence(guint8 message, guint8 field, int *position) {
 
        while (mess_items[i].code) {
                if (mess_items[i].code == message) {
-                       
+
                        while (mess_items[i].fields[*position].code) {
                                if (mess_items[i].fields[*position].code == field) {
                                        (*position)++;
                                        return 0;
-                               } else { 
-                               if (mess_items[i].fields[*position].presence == MANDATORY) {
+                               } else {
+                               if (mess_items[i].fields[*position].presence == GTP_MANDATORY) {
                                        return mess_items[i].fields[(*position)++].code;
                                } else {
                                        (*position)++;
@@ -2460,7 +2471,7 @@ check_field_presence(guint8 message, guint8 field, int *position) {
                        return -1;
                }
                i++;
-       }       
+       }
 
        return -2;
 }
@@ -2471,12 +2482,12 @@ check_field_presence(guint8 message, guint8 field, int *position) {
  * UMTS:       29.060 v4.0, chapter
  */
 static int
-decode_gtp_cause(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
+decode_gtp_cause(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
 
        guint8  cause;
-       
-       cause = tvb_get_guint8(tvb, offset+1);  
-       
+
+       cause = tvb_get_guint8(tvb, offset+1);
+
        proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_cause : hf_gtpv0_cause, tvb, offset, 2, cause);
 
        return 2;
@@ -2485,16 +2496,16 @@ decode_gtp_cause(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree
 /* GPRS:       9.60 v7.6.0, chapter 7.9.2
  * UMTS:       29.060 v4.0, chapter 7.7.2
  */
-static int 
-decode_gtp_imsi(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
+static int
+decode_gtp_imsi(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        guint8  tid_val[8];
        gchar   *tid_str;
 
        tvb_memcpy(tvb, tid_val, offset+1, 8);
        tid_val[1] = tid_val[1] & 0x0F;
        tid_str = id_to_str(tid_val);
-       
+
        proto_tree_add_string(tree, gtp_version ? hf_gtpv1_imsi : hf_gtpv0_imsi, tvb, offset, 9, tid_str);
 
        return 9;
@@ -2505,18 +2516,25 @@ decode_gtp_imsi(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
  * TODO: Add details about MCC, MNC, LAC, RAC (show each digit) ?
  */
 static int
-decode_gtp_rai(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
+decode_gtp_rai(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        proto_tree      *ext_tree_rai;
        proto_item      *te;
-       
-       te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_RAI, gtp_val, "Unknown message")); 
+       guint8          byte[3];
+
+       te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_RAI, gtp_val, "Unknown message"));
        ext_tree_rai = proto_item_add_subtree(te, ett_gtp_rai);
-       
-       proto_tree_add_uint(ext_tree_rai, gtp_version ? hf_gtpv1_rai_mcc : hf_gtpv0_rai_mcc, tvb, offset+1, 2, tvb_get_letohs(tvb, offset+1) & 0xFF0F);
-       proto_tree_add_uint(ext_tree_rai, gtp_version ? hf_gtpv1_rai_mnc : hf_gtpv0_rai_mnc, tvb, offset+2, 2, tvb_get_ntohs(tvb, offset+3) & 0xF0FF);
-       proto_tree_add_uint(ext_tree_rai, gtp_version ? hf_gtpv1_rai_lac : hf_gtpv0_rai_lac, tvb, offset+4, 2, tvb_get_letohs(tvb, offset+4));
-       proto_tree_add_uint(ext_tree_rai, gtp_version ? hf_gtpv1_rai_rac : hf_gtpv0_rai_rac, tvb, offset+6, 1, tvb_get_guint8(tvb, offset+6));
+
+/*     tvb_memcpy (tvb, (guint8 *)&byte, offset + 1, 3); */
+       byte[1] = tvb_get_guint8 (tvb, offset + 1);
+       byte[2] = tvb_get_guint8 (tvb, offset + 2);
+       byte[3] = tvb_get_guint8 (tvb, offset + 3);
+
+
+       proto_tree_add_uint(ext_tree_rai, gtp_version ? hf_gtpv1_rai_mcc : hf_gtpv0_rai_mcc, tvb, offset+1, 2, (byte[1] & 0x0F) * 100 + ((byte[1] & 0xF0) >> 4) * 10  + (byte[2] & 0x0F ));
+       proto_tree_add_uint(ext_tree_rai, gtp_version ? hf_gtpv1_rai_mnc : hf_gtpv0_rai_mnc, tvb, offset+2, 2, ((byte[3] & 0xF0) >> 4 ) * 10  + (byte[3] & 0x0F));
+       proto_tree_add_uint(ext_tree_rai, gtp_version ? hf_gtpv1_rai_lac : hf_gtpv0_rai_lac, tvb, offset+4, 2, tvb_get_ntohs (tvb, offset+4));
+       proto_tree_add_uint(ext_tree_rai, gtp_version ? hf_gtpv1_rai_rac : hf_gtpv0_rai_rac, tvb, offset+6, 1, tvb_get_guint8 (tvb, offset+6));
 
        return 7;
 }
@@ -2525,12 +2543,12 @@ decode_gtp_rai(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
  * UMTS:       29.060 v4.0, chapter 7.7.4, page 47
  */
 static int
-decode_gtp_tlli(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
+decode_gtp_tlli(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        guint32 tlli;
-       
-       tlli = tvb_get_ntohl(tvb, offset+1);    
-       proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_tlli : hf_gtpv0_tlli, tvb, offset, 5, tlli); 
+
+       tlli = tvb_get_ntohl(tvb, offset+1);
+       proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_tlli : hf_gtpv0_tlli, tvb, offset, 5, tlli);
 
        return 5;
 }
@@ -2539,25 +2557,25 @@ decode_gtp_tlli(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
  * UMTS:       29.060 v4.0, chapter 7.7.5, page 47
  */
 static int
-decode_gtp_ptmsi(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
+decode_gtp_ptmsi(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        guint32 ptmsi;
-       
-       ptmsi = tvb_get_ntohl(tvb, offset);     
+
+       ptmsi = tvb_get_ntohl(tvb, offset);
        proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_ptmsi : hf_gtpv0_ptmsi, tvb, offset, 5, ptmsi);
 
        return 5;
 }
 
-/* adjust - how many bytes before offset should be highlighted 
+/* adjust - how many bytes before offset should be highlighted
  */
 static int
 decode_qos_gprs(tvbuff_t *tvb, int offset, proto_tree *tree, gchar* qos_str, guint8 adjust) {
-       
+
        guint8          spare1, delay, reliability, peak, spare2,  precedence, spare3, mean;
        proto_tree      *ext_tree_qos;
        proto_item      *te;
-       
+
        spare1 = tvb_get_guint8(tvb, offset) & 0xC0;
        delay = tvb_get_guint8(tvb, offset) & 0x38;
        reliability = tvb_get_guint8(tvb, offset) & 0x07;
@@ -2566,7 +2584,7 @@ decode_qos_gprs(tvbuff_t *tvb, int offset, proto_tree *tree, gchar* qos_str, gui
        precedence = tvb_get_guint8(tvb, offset+1) & 0x07;
        spare3 = tvb_get_guint8(tvb, offset+2) & 0xE0;
        mean = tvb_get_guint8(tvb, offset+2) & 0x1F;
-       
+
        te = proto_tree_add_text(tree, tvb, offset-adjust, 3+adjust, "%s: delay: %u, reliability: %u, peak: %u, precedence: %u, mean: %u",
                                                                        qos_str, delay, reliability, peak, precedence, mean);
        ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
@@ -2582,55 +2600,55 @@ decode_qos_gprs(tvbuff_t *tvb, int offset, proto_tree *tree, gchar* qos_str, gui
                proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_mean, tvb, offset+2, 1, mean);
        }
 
-       return 3; 
+       return 3;
 }
 
 /* GPRS:       9.60 v7.6.0, chapter 7.9.6, page 39
  *             4.08
  *             3.60
  * UMTS:       not present
- * TODO:       check if length is included: ETSI 4.08 vs 9.60 
+ * TODO:       check if length is included: ETSI 4.08 vs 9.60
  */
 static int
-decode_gtp_qos_gprs(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
+decode_gtp_qos_gprs(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        return (1+decode_qos_gprs(tvb, offset+1, tree, "Quality of Service", 1));
-       
+
 }
 
 /* GPRS:       9.60 v7.6.0, chapter 7.9.7, page 39
  * UMTS:       29.060 v4.0, chapter 7.7.6, page 47
  */
 static int
-decode_gtp_reorder(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
+decode_gtp_reorder(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
 
        guint8  reorder;
-       
-       reorder = tvb_get_guint8(tvb, offset+1) & 0x01; 
-       proto_tree_add_boolean(tree, gtp_version ? hf_gtpv1_reorder : hf_gtpv0_reorder, tvb, offset, 2, reorder); 
+
+       reorder = tvb_get_guint8(tvb, offset+1) & 0x01;
+       proto_tree_add_boolean(tree, gtp_version ? hf_gtpv1_reorder : hf_gtpv0_reorder, tvb, offset, 2, reorder);
 
        return 2;
 }
 
 /* GPRS:       9.60 v7.6.0, chapter 7.9.8, page 40
- *             4.08 v7.1.2, chapter 10.5.3.1+ 
+ *             4.08 v7.1.2, chapter 10.5.3.1+
  * UMTS:       29.060 v4.0, chapter 7.7.7
  * TODO: Add blurb support by registering items in the protocol registration
  */
 static int
-decode_gtp_auth_tri(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
+decode_gtp_auth_tri(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
 
        proto_tree      *ext_tree_auth_tri;
        proto_item      *te;
        guint32         rand[4], sres, kc[2];
-       
+
        tvb_memcpy(tvb, (guint8 *)&rand, offset+1, 16);
        sres = tvb_get_ntohl(tvb, offset+17);
        tvb_memcpy(tvb, (guint8 *)&kc, offset+21, 16);
-       
+
        te = proto_tree_add_text(tree, tvb, offset, 29, val_to_str(GTP_EXT_AUTH_TRI, gtp_val, "Unknown message"));
        ext_tree_auth_tri = proto_item_add_subtree(tree, ett_gtp_auth_tri);
-                                                       
+
        proto_tree_add_text(ext_tree_auth_tri, tvb, offset+1, 16, "RAND: %x%x%x%x", rand[0], rand[1], rand[2], rand[3]);
        proto_tree_add_text(ext_tree_auth_tri, tvb, offset+17, 4, "SRES: %x", sres);
        proto_tree_add_text(ext_tree_auth_tri, tvb, offset+21, 8, "Kc: %x%x", kc[0], kc[1]);
@@ -2644,11 +2662,11 @@ decode_gtp_auth_tri(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
  *             29.002 v4.2.1, chapter 17.5, page 268
  */
 static int
-decode_gtp_map_cause(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
+decode_gtp_map_cause(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        guint8  map_cause;
-       
-       map_cause = tvb_get_guint8(tvb, offset+1);      
+
+       map_cause = tvb_get_guint8(tvb, offset+1);
        proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_map_cause : hf_gtpv0_map_cause, tvb, offset, 2, map_cause);
 
        return 2;
@@ -2658,11 +2676,11 @@ decode_gtp_map_cause(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
  * UMTS:       29.060 v4.0, chapter 7.7.9, page 48
  */
 static int
-decode_gtp_ptmsi_sig(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
+decode_gtp_ptmsi_sig(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        guint32 ptmsi_sig;
-       
-       ptmsi_sig = tvb_get_ntoh24(tvb, offset+1);      
+
+       ptmsi_sig = tvb_get_ntoh24(tvb, offset+1);
        proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_ptmsi_sig : hf_gtpv0_ptmsi_sig, tvb, offset, 4, ptmsi_sig);
 
        return 4;
@@ -2672,11 +2690,11 @@ decode_gtp_ptmsi_sig(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
  * UMTS:       29.060 v4.0, chapter 7.7.10, page 49
  */
 static int
-decode_gtp_ms_valid(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
+decode_gtp_ms_valid(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        guint8  ms_valid;
-       
-       ms_valid = tvb_get_guint8(tvb, offset+1) & 0x01;        
+
+       ms_valid = tvb_get_guint8(tvb, offset+1) & 0x01;
        proto_tree_add_boolean(tree, gtp_version ? hf_gtpv1_ms_valid : hf_gtpv0_ms_valid, tvb, offset, 2, ms_valid);
 
        return 2;
@@ -2686,11 +2704,11 @@ decode_gtp_ms_valid(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
  * UMTS:       29.060 v4.0, chapter 7.7.11, page 49
  */
 static int
-decode_gtp_recovery(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
+decode_gtp_recovery(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        guint8  recovery;
-       
-       recovery = tvb_get_guint8(tvb, offset+1);       
+
+       recovery = tvb_get_guint8(tvb, offset+1);
        proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_recovery : hf_gtpv0_recovery, tvb, offset, 2, recovery);
 
        return 2;
@@ -2700,11 +2718,11 @@ decode_gtp_recovery(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
  * UMTS:       29.060 v4.0, chapter 7.7.12, page 49
  */
 static int
-decode_gtp_sel_mode(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
+decode_gtp_sel_mode(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        guint8  sel_mode;
-       
-       sel_mode = tvb_get_guint8(tvb, offset+1) & 0x03;        
+
+       sel_mode = tvb_get_guint8(tvb, offset+1) & 0x03;
        proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_sel_mode : hf_gtpv0_sel_mode, tvb, offset, 2, sel_mode);
 
        return 2;
@@ -2714,25 +2732,25 @@ decode_gtp_sel_mode(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
  * UMTS:       29.060 v4.0, chapter 7.7.13, page 50
  */
 static int
-decode_gtp_16(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
-       guint16 ext_flow_label; 
+decode_gtp_16(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
+       guint16 ext_flow_label;
        guint32 teid_data;
 
        switch (gtp_version) {
                case 0:
-                       ext_flow_label = tvb_get_ntohs(tvb, offset+1);  
+                       ext_flow_label = tvb_get_ntohs(tvb, offset+1);
                        proto_tree_add_uint(tree, hf_gtpv0_ext_flow_label, tvb, offset, 3, ext_flow_label);
-                       
+
                        return 3;
                case 1:
                        teid_data = tvb_get_ntohl(tvb, offset+1);
                        proto_tree_add_uint(tree, hf_gtpv1_teid_data, tvb, offset, 5, teid_data);
 
                        return 5;
-               default: 
+               default:
                        proto_tree_add_text(tree, tvb, offset, 1, "Flow label/TEID Data I : GTP version not supported");
-                       
+
                        return 3;
        }
 }
@@ -2741,25 +2759,25 @@ decode_gtp_16(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
  * UMTS:       29.060 v4.0, chapter 7.7.14, page 42
  */
 static int
-decode_gtp_17(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
+decode_gtp_17(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
 
        guint16         flow_sig;
        guint32         teid_cp;
 
        switch (gtp_version) {
                case 0:
-                       flow_sig = tvb_get_ntohs(tvb, offset+1);        
+                       flow_sig = tvb_get_ntohs(tvb, offset+1);
                        proto_tree_add_uint(tree, hf_gtpv0_flow_sig, tvb, offset, 3, flow_sig);
-                       
+
                        return 3;
                case 1:
                        teid_cp = tvb_get_ntohl(tvb, offset+1);
                        proto_tree_add_uint(tree, hf_gtpv1_teid_cp, tvb, offset, 5, teid_cp);
-                       
+
                        return 5;
                default:
                        proto_tree_add_text(tree, tvb, offset, 1, "Flow label signalling/TEID control plane : GTP version not supported");
-                       
+
                        return 3;
        }
 }
@@ -2768,7 +2786,7 @@ decode_gtp_17(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
  * UMTS:       29.060 v4.0, chapter 7.7.15, page 51
  */
 static int
-decode_gtp_18(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
+decode_gtp_18(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
 
        guint16         flow_ii;
        guint32         teid_ii;
@@ -2779,27 +2797,27 @@ decode_gtp_18(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
                case 0:
                        te = proto_tree_add_text(tree, tvb, offset, 4, val_to_str(GTP_EXT_FLOW_II, gtp_val, "Unknown message"));
                        ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_flow_ii);
-                       
+
                        proto_tree_add_uint(ext_tree_flow_ii, hf_gtpv0_nsapi, tvb, offset+1, 1, tvb_get_guint8(tvb, offset+1) & 0x0F);
-                       
-                       flow_ii = tvb_get_ntohs(tvb, offset+2); 
+
+                       flow_ii = tvb_get_ntohs(tvb, offset+2);
                        proto_tree_add_uint(ext_tree_flow_ii, hf_gtpv0_flow_ii, tvb, offset+2, 2, flow_ii);
-                       
+
                        return 4;
-               case 1: 
+               case 1:
                        te = proto_tree_add_text(tree, tvb, offset, 6, val_to_str(GTP_EXT_TEID_II, gtp_val, "Unknown message"));
                        ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_flow_ii);
-                       
+
                        proto_tree_add_uint(ext_tree_flow_ii, hf_gtpv1_nsapi, tvb, offset+1, 1, tvb_get_guint8(tvb, offset+1) & 0x0F);
 
-                       
+
                        teid_ii = tvb_get_ntohl(tvb, offset+2);
                        proto_tree_add_uint(ext_tree_flow_ii, hf_gtpv1_teid_ii, tvb, offset+2, 4, teid_ii);
-                       
+
                        return 6;
                default:
                        proto_tree_add_text(tree, tvb, offset, 1, "Flow data II/TEID Data II : GTP Version not supported");
-                       
+
                        return 4;
        }
 }
@@ -2809,20 +2827,20 @@ decode_gtp_18(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
  * Check if all ms_reason types are included
  */
 static int
-decode_gtp_19(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
-       guint8          field19;        
-       
-       field19 = tvb_get_guint8(tvb, offset+1);        
-       
+decode_gtp_19(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
+       guint8          field19;
+
+       field19 = tvb_get_guint8(tvb, offset+1);
+
        switch (gtp_version) {
-               case 0: 
+               case 0:
                        proto_tree_add_uint(tree, hf_gtpv0_ms_reason, tvb, offset, 2, field19);
-                       
+
                        break;
                case 1:
                        proto_tree_add_boolean(tree, hf_gtpv1_tear_ind, tvb, offset, 2, field19 & 0x01);
-                       
+
                        break;
                default:
                        proto_tree_add_text(tree, tvb, offset, 1, "Information Element Type = 19 : GTP Version not supported");
@@ -2837,11 +2855,11 @@ decode_gtp_19(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
  * UMTS:       29.060 v4.0, chapter 7.7.17, page 51
  */
 static int
-decode_gtp_nsapi(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
+decode_gtp_nsapi(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        guint8          nsapi;
-       
-       nsapi = tvb_get_guint8(tvb, offset+1) & 0x0F;   
+
+       nsapi = tvb_get_guint8(tvb, offset+1) & 0x0F;
        proto_tree_add_uint(tree, hf_gtpv1_nsapi, tvb, offset, 2, nsapi);
 
        return 2;
@@ -2851,10 +2869,10 @@ decode_gtp_nsapi(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree
  * UMTS:       29.060 v4.0, chapter 7.7.18, page 52
  */
 static int
-decode_gtp_ranap_cause(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
+decode_gtp_ranap_cause(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        guint8          ranap;
-       
+
        ranap = tvb_get_guint8(tvb, offset+1);
 
        if(ranap > 0 && ranap <=64)
@@ -2882,17 +2900,17 @@ decode_gtp_ranap_cause(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
  * UMTS:       29.060 v4.0, chapter 7.7.19, page 52
  */
 static int
-decode_gtp_rab_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
+decode_gtp_rab_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        guint8          nsapi, dl_pdcp_seq, ul_pdcp_seq;
        guint16         dl_gtpu_seq, ul_gtpu_seq;
        proto_tree      *ext_tree_rab_cntxt;
        proto_item      *te;
-       
+
        te = proto_tree_add_text(tree, tvb, offset, 8, val_to_str(GTP_EXT_RAB_CNTXT, gtp_val, "Unknown message"));
        ext_tree_rab_cntxt = proto_item_add_subtree(te, ett_gtp_rab_cntxt);
-       
-       nsapi = tvb_get_guint8(tvb, offset+1) & 0x0F;   
+
+       nsapi = tvb_get_guint8(tvb, offset+1) & 0x0F;
        dl_gtpu_seq = tvb_get_ntohs(tvb, offset+2);
        ul_gtpu_seq = tvb_get_ntohs(tvb, offset+4);
        dl_pdcp_seq = tvb_get_guint8(tvb, offset+6);
@@ -2912,11 +2930,11 @@ decode_gtp_rab_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
  * UMTS:       29.060 v4.0, chapter 7.7.20, page 53
  */
 static int
-decode_gtp_rp_sms(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
+decode_gtp_rp_sms(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        guint8          rp_sms;
-       
-       rp_sms = tvb_get_guint8(tvb, offset+1) & 0x07;  
+
+       rp_sms = tvb_get_guint8(tvb, offset+1) & 0x07;
        proto_tree_add_uint(tree, hf_gtpv1_rp_sms, tvb, offset, 2, rp_sms);
 
        return 2;
@@ -2926,12 +2944,12 @@ decode_gtp_rp_sms(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tre
  * UMTS:       29.060 v4.0, chapter 7.7.21, page 53
  */
 static int
-decode_gtp_rp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
+decode_gtp_rp(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        proto_tree      *ext_tree_rp;
        proto_item      *te;
        guint8          nsapi, rp, spare;
-       
+
        nsapi = tvb_get_guint8(tvb, offset+1) & 0xF0;
        spare = tvb_get_guint8(tvb, offset+1) & 0x08;
        rp = tvb_get_guint8(tvb, offset+1) & 0x07;
@@ -2950,12 +2968,12 @@ decode_gtp_rp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
  * UMTS:       29.060 v4.0, chapter 7.7.22, page 53
  */
 static int
-decode_gtp_pkt_flow_id(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
+decode_gtp_pkt_flow_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        proto_tree      *ext_tree_pkt_flow_id;
        proto_item      *te;
        guint8          nsapi, pkt_flow_id;
-       
+
        nsapi = tvb_get_guint8(tvb, offset+1) & 0x0F;
        pkt_flow_id = tvb_get_guint8(tvb, offset+2);
 
@@ -2964,7 +2982,7 @@ decode_gtp_pkt_flow_id(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
 
        proto_tree_add_uint(ext_tree_pkt_flow_id, hf_gtpv1_nsapi, tvb, offset+1, 1, nsapi);
        proto_tree_add_uint_format(ext_tree_pkt_flow_id, hf_gtpv1_pkt_flow_id, tvb, offset+2, 1, pkt_flow_id, "%s : %u", val_to_str(GTP_EXT_PKT_FLOW_ID, gtp_val, "Unknown message"), pkt_flow_id);
-       
+
        return 3;
 }
 
@@ -2973,67 +2991,67 @@ decode_gtp_pkt_flow_id(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
  * TODO: Differenciate these uints?
  */
 static int
-decode_gtp_chrg_char(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
+decode_gtp_chrg_char(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        guint16         chrg_char;
        proto_item      *te;
        proto_tree      *ext_tree_chrg_char;
-       
+
        chrg_char = tvb_get_ntohs(tvb, offset+1);
-       
+
        te = proto_tree_add_text(tree, tvb, offset, 3, "%s: %x", val_to_str(GTP_EXT_CHRG_CHAR, gtp_val, "Unknown message"), chrg_char);
        ext_tree_chrg_char = proto_item_add_subtree(te, ett_gtp_chrg_char);
-       
+
        proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_s, tvb, offset+1, 2, chrg_char);
        proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_n, tvb, offset+1, 2, chrg_char);
        proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_p, tvb, offset+1, 2, chrg_char);
        proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_f, tvb, offset+1, 2, chrg_char);
        proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_h, tvb, offset+1, 2, chrg_char);
        proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_r, tvb, offset+1, 2, chrg_char);
-       
+
        return 3;
 }
 
 /* GPRS:       not present
- * UMTS:       29.060 v4.0, chapter 7.7.24, page 
+ * UMTS:       29.060 v4.0, chapter 7.7.24, page
  */
 static int
-decode_gtp_trace_ref(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
+decode_gtp_trace_ref(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        guint16         trace_ref;
-       
+
        trace_ref = tvb_get_ntohs(tvb, offset+1);
-       
+
        proto_tree_add_uint(tree, hf_gtpv1_trace_ref, tvb, offset, 3, trace_ref);
 
        return 3;
 }
 
 /* GPRS:       not present
- * UMTS:       29.060 v4.0, chapter 7.7.25, page 
+ * UMTS:       29.060 v4.0, chapter 7.7.25, page
  */
 static int
-decode_gtp_trace_type(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
+decode_gtp_trace_type(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        guint16         trace_type;
-       
+
        trace_type = tvb_get_ntohs(tvb, offset+1);
-       
+
        proto_tree_add_uint(tree, hf_gtpv1_trace_type, tvb, offset, 3, trace_type);
-       
+
        return 3;
 }
 
 /* GPRS:       9.60 v7.6.0, chapter 7.9.16A
- * UMTS:       29.060 v4.0, chapter 7.7.25A, page 
+ * UMTS:       29.060 v4.0, chapter 7.7.25A, page
  */
 static int
-decode_gtp_ms_reason(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
-       guint8          reason; 
-       
-       reason = tvb_get_guint8(tvb, offset+1); 
-       
+decode_gtp_ms_reason(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
+       guint8          reason;
+
+       reason = tvb_get_guint8(tvb, offset+1);
+
        proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_ms_reason : hf_gtpv0_ms_reason, tvb, offset, 2, reason);
 
        return 2;
@@ -3044,12 +3062,12 @@ decode_gtp_ms_reason(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
  * UMTS:       33.015
  */
 static int
-decode_gtp_tr_comm(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
-       guint8  tr_command;     
-       
-       tr_command = tvb_get_ntohl(tvb, offset+1);      
-       
+decode_gtp_tr_comm(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
+       guint8  tr_command;
+
+       tr_command = tvb_get_ntohl(tvb, offset+1);
+
        proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_tr_comm : hf_gtpv0_tr_comm, tvb, offset, 2, tr_command);
 
        return 2;
@@ -3059,11 +3077,11 @@ decode_gtp_tr_comm(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr
  * UMTS:       29.060 v4.0, chapter 7.7.26, page 55
  */
 static int
-decode_gtp_chrg_id(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
-       guint32 chrg_id;        
-       
-       chrg_id = tvb_get_ntohl(tvb, offset+1); 
+decode_gtp_chrg_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
+       guint32 chrg_id;
+
+       chrg_id = tvb_get_ntohl(tvb, offset+1);
        proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_chrg_id : hf_gtpv0_chrg_id, tvb, offset, 5, chrg_id);
 
        return 5;
@@ -3073,16 +3091,16 @@ decode_gtp_chrg_id(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr
  * UMTS:       29.060 v4.0, chapter 7.7.27, page 55
  */
 static int
-decode_gtp_user_addr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
+decode_gtp_user_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        guint16         length;
-       guint8          pdp_typ, pdp_org;       
+       guint8          pdp_typ, pdp_org;
        guint32         addr_ipv4;
        struct          e_in6_addr addr_ipv6;
        proto_tree      *ext_tree_user;
        proto_item      *te;
-       
-       
+
+
        length = tvb_get_ntohs(tvb, offset+1);
        pdp_org = tvb_get_guint8(tvb, offset+3) & 0x0F;
        pdp_typ = tvb_get_guint8(tvb, offset+4);
@@ -3092,11 +3110,11 @@ decode_gtp_user_addr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
            val_to_str(pdp_org, pdp_org_type, "Unknown PDP Organization"),
            val_to_str(pdp_typ, pdp_type, "Unknown PDP Type"));
        ext_tree_user = proto_item_add_subtree(te, ett_gtp_user);
-       
+
        proto_tree_add_text(ext_tree_user, tvb, offset+1, 2, "Length : %u", length);
        proto_tree_add_uint(ext_tree_user, gtp_version ? hf_gtpv1_user_addr_pdp_org : hf_gtpv0_user_addr_pdp_org, tvb, offset+3, 1, pdp_org);
        proto_tree_add_uint(ext_tree_user, gtp_version ? hf_gtpv1_user_addr_pdp_type : hf_gtpv0_user_addr_pdp_type, tvb, offset+4, 1, pdp_typ);
-       
+
        if (length == 2) {
                if (pdp_org == 0 && pdp_typ == 1)
                        proto_item_append_text(te, " (Point to Point Protocol)");
@@ -3117,32 +3135,32 @@ decode_gtp_user_addr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
                }
        } else
                proto_item_append_text(te, " : empty PDP Address");
-                               
+
        return 3+length;
 }
 
 static int
 decode_triplet(tvbuff_t *tvb, int offset, proto_tree *tree, guint16 count) {
-       
+
        proto_tree      *ext_tree_trip;
        proto_item      *te_trip;
        guint32         rand[4], sres, kc[2];
        guint16         i;
-       
+
        for (i=0;i<count;i++) {
-               
+
                tvb_memcpy(tvb, (guint8 *)&rand, offset+i*28, 16);
                sres = tvb_get_ntohl(tvb, offset+i*28+16);
                tvb_memcpy(tvb, (guint8 *)&kc, offset+i*28+20, 8);
 
                te_trip = proto_tree_add_text(tree, tvb, offset+i*28, 28, "Triplet no%x", i);
                ext_tree_trip = proto_item_add_subtree(te_trip, ett_gtp_trip);
-                                                       
+
                proto_tree_add_text(ext_tree_trip, tvb, offset+i*28, 16, "RAND: %x%x%x%x", rand[0], rand[1], rand[2], rand[3]);
                proto_tree_add_text(ext_tree_trip, tvb, offset+i*28+16, 4, "SRES: %x", sres);
                proto_tree_add_text(ext_tree_trip, tvb, offset+i*28+20, 8, "Kc: %x%x", kc[0], kc[1]);
        }
-       
+
        return count*28;
 }
 
@@ -3150,20 +3168,20 @@ decode_triplet(tvbuff_t *tvb, int offset, proto_tree *tree, guint16 count) {
  */
 static int
 decode_quintuplet(tvbuff_t *tvb, int offset, proto_tree *tree, guint16 count, guint8 adjust) {
-       
+
        proto_tree      *ext_tree_quint;
        proto_item      *te_quint;
        guint32         rand[4], q_ck[4], q_ik[4];
        guint16         q_len, xres_len, auth_len, q_offset, i;
 
        q_offset = 0;
-       
-       for (i=0;i<count;i++) { 
-       
+
+       for (i=0;i<count;i++) {
+
                offset = offset + q_offset;
-               
+
                q_len = tvb_get_ntohs(tvb, offset);
-               
+
                tvb_memcpy(tvb, (guint8 *)&rand, offset+2, 16);
                xres_len = tvb_get_ntohs(tvb, offset+18);
 /*             xres = tvb_get_ptr(tvb, offset+20, xres_len);*/
@@ -3174,7 +3192,7 @@ decode_quintuplet(tvbuff_t *tvb, int offset, proto_tree *tree, guint16 count, gu
 
                te_quint = proto_tree_add_text(tree, tvb, offset-adjust, q_len+adjust, "Quintuplet #%x", i);
                ext_tree_quint = proto_item_add_subtree(te_quint, ett_gtp_quint);
-                                                       
+
                proto_tree_add_text(ext_tree_quint, tvb, offset, 2, "Length: %x", q_len);
                proto_tree_add_text(ext_tree_quint, tvb, offset+2, 16, "RAND: %x%x%x%x", rand[0], rand[1], rand[2], rand[3]);
                proto_tree_add_text(ext_tree_quint, tvb, offset+18, 2, "XRES length: %x", xres_len);
@@ -3186,35 +3204,35 @@ decode_quintuplet(tvbuff_t *tvb, int offset, proto_tree *tree, guint16 count, gu
 
                q_offset = q_offset + q_len + 2;
        }
-       
+
        return q_offset;
 }
 
-/* GPRS:       9.60 v7.6.0, chapter 7.9.19 page 
+/* GPRS:       9.60 v7.6.0, chapter 7.9.19 page
  * UMTS:       29.060 v4.0, chapter 7.7.28 page 57
  * TODO:       - check if for quintuplets first 2 bytes are length, according to AuthQuint
  *             - finish displaying last 3 parameters
  */
 static int
-decode_gtp_mm_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
-       guint16         length, quint_len, net_cap, con_len;    
+decode_gtp_mm_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
+       guint16         length, quint_len, net_cap, con_len;
        guint8          cksn, count, sec_mode, cipher, trans_id, proto_disc, message, drx_split, drx_len, drx_ccch, non_drx_timer;
        guint32         kc[4], ik[4];
        proto_tree      *ext_tree_mm;
        proto_item      *te;
-       
+
        te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_MM_CNTXT, gtp_val, "Unknown message"));
        ext_tree_mm = proto_item_add_subtree(te, ett_gtp_mm);
-       
+
        length = tvb_get_ntohs(tvb, offset+1);
        if (length < 1) return 3;
-       
+
        cksn = tvb_get_guint8(tvb, offset+3) & 0x07;
        sec_mode = (tvb_get_guint8(tvb, offset+4) >> 6) & 0x03;
        count = (tvb_get_guint8(tvb, offset+4) >> 3) & 0x07;
        cipher = tvb_get_guint8(tvb, offset+4) & 0x07;
-       
+
        proto_tree_add_text(ext_tree_mm, tvb, offset+1, 2, "Length: %x", length);
        proto_tree_add_text(ext_tree_mm, tvb, offset+3, 1, "Ciphering Key Sequence Number: %u", cksn);
        if (gtp_version != 0) {
@@ -3222,11 +3240,11 @@ decode_gtp_mm_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
        } else {
                sec_mode = 1;
        }
-       
+
        proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "No of triplets: %u", count);
 
        switch (sec_mode) {
-               case 0: 
+               case 0:
                        if (cipher == 0) {
                                proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: no ciphering");
                        } else {
@@ -3240,10 +3258,10 @@ decode_gtp_mm_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
                        proto_tree_add_text(ext_tree_mm, tvb, offset+37, 2, "Quintuplets length: %x", quint_len);
 
                        offset = offset + decode_quintuplet(tvb, offset+39, ext_tree_mm, count, 0) + 39;
-                       
-                                       
+
+
                        break;
-               case 1: 
+               case 1:
                        if (cipher == 0) {
                                proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: no ciphering");
                        } else {
@@ -3255,18 +3273,18 @@ decode_gtp_mm_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
                        offset = offset + decode_triplet(tvb, offset+13, ext_tree_mm, count) + 13;
 
                        break;
-               case 2: 
+               case 2:
                        tvb_memcpy(tvb, (guint8 *)&kc, offset+5, 16);
                        proto_tree_add_text(ext_tree_mm, tvb, offset+5, 16, "Ciphering key CK: %x%x%x%x", kc[0], kc[1], kc[2], kc[3]);
                        tvb_memcpy(tvb, (guint8 *)&ik, offset+21, 16);
                        proto_tree_add_text(ext_tree_mm, tvb, offset+21, 16, "Integrity key CK: %x%x%x%x", ik[0], ik[1], ik[2], ik[3]);
                        quint_len = tvb_get_ntohs(tvb, offset+37);
                        proto_tree_add_text(ext_tree_mm, tvb, offset+37, 2, "Quintuplets length: %x", quint_len);
-                       
+
                        offset = offset + decode_quintuplet(tvb, offset+39, ext_tree_mm, count, 0) + 39;
-                       
+
                        break;
-               case 3: 
+               case 3:
                        if (cipher == 0) {
                                proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: no ciphering");
                        } else {
@@ -3278,13 +3296,13 @@ decode_gtp_mm_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
                        proto_tree_add_text(ext_tree_mm, tvb, offset+13, 2, "Quintuplets length: %x", quint_len);
 
                        offset = offset + decode_quintuplet(tvb, offset+15, ext_tree_mm, count, 0) + 15;
-                       
+
                        break;
                default:
                        break;
        }
-       
-       
+
+
        drx_split = tvb_get_guint8(tvb, offset);
        drx_len = (tvb_get_guint8(tvb, offset+1) >> 4) & 0x0F;
        drx_ccch = (tvb_get_guint8(tvb, offset+1) >> 3) & 0x01;
@@ -3292,7 +3310,7 @@ decode_gtp_mm_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
 
        net_cap = tvb_get_ntohs(tvb, offset+2);
        con_len = tvb_get_ntohs(tvb, offset+4);
-       
+
        proto_tree_add_text(ext_tree_mm, tvb, offset, 1, "DRX: split PG cycle code: %u", drx_split);
        proto_tree_add_text(ext_tree_mm, tvb, offset+1, 1, "DRX: CN specific DRX cycle length coefficient: %u", drx_len);
        proto_tree_add_text(ext_tree_mm, tvb, offset+1, 1, "DRX: split PG cycle on CCCH supported by MS: %s", yesno[drx_ccch]);
@@ -3301,10 +3319,10 @@ decode_gtp_mm_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
        } else {
                proto_tree_add_text(ext_tree_mm, tvb, offset+1, 1, "DRX: max sec non-DRX mode after transfer state:  2^%u", non_drx_timer-1);
        }
-       
+
        proto_tree_add_text(ext_tree_mm, tvb, offset+2, 2, "MS network capability: %u", net_cap);
        proto_tree_add_text(ext_tree_mm, tvb, offset+4, 2, "Container length: %u", con_len);
-       
+
        if (con_len > 0) {
                trans_id = (tvb_get_guint8(tvb, offset+6) >> 4) & 0x0F;
                proto_disc = tvb_get_guint8(tvb, offset+6) & 0x0F;
@@ -3314,11 +3332,43 @@ decode_gtp_mm_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
        return 3+length;
 }
 
-/* adjust - how many bytes before offset sould be highligthed
- * WARNING : actually length is coded on 2 octets for QoS profile but on 1 octet for PDP Context!
+/* Function to extract the value of an hexadecimal octet. Only the lower
+ * nybble will be non-zero in the output.
+ * */
+static guint8 hex2dec (guint8 x)
+{
+       if ((x >= 'a') && (x <= 'f'))
+               x = x - 'a' + 10;
+       else if ((x >= 'A') && (x <= 'F'))
+               x = x - 'A' + 10;
+       else if ((x >= '0') && (x <= '9'))
+               x = x - '0';
+       else
+               x = 0;
+       return x;
+}
+
+/* Wrapper function to add UTF-8 decoding for QoS attributes in
+ * RADIUS messages.
+ * */
+static guint8 wrapped_tvb_get_guint8(
+                                        tvbuff_t *tvb, int offset, int type)
+{
+       if (type == 2)
+               return (hex2dec(tvb_get_guint8(tvb, offset)) << 4
+                                       | hex2dec(tvb_get_guint8(tvb, offset + 1)));
+       else
+               return tvb_get_guint8(tvb, offset);
+}
+
+ /* WARNING : actually length is coded on 2 octets for QoS profile but on 1 octet for PDP Context!
+  * so type means length of length :-)
+  *
+  * WARNING :) type does not mean length of length any more... see below for
+  * type = 3!
  */
-static int
-decode_qos_umts(tvbuff_t *tvb, int offset, proto_tree *tree, gchar* qos_str, guint8 adjust) {
+int
+decode_qos_umts(tvbuff_t *tvb, int offset, proto_tree *tree, gchar* qos_str, guint8 type) {
 
        guint8          length;
        guint8          al_ret_priority;
@@ -3332,115 +3382,193 @@ decode_qos_umts(tvbuff_t *tvb, int offset, proto_tree *tree, gchar* qos_str, gui
        proto_item      *te;
        int             mss, mu, md, gu, gd;
 
-       length = tvb_get_guint8(tvb, offset-1);
-       al_ret_priority = tvb_get_guint8(tvb, offset);
-
-       spare1 = tvb_get_guint8(tvb, offset+1) & 0xC0;
-       delay = tvb_get_guint8(tvb, offset+1) & 0x38;
-       reliability = tvb_get_guint8(tvb, offset+1) & 0x07;
-       peak = tvb_get_guint8(tvb, offset+2) & 0xF0;
-       spare2 = tvb_get_guint8(tvb, offset+2) & 0x08;
-       precedence = tvb_get_guint8(tvb, offset+2) & 0x07;
-       spare3 = tvb_get_guint8(tvb, offset+3) & 0xE0;
-       mean = tvb_get_guint8(tvb, offset+3) & 0x1F;
-       traf_class = tvb_get_guint8(tvb, offset+4) & 0xE0;
-       del_order = tvb_get_guint8(tvb, offset+4) & 0x18;
-       del_err_sdu = tvb_get_guint8(tvb, offset+4) & 0x07;
-       max_sdu_size = tvb_get_guint8(tvb, offset+5);
-       max_dl = tvb_get_guint8(tvb, offset+6);
-       max_ul = tvb_get_guint8(tvb, offset+7);
-       res_ber = tvb_get_guint8(tvb, offset+8) & 0xF0;
-       sdu_err_ratio = tvb_get_guint8(tvb, offset+8) & 0x0F;
-       trans_delay = tvb_get_guint8(tvb, offset+9) & 0xFC;
-       traf_handl_prio = tvb_get_guint8(tvb, offset+9) & 0x03;
-       guar_ul = tvb_get_guint8(tvb, offset+10);
-       guar_dl = tvb_get_guint8(tvb, offset+11);
-       
-       te = proto_tree_add_text(tree, tvb, offset-adjust, length+adjust, "%s : length (%u)", qos_str, length);
-       ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
-       
-       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_al_ret_priority, tvb, offset, 1, al_ret_priority);
-       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_spare1, tvb, offset+1, 1, spare1);
-       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_delay, tvb, offset+1, 1, delay);
-       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_reliability, tvb, offset+1, 1, reliability);
-       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_peak, tvb, offset+2, 1, peak);
-       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_spare2, tvb, offset+2, 1, spare2);
-       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_precedence, tvb, offset+2, 1, precedence);
-       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_spare3, tvb, offset+3, 1, spare3);
-       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_mean, tvb, offset+3, 1, mean);
-       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_traf_class, tvb, offset+4, 1, traf_class);
-       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_del_order, tvb, offset+4, 1, del_order);
-       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_del_err_sdu, tvb, offset+4, 1, del_err_sdu);
-       
-       if (max_sdu_size == 0 || max_sdu_size > 150)
-               proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_max_sdu_size, tvb, offset+5, 1, max_sdu_size);
-       if (max_sdu_size > 0 && max_sdu_size <= 150) {
-               mss = max_sdu_size*10;
-               proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_sdu_size, tvb, offset+5, 1, mss, "Maximum SDU size : %u octets", mss);
-       }
+       /* Will keep if the input is UTF-8 encoded (as in RADIUS messages).
+        * If 1, input is *not* UTF-8 encoded (i.e. each input octet corresponds
+        * to one byte to be dissected).
+        * If 2, input is UTF-8 encoded (i.e. each *couple* of input octets
+        * corresponds to one byte to be dissected)
+        * */
+       guint8      utf8_type = 1;
 
-       if(max_ul == 0 || max_ul == 255)
-               proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_max_ul, tvb, offset+6, 1, max_ul);
-       if(max_ul > 0 && max_ul <= 63)
-               proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_ul, tvb, offset+6, 1, max_ul, "Maximum bit rate for uplink : %u kbps", max_ul);
-       if(max_ul > 63 && max_ul <=127) {
-               mu = 64 + ( max_ul - 64 ) * 8;
-               proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_ul, tvb, offset+6, 1, mu, "Maximum bit rate for uplink : %u kbps", mu);
-       }
+       /* In RADIUS messages the QoS has a version field of two octets prepended.
+        * */
+       guint8          version_buffer[2];
 
-       if(max_ul > 127 && max_ul <=254) {
-               mu = 576 + ( max_ul - 128 ) * 64;
-               proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_ul, tvb, offset+6, 1, mu, "Maximum bit rate for uplink : %u kbps", mu);
+       /* Will keep the value that will be returned
+        * */
+       int             retval = 0;
+       
+       switch (type) {
+               case 1:
+                       length = tvb_get_guint8 (tvb, offset);
+                       te = proto_tree_add_text (tree, tvb, offset, length + 1, "%s", qos_str);
+                       ext_tree_qos = proto_item_add_subtree (te, ett_gtp_qos);
+                       proto_tree_add_text (ext_tree_qos, tvb, offset, 1, "Length: %u", length);
+                       offset++;
+                       retval = length + 1;
+                       break;
+               case 2:
+                       length = tvb_get_ntohs (tvb, offset + 1);
+                       te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", qos_str);
+                       ext_tree_qos = proto_item_add_subtree (te, ett_gtp_qos);
+                       proto_tree_add_text (ext_tree_qos, tvb, offset + 1, 2, "Length: %u", length);
+                       offset += 3;            /* +1 because of first 0x86 byte for UMTS QoS */
+                       retval = length + 3;
+                       break;
+               case 3:
+                       /* For QoS inside RADIUS Client messages from GGSN */
+                       utf8_type = 2;
+
+                       /* The field in the RADIUS message starts one byte before :) */
+                       length = tvb_get_guint8 (tvb, offset);
+                       te = proto_tree_add_text (tree, tvb, offset - 1, length, "%s", qos_str);
+
+                       ext_tree_qos = proto_item_add_subtree (te, ett_gtp_qos);
+                       version_buffer[0] = tvb_get_guint8(tvb, offset + 1);
+                       version_buffer[1] = tvb_get_guint8(tvb, offset + 2);
+                       proto_tree_add_text (ext_tree_qos, tvb, offset + 1, 2, "Version: %c%c", version_buffer[0], version_buffer[1]);
+
+                       /* Now, we modify offset here and in order to use type later
+                        * effectively.*/
+                       offset += 2;
+                       retval = length + 3;      /* Actually, will be ignored. */
+                       break;
+               default:
+                       /* XXX - what should we do with the length here? */
+                       length = 0;
+                       retval = 0;
+                       ext_tree_qos = NULL;
+                       break;
        }
 
-       if(max_dl == 0 || max_dl == 255)
-               proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_max_dl, tvb, offset+7, 1, max_dl);
-       if(max_dl > 0 && max_dl <= 63)
-               proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_dl, tvb, offset+7, 1, max_dl, "Maximum bit rate for downlink : %u kbps", max_dl);
-       if(max_dl > 63 && max_dl <=127) {
-               md = 64 + ( max_dl - 64 ) * 8;
-               proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_dl, tvb, offset+7, 1, md, "Maximum bit rate for downlink : %u kbps", md);
-       }
-       if(max_dl > 127 && max_dl <=254) {
-               md = 576 + ( max_dl - 128 ) * 64;
-               proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_dl, tvb, offset+7, 1, md, "Maximum bit rate for downlink : %u kbps", md);
-       }
+       /* In RADIUS messages there is no allocation-retention priority
+        * so I don't need to wrap the following call to tvb_get_guint8
+        * */
+       al_ret_priority = tvb_get_guint8 (tvb, offset);
+
+       /* All calls are wrapped to take into account the possibility that the
+        * input is UTF-8 encoded. If utf8_type is equal to 1, the final value
+        * of the offset will be the same as in the previous version of this
+        * dissector, and the wrapped function will serve as a dumb wrapper;
+        * otherwise, if utf_8_type is 2, the offset is correctly shifted by
+        * two bytes for needed shift, and the wrapped function will unencode
+        * two values from the input.
+        * */
+       spare1 = wrapped_tvb_get_guint8(tvb, offset+(1 - 1) * utf8_type + 1, utf8_type) & 0xC0;
+       delay = wrapped_tvb_get_guint8(tvb, offset+(1 - 1) * utf8_type + 1, utf8_type) & 0x38;
+       reliability = wrapped_tvb_get_guint8(tvb, offset+(1 - 1) * utf8_type + 1, utf8_type) & 0x07;
+       peak = wrapped_tvb_get_guint8(tvb, offset+(2 - 1) * utf8_type + 1, utf8_type) & 0xF0;
+       spare2 = wrapped_tvb_get_guint8(tvb, offset+(2 - 1) * utf8_type + 1, utf8_type) & 0x08;
+       precedence = wrapped_tvb_get_guint8(tvb, offset+(2 - 1) * utf8_type + 1, utf8_type) & 0x07;
+       spare3 = wrapped_tvb_get_guint8(tvb, offset+(3 - 1) * utf8_type + 1, utf8_type) & 0xE0;
+       mean = wrapped_tvb_get_guint8(tvb, offset+(3 - 1) * utf8_type + 1, utf8_type) & 0x1F;
+
+       /* In RADIUS messages there is no allocation-retention priority */
+       if (type != 3)
+               proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_al_ret_priority, tvb, offset, 1, al_ret_priority);
+
+       /* All additions must take care of the fact that QoS fields in RADIUS
+        * messages are UTF-8 encoded, so we have to use the same trick as above.
+        * */
+       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_spare1, tvb, offset+(1 - 1) * utf8_type + 1, utf8_type, spare1);
+       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_delay, tvb, offset+(1 - 1) * utf8_type + 1, utf8_type, delay);
+       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_reliability, tvb, offset+(1 - 1) * utf8_type + 1, utf8_type, reliability);
+       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_peak, tvb, offset+(2 - 1) * utf8_type + 1, utf8_type, peak);
+       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_spare2, tvb, offset+(2 - 1) * utf8_type + 1, utf8_type, spare2);
+       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_precedence, tvb, offset+(2 - 1) * utf8_type + 1, utf8_type, precedence);
+       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_spare3, tvb, offset+(3 - 1) * utf8_type + 1, utf8_type, spare3);
+       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_mean, tvb, offset+(3 - 1) * utf8_type + 1, utf8_type, mean);
+
+       if (length > 4) {
+
+               /* See above for the need of wrapping
+                * */
+               traf_class = wrapped_tvb_get_guint8(tvb, offset+(4 - 1) * utf8_type + 1, utf8_type) & 0xE0;
+               del_order = wrapped_tvb_get_guint8(tvb, offset+(4 - 1) * utf8_type + 1, utf8_type) & 0x18;
+               del_err_sdu = wrapped_tvb_get_guint8(tvb, offset+(4 - 1) * utf8_type + 1, utf8_type) & 0x07;
+               max_sdu_size = wrapped_tvb_get_guint8(tvb, offset+(5 - 1) * utf8_type + 1, utf8_type);
+               max_ul = wrapped_tvb_get_guint8(tvb, offset+(6 - 1) * utf8_type + 1, utf8_type);
+               max_dl = wrapped_tvb_get_guint8(tvb, offset+(7 - 1) * utf8_type + 1, utf8_type);
+               res_ber = wrapped_tvb_get_guint8(tvb, offset+(8 - 1) * utf8_type + 1, utf8_type) & 0xF0;
+               sdu_err_ratio = wrapped_tvb_get_guint8(tvb, offset+(8 - 1) * utf8_type + 1, utf8_type) & 0x0F;
+               trans_delay = wrapped_tvb_get_guint8(tvb, offset+(9 - 1) * utf8_type + 1, utf8_type) & 0xFC;
+               traf_handl_prio = wrapped_tvb_get_guint8(tvb, offset+(9 - 1) * utf8_type + 1, utf8_type) & 0x03;
+               guar_ul = wrapped_tvb_get_guint8(tvb, offset+(10 - 1) * utf8_type + 1, utf8_type);
+               guar_dl = wrapped_tvb_get_guint8(tvb, offset+(11 - 1) * utf8_type + 1, utf8_type);
+
+               /* See above comments for the changes
+                * */
+               proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_traf_class, tvb, offset+(4 - 1) * utf8_type + 1, utf8_type, traf_class);
+               proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_del_order, tvb, offset+(4 - 1) * utf8_type + 1, utf8_type, del_order);
+               proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_del_err_sdu, tvb, offset+(4 - 1) * utf8_type + 1, utf8_type, del_err_sdu);
+               if (max_sdu_size == 0 || max_sdu_size > 150)
+                       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_max_sdu_size, tvb, offset+(5 - 1) * utf8_type + 1, utf8_type, max_sdu_size);
+               if (max_sdu_size > 0 && max_sdu_size <= 150) {
+                       mss = max_sdu_size*10;
+                       proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_sdu_size, tvb, offset+(5 - 1) * utf8_type + 1, utf8_type, mss, "Maximum SDU size : %u octets", mss);
+               }
 
-       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_res_ber, tvb, offset+8, 1, res_ber);
-       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_sdu_err_ratio, tvb, offset+8, 1, sdu_err_ratio);
-       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_trans_delay, tvb, offset+9, 1, trans_delay);
+               if(max_ul == 0 || max_ul == 255)
+                       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_max_ul, tvb, offset+(6 - 1) * utf8_type + 1, utf8_type, max_ul);
+               if(max_ul > 0 && max_ul <= 63)
+                       proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_ul, tvb, offset+(6 - 1) * utf8_type + 1, utf8_type, max_ul, "Maximum bit rate for uplink : %u kbps", max_ul);
+               if(max_ul > 63 && max_ul <=127) {
+                       mu = 64 + ( max_ul - 64 ) * 8;
+                       proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_ul, tvb, offset+(6 - 1) * utf8_type + 1, utf8_type, mu, "Maximum bit rate for uplink : %u kbps", mu);
+               }
 
+               if(max_ul > 127 && max_ul <=254) {
+                       mu = 576 + ( max_ul - 128 ) * 64;
+                       proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_ul, tvb, offset+(6 - 1) * utf8_type + 1, utf8_type, mu, "Maximum bit rate for uplink : %u kbps", mu);
+               }
 
-       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_traf_handl_prio, tvb, offset+9, 1, traf_handl_prio);
+               if(max_dl == 0 || max_dl == 255)
+                       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_max_dl, tvb, offset+(7 - 1) * utf8_type + 1, utf8_type, max_dl);
+               if(max_dl > 0 && max_dl <= 63)
+                       proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_dl, tvb, offset+(7 - 1) * utf8_type + 1, utf8_type, max_dl, "Maximum bit rate for downlink : %u kbps", max_dl);
+               if(max_dl > 63 && max_dl <=127) {
+                       md = 64 + ( max_dl - 64 ) * 8;
+                       proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_dl, tvb, offset+(7 - 1) * utf8_type + 1, utf8_type, md, "Maximum bit rate for downlink : %u kbps", md);
+               }
+               if(max_dl > 127 && max_dl <=254) {
+                       md = 576 + ( max_dl - 128 ) * 64;
+                       proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_dl, tvb, offset+(7 - 1) * utf8_type + 1, utf8_type, md, "Maximum bit rate for downlink : %u kbps", md);
+               }
 
-       if(guar_ul == 0 || guar_ul == 255)
-               proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_guar_ul, tvb, offset+10, 1, guar_ul);
-       if(guar_ul > 0 && guar_ul <= 63)
-               proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_ul, tvb, offset+10, 1, guar_ul, "Guaranteed bit rate for uplink : %u kbps", guar_ul);
-       if(guar_ul > 63 && guar_ul <=127) {
-               gu = 64 + ( guar_ul - 64 ) * 8;
-               proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_ul, tvb, offset+10, 1, gu, "Guaranteed bit rate for uplink : %u kbps", gu);
-       }
-       if(guar_ul > 127 && guar_ul <=254) {
-               gu = 576 + ( guar_ul - 128 ) * 64;
-               proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_ul, tvb, offset+10, 1, gu, "Guaranteed bit rate for uplink : %u kbps", gu);
-       }
+               proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_res_ber, tvb, offset+(8 - 1) * utf8_type + 1, utf8_type, res_ber);
+               proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_sdu_err_ratio, tvb, offset+(8 - 1) * utf8_type + 1, utf8_type, sdu_err_ratio);
+               proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_trans_delay, tvb, offset+(9 - 1) * utf8_type + 1, utf8_type, trans_delay);
+               proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_traf_handl_prio, tvb, offset+(9 - 1) * utf8_type + 1, utf8_type, traf_handl_prio);
+
+               if(guar_ul == 0 || guar_ul == 255)
+                       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_guar_ul, tvb, offset+(10 - 1) * utf8_type + 1, utf8_type, guar_ul);
+               if(guar_ul > 0 && guar_ul <= 63)
+                       proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_ul, tvb, offset+(10 - 1) * utf8_type + 1, utf8_type, guar_ul, "Guaranteed bit rate for uplink : %u kbps", guar_ul);
+               if(guar_ul > 63 && guar_ul <=127) {
+                       gu = 64 + ( guar_ul - 64 ) * 8;
+                       proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_ul, tvb, offset+(10 - 1) * utf8_type + 1, utf8_type, gu, "Guaranteed bit rate for uplink : %u kbps", gu);
+               }
+               if(guar_ul > 127 && guar_ul <=254) {
+                       gu = 576 + ( guar_ul - 128 ) * 64;
+                       proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_ul, tvb, offset+(10 - 1) * utf8_type + 1, utf8_type, gu, "Guaranteed bit rate for uplink : %u kbps", gu);
+               }
+
+               if(guar_dl == 0 || guar_dl == 255)
+                       proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_guar_dl, tvb, offset+(11 - 1) * utf8_type + 1, utf8_type, guar_dl);
+               if(guar_dl > 0 && guar_dl <= 63)
+                       proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_dl, tvb, offset+(11 - 1) * utf8_type + 1, utf8_type, guar_dl, "Guaranteed bit rate for downlink : %u kbps", guar_dl);
+               if(guar_dl > 63 && guar_dl <=127) {
+                       gd = 64 + ( guar_dl - 64 ) * 8;
+                       proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_dl, tvb, offset+(11 - 1) * utf8_type + 1, utf8_type, gd, "Guaranteed bit rate for downlink : %u kbps", gd);
+               }
+               if(guar_dl > 127 && guar_dl <=254) {
+                       gd = 576 + ( guar_dl - 128 ) * 64;
+                       proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_dl, tvb, offset+(11 - 1) * utf8_type + 1, utf8_type, gd, "Guaranteed bit rate for downlink : %u kbps", gd);
+               }
 
-       if(guar_dl == 0 || guar_dl == 255)
-               proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_guar_dl, tvb, offset+11, 1, guar_dl);
-       if(guar_dl > 0 && guar_dl <= 63)
-               proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_dl, tvb, offset+11, 1, guar_dl, "Guaranteed bit rate for downlink : %u kbps", guar_dl);
-       if(guar_dl > 63 && guar_dl <=127) {
-               gd = 64 + ( guar_dl - 64 ) * 8;
-               proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_dl, tvb, offset+11, 1, gd, "Guaranteed bit rate for downlink : %u kbps", gd);
-       }
-       if(guar_dl > 127 && guar_dl <=254) {
-               gd = 576 + ( guar_dl - 128 ) * 64;
-               proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_dl, tvb, offset+11, 1, gd, "Guaranteed bit rate for downlink : %u kbps", gd);
        }
-       
-       return length + adjust;
 
+       return retval;
 }
 
 static void
@@ -3450,16 +3578,21 @@ decode_apn(tvbuff_t *tvb, int offset, guint16 length, proto_tree *tree) {
        guint8  name_len, tmp;
 
        if (length > 0) {
-               apn = g_malloc(length);
-               tvb_memcpy(tvb, apn, offset+1, length);
-               name_len = tvb_get_guint8(tvb, offset);
-               
-               for (;;) {
-                       if (name_len >= length-1) break;
-                       tmp = name_len;
-                       name_len = name_len + apn[tmp] + 1;
-                       apn[tmp] = '.';
+               apn = g_malloc (length + 1);
+               name_len = tvb_get_guint8 (tvb, offset);
+
+               if (name_len < 0x20) {
+                       tvb_memcpy (tvb, apn, offset + 1, length);
+                       for (;;) {
+                               if (name_len >= length - 1) break;
+                               tmp = name_len;
+                               name_len = name_len + apn[tmp] + 1;
+                               apn[tmp] = '.';
+                       }
+               } else {
+                       tvb_memcpy (tvb, apn, offset, length);
                }
+
                apn[length-1] = '\0';
                proto_tree_add_string(tree, gtp_version ? hf_gtpv1_apn : hf_gtpv0_apn, tvb, offset, length, apn);
                g_free(apn);
@@ -3468,61 +3601,61 @@ decode_apn(tvbuff_t *tvb, int offset, guint16 length, proto_tree *tree) {
 
 /* GPRS:       9.60 v7.6.0, chapter 7.9.20
  * UMTS:       29.060 v4.0, chapter 7.7.29
- * TODO:       unify addr functions 
+ * TODO:       unify addr functions
  */
 static int
-decode_gtp_pdp_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
+decode_gtp_pdp_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
 
        guint8          ggsn_addr_len, apn_len, trans_id, vaa, order, nsapi, sapi, pdu_send_no, pdu_rec_no, pdp_cntxt_id,
                        pdp_type_org, pdp_type_num, pdp_addr_len;
-       guint16         length, l_offset, sn_down, sn_up, up_flow;
+       guint16         length, sn_down, sn_up, up_flow;
        guint32         addr_ipv4, up_teid, up_teid_cp;
-       struct  e_in6_addr addr_ipv6;   
+       struct  e_in6_addr addr_ipv6;
        proto_tree      *ext_tree_pdp;
        proto_item      *te;
-       
+
        length = tvb_get_ntohs(tvb, offset+1);
-       
+
        te = proto_tree_add_text(tree, tvb, offset, length+3, val_to_str(GTP_EXT_PDP_CNTXT, gtp_val, "Unknown message"));
        ext_tree_pdp = proto_item_add_subtree(te, ett_gtp_pdp);
-       
+
        vaa = (tvb_get_guint8(tvb, offset+3) >> 6) & 0x01;
        order = (tvb_get_guint8(tvb, offset+3) >> 4) & 0x01;
        nsapi =  tvb_get_guint8(tvb, offset+3) & 0x0F;
        sapi = tvb_get_guint8(tvb, offset+4) & 0x0F;
-       
+
        proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 1, "VPLMN address allowed: %s", yesno[vaa]);
        proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 1, "Reordering required: %s", yesno[order]);
        proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 1, "NSAPI: %u", nsapi);
        proto_tree_add_text(ext_tree_pdp, tvb, offset+4, 1, "SAPI: %u", sapi);
-       
+
        switch (gtp_version) {
-               case 0: 
+               case 0:
                        decode_qos_gprs(tvb, offset+5, ext_tree_pdp, "QoS subscribed", 0);
                        decode_qos_gprs(tvb, offset+8, ext_tree_pdp, "QoS requested", 0);
                        decode_qos_gprs(tvb, offset+11, ext_tree_pdp, "QoS negotiated", 0);
-                       offset = offset + 13;
+                       offset = offset + 14;
                        break;
-               case 1: 
+               case 1:
                        offset = offset + 5;
-                       offset = offset + decode_qos_umts(tvb, offset+1, ext_tree_pdp, "QoS subscribed", 1);
-                       offset = offset + decode_qos_umts(tvb, offset+1, ext_tree_pdp, "QoS requested", 1);
-                       offset = offset + decode_qos_umts(tvb, offset+1, ext_tree_pdp, "QoS negotiated", 1);
+                       offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS subscribed", 1);
+                       offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS requested", 1);
+                       offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS negotiated", 1);
                        break;
                default:
                        break;
        }
-       
+
        sn_down = tvb_get_ntohs(tvb, offset);
        sn_up = tvb_get_ntohs(tvb, offset+2);
        pdu_send_no = tvb_get_guint8(tvb, offset+4);
        pdu_rec_no = tvb_get_guint8(tvb, offset+5);
-       
+
        proto_tree_add_text(ext_tree_pdp, tvb, offset, 2, "Sequence number down: %u", sn_down);
        proto_tree_add_text(ext_tree_pdp, tvb, offset+2, 2, "Sequence number up: %u", sn_up);
        proto_tree_add_text(ext_tree_pdp, tvb, offset+4, 1, "Send N-PDU number: %u", pdu_send_no);
        proto_tree_add_text(ext_tree_pdp, tvb, offset+5, 1, "Receive N-PDU number: %u", pdu_rec_no);
-       
+
        switch (gtp_version) {
                case 0:
                        up_flow = tvb_get_ntohs(tvb, offset+6);
@@ -3545,9 +3678,9 @@ decode_gtp_pdp_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
        pdp_type_org = tvb_get_guint8(tvb, offset) & 0x0F;
        pdp_type_num = tvb_get_guint8(tvb, offset+1);
        pdp_addr_len = tvb_get_guint8(tvb, offset+2);
-       
-       proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "PDP type: %s", val_to_str(pdp_type_org, pdp_type, "Unknown PDP type"));
-       proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 1, "PDP organization: %s", val_to_str(pdp_type_num, pdp_org_type, "Unknown PDP org"));
+
+       proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "PDP organization: %s", val_to_str(pdp_type_org, pdp_type, "Unknown PDP org"));
+       proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 1, "PDP type: %s", val_to_str(pdp_type_num, pdp_org_type, "Unknown PDP type"));
        proto_tree_add_text(ext_tree_pdp, tvb, offset+2, 1, "PDP address length: %u", pdp_addr_len);
 
        if (pdp_addr_len > 0) {
@@ -3564,51 +3697,54 @@ decode_gtp_pdp_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
                                break;
                }
        }
-       
+
        offset = offset + 3 + pdp_addr_len;
 
        ggsn_addr_len = tvb_get_guint8(tvb, offset);
-       proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN address length: %u", ggsn_addr_len);
-       
+       proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN address length: %u", ggsn_addr_len);
+
        switch (ggsn_addr_len) {
-               case 4: 
+               case 4:
                        tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+1, sizeof addr_ipv4);
-                       proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 4, "GGSN address: %s", ip_to_str((guint8 *)&addr_ipv4));
+                       proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 4, "GGSN address: %s", ip_to_str((guint8 *)&addr_ipv4));
                        break;
-               case 16: 
+               case 16:
                        tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+1, sizeof addr_ipv6);
-                       proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 16, "GGSN address: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
+                       proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 16, "GGSN address: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
                        break;
                default:
                        break;
        }
-       
+
        offset = offset + 1 + ggsn_addr_len;
-       
-       ggsn_addr_len = tvb_get_guint8(tvb, offset);
-       proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN 2 address length: %u", ggsn_addr_len);
-       
-       switch (ggsn_addr_len) {
-               case 4: 
-                       tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+1, sizeof addr_ipv4);
-                       proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 4, "GGSN 2 address: %s", ip_to_str((guint8 *)&addr_ipv4));
-                       break;
-               case 16: 
-                       tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+1, sizeof addr_ipv6);
-                       proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 16, "GGSN 2 address: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
-                       break;
-               default:
-                       break;
+
+       if (gtp_version == 1) {
+
+               ggsn_addr_len = tvb_get_guint8(tvb, offset);
+               proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN 2 address length: %u", ggsn_addr_len);
+
+               switch (ggsn_addr_len) {
+                       case 4:
+                               tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+1, sizeof addr_ipv4);
+                               proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 4, "GGSN 2 address: %s", ip_to_str((guint8 *)&addr_ipv4));
+                               break;
+                       case 16:
+                               tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+1, sizeof addr_ipv6);
+                               proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 16, "GGSN 2 address: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
+                               break;
+                       default:
+                               break;
+               }
+               offset = offset + 1 + ggsn_addr_len;
+
        }
-       
-       offset = offset + 1 + ggsn_addr_len;
-       
+
        apn_len = tvb_get_guint8(tvb, offset);
        proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "APN length: %u", apn_len);
        decode_apn(tvb, offset+1, apn_len, ext_tree_pdp);
 
        offset = offset + 1 + apn_len;
-       
+
        trans_id = tvb_get_guint8(tvb, offset);
        proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "Transaction identifier: %u", trans_id);
 
@@ -3619,18 +3755,17 @@ decode_gtp_pdp_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
  * UMTS:       29.060, v4.0, chapter 7.7.30
  */
 static int
-decode_gtp_apn(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
+decode_gtp_apn(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
 
-       guint16         length, name_len, tmp;  
-       gchar           *apn;
+       guint16         length;
        proto_tree      *ext_tree_apn;
        proto_item      *te;
-       
-       length = tvb_get_ntohs(tvb, offset+1);  
+
+       length = tvb_get_ntohs(tvb, offset+1);
 
        te = proto_tree_add_text(tree, tvb, offset, length+3, val_to_str(GTP_EXT_APN, gtp_val, "Unknown field"));
        ext_tree_apn = proto_item_add_subtree(te, ett_gtp_apn);
-       
+
        proto_tree_add_text(ext_tree_apn, tvb, offset+1, 2, "APN length : %u", length);
        decode_apn(tvb, offset+3, length, ext_tree_apn);
 
@@ -3641,17 +3776,15 @@ decode_gtp_apn(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
  *             4.08 v. 7.1.2, chapter 10.5.6.3 (p.580)
  * UMTS:       29.060 v4.0, chapter 7.7.31
  *             24.008, v4.2, chapter 10.5.6.3
- * TODO:       check if length is 8 or 16 bits
- *             - proto_conf in 3G */
+ */
 int
 decode_gtp_proto_conf(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
 
        guint16         length, proto_offset;
-       guint8          *ptr, conf, proto_len, tmp, msg;
+       guint8          *ptr, conf, proto_len, tmp, msg, cnt = 1;
        tvbuff_t        *next_tvb;
        proto_tree      *ext_tree_proto;
        proto_item      *te;
-       packet_info     save_pi;
 
        length = tvb_get_ntohs(tvb, offset + 1);
 
@@ -3662,49 +3795,48 @@ decode_gtp_proto_conf(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
 
        if (length < 1) return 3;
 
-       conf = tvb_get_guint8(tvb, offset + 3) & 0x07;
+       conf = tvb_get_guint8 (tvb, offset + 3) & 0x07;
+       proto_tree_add_text (ext_tree_proto, tvb, offset + 3, 1, "Configuration protocol (00000xxx): %u", conf);
+
        proto_offset = 1;       /* ... 1st byte is conf */
+       offset += 4;
 
        for (;;) {
                if (proto_offset >= length) break;
-               proto_len = tvb_get_guint8(tvb, offset + 6); 
-               proto_offset += proto_len + 3; 
-                       
-               if ((proto_len > 0) && ppp_reorder) { 
-                       
-                       /* this part changes layout of GTP payload: 
-                        * it swaps "length field" with "protocol header"  */ 
-                       
-                       ptr = (guint8 *)tvb_get_ptr(tvb, offset + 4, 3); 
-                       
-                       tmp = ptr[2]; 
-                       ptr[2] = ptr[1]; 
-                       ptr[1] = ptr[0]; 
-                       ptr[0] = tmp; 
-                               
-                       next_tvb = tvb_new_subset(tvb, offset + 5, proto_len + 2, proto_len + 2); 
-
-                       /* Save the current value of "pi", and adjust
-                          certain fields to reflect the new top-level
-                          tvbuff. */
-                       save_pi = pi;
-                       pi.compat_top_tvb = next_tvb;
-                       pi.len = tvb_reported_length(next_tvb);
-                       pi.captured_len = tvb_length(next_tvb);
-
-                       call_dissector(ppp_handle, next_tvb, pinfo, ext_tree_proto); 
-
-                       pi = save_pi;
-                               
-                       if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "GTP"); 
-                               
-                       if (check_col(pinfo->fd, COL_INFO)) { 
-                                       
-                               msg = tvb_get_guint8(tvb, 1); 
-                                               
-                               col_set_str(pinfo->fd, COL_INFO, val_to_str(msg, message_type, "Unknown")); 
-                       } 
-               } 
+               proto_len = tvb_get_guint8 (tvb, offset + 2);
+               proto_offset += proto_len + 3;          /* 3 = proto id + length byte */
+
+               if ((proto_len > 0) && ppp_reorder) {
+
+                       /* this part changes layout of GTP payload:
+                        * it swaps "length field" with "protocol header"  */
+
+                       ptr = (guint8 *)tvb_get_ptr(tvb, offset, 3);
+
+                       tmp = ptr[2];
+                       ptr[2] = ptr[1];
+                       ptr[1] = ptr[0];
+                       ptr[0] = tmp;
+
+                       proto_tree_add_text (ext_tree_proto, tvb, offset, 3, "[WARNING] Next 3 bytes were swapped to allow processing PPP section");
+                       proto_tree_add_text (ext_tree_proto, tvb, offset, 1, "Protocol %u length: %u", cnt, proto_len);
+
+                       next_tvb = tvb_new_subset (tvb, offset + 1, proto_len + 2, proto_len + 2);
+                       call_dissector(ppp_handle, next_tvb, pinfo, ext_tree_proto);
+
+                       if (check_col(pinfo->cinfo, COL_PROTOCOL))
+                               col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP");
+
+                       if (check_col(pinfo->cinfo, COL_INFO)) {
+
+                               msg = tvb_get_guint8(tvb, 1);
+
+                               col_set_str(pinfo->cinfo, COL_INFO, val_to_str(msg, message_type, "Unknown"));
+                       }
+               }
+
+               offset += proto_len + 3;
+               cnt++;
        }
 
        return 3 + length;
@@ -3714,20 +3846,20 @@ decode_gtp_proto_conf(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
  * UMTS:       29.060 v4.0, chapter 7.7.32
  */
 static int
-decode_gtp_gsn_addr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-       
-       guint8          addr_type, addr_len;    
-       guint16         length; 
+decode_gtp_gsn_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
+       guint8          addr_type, addr_len;
+       guint16         length;
        guint32         addr_ipv4;
        struct  e_in6_addr addr_ipv6;
        proto_tree      *ext_tree_gsn_addr;
        proto_item      *te;
-       
+
        length = tvb_get_ntohs(tvb, offset+1);
-       
+
        te = proto_tree_add_text(tree, tvb, offset, 3+length, "GSN address : ");
        ext_tree_gsn_addr = proto_item_add_subtree(te, ett_gtp_gsn_addr);
-       
+
        switch (length) {
                case 4:
                        proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address length : %u", length);
@@ -3746,12 +3878,12 @@ decode_gtp_gsn_addr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
                        proto_tree_add_ipv4(ext_tree_gsn_addr, gtp_version ? hf_gtpv1_gsn_ipv4 : hf_gtpv0_gsn_ipv4, tvb, offset+4, 4, addr_ipv4);
                        break;
                case 16:
-                       proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address length : %u", length); 
+                       proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address length : %u", length);
                        tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
                        proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
                        proto_tree_add_ipv6(ext_tree_gsn_addr, gtp_version ? hf_gtpv1_gsn_ipv6 : hf_gtpv0_gsn_ipv6, tvb, offset+3, 16, (guint8*)&addr_ipv6);
                        break;
-               case 17: 
+               case 17:
                        proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address Information Element length : %u", length);
                        addr_type = tvb_get_guint8(tvb, offset+3) & 0xC0;
                        proto_tree_add_uint(ext_tree_gsn_addr, gtp_version ? hf_gtpv1_gsn_addr_type : hf_gtpv0_gsn_addr_type, tvb, offset+3, 1, addr_type);
@@ -3765,7 +3897,7 @@ decode_gtp_gsn_addr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
                        proto_item_append_text(te, "unknown type or wrong length");
                        break;
        }
-       
+
        return 3+length;
 }
 
@@ -3773,21 +3905,21 @@ decode_gtp_gsn_addr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
  * UMTS:       29.060 v4.0, chapter 7.7.33
  */
 static int
-decode_gtp_msisdn(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
+decode_gtp_msisdn(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        const guint8    *msisdn_val;
        gchar           *msisdn_str;
        guint16         length;
-       
+
        length = tvb_get_ntohs(tvb, offset+1);
-       
+
        if (length < 1) return 3;
-       
+
        msisdn_val = tvb_get_ptr(tvb, offset+3, length);
        msisdn_str = msisdn_to_str(msisdn_val, length);
-       
+
        proto_tree_add_string(tree, gtp_version ? hf_gtpv1_msisdn : hf_gtpv0_msisdn, tvb, offset, 3+length, msisdn_str);
-       
+
        return 3+length;
 }
 
@@ -3796,17 +3928,17 @@ decode_gtp_msisdn(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tre
  *             24.008 v4.2, chapter 10.5.6.5
  */
 static int
-decode_gtp_qos_umts(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
+decode_gtp_qos_umts(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
 
-       return decode_qos_umts(tvb, offset+3, tree, "Quality of Service", 3);
+       return decode_qos_umts(tvb, offset, tree, "Quality of Service", 2);
 }
 
 /* GPRS:       not present
  * UMTS:       29.060 v4.0, chapter 7.7.35
  */
 static int
-decode_gtp_auth_qui(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-       
+decode_gtp_auth_qui(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        return (1 + decode_quintuplet(tvb, offset+1, tree, 1, 1));
 
 }
@@ -3816,136 +3948,135 @@ decode_gtp_auth_qui(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
  *             24.008 v4.2, chapter 10.5.6.12
  */
 static int
-decode_gtp_tft(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
+decode_gtp_tft(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
 
        guint16         length, port1, port2, tos;
-       guint8          tft_code, no_packet_filters, i, pf_id, pf_eval, pf_len, pf_content_id, pf_offset, proto;
-       guint32         addr_ipv4, ipsec_id, label;
-       struct  e_in6_addr addr_ipv6;
-       proto_tree      *ext_tree_tft, *ext_tree_tft_pf;
-       proto_item      *te, *tee;
-       
+       guint8          tft_flags, tft_code, no_packet_filters, i, pf_id, pf_eval, pf_len, pf_content_id, pf_offset, proto, spare;
+       guint32         mask_ipv4, addr_ipv4, ipsec_id, label;
+       struct  e_in6_addr addr_ipv6, mask_ipv6;
+       proto_tree      *ext_tree_tft, *ext_tree_tft_pf, *ext_tree_tft_flags;
+       proto_item      *te, *tee, *tef;
+
        length = tvb_get_ntohs(tvb, offset+1);
-       
+
        te = proto_tree_add_text(tree, tvb, offset, 3+length, "Traffic flow template");
        ext_tree_tft = proto_item_add_subtree(te, ett_gtp_tft);
-       
-       tft_code = (tvb_get_guint8(tvb, offset+3) >> 5) & 0x07;
-       no_packet_filters = tvb_get_guint8(tvb, offset+3) & 0x0F;
-       
+
+       tft_flags = tvb_get_guint8(tvb, offset+3);
+       tft_code = (tft_flags >> 5) & 0x07;
+       spare = (tft_flags >> 4) & 0x01;
+       no_packet_filters = tft_flags & 0x0F;
+
        proto_tree_add_text(ext_tree_tft, tvb, offset+1, 2, "TFT length: %u", length);
-       proto_tree_add_text(ext_tree_tft, tvb, offset+3, 1, "TFT operation code: %u", tft_code);
-       proto_tree_add_text(ext_tree_tft, tvb, offset+3, 1, "Number of packet filters: %u", no_packet_filters); 
+
+       tef = proto_tree_add_text (ext_tree_tft, tvb, offset + 3, 1, "TFT flags");
+       ext_tree_tft_flags = proto_item_add_subtree (tef, ett_gtp_tft_flags);
+       proto_tree_add_uint (ext_tree_tft_flags, hf_gtpv1_tft_code, tvb, offset + 3, 1, tft_flags);
+       proto_tree_add_uint (ext_tree_tft_flags, hf_gtpv1_tft_spare, tvb, offset + 3, 1, tft_flags);
+       proto_tree_add_uint (ext_tree_tft_flags, hf_gtpv1_tft_number, tvb, offset + 3, 1, tft_flags);
 
        offset = offset + 4;
-       
+
        for (i=0;i<no_packet_filters;i++) {
-               
+
                pf_id = tvb_get_guint8(tvb, offset);
-               
-               tee = proto_tree_add_text(ext_tree_tft, tvb, offset, 1, "Packet filter id: %u", pf_id);
-               ext_tree_tft_pf = proto_item_add_subtree(tee, ett_gtp_tft_pf);
-               
+
+               tee = proto_tree_add_text (ext_tree_tft, tvb, offset, 1, "Packet filter id: %u", pf_id);
+               ext_tree_tft_pf = proto_item_add_subtree (tee, ett_gtp_tft_pf);
+               offset++;
+
                if (tft_code != 2) {
-                       
-                       pf_eval = tvb_get_guint8(tvb, offset+1);
-                       pf_len = tvb_get_guint8(tvb, offset+2);
-                       
-                       proto_tree_add_text(ext_tree_tft_pf, tvb, offset+1, 1, "Evaluation precedence: %u", pf_eval);
-                       proto_tree_add_text(ext_tree_tft_pf, tvb, offset+2, 1, "Contents length: %u", pf_len);
-
-                       offset = offset + 3;
-                       pf_offset = 0;  
-                       
-                       while (pf_offset < pf_len) {    
-                               
-                               pf_content_id = tvb_get_guint8(tvb, offset + pf_offset);
-                               
+
+                       pf_eval = tvb_get_guint8(tvb, offset);
+                       pf_len = tvb_get_guint8(tvb, offset + 1);
+
+                       proto_tree_add_uint (ext_tree_tft_pf, hf_gtpv1_tft_eval, tvb, offset, 1, pf_eval);
+                       proto_tree_add_text (ext_tree_tft_pf, tvb, offset+1, 1, "Content length: %u", pf_len);
+
+                       offset = offset + 2;
+                       pf_offset = 0;
+
+                       while (pf_offset < pf_len) {
+
+                               pf_content_id = tvb_get_guint8 (tvb, offset + pf_offset);
+
                                switch (pf_content_id) {
                                        /* address IPv4 and mask = 8 bytes*/
-                                       case 0x10: 
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 1, "Address IPv4 and mask (0x10)");
-                                               tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset + pf_offset + 1, sizeof addr_ipv4);
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 4, "\tAddress: %s", ip_to_str((guint8 *)&addr_ipv4));
-                                               tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset + pf_offset + 5, sizeof addr_ipv4);
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 5, 4, "\tNetmask: %s", ip_to_str((guint8 *)&addr_ipv4));
+                                       case 0x10:
+                                               tvb_memcpy (tvb, (guint8 *)&addr_ipv4, offset + pf_offset + 1, sizeof addr_ipv4);
+                                               tvb_memcpy (tvb, (guint8 *)&mask_ipv4, offset + pf_offset + 5, sizeof mask_ipv4);
+                                               proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 9, "ID 0x10: IPv4/mask: %s/%s", ip_to_str ((guint8 *)&addr_ipv4), ip_to_str ((guint8 *)&mask_ipv4));
                                                pf_offset = pf_offset + 9;
                                                break;
                                        /* address IPv6 and mask = 32 bytes*/
-                                       case 0x20: 
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset+pf_offset, 1, "Address IPv6 and mask (0x20)");
-                                               tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+pf_offset+1, sizeof addr_ipv6);
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset+offset+1, 16, "\tAddress: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
-                                               tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+pf_offset+17, sizeof addr_ipv6);
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset+offset+17, 16, "\tNetmask: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
+                                       case 0x20:
+                                               tvb_memcpy (tvb, (guint8 *)&addr_ipv6, offset+pf_offset+1, sizeof addr_ipv6);
+                                               tvb_memcpy (tvb, (guint8 *)&mask_ipv6, offset+pf_offset+17, sizeof mask_ipv6);
+                                               proto_tree_add_text (ext_tree_tft_pf, tvb, offset+pf_offset, 33, "ID 0x20: IPv6/mask: %s/%s", ip6_to_str ((struct e_in6_addr*)&addr_ipv6), ip6_to_str ((struct e_in6_addr*)&mask_ipv6));
                                                pf_offset = pf_offset + 33;
                                                break;
                                        /* protocol identifier/next header type = 1 byte*/
                                        case 0x30:
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 1, "IPv4 protocol identifier/IPv6 next header (0x30)");
-                                               proto = tvb_get_guint8(tvb, offset + pf_offset + 1);
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 1, "\t%u", proto);
+                                               proto = tvb_get_guint8 (tvb, offset + pf_offset + 1);
+                                               proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 2, "ID 0x30: IPv4 protocol identifier/IPv6 next header: %u (%x)", proto, proto);
                                                pf_offset = pf_offset + 2;
                                                break;
                                        /* single destination port type = 2 bytes */
                                        case 0x40:
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 1, "Destination port (0x40)");
-                                               port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 2, "\t%u", port1);
+                                               port1 = tvb_get_ntohs (tvb, offset + pf_offset + 1);
+                                               proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 3, "ID 0x40: destination port: %u", port1);
                                                pf_offset = pf_offset + 3;
                                                break;
                                        /* destination port range type = 4 bytes */
                                        case 0x41:
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset+pf_offset, 1, "Destination port range (0x41)");
-                                               port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
-                                               port2 = tvb_get_ntohs(tvb, offset + pf_offset + 3);
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 4, "\t%u-%u", port1, port2);
+                                               port1 = tvb_get_ntohs (tvb, offset + pf_offset + 1);
+                                               port2 = tvb_get_ntohs (tvb, offset + pf_offset + 3);
+                                               proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x41: destination port range: %u - %u", port1, port2);
                                                pf_offset = pf_offset + 5;
                                                break;
                                        /* single source port type = 2 bytes */
                                        case 0x50:
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset+pf_offset, 1, "Source port (0x50)");
-                                               port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 2, "\t%u", port1);
+                                               port1 = tvb_get_ntohs (tvb, offset + pf_offset + 1);
+                                               proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 3, "ID 0x50: source port: %u", port1);
                                                pf_offset = pf_offset + 3;
                                                break;
                                        /* source port range type = 4 bytes */
                                        case 0x51:
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset+pf_offset, 1, "Source port range (0x51)");
-                                               port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
-                                               port2 = tvb_get_ntohs(tvb, offset + pf_offset + 3);
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 4, "\t%u-%u", port1, port2);
+                                               port1 = tvb_get_ntohs (tvb, offset + pf_offset + 1);
+                                               port2 = tvb_get_ntohs (tvb, offset + pf_offset + 3);
+                                               proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x51: source port range: %u - %u", port1, port2);
                                                pf_offset = pf_offset + 5;
                                                break;
                                        /* security parameter index type = 4 bytes */
                                        case 0x60:
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset+pf_offset, 1, "Security parameter index (0x60)");
-                                               ipsec_id = tvb_get_ntohl(tvb, offset + pf_offset + 1);
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 4, "\t%x", ipsec_id);
+                                               ipsec_id = tvb_get_ntohl (tvb, offset + pf_offset + 1);
+                                               proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x60: security parameter index: %x", ipsec_id);
                                                pf_offset = pf_offset + 5;
                                                break;
                                        /* type of service/traffic class type = 2 bytes */
                                        case 0x70:
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset+pf_offset, 1, "Type of Service/Traffic Class (0x70)");
-                                               tos = tvb_get_ntohs(tvb, offset + pf_offset + 1);
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 2, "\t%u", tos);
+                                               tos = tvb_get_ntohs (tvb, offset + pf_offset + 1);
+                                               proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 2, "ID 0x70: Type of Service/Traffic Class: %u (%x)", tos, tos);
                                                pf_offset = pf_offset + 3;
                                                break;
                                        /* flow label type = 3 bytes */
                                        case 0x80:
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset+pf_offset, 1, "Flow label (0x80)");
                                                label = tvb_get_ntoh24(tvb, offset + pf_offset + 1) & 0x0FFFFF;;
-                                               proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 3, "\t%x", label);
+                                               proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 4, "ID 0x80: Flow Label: %u (%x)", label, label);
                                                pf_offset = pf_offset + 4;
                                                break;
-                                       
-                                       default: 
+
+                                       default:
+                                               proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 1, "Unknown value: %x ", pf_content_id);
+                                               pf_offset++; /* to avoid infinite loop */
                                                break;
                                }
                        }
-               }       
+
+                       offset = offset + pf_offset;
+               }
        }
-       
+
        return 3 + length;
 }
 
@@ -3954,14 +4085,14 @@ decode_gtp_tft(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
  *             25.413 v3.4, chapter ???
  */
 static int
-decode_gtp_target_id(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
+decode_gtp_target_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
 
        guint16         length;
 
        length = tvb_get_ntohs(tvb, offset + 1);
 
        proto_tree_add_text(tree, tvb, offset, 3 + length, "Targer Identification");
-       
+
        return 3 + length;
 }
 
@@ -3970,7 +4101,7 @@ decode_gtp_target_id(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
  * UMTS:       29.060 v4.0, chapter 7.7.38
  */
 static int
-decode_gtp_utran_cont(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
+decode_gtp_utran_cont(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
 
        guint16         length;
 
@@ -3981,13 +4112,13 @@ decode_gtp_utran_cont(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
        return 3 + length;
 
 }
-       
+
 
 /* GPRS:       not present
  * UMTS:       29.060 v4.0, chapter 7.7.39
  */
 static int
-decode_gtp_rab_setup(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
+decode_gtp_rab_setup(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
 
        guint32         teid, addr_ipv4;
        guint16         length;
@@ -3995,7 +4126,7 @@ decode_gtp_rab_setup(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
        struct  e_in6_addr addr_ipv6;
        proto_tree      *ext_tree_rab_setup;
        proto_item      *te;
-       
+
        length = tvb_get_ntohs(tvb, offset + 1);
        nsapi = tvb_get_guint8(tvb, offset + 3) & 0x0F;
 
@@ -4006,17 +4137,17 @@ decode_gtp_rab_setup(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
        proto_tree_add_uint(ext_tree_rab_setup, hf_gtpv1_nsapi, tvb, offset+3, 1, nsapi);
 
        if (length > 1) {
-               
+
                teid = tvb_get_ntohl(tvb, offset + 4);
 
                proto_tree_add_uint(ext_tree_rab_setup, hf_gtpv1_teid_data, tvb, offset+4, 4, teid);
-       
+
                switch (length) {
                        case 12:
                                tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+8, sizeof addr_ipv4);
                                proto_tree_add_ipv4(ext_tree_rab_setup, hf_gtpv1_rnc_ipv4, tvb, offset+8, 4, addr_ipv4);
                                break;
-                       case 24: 
+                       case 24:
                                tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+8, sizeof addr_ipv6);
                                proto_tree_add_ipv6(ext_tree_rab_setup, hf_gtpv1_rnc_ipv6, tvb, offset+8, 16, (guint8 *)&addr_ipv6);
                                break;
@@ -4033,18 +4164,18 @@ decode_gtp_rab_setup(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
  * UMTS:       29.060 v4.0, chapter 7.7.40
  */
 static int
-decode_gtp_hdr_list(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
+decode_gtp_hdr_list(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
 
        int             i;
        guint8          length, hdr;
        proto_tree      *ext_tree_hdr_list;
        proto_item      *te;
-       
+
        length = tvb_get_guint8(tvb, offset + 1);
 
        te = proto_tree_add_text(tree, tvb, offset, 2+length, "%s", val_to_str(GTP_EXT_HDR_LIST, gtp_val, "Unknown"));
        ext_tree_hdr_list = proto_item_add_subtree(te, ett_gtp_hdr_list);
-       
+
        proto_tree_add_text(ext_tree_hdr_list, tvb, offset+1, 1, "Number of Extension Header Types in list (i.e., length) : %u", length);
 
        for(i=0 ; i<length ; i++) {
@@ -4061,7 +4192,7 @@ decode_gtp_hdr_list(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
  * TODO:       find TriggerID description
  */
 static int
-decode_gtp_trigger_id(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
+decode_gtp_trigger_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
 
        guint16         length;
 
@@ -4078,7 +4209,7 @@ decode_gtp_trigger_id(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
  * TODO:       find OMC-ID description
  */
 static int
-decode_gtp_omc_id(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
+decode_gtp_omc_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
 
        guint16         length;
 
@@ -4094,28 +4225,28 @@ decode_gtp_omc_id(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tre
  * UMTS:       29.060 v4.0, chapter 7.7.43
  */
 static int
-decode_gtp_chrg_addr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
-       guint16         length; 
+decode_gtp_chrg_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
+       guint16         length;
        guint32         addr_ipv4;
        struct  e_in6_addr addr_ipv6;
        proto_tree      *ext_tree_chrg_addr;
        proto_item      *te;
-       
+
        length = tvb_get_ntohs(tvb, offset+1);
-       
+
        te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s : ", val_to_str(GTP_EXT_CHRG_ADDR, gtp_val, "Unknown"));
        ext_tree_chrg_addr = proto_item_add_subtree(te, ett_gtp_chrg_addr);
-       
+
        proto_tree_add_text(ext_tree_chrg_addr, tvb, offset+1, 2, "%s length : %u", val_to_str(GTP_EXT_CHRG_ADDR, gtp_val, "Unknown"), length);
-       
+
        switch (length) {
                case 4:
                        tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
                        proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
                        proto_tree_add_ipv4(ext_tree_chrg_addr, gtp_version ? hf_gtpv1_chrg_ipv4 : hf_gtpv0_chrg_ipv4, tvb, offset+3, 4, addr_ipv4);
                        break;
-               case 16: 
+               case 16:
                        tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
                        proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
                        proto_tree_add_ipv6(ext_tree_chrg_addr, gtp_version ? hf_gtpv1_chrg_ipv6 : hf_gtpv0_chrg_ipv6, tvb, offset+3, 16, (guint8*)&addr_ipv6);
@@ -4132,19 +4263,19 @@ decode_gtp_chrg_addr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
  * UMTS:       33.015
  */
 static int
-decode_gtp_rel_pack(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-       
+decode_gtp_rel_pack(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        guint16         length, n, number;
        proto_tree      *ext_tree_rel_pack;
        proto_item      *te;
 
        length = tvb_get_ntohs(tvb, offset + 1);
-       
+
        te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of released packets IE");
        ext_tree_rel_pack = proto_item_add_subtree(te, ett_gtp_rel_pack);
-       
+
        n = 0;
-       
+
        while (n < length) {
 
                number = tvb_get_ntohs(tvb, offset + 3 + n);
@@ -4152,7 +4283,7 @@ decode_gtp_rel_pack(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
                n = n + 2;
 
        }
-       
+
        return 3 + length;
 }
 
@@ -4160,19 +4291,19 @@ decode_gtp_rel_pack(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
  * UMTS:       33.015
  */
 static int
-decode_gtp_can_pack(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-       
+decode_gtp_can_pack(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        guint16         length, n, number;
        proto_tree      *ext_tree_can_pack;
        proto_item      *te;
 
        length = tvb_get_ntohs(tvb, offset + 1);
-       
+
        te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of cancelled  packets IE");
        ext_tree_can_pack = proto_item_add_subtree(te, ett_gtp_can_pack);
-       
+
        n = 0;
-       
+
        while (n < length) {
 
                number = tvb_get_ntohs(tvb, offset + 3 + n);
@@ -4180,14 +4311,14 @@ decode_gtp_can_pack(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
                n = n + 2;
 
        }
-       
+
        return 3 + length;
 }
 
 /* CDRs dissector */
 static int
-decode_gtp_data_req(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-       
+decode_gtp_data_req(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        guint16         length, format_ver, data_len, i, j;
        guint8          no, format, rectype;
        proto_tree      *ext_tree, *cdr_tree;
@@ -4195,12 +4326,12 @@ decode_gtp_data_req(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
 
        te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_DATA_REQ, gtp_val, "Unknown message"));
        ext_tree = proto_item_add_subtree(te, ett_gtp_ext);
-       
+
        length = tvb_get_ntohs(tvb, offset + 1);
        no = tvb_get_guint8(tvb, offset + 3);
        format = tvb_get_guint8(tvb, offset + 4);
        format_ver = tvb_get_ntohs(tvb, offset + 5);
-       
+
        proto_tree_add_text(ext_tree, tvb, offset+1, 2, "Length: %u", length);
        proto_tree_add_text(ext_tree, tvb, offset+3, 1, "Number of data records: %u", no);
        proto_tree_add_text(ext_tree, tvb, offset+4, 1, "Data record format: %u", format);
@@ -4210,18 +4341,18 @@ decode_gtp_data_req(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
        offset = offset + 7;
 
        if (gtpv0_cdr_as != DONT_DISSECT_CDRS) {
-       
+
        for (i = 0; i < no; i++) {
                data_len = tvb_get_ntohs(tvb, offset);
                rectype = tvb_get_guint8(tvb, offset+2);
                switch (rectype) {
-                       case 0x13:              /* GCDR */ 
+                       case 0x13:              /* GCDR */
                                if (tvb_length_remaining(tvb, offset) < 3 + 118) {
                                        proto_tree_add_text(ext_tree, tvb, offset, tvb_length_remaining(tvb, offset), "GCDR fragmented, can't dissect");
                                        break;
                                }
-                               
-                               tvb_memcpy(tvb, gcdr.imsi, offset+3, 8);        
+
+                               tvb_memcpy(tvb, gcdr.imsi, offset+3, 8);
                                tvb_memcpy(tvb, (guint8 *)&gcdr.ggsnaddr, offset+11, sizeof gcdr.ggsnaddr);
                                gcdr.chrgid = tvb_get_ntohl(tvb, offset+15);
                                tvb_memcpy(tvb, (guint8 *)&gcdr.sgsnaddr, offset+19, sizeof gcdr.sgsnaddr);
@@ -4237,7 +4368,7 @@ decode_gtp_data_req(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
                                gcdr.duration = tvb_get_ntohl(tvb, offset+112);
                                gcdr.closecause = tvb_get_guint8(tvb, offset+116);
                                gcdr.seqno = tvb_get_ntohl(tvb, offset+117);
-                               
+
                                ce = proto_tree_add_text(ext_tree, tvb, offset, data_len + 2, "GCDR (0x13), sequence number: %u", gcdr.seqno);
                                cdr_tree = proto_item_add_subtree(ce, ett_gtp_ext);
                                proto_tree_add_text(cdr_tree, tvb, offset, 2, "Length: %u", data_len);
@@ -4256,14 +4387,15 @@ decode_gtp_data_req(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
                                proto_tree_add_text(cdr_tree, tvb, offset+100, 4, "Downlink volume: %u", gcdr.downlink);
                                proto_tree_add_text(cdr_tree, tvb, offset+104, 4, "Timestamp: %s", time_int_to_str(gcdr.timestamp));
                                proto_tree_add_text(cdr_tree, tvb, offset+108, 4, "Record opening time: %s", time_int_to_str(gcdr.opening));
-                               proto_tree_add_text(cdr_tree, tvb, offset+112, 4, "Duration: %s", time_int_to_str(gcdr.duration));
+                               proto_tree_add_text(cdr_tree, tvb, offset+112, 4, "Duration: %s", rel_time_int_to_str(gcdr.duration));
                                proto_tree_add_text(cdr_tree, tvb, offset+116, 1, "Cause for close: %s (%u)", val_to_str(gcdr.closecause, cdr_close_type, "Unknown cause"), gcdr.closecause);
                                proto_tree_add_text(cdr_tree, tvb, offset+117, 4, "Sequence number: %u", gcdr.seqno);
-                               
+
                                if (data_len > 119) {
-                                       proto_tree_add_text(cdr_tree, tvb, offset+121, 8, "MSISDN: ");
+                                       tvb_memcpy (tvb, gcdr.msisdn, offset + 121, 9);
+                                       proto_tree_add_text(cdr_tree, tvb, offset+121, 9, "MSISDN: %s", msisdn_to_str (gcdr.msisdn, 9));
                                }
-                                       
+
                                break;
 
                        case 0x12:              /* SCDR */
@@ -4271,7 +4403,7 @@ decode_gtp_data_req(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
                                        proto_tree_add_text(ext_tree, tvb, offset, tvb_length_remaining(tvb, offset), "SCDR fragmented, can't dissect");
                                        break;
                                }
-                               
+
                                scdr.len = tvb_get_letohs(tvb, offset+3);
                                scdr.netini = tvb_get_guint8(tvb, offset+5);
                                scdr.anon = tvb_get_guint8(tvb, offset+6);
@@ -4331,7 +4463,7 @@ decode_gtp_data_req(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
                                proto_tree_add_text(cdr_tree, tvb, offset+35, 4, "SGSN address: %s", ip_to_str((guint8 *)&scdr.sgsnaddr));
                                proto_tree_add_text(cdr_tree, tvb, offset+39, 12, "(not used)");
                                proto_tree_add_text(cdr_tree, tvb, offset+51, 1, "MS network capability length: %u", scdr.msclass_caplen);
-                               
+
 /*                             cap_id = proto_tree_add_text(cdr_tree, tvb, offset+52, 1, "MS network capability: %u", scdr.msclass_cap);
                                cap_tree = proto_item_add_subtree(cap_id, ett_chrg_cap);
                                proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_gea, tvb, offset+52, 1, scdr.cap);
@@ -4362,10 +4494,10 @@ decode_gtp_data_req(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
                                        proto_tree_add_text(cdr_tree, tvb, offset+152+23*j, 4, "Downlink: %x", scdr.change[j].downlink);
                                        decode_qos_gprs(tvb, offset+156, cdr_tree, "QoS requested", 0);
                                        decode_qos_gprs(tvb, offset+159, cdr_tree, "QoS negotiated", 0);
-                               }       
+                               }
                                proto_tree_add_text(cdr_tree, tvb, offset+254, 4, "Timestamp: %s", time_int_to_str(scdr.timestamp));
                                proto_tree_add_text(cdr_tree, tvb, offset+258, 4, "Opening: %s", time_int_to_str(scdr.opening));
-                               proto_tree_add_text(cdr_tree, tvb, offset+262, 4, "Duration: %s", time_int_to_str(scdr.duration));
+                               proto_tree_add_text(cdr_tree, tvb, offset+262, 4, "Duration: %s", rel_time_int_to_str(scdr.duration));
                                proto_tree_add_text(cdr_tree, tvb, offset+266, 1, "SGSN change: %u", scdr.sgsnchange);
                                proto_tree_add_text(cdr_tree, tvb, offset+267, 1, "Cause for close: %s (%u)", val_to_str(scdr.closecause, cdr_close_type, "Unknown cause"), scdr.closecause);
                                proto_tree_add_text(cdr_tree, tvb, offset+268, 1, "Diagnostics 1: %u", scdr.diag1);
@@ -4427,7 +4559,7 @@ decode_gtp_data_req(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
                                proto_tree_add_text(cdr_tree, tvb, offset+33, 4, "SGSN address: %s", ip_to_str((guint8 *)&mcdr.sgsnaddr));
                                proto_tree_add_text(cdr_tree, tvb, offset+37, 12, "(not used)");
                                proto_tree_add_text(cdr_tree, tvb, offset+49, 1, "MS network capability length: %u", mcdr.msclass_caplen);
-                               
+
 /*                             cap_id = proto_tree_add_text(cdr_tree, tvb, offset+50, 1, "MS network capability: %u", mcdr.msclass_cap);
                                cap_tree = proto_item_add_subtree(cap_id, ett_chrg_cap);
                                proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_gea, tvb, offset+50, 1, mcdr.cap);
@@ -4452,7 +4584,7 @@ decode_gtp_data_req(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
 
                                proto_tree_add_text(cdr_tree, tvb, offset+124, 4, "Timestamp: %s", time_int_to_str(mcdr.timestamp));
                                proto_tree_add_text(cdr_tree, tvb, offset+128, 4, "Record opening time: %s", time_int_to_str(mcdr.opening));
-                               proto_tree_add_text(cdr_tree, tvb, offset+132, 4, "Duration: %s", time_int_to_str(mcdr.duration));
+                               proto_tree_add_text(cdr_tree, tvb, offset+132, 4, "Duration: %s", rel_time_int_to_str(mcdr.duration));
                                proto_tree_add_text(cdr_tree, tvb, offset+136, 1, "SGSN change: %u", mcdr.sgsnchange);
                                proto_tree_add_text(cdr_tree, tvb, offset+137, 1, "Cause for close: %s (%u)", val_to_str(mcdr.closecause, cdr_close_type, "Unknown cause"), mcdr.closecause);
                                proto_tree_add_text(cdr_tree, tvb, offset+138, 1, "Diagnostics 1: %u", mcdr.diag1);
@@ -4501,7 +4633,7 @@ decode_gtp_data_req(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
                                proto_tree_add_text(cdr_tree, tvb, offset+23, 10, "MSISDN: %s", msisdn_to_str(socdr.msisdn, 10));
                                proto_tree_add_text(cdr_tree, tvb, offset+33, 12, "(not used)");
                                proto_tree_add_text(cdr_tree, tvb, offset+45, 1, "MS network capability length: %u", socdr.msclass_caplen);
-                               
+
 /*                             cap_id = proto_tree_add_text(cdr_tree, tvb, offset+46, 1, "MS network capability: %u", socdr.msclass_cap);
                                cap_tree = proto_item_add_subtree(cap_id, ett_chrg_cap);
                                proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_gea, tvb, offset+46, 1, socdr.cap);
@@ -4560,7 +4692,7 @@ decode_gtp_data_req(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
                                proto_tree_add_text(cdr_tree, tvb, offset+23, 10, "MSISDN: %s", msisdn_to_str(stcdr.msisdn, 10));
                                proto_tree_add_text(cdr_tree, tvb, offset+33, 12, "(not used)");
                                proto_tree_add_text(cdr_tree, tvb, offset+45, 1, "MS network capability length: %u", stcdr.msclass_caplen);
-                               
+
 /*                             cap_id = proto_tree_add_text(cdr_tree, tvb, offset+46, 1, "MS network capability: %u", stcdr.msclass_cap);
                                cap_tree = proto_item_add_subtree(cap_id, ett_chrg_cap);
                                proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_gea, tvb, offset+46, 1, stcdr.cap);
@@ -4591,19 +4723,19 @@ decode_gtp_data_req(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
  * UMTS:       33.015
  */
 static int
-decode_gtp_data_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-       
+decode_gtp_data_resp(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
        guint16         length, n, number;
        proto_tree      *ext_tree_data_resp;
        proto_item      *te;
 
        length = tvb_get_ntohs(tvb, offset + 1);
-       
+
        te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Requests responded");
        ext_tree_data_resp = proto_item_add_subtree(te, ett_gtp_data_resp);
-       
+
        n = 0;
-       
+
        while (n < length) {
 
                number = tvb_get_ntohs(tvb, offset + 3 + n);
@@ -4615,33 +4747,33 @@ decode_gtp_data_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
        return 3 + length;
 
 }
-       
+
 /* GPRS:       12.15
  * UMTS:       33.015
  */
 static int
-decode_gtp_node_addr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
-               
-       guint16         length; 
+decode_gtp_node_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
+       guint16         length;
        guint32         addr_ipv4;
        struct  e_in6_addr addr_ipv6;
        proto_tree      *ext_tree_node_addr;
        proto_item      *te;
-       
+
        length = tvb_get_ntohs(tvb, offset+1);
-       
+
        te = proto_tree_add_text(tree, tvb, offset, 3+length, "Node address: ");
        ext_tree_node_addr = proto_item_add_subtree(te, ett_gtp_node_addr);
-       
+
        proto_tree_add_text(ext_tree_node_addr, tvb, offset+1, 2, "Node address length: %u", length);
-       
+
        switch (length) {
                case 4:
                        tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
                        proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
                        proto_tree_add_ipv4(ext_tree_node_addr, gtp_version ? hf_gtpv1_node_ipv4 : hf_gtpv0_node_ipv4, tvb, offset+3, 4, addr_ipv4);
                        break;
-               case 16: 
+               case 16:
                        tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
                        proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
                        proto_tree_add_ipv6(ext_tree_node_addr, gtp_version ? hf_gtpv1_node_ipv6 : hf_gtpv0_node_ipv6, tvb, offset+3, 16, (guint8*)&addr_ipv6);
@@ -4659,30 +4791,30 @@ decode_gtp_node_addr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
  * UMTS:       29.060 v4.0, chapter 7.7.44
  */
 static int
-decode_gtp_priv_ext(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { 
-               
-       guint16         length, ext_id; 
+decode_gtp_priv_ext(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
+
+       guint16         length, ext_id;
        gchar           ext_val[64];
        proto_tree      *ext_tree_priv_ext;
        proto_item      *te;
-       
+
        te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_PRIV_EXT, gtp_val, "Unknown message"));
        ext_tree_priv_ext = proto_item_add_subtree(te, ett_gtp_ext);
-       
+
        length = tvb_get_ntohs(tvb, offset+1);
        if (length < 1) return 3+length;
-       
-       ext_id = tvb_get_ntohs(tvb, offset+3);  
+
+       ext_id = tvb_get_ntohs(tvb, offset+3);
        tvb_memcpy(tvb, ext_val, offset+5, length > 65 ? 63 : length-2);
        ext_val[length > 65 ? 64 : length-1] = '\0';
        proto_tree_add_uint(ext_tree_priv_ext, gtp_version ? hf_gtpv1_ext_id : hf_gtpv0_ext_id, tvb, offset+3, 2, ext_id);
        proto_tree_add_string(ext_tree_priv_ext, gtp_version ? hf_gtpv1_ext_val : hf_gtpv0_ext_val, tvb, offset+5, length-2, ext_val);
-       
+
        return 3+length;
 }
 
 static int
-decode_gtp_unknown(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
+decode_gtp_unknown(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
 
        proto_tree_add_text(tree, tvb, offset, 1, "Unknown extension header");
 
@@ -4692,7 +4824,7 @@ decode_gtp_unknown(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr
 static void
 dissect_gtpv0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
-       
+
        _gtpv0_hdr      gtpv0_hdr;
        proto_item      *ti, *tf;
        proto_tree      *gtpv0_tree, *flags_tree;
@@ -4700,38 +4832,42 @@ dissect_gtpv0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        tvbuff_t        *next_tvb;
        const guint8    *tid_val;
        gchar           *tid_str;
-       int             offset, length, i, mandatory, checked_field;
-       
-       if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "GTP");
-       if (check_col(pinfo->fd, COL_INFO)) col_clear(pinfo->fd, COL_INFO);
+       int             offset, length, i, mandatory, checked_field, gtp_prime = 0;
+
+       if (check_col(pinfo->cinfo, COL_PROTOCOL))
+               col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP");
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_clear(pinfo->cinfo, COL_INFO);
 
-       tvb_memcpy(tvb, (guint8 *)&gtpv0_hdr, 0, 12); 
+       tvb_memcpy(tvb, (guint8 *)&gtpv0_hdr, 0, 12);
        tid_val = tvb_get_ptr(tvb, 12, 8);
        tid_str = id_to_str(tid_val);
        gtp_version = (gtpv0_hdr.flags >> 5) & 0x07;
 
        if (!((gtpv0_hdr.flags >> 4) & 1)) {
-               if (check_col(pinfo->fd, COL_PROTOCOL))
-                       col_set_str(pinfo->fd, COL_PROTOCOL, "GTP-CDR");
+               gtp_prime = 1;
+               if (check_col(pinfo->cinfo, COL_PROTOCOL))
+                       col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP-CDR");
        } else {
                switch ((gtpv0_hdr.flags >> 5) & 0x07) {
-               case 0: if (check_col(pinfo->fd, COL_PROTOCOL))
-                               col_set_str(pinfo->fd, COL_PROTOCOL, "GTP");
+               case 0: if (check_col(pinfo->cinfo, COL_PROTOCOL))
+                               col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP");
                        break;
-               case 1: if (check_col(pinfo->fd, COL_PROTOCOL))
-                               col_set_str(pinfo->fd, COL_PROTOCOL, "GTPv1");
-               default: if (check_col(pinfo->fd, COL_PROTOCOL))
-                               col_set_str(pinfo->fd, COL_PROTOCOL, "GTPv?");
+               case 1: if (check_col(pinfo->cinfo, COL_PROTOCOL))
+                               col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTPv1");
+               default: if (check_col(pinfo->cinfo, COL_PROTOCOL))
+                               col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTPv?");
                        break;
                }
        }
 
-       if (check_col(pinfo->fd, COL_INFO)) col_add_str(pinfo->fd, COL_INFO, val_to_str(gtpv0_hdr.message, message_type, "Unknown"));
-       
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_add_str(pinfo->cinfo, COL_INFO, val_to_str(gtpv0_hdr.message, message_type, "Unknown"));
+
        if (tree) {
-                       
+
                /* dissect GTP header */
-               ti = proto_tree_add_item(tree, proto_gtpv0, tvb, 0, tvb_length(tvb), FALSE);
+               ti = proto_tree_add_item(tree, proto_gtpv0, tvb, 0, -1, FALSE);
                gtpv0_tree = proto_item_add_subtree(ti, ett_gtp);
 
                tf = proto_tree_add_uint(gtpv0_tree, hf_gtpv0_flags, tvb, 0, 1, gtpv0_hdr.flags);
@@ -4741,30 +4877,35 @@ dissect_gtpv0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                proto_tree_add_uint(flags_tree, hf_gtpv0_flags_pt, tvb, 0, 1, gtpv0_hdr.flags);
                proto_tree_add_uint(flags_tree, hf_gtpv0_flags_spare, tvb, 0, 1, gtpv0_hdr.flags);
                proto_tree_add_boolean(flags_tree, hf_gtpv0_flags_snn, tvb, 0, 1, gtpv0_hdr.flags);
-               
-               gtpv0_hdr.length = ntohs(gtpv0_hdr.length);
-               gtpv0_hdr.seq_no = ntohs(gtpv0_hdr.seq_no);
+
+               gtpv0_hdr.length = g_ntohs(gtpv0_hdr.length);
+               gtpv0_hdr.seq_no = g_ntohs(gtpv0_hdr.seq_no);
                proto_tree_add_uint(gtpv0_tree, hf_gtpv0_message_type, tvb, 1, 1, gtpv0_hdr.message);
                proto_tree_add_uint(gtpv0_tree, hf_gtpv0_length, tvb, 2, 2, gtpv0_hdr.length);
                proto_tree_add_uint(gtpv0_tree, hf_gtpv0_seq_number, tvb, 4, 2, gtpv0_hdr.seq_no);
-               proto_tree_add_uint(gtpv0_tree, hf_gtpv0_flow_label, tvb, 6, 2, gtpv0_hdr.flow_label);
-               proto_tree_add_uint(gtpv0_tree, hf_gtpv0_sndcp_number, tvb, 8, 1, gtpv0_hdr.sndcp_no);
-               proto_tree_add_string(gtpv0_tree, hf_gtpv0_tid, tvb, 12, 8, tid_str);
-       
+
+               /* GTP' has 6 bytes of length */
+               if (!gtp_prime) {
+                       proto_tree_add_uint(gtpv0_tree, hf_gtpv0_flow_label, tvb, 6, 2, gtpv0_hdr.flow_label);
+                       proto_tree_add_uint(gtpv0_tree, hf_gtpv0_sndcp_number, tvb, 8, 1, gtpv0_hdr.sndcp_no);
+                       proto_tree_add_string(gtpv0_tree, hf_gtpv0_tid, tvb, 12, 8, tid_str);
+               }
+
                if (gtpv0_hdr.message != GTP_MSG_TPDU) {
-                               
+
                        proto_tree_add_text(gtpv0_tree, tvb, 0, 0, "[--- end of GTPv0 header, beginning of extension headers ---]");
-                                       
-                       offset = GTPv0_HDR_LENGTH;
+
+                       offset = gtp_prime ? GTP_PRIME_HDR_LENGTH : GTPv0_HDR_LENGTH;
+
                        length = tvb_length(tvb);
 
                        mandatory = 0;          /* check order of GTP fields against ETSI */
-               
+
                        for (;;) {
-                                       
+
                                if (offset >= length) break;
                                ext_hdr_val = tvb_get_guint8(tvb, offset);
-                               
+
                                if (gtpv0_etsi_order) {
                                        checked_field = check_field_presence (gtpv0_hdr.message, ext_hdr_val , (int *)&mandatory);
                                        switch (checked_field) {
@@ -4776,104 +4917,106 @@ dissect_gtpv0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                                                default: proto_tree_add_text(gtpv0_tree, tvb, offset, 1, "[WARNING] wrong next field, should be: %s", val_to_str(checked_field, gtp_val, "Unknown extension field"));
                                        }
                                }
-                               
+
                                i = -1;
                                while (gtpopt[++i].optcode) if (gtpopt[i].optcode == ext_hdr_val) break;
                                offset = offset + (*gtpopt[i].decode)(tvb, offset, pinfo, gtpv0_tree);
                        }
                }
-       } 
+       }
 
 /* next part dissects sublayers of GTP
  * right now it's only IP */
-       
+
        if ((gtpv0_hdr.message == GTP_MSG_TPDU) && gtp_tpdu) {
                next_tvb = tvb_new_subset(tvb, 20, -1, -1);
                call_dissector(ip_handle, next_tvb, pinfo, tree);
-               if (check_col(pinfo->fd, COL_PROTOCOL)) col_append_str_gtp(pinfo->fd, COL_PROTOCOL, "GTP");
+               if (check_col(pinfo->cinfo, COL_PROTOCOL))
+                       col_append_str_gtp(pinfo->cinfo, COL_PROTOCOL, "GTP");
        }
-       
+
 }
 
 /* GTP v1 dissector */
 static void
 dissect_gtpv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
-       
+
        _gtpv1_hdr      gtpv1_hdr;
        proto_item      *ti, *tf;
        proto_tree      *gtpv1_tree, *flags_tree;
        guint16         seq_no;
-       guint8          ext_hdr_val, i, hdr_offset = 4, next_hdr, npdu_no, probe;
+       guint8          ext_hdr_val, i, hdr_offset = 4, next_hdr, npdu_no, sub_proto;
        tvbuff_t        *next_tvb;
-       int             offset, length, mandatory, checked_field;
-       
-       if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "GTP-C");
-       if (check_col(pinfo->fd, COL_INFO)) col_clear(pinfo->fd, COL_INFO);
+       int             offset, length, mandatory, checked_field, gtp_prime = 0;
+
+       if (check_col(pinfo->cinfo, COL_PROTOCOL))
+               col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP-C");
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_clear(pinfo->cinfo, COL_INFO);
 
        tvb_memcpy(tvb, (guint8 *)&gtpv1_hdr, 0, 8);
        gtp_version = (gtpv1_hdr.flags >> 5) & 0x07;
 
-       if (check_col(pinfo->fd, COL_INFO)) col_add_str(pinfo->fd, COL_INFO, val_to_str(gtpv1_hdr.message, message_type, "Unknown"));
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_add_str(pinfo->cinfo, COL_INFO, val_to_str(gtpv1_hdr.message, message_type, "Unknown"));
 
        if (tree) {
-                       
-               ti = proto_tree_add_item(tree, proto_gtpv1, tvb, 0, tvb_length(tvb), FALSE);
+
+               ti = proto_tree_add_item(tree, proto_gtpv1, tvb, 0, -1, FALSE);
                gtpv1_tree = proto_item_add_subtree(ti, ett_gtp);
 
                tf = proto_tree_add_uint(gtpv1_tree, hf_gtpv1_flags, tvb, 0, 1, gtpv1_hdr.flags);
                flags_tree = proto_item_add_subtree(tf, ett_gtp_flags);
-               
+
                proto_tree_add_uint(flags_tree, hf_gtpv1_flags_ver, tvb, 0, 1, gtpv1_hdr.flags);
                proto_tree_add_uint(flags_tree, hf_gtpv1_flags_pt, tvb, 0, 1, gtpv1_hdr.flags);
                proto_tree_add_uint(flags_tree, hf_gtpv1_flags_spare, tvb, 0, 1, gtpv1_hdr.flags);
                proto_tree_add_boolean(flags_tree, hf_gtpv1_flags_e, tvb, 0, 1, gtpv1_hdr.flags);
                proto_tree_add_boolean(flags_tree, hf_gtpv1_flags_s, tvb, 0, 1, gtpv1_hdr.flags);
                proto_tree_add_boolean(flags_tree, hf_gtpv1_flags_pn, tvb, 0, 1, gtpv1_hdr.flags);
-               
-               gtpv1_hdr.length = ntohs(gtpv1_hdr.length);
-               gtpv1_hdr.teid = ntohl(gtpv1_hdr.teid);
-               
+
                proto_tree_add_uint(gtpv1_tree, hf_gtpv1_message_type, tvb, 1, 1, gtpv1_hdr.message);
+
+               gtpv1_hdr.length = g_ntohs(gtpv1_hdr.length);
                proto_tree_add_uint(gtpv1_tree, hf_gtpv1_length, tvb, 2, 2, gtpv1_hdr.length);
-               proto_tree_add_uint(gtpv1_tree, hf_gtpv1_teid, tvb, 4, 4, gtpv1_hdr.teid);
 
-               hdr_offset = 0;
+               gtp_prime = (gtpv1_hdr.flags & 0x01) >> 4;
 
-               if (gtpv1_hdr.flags & 0x02) {
-                       seq_no = tvb_get_ntohs(tvb, 8);
-                       proto_tree_add_uint(gtpv1_tree, hf_gtpv1_seq_number, tvb, 8, 2, seq_no);
-               } else {
-                       hdr_offset = hdr_offset + 2;
-               }
-               
-               if ((gtpv1_hdr.flags & 0x01 ) || (gtpv1_hdr.message != 0xFF)) {
-                       npdu_no = tvb_get_guint8(tvb, 10 - hdr_offset);
-                       proto_tree_add_uint(gtpv1_tree, hf_gtpv1_npdu_number, tvb, 10 - hdr_offset, 1, npdu_no);
-               } else {
-                       hdr_offset = hdr_offset + 1;
-               }
+               /* GTP' has 6 bytes of length */
 
-               if ((gtpv1_hdr.flags & 0x04) || (gtpv1_hdr.message != 0xFF)) { 
-                       next_hdr = tvb_get_guint8(tvb, 11 - hdr_offset);
-                       proto_tree_add_uint(gtpv1_tree, hf_gtpv1_next, tvb, 11 - hdr_offset, 1, next_hdr);
-               } else {
-                       hdr_offset = hdr_offset + 1;
+               if (!gtp_prime) {
+
+                       gtpv1_hdr.teid = g_ntohl(gtpv1_hdr.teid);
+                       proto_tree_add_uint(gtpv1_tree, hf_gtpv1_teid, tvb, 4, 4, gtpv1_hdr.teid);
+
+                       if (gtpv1_hdr.flags & 0x07) {
+                               seq_no = tvb_get_ntohs (tvb, 8);
+                               proto_tree_add_uint (gtpv1_tree, hf_gtpv1_seq_number, tvb, 8, 2, seq_no);
+                               npdu_no = tvb_get_guint8 (tvb, 10);
+                               proto_tree_add_uint (gtpv1_tree, hf_gtpv1_npdu_number, tvb, 10, 1, npdu_no);
+                               next_hdr = tvb_get_guint8(tvb, 11);
+                               proto_tree_add_uint(gtpv1_tree, hf_gtpv1_next, tvb, 11, 1, next_hdr);
+                               hdr_offset = 0;
+
+                               if (next_hdr) hdr_offset = 1;
+                               else hdr_offset = 0;
+                       }
                }
 
                if (gtpv1_hdr.message != GTP_MSG_TPDU) {
 
                        proto_tree_add_text(gtpv1_tree, tvb, 0, 0, "[--- end of GTP v1 header, beginning of extension headers ---]");
-                               
-                       offset = GTPv1_HDR_LENGTH - hdr_offset;
+
+                       offset = gtp_prime ? GTP_PRIME_HDR_LENGTH: GTPv1_HDR_LENGTH - hdr_offset;
                        length = tvb_length(tvb);
-               
+
                        mandatory = 0;          /* check order of GTP fields against ETSI */
-               
+
                        for (;;) {
-                                       
+
                                if (offset >= length) break;
                                ext_hdr_val = tvb_get_guint8(tvb, offset);
-                               
+
                                if (gtpv1_etsi_order) {
                                        checked_field = check_field_presence (gtpv1_hdr.message, ext_hdr_val , (int *)&mandatory);
                                        switch (checked_field) {
@@ -4885,47 +5028,81 @@ dissect_gtpv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
                                                default: proto_tree_add_text(gtpv1_tree, tvb, offset, 1, "[WARNING] wrong next field, should be: %s", val_to_str(checked_field, gtp_val, "Unknown extension field"));
                                        }
                                }
-                               
+
                                i = -1;
                                while (gtpopt[++i].optcode) if (gtpopt[i].optcode == ext_hdr_val) break;
                                offset = offset + (*gtpopt[i].decode)(tvb, offset, pinfo, gtpv1_tree);
                        }
-               } 
+               }
        }
 
        if (gtpv1_hdr.message == GTP_MSG_ERR_IND)
-               if (check_col(pinfo->fd, COL_PROTOCOL)) col_add_str(pinfo->fd, COL_PROTOCOL, "GTP-U");
+               if (check_col(pinfo->cinfo, COL_PROTOCOL))
+                       col_add_str(pinfo->cinfo, COL_PROTOCOL, "GTP-U");
 
 
        if ((gtpv1_hdr.message == GTP_MSG_TPDU) && gtp_tpdu) {
-       
-               hdr_offset =  (gtpv1_hdr.flags & 0x02) ? 0 : 2;
-
-               /* some stupid checking, because some vendors do not respect
-                * ETSI recommendation */
-               
-               probe = tvb_get_guint8(tvb, 10 - hdr_offset);
-               if (probe == 0) {
-                       probe = tvb_get_guint8(tvb, 11 - hdr_offset);
-                       if (probe != 0) hdr_offset++;
-               } else {
-                       hdr_offset = hdr_offset + 2;
+
+               if (gtpv1_hdr.flags & 0x07) {
+                       if (tvb_get_guint8 (tvb, 11))
+                               hdr_offset = 1;         /* if next_hdr != 0 */
+                       else
+                               hdr_offset = 0;
+               }
+
+               sub_proto = tvb_get_guint8(tvb,GTPv1_HDR_LENGTH - hdr_offset);
+
+               switch(sub_proto) {
+                       case GTP_PPP_0x00:
+                       case GTP_PPP_0xC0:
+                       case GTP_PPP_0x80:
+                       case GTP_PPP_0xC2:
+                               next_tvb = tvb_new_subset(tvb, GTPv1_HDR_LENGTH - hdr_offset, -1, -1);
+                               call_dissector(ppp_handle, next_tvb, pinfo, tree);
+                               if (check_col(pinfo->cinfo, COL_PROTOCOL))
+                                       col_append_str_gtp(pinfo->cinfo, COL_PROTOCOL, "PPP");
+                               break;
+
+                       case GTP_PPP_REQ_ERROR:
+                               sub_proto = tvb_get_guint8(tvb,GTPv1_HDR_LENGTH - hdr_offset+2);
+                               switch(sub_proto) {
+                                       case GTP_PPP_0x00:
+                                       case GTP_PPP_0xC0:
+                                       case GTP_PPP_0x80:
+                                       case GTP_PPP_0xC2:
+                                               next_tvb = tvb_new_subset(tvb, GTPv1_HDR_LENGTH - hdr_offset+2, -1, -1);
+                                               call_dissector(ppp_handle, next_tvb, pinfo, tree);
+                                               if (check_col(pinfo->cinfo, COL_PROTOCOL))
+                                                       col_append_str_gtp(pinfo->cinfo, COL_PROTOCOL, "PPP");
+                                               break;
+
+
+                                       default:
+                                               next_tvb = tvb_new_subset(tvb, GTPv1_HDR_LENGTH - hdr_offset+2, -1, -1);
+                                               call_dissector(ip_handle, next_tvb, pinfo, tree);
+                                               if (check_col(pinfo->cinfo, COL_PROTOCOL))
+                                                       col_append_str_gtp(pinfo->cinfo, COL_PROTOCOL, "GTP-U");
+                                               break;
+                               }
+                               break;
+                       default:
+                               next_tvb = tvb_new_subset(tvb, GTPv1_HDR_LENGTH - hdr_offset, -1, -1);
+                               call_dissector(ip_handle, next_tvb, pinfo, tree);
+                               if (check_col(pinfo->cinfo, COL_PROTOCOL))
+                                       col_append_str_gtp(pinfo->cinfo, COL_PROTOCOL, "GTP-U");
+                               break;
                }
-               
-               next_tvb = tvb_new_subset(tvb, GTPv1_HDR_LENGTH - hdr_offset, -1, -1);
-               call_dissector(ip_handle, next_tvb, pinfo, tree);
-               if (check_col(pinfo->fd, COL_PROTOCOL)) col_append_str_gtp(pinfo->fd, COL_PROTOCOL, "GTP-U");
        }
 }
 
-static const true_false_string yes_no_tfs = { 
+static const true_false_string yes_no_tfs = {
        "yes" ,
        "no"
 };
 
 void
 proto_register_gtp(void)
-{                 
+{
 
        static hf_register_info hf_gtpv0[] = {
 
@@ -4989,7 +5166,7 @@ proto_register_gtp(void)
 
        };
 
-       
+
        static hf_register_info hf_gtpv1[] = {
 
        { &hf_gtpv1_flags,              { "Flags",              "gtpv1.flags",                  FT_UINT8,       BASE_HEX, NULL, 0, "Ver/PT/Spare/E/S/PN", HFILL }},
@@ -5076,6 +5253,12 @@ proto_register_gtp(void)
        { &hf_gtpv1_qos_traf_handl_prio,        { "Traffic handling priority",  "gtpv1.qos_traf_handl_prio",    FT_UINT8,       BASE_DEC, VALS(qos_traf_handl_prio), GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK, "Traffic Handling Priority", HFILL }},
        { &hf_gtpv1_qos_guar_ul,                { "Guaranteed bit rate for uplink",     "gtpv1.qos_guar_ul",    FT_UINT8,       BASE_DEC, VALS(qos_guar_ul), 0, "Guaranteed bit rate for uplink", HFILL }},
        { &hf_gtpv1_qos_guar_dl,                { "Guaranteed bit rate for downlink",   "gtpv1.qos_guar_dl",    FT_UINT8,       BASE_DEC, VALS(qos_guar_dl), 0, "Guaranteed bit rate for downlink", HFILL }},
+
+       { &hf_gtpv1_tft_code,           { "TFT operation code", "gtpv1.tft_code",               FT_UINT8,       BASE_DEC, VALS (tft_code_type), GTPv1_TFT_CODE_MASK, "TFT operation code", HFILL }},
+       { &hf_gtpv1_tft_spare,          { "TFT spare bit",      "gtpv1.tft_spare",              FT_UINT8,       BASE_DEC, NULL, GTPv1_TFT_SPARE_MASK, "TFT spare bit", HFILL }},
+       { &hf_gtpv1_tft_number,         { "Number of packet filters",   "gtpv1.tft_number",     FT_UINT8,       BASE_DEC, NULL, GTPv1_TFT_NUMBER_MASK, "Number of packet filters", HFILL }},
+       { &hf_gtpv1_tft_eval,           { "Evaluation precedence",      "gtpv1.tft_eval",       FT_UINT8,       BASE_DEC, NULL, 0, "Evaluation precedence", HFILL }},
+
        { &hf_gtpv1_rnc_ipv4,           { "RNC address IPv4",   "gtpv1.rnc_ipv4",               FT_IPv4,        BASE_DEC, NULL, 0, "Radio Network Controller address IPv4", HFILL }},
        { &hf_gtpv1_rnc_ipv6,           { "RNC address IPv6",   "gtpv1.rnc_ipv6",               FT_IPv6,        BASE_HEX, NULL, 0, "Radio Network Controller address IPv6", HFILL }},
        { &hf_gtpv1_chrg_ipv4,          { "CG address IPv4",    "gtpv1.chrg_ipv4",              FT_IPv4,        BASE_DEC, NULL, 0, "Charging Gateway address IPv4", HFILL }},
@@ -5110,6 +5293,7 @@ proto_register_gtp(void)
                &ett_gtp_gsn_addr,
                &ett_gtp_tft,
                &ett_gtp_tft_pf,
+               &ett_gtp_tft_flags,
                &ett_gtp_rab_setup,
                &ett_gtp_hdr_list,
                &ett_gtp_chrg_addr,
@@ -5121,24 +5305,27 @@ proto_register_gtp(void)
        };
 
        module_t        *gtp_module;
-       
+
        static enum_val_t gtpv0_cdr_options[] = {
-               { "GSM 12.15",  0 },
+               { "GSM 12.15 (not implemented yet)",    0 },
                { "Nokia CDR",  1 },
                { "None",       2 },
                { NULL,         -1 }
        };
 
-       proto_gtpv0 = proto_register_protocol("GPRS Tunnelling Protocol v0", "GTPv0", "gtpv0");
+       /* proto_gtp defined only for preference tab */
+       proto_gtp = proto_register_protocol ("GPRS Tunneling Protocol", "GTP", "gtp");
+
+       proto_gtpv0 = proto_register_protocol ("GPRS Tunnelling Protocol v0", "GTPv0", "gtpv0");
        proto_register_field_array(proto_gtpv0, hf_gtpv0, array_length(hf_gtpv0));
        proto_register_subtree_array(ett_gtp_array, array_length(ett_gtp_array));
-       
+
        proto_gtpv1 = proto_register_protocol("GPRS Tunnelling Protocol v1", "GTPv1", "gtpv1");
        proto_register_field_array(proto_gtpv1, hf_gtpv1, array_length(hf_gtpv1));
        proto_register_subtree_array(ett_gtp_array, array_length(ett_gtp_array));
-       
-       gtp_module = prefs_register_protocol(proto_gtpv0, proto_reg_handoff_gtp);
-       
+
+       gtp_module = prefs_register_protocol(proto_gtp, proto_reg_handoff_gtp);
+
        prefs_register_uint_preference(gtp_module, "gtpv0_port", "GTPv0 port ", "GTPv0 port (default 3386)", 10, &g_gtpv0_port);
        prefs_register_uint_preference(gtp_module, "gtpv1c_port", "GTPv1 control plane (GTP-C) port ", "GTPv1 control plane port (default 2123)", 10, &g_gtpv1c_port);
        prefs_register_uint_preference(gtp_module, "gtpv1u_port", "GTPv1 user plane (GTP-U) port ", "GTPv1 user plane port (default 2152)", 10, &g_gtpv1u_port);
@@ -5146,8 +5333,8 @@ proto_register_gtp(void)
        prefs_register_enum_preference(gtp_module, "gtpv0_dissect_cdr_as", "Dissect GTP'v0 CDRs as ", "Dissect GTP'v0 CDRs as", &gtpv0_cdr_as, gtpv0_cdr_options, FALSE);
        prefs_register_bool_preference(gtp_module, "gtpv0_check_etsi", "Compare GTPv0 order with ETSI ", "GTPv0 ETSI order", &gtpv0_etsi_order);
        prefs_register_bool_preference(gtp_module, "gtpv1_check_etsi", "Compare GTPv1 order with ETSI ", "GTPv1 ETSI order", &gtpv1_etsi_order);
-       prefs_register_bool_preference(gtp_module, "ppp_reorder", "Reorder & dissect PPP in Protocol conf. options", "PPP reorder & dissect", &ppp_reorder);
-       
+       prefs_register_bool_preference(gtp_module, "ppp_reorder", "Reorder & dissect PPP in Protocol conf. options", "Reorder & dissect PPP inside of Protocol Configuration Options, 3 bytes will be swapped to allow processing PPP section: 1 byte of length with 2 bytes of protocol id (refer to ETSI 29.060, 7.7.21 & 24.008 10.5.6.3)", &ppp_reorder);
+
        register_dissector("gtpv0", dissect_gtpv0, proto_gtpv0);
        register_dissector("gtpv1", dissect_gtpv1, proto_gtpv1);
 
@@ -5157,38 +5344,45 @@ void
 proto_reg_handoff_gtp(void)
 {
        static int Initialized = FALSE;
-       
-       if (Initialized) {
-               
-               dissector_delete("udp.port", gtpv0_port, dissect_gtpv0);
-               dissector_delete("tcp.port", gtpv0_port, dissect_gtpv0);
-               
-               dissector_delete("udp.port", gtpv1c_port, dissect_gtpv1);
-               dissector_delete("tcp.port", gtpv1c_port, dissect_gtpv1);
-               dissector_delete("udp.port", gtpv1u_port, dissect_gtpv1);
-               dissector_delete("tcp.port", gtpv1u_port, dissect_gtpv1);
-               
-       } else {
-               
+       static dissector_handle_t gtpv0_handle;
+       static dissector_handle_t gtpv1_handle;
+
+       if (!Initialized) {
+
+               gtpv0_handle = find_dissector("gtpv0");
+
+               gtpv1_handle = find_dissector("gtpv1");
+
                Initialized = TRUE;
+
+       } else {
+
+               dissector_delete("udp.port", gtpv0_port, gtpv0_handle);
+               dissector_delete("tcp.port", gtpv0_port, gtpv0_handle);
+
+               dissector_delete("udp.port", gtpv1c_port, gtpv1_handle);
+               dissector_delete("tcp.port", gtpv1c_port, gtpv1_handle);
+               dissector_delete("udp.port", gtpv1u_port, gtpv1_handle);
+               dissector_delete("tcp.port", gtpv1u_port, gtpv1_handle);
        }
-               
+
        gtpv0_port = g_gtpv0_port;
        gtpv1c_port = g_gtpv1c_port;
        gtpv1u_port = g_gtpv1u_port;
-       
+
        /* GTP v0 */
-       
-       dissector_add("udp.port", g_gtpv0_port, dissect_gtpv0, proto_gtpv0);
-       dissector_add("tcp.port", g_gtpv0_port, dissect_gtpv0, proto_gtpv0);
+
+       dissector_add("udp.port", g_gtpv0_port, gtpv0_handle);
+       dissector_add("tcp.port", g_gtpv0_port, gtpv0_handle);
 
        /* GTP v1 */
-       
-       dissector_add("udp.port", g_gtpv1c_port, dissect_gtpv1, proto_gtpv1);
-       dissector_add("tcp.port", g_gtpv1c_port, dissect_gtpv1, proto_gtpv1);
-       dissector_add("udp.port", g_gtpv1u_port, dissect_gtpv1, proto_gtpv1);
-       dissector_add("tcp.port", g_gtpv1u_port, dissect_gtpv1, proto_gtpv1);
-       
+
+       dissector_add("udp.port", g_gtpv1c_port, gtpv1_handle);
+       dissector_add("tcp.port", g_gtpv1c_port, gtpv1_handle);
+       dissector_add("udp.port", g_gtpv1u_port, gtpv1_handle);
+       dissector_add("tcp.port", g_gtpv1u_port, gtpv1_handle);
+       dissector_add("ppp.protocol", PPP_IP, ip_handle);
+
        ip_handle = find_dissector("ip");
        ppp_handle = find_dissector("ppp");
 }