summaryrefslogtreecommitdiff
path: root/epan
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-11-21 20:08:20 +0000
committerMichael Mann <mmann78@netscape.net>2013-11-21 20:08:20 +0000
commiteabaddaca96a79f609a8235fb09e6151f6b9387f (patch)
treed91da11cb14ac06039bc010480a16a42bc7ce141 /epan
parent9fa6c9fb800199967b5ec44a93fcfaeeed405085 (diff)
downloadwireshark-eabaddaca96a79f609a8235fb09e6151f6b9387f.tar.gz
Remove ethertype, mpls_label and ppids from packet_info structure.
The information was converted to "proto" data within their respective dissectors strictly for use in "Decode As". svn path=/trunk/; revision=53489
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-ethertype.c7
-rw-r--r--epan/dissectors/packet-exported_pdu.c8
-rw-r--r--epan/dissectors/packet-infiniband.c2
-rw-r--r--epan/dissectors/packet-mpls.c8
-rw-r--r--epan/dissectors/packet-pw-eth.c18
-rw-r--r--epan/dissectors/packet-sctp.c34
-rw-r--r--epan/exported_pdu.c34
-rw-r--r--epan/exported_pdu.h6
-rw-r--r--epan/packet.c3
-rw-r--r--epan/packet_info.h8
-rw-r--r--epan/wslua/wslua_pinfo.c10
11 files changed, 33 insertions, 105 deletions
diff --git a/epan/dissectors/packet-ethertype.c b/epan/dissectors/packet-ethertype.c
index 87c259b038..cd3157a3a8 100644
--- a/epan/dissectors/packet-ethertype.c
+++ b/epan/dissectors/packet-ethertype.c
@@ -190,12 +190,13 @@ const value_string etype_vals[] = {
static void eth_prompt(packet_info *pinfo, gchar* result)
{
- g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "Ethertype 0x%04x as", pinfo->ethertype);
+ g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "Ethertype 0x%04x as",
+ GPOINTER_TO_UINT(p_get_proto_data(pinfo->fd, proto_ethertype, 0)));
}
static gpointer eth_value(packet_info *pinfo)
{
- return GUINT_TO_POINTER(pinfo->ethertype);
+ return p_get_proto_data(pinfo->fd, proto_ethertype, 0);
}
static void add_dix_trailer(packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree,
@@ -287,7 +288,7 @@ dissect_ethertype(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
next_tvb = tvb_new_subset(tvb, ethertype_data->offset_after_ethertype, captured_length,
reported_length);
- pinfo->ethertype = ethertype_data->etype;
+ p_add_proto_data(pinfo->fd, proto_ethertype, 0, GUINT_TO_POINTER(ethertype_data->etype));
/* Look for sub-dissector, and call it if found.
Catch exceptions, so that if the reported length of "next_tvb"
diff --git a/epan/dissectors/packet-exported_pdu.c b/epan/dissectors/packet-exported_pdu.c
index 358ef86d11..77a334ba08 100644
--- a/epan/dissectors/packet-exported_pdu.c
+++ b/epan/dissectors/packet-exported_pdu.c
@@ -79,8 +79,6 @@ static const value_string exported_pdu_tag_vals[] = {
{ EXP_PDU_TAG_SRC_PORT, "Source Port" },
{ EXP_PDU_TAG_DST_PORT, "Destination Port" },
- { EXP_PDU_TAG_SCTP_PPID, "SCTP PPID" },
-
{ EXP_PDU_TAG_SS7_OPC, "SS7 OPC" },
{ EXP_PDU_TAG_SS7_DPC, "SS7 DPC" },
@@ -167,12 +165,6 @@ dissect_exported_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(tag_tree, hf_exported_pdu_dst_port, tvb, offset, 4, ENC_BIG_ENDIAN);
pinfo->destport = tvb_get_ntohl(tvb, offset);
break;
- case EXP_PDU_TAG_SCTP_PPID:
- proto_tree_add_item(tag_tree, hf_exported_pdu_sctp_ppid, tvb, offset, 4, ENC_BIG_ENDIAN);
- if (number_of_ppids < MAX_NUMBER_OF_PPIDS) {
- pinfo->ppids[number_of_ppids++] = tvb_get_ntohl(tvb, offset);
- }
- break;
case EXP_PDU_TAG_SS7_OPC:
proto_tree_add_item(tag_tree, hf_exported_pdu_ss7_opc, tvb, offset, 4, ENC_BIG_ENDIAN);
mtp3_addr = (mtp3_addr_pc_t *)wmem_alloc0(pinfo->pool, sizeof(mtp3_addr_pc_t));
diff --git a/epan/dissectors/packet-infiniband.c b/epan/dissectors/packet-infiniband.c
index bf57e32e3f..b26e23e272 100644
--- a/epan/dissectors/packet-infiniband.c
+++ b/epan/dissectors/packet-infiniband.c
@@ -2509,8 +2509,6 @@ static void parse_PAYLOAD(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *
next_tvb = tvb_new_subset(tvb, local_offset+4, captured_length, reported_length);
- pinfo->ethertype = etype;
-
/* Look for sub-dissector, and call it if found.
Catch exceptions, so that if the reported length of "next_tvb"
was reduced by some dissector before an exception was thrown,
diff --git a/epan/dissectors/packet-mpls.c b/epan/dissectors/packet-mpls.c
index b4f9c05d6a..95214f148c 100644
--- a/epan/dissectors/packet-mpls.c
+++ b/epan/dissectors/packet-mpls.c
@@ -319,12 +319,13 @@ static dissector_table_t mpls_subdissector_table;
static void mpls_prompt(packet_info *pinfo, gchar* result)
{
- g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "Data after label %u as", pinfo->mpls_label);
+ g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "Data after label %u as",
+ GPOINTER_TO_UINT(p_get_proto_data(pinfo->fd, proto_mpls, 0)));
}
static gpointer mpls_value(packet_info *pinfo)
{
- return GUINT_TO_POINTER(pinfo->mpls_label);
+ return p_get_proto_data(pinfo->fd, proto_mpls, 0);
}
/*
@@ -548,7 +549,8 @@ dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* FF: export (last shim in stack) info to subdissectors and
* update pinfo
*/
- mplsinfo.label = pinfo->mpls_label = label;
+ mplsinfo.label = label;
+ p_add_proto_data(pinfo->fd, proto_mpls, 0, GUINT_TO_POINTER(label));
mplsinfo.exp = exp;
mplsinfo.bos = bos;
mplsinfo.ttl = ttl;
diff --git a/epan/dissectors/packet-pw-eth.c b/epan/dissectors/packet-pw-eth.c
index 8ad4cab5a8..87906b22f9 100644
--- a/epan/dissectors/packet-pw-eth.c
+++ b/epan/dissectors/packet-pw-eth.c
@@ -87,23 +87,7 @@ dissect_pw_eth_cw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
next_tvb = tvb_new_subset_remaining(tvb, 4);
{
- /*
- * When Ethernet frames being decoded, pinfo->ethertype is extracted
- * from the top-level Ethernet frame. Dissection of Ethernet PW payload
- * overwrites this value as the same dissector is invoked again.
- * This may lead to undesired behavior (like disappearance of "Link"
- * tab from the "Decode as" menu).
- *
- * Let's save/restore ethertype. --ATA
- *
- * XXX it looks that more pinfo members (or even the whole pinfo)
- * XXX should be saved/restored in PW cases. Multilayer encapsulations,
- * XXX like ethernet/mpls/ethernet-pw/ip/vlan, may lead to undesired
- * XXX changes if pinfo->ipproto, ptype etc.
- */
- guint32 etype_save = pinfo->ethertype;
call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, tree);
- pinfo->ethertype = etype_save;
}
}
@@ -120,9 +104,7 @@ dissect_pw_eth_nocw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
next_tvb = tvb_new_subset_remaining(tvb, 0);
{
- guint32 etype_save = pinfo->ethertype;
call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, tree);
- pinfo->ethertype = etype_save;
}
}
diff --git a/epan/dissectors/packet-sctp.c b/epan/dissectors/packet-sctp.c
index 32d2ddc3e2..e9660b2bea 100644
--- a/epan/dissectors/packet-sctp.c
+++ b/epan/dissectors/packet-sctp.c
@@ -76,6 +76,10 @@
#define ADD_PADDING(x) ((((x) + 3) >> 2) << 2)
#define UDP_TUNNELING_PORT 9899
+#define MAX_NUMBER_OF_PPIDS 2
+/** This is a valid PPID, but we use it to mark the end of the list */
+#define LAST_PPID 0xffffffff
+
/* Initialize the protocol and registered fields */
static int proto_sctp = -1;
static int hf_port = -1;
@@ -487,30 +491,34 @@ static void sctp_both_prompt(packet_info *pinfo _U_, gchar* result)
static void sctp_ppi_prompt1(packet_info *pinfo _U_, gchar* result)
{
- if (pinfo->ppids[0] == LAST_PPID) {
+ guint32 ppid = GPOINTER_TO_UINT(p_get_proto_data(pinfo->fd, proto_sctp, 0));
+
+ if (ppid == LAST_PPID) {
g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "PPID (none)");
} else {
- g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "PPID (%d)", pinfo->ppids[0]);
+ g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "PPID (%d)", ppid);
}
}
static void sctp_ppi_prompt2(packet_info *pinfo _U_, gchar* result)
{
- if (pinfo->ppids[1] == LAST_PPID) {
+ guint32 ppid = GPOINTER_TO_UINT(p_get_proto_data(pinfo->fd, proto_sctp, 1));
+
+ if (ppid == LAST_PPID) {
g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "PPID (none)");
} else {
- g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "PPID (%d)", pinfo->ppids[1]);
+ g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "PPID (%d)", ppid);
}
}
static gpointer sctp_ppi_value1(packet_info *pinfo)
{
- return GUINT_TO_POINTER(pinfo->ppids[0]);
+ return p_get_proto_data(pinfo->fd, proto_sctp, 0);
}
static gpointer sctp_ppi_value2(packet_info *pinfo)
{
- return GUINT_TO_POINTER(pinfo->ppids[1]);
+ return p_get_proto_data(pinfo->fd, proto_sctp, 1);
}
@@ -2841,7 +2849,7 @@ dissect_data_chunk(tvbuff_t *chunk_tvb,
proto_tree *flags_tree;
guint8 e_bit, b_bit, u_bit;
guint16 stream_id, stream_seq_num = 0;
- guint32 tsn;
+ guint32 tsn, ppid;
proto_item *tsn_item = NULL;
gboolean call_subdissector = FALSE;
gboolean is_retransmission;
@@ -2854,11 +2862,13 @@ dissect_data_chunk(tvbuff_t *chunk_tvb,
payload_proto_id = tvb_get_ntohl(chunk_tvb, DATA_CHUNK_PAYLOAD_PROTOCOL_ID_OFFSET);
/* insert the PPID in the pinfo structure if it is not already there and there is still room */
- for(number_of_ppid = 0; number_of_ppid < MAX_NUMBER_OF_PPIDS; number_of_ppid++)
- if ((pinfo->ppids[number_of_ppid] == LAST_PPID) || (pinfo->ppids[number_of_ppid] == payload_proto_id))
+ for(number_of_ppid = 0; number_of_ppid < MAX_NUMBER_OF_PPIDS; number_of_ppid++) {
+ ppid = GPOINTER_TO_UINT(p_get_proto_data(pinfo->fd, proto_sctp, number_of_ppid));
+ if ((ppid == LAST_PPID) || (ppid == payload_proto_id))
break;
- if ((number_of_ppid < MAX_NUMBER_OF_PPIDS) && (pinfo->ppids[number_of_ppid] == LAST_PPID))
- pinfo->ppids[number_of_ppid] = payload_proto_id;
+ }
+ if ((number_of_ppid < MAX_NUMBER_OF_PPIDS) && (ppid == LAST_PPID))
+ p_add_proto_data(pinfo->fd, proto_sctp, number_of_ppid, GUINT_TO_POINTER(payload_proto_id));
e_bit = tvb_get_guint8(chunk_tvb, CHUNK_FLAGS_OFFSET) & SCTP_DATA_CHUNK_E_BIT;
b_bit = tvb_get_guint8(chunk_tvb, CHUNK_FLAGS_OFFSET) & SCTP_DATA_CHUNK_B_BIT;
@@ -4121,7 +4131,7 @@ dissect_sctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
for(number_of_ppid = 0; number_of_ppid < MAX_NUMBER_OF_PPIDS; number_of_ppid++) {
- pinfo->ppids[number_of_ppid] = LAST_PPID;
+ p_add_proto_data(pinfo->fd, proto_sctp, number_of_ppid, GUINT_TO_POINTER(LAST_PPID));
}
/* The tvb array in struct _sctp_info is huge: currently 2k pointers.
diff --git a/epan/exported_pdu.c b/epan/exported_pdu.c
index 01314c93ea..7d89b50d7b 100644
--- a/epan/exported_pdu.c
+++ b/epan/exported_pdu.c
@@ -43,7 +43,7 @@ load_export_pdu_tags(packet_info *pinfo, const char* proto_name, int wtap_encap
int tag_buf_size = 0;
int str_len = 0;
int tag_str_len = 0;
- int i = 0, j;
+ int i = 0;
gboolean port_type_defined = FALSE;
exp_pdu_data = (exp_pdu_data_t *)g_malloc(sizeof(exp_pdu_data_t));
@@ -89,16 +89,6 @@ load_export_pdu_tags(packet_info *pinfo, const char* proto_name, int wtap_encap
tag_buf_size= tag_buf_size + EXP_PDU_TAG_DST_PORT_LEN + 4;
}
- if((tags_bit_field & EXP_PDU_TAG_SCTP_PPID_BIT) == EXP_PDU_TAG_SCTP_PPID_BIT){
- for(j = 0; j < MAX_NUMBER_OF_PPIDS; j++) {
- if (pinfo->ppids[j] != LAST_PPID) {
- tag_buf_size= tag_buf_size + EXP_PDU_TAG_SCTP_PPID_LEN + 4;
- } else {
- break;
- }
- }
- }
-
if((tags_bit_field & EXP_PDU_TAG_SS7_OPC_BIT) == EXP_PDU_TAG_SS7_OPC_BIT){
if(pinfo->src.type == AT_SS7PC){
tag_buf_size += 4 + EXP_PDU_TAG_SS7_OPC_LEN;
@@ -255,28 +245,6 @@ load_export_pdu_tags(packet_info *pinfo, const char* proto_name, int wtap_encap
i = i +EXP_PDU_TAG_DST_PORT_LEN;
}
- if((tags_bit_field & EXP_PDU_TAG_SCTP_PPID_BIT) == EXP_PDU_TAG_SCTP_PPID_BIT){
- for(j = 0; j < MAX_NUMBER_OF_PPIDS; j++) {
- if (pinfo->ppids[j] != LAST_PPID) {
- exp_pdu_data->tlv_buffer[i] = 0;
- i++;
- exp_pdu_data->tlv_buffer[i] = EXP_PDU_TAG_SCTP_PPID;
- i++;
- exp_pdu_data->tlv_buffer[i] = 0;
- i++;
- exp_pdu_data->tlv_buffer[i] = EXP_PDU_TAG_SCTP_PPID_LEN; /* tag length */
- i++;
- exp_pdu_data->tlv_buffer[i] = (pinfo->ppids[j] & 0xff000000) >> 24;
- exp_pdu_data->tlv_buffer[i+1] = (pinfo->ppids[j] & 0x00ff0000) >> 16;
- exp_pdu_data->tlv_buffer[i+2] = (pinfo->ppids[j] & 0x0000ff00) >> 8;
- exp_pdu_data->tlv_buffer[i+3] = (pinfo->ppids[j] & 0x000000ff);
- i = i +EXP_PDU_TAG_SCTP_PPID_LEN;
- } else {
- break;
- }
- }
- }
-
if((tags_bit_field & EXP_PDU_TAG_SS7_OPC_BIT) == EXP_PDU_TAG_SS7_OPC_BIT){
if(pinfo->src.type == AT_SS7PC){
mtp3_addr_pc_t *mtp3_addr = (mtp3_addr_pc_t *)(pinfo->src.data);
diff --git a/epan/exported_pdu.h b/epan/exported_pdu.h
index 47baf4bdd0..a69ad3d58c 100644
--- a/epan/exported_pdu.h
+++ b/epan/exported_pdu.h
@@ -89,8 +89,6 @@
#define EXP_PDU_TAG_SRC_PORT 25
#define EXP_PDU_TAG_DST_PORT 26
-#define EXP_PDU_TAG_SCTP_PPID 27
-
#define EXP_PDU_TAG_SS7_OPC 28
#define EXP_PDU_TAG_SS7_DPC 29
@@ -112,8 +110,6 @@ typedef struct _exp_pdu_data_t {
#define EXP_PDU_TAG_SRC_PORT_BIT 0x00000004
#define EXP_PDU_TAG_DST_PORT_BIT 0x00000008
-#define EXP_PDU_TAG_SCTP_PPID_BIT 0x00000010
-
#define EXP_PDU_TAG_SS7_OPC_BIT 0x00000020
#define EXP_PDU_TAG_SS7_DPC_BIT 0x00000040
@@ -130,8 +126,6 @@ typedef struct _exp_pdu_data_t {
#define EXP_PDU_TAG_SRC_PORT_LEN 4
#define EXP_PDU_TAG_DST_PORT_LEN 4
-#define EXP_PDU_TAG_SCTP_PPID_LEN 4
-
#define EXP_PDU_TAG_SS7_OPC_LEN 8 /* 4 bytes PC, 2 bytes standard type, 1 byte NI, 1 byte padding */
#define EXP_PDU_TAG_SS7_DPC_LEN 8 /* 4 bytes PC, 2 bytes standard type, 1 byte NI, 1 byte padding */
diff --git a/epan/packet.c b/epan/packet.c
index 65cb2d5134..5e5f5bdb83 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -440,9 +440,6 @@ dissect_packet(epan_dissect_t *edt, struct wtap_pkthdr *phdr,
else if (fd->flags.has_phdr_comment)
edt->pi.pkt_comment = phdr->opt_comment;
- /* to enable decode as for ethertype=0x0000 (fix for bug 4721) */
- edt->pi.ethertype = G_MAXINT;
-
EP_CHECK_CANARY(("before dissecting frame %d",fd->num));
TRY {
diff --git a/epan/packet_info.h b/epan/packet_info.h
index d928ffb766..0aa389f624 100644
--- a/epan/packet_info.h
+++ b/epan/packet_info.h
@@ -52,7 +52,6 @@
#define PINFO_SOF_SOFF 0x2
#define PINFO_EOF_LAST_FRAME 0x80
#define PINFO_EOF_INVALID 0x40
-#define MAX_NUMBER_OF_PPIDS 2
typedef struct _packet_info {
const char *current_proto; /**< name of protocol currently being dissected */
@@ -67,9 +66,7 @@ typedef struct _packet_info {
address net_dst; /**< network-layer destination address */
address src; /**< source address (net if present, DL otherwise )*/
address dst; /**< destination address (net if present, DL otherwise )*/
- guint32 ethertype; /**< Ethernet Type Code, if this is an Ethernet packet */
guint32 ipproto; /**< IP protocol, if this is an IP packet */
- guint32 mpls_label; /**< last mpls label in label stack, if this is a MPLS packet */
circuit_type ctype; /**< type of circuit, for protocols with a VC identifier */
guint32 circuit_id; /**< circuit ID, for protocols with a VC identifier */
const char *noreassembly_reason; /**< reason why reassembly wasn't done, if any */
@@ -176,11 +173,6 @@ typedef struct _packet_info {
tvbuff_t *gssapi_decrypted_tvb;
gboolean gssapi_data_encrypted;
-/** This is a valid PPID, but we use it to mark the end of the list */
-#define LAST_PPID 0xffffffff
- guint32 ppids[MAX_NUMBER_OF_PPIDS]; /**< The first NUMBER_OF_PPIDS PPIDS which are present
- * in the SCTP packet
- */
void *private_data; /**< pointer to data passed from one dissector to another */
GHashTable *private_table; /**< a hash table passed from one dissector to another */
diff --git a/epan/wslua/wslua_pinfo.c b/epan/wslua/wslua_pinfo.c
index 70aa79a8b5..8fc6cb3449 100644
--- a/epan/wslua/wslua_pinfo.c
+++ b/epan/wslua/wslua_pinfo.c
@@ -1036,7 +1036,6 @@ PINFO_GET_NUMBER(Pinfo_desegment_offset,pinfo->ws_pinfo->desegment_offset)
PINFO_GET_NUMBER(Pinfo_ptype,pinfo->ws_pinfo->ptype)
PINFO_GET_NUMBER(Pinfo_src_port,pinfo->ws_pinfo->srcport)
PINFO_GET_NUMBER(Pinfo_dst_port,pinfo->ws_pinfo->destport)
-PINFO_GET_NUMBER(Pinfo_ethertype,pinfo->ws_pinfo->ethertype)
PINFO_GET_NUMBER(Pinfo_match_uint,pinfo->ws_pinfo->match_uint)
PINFO_GET_STRING(Pinfo_curr_proto,pinfo->ws_pinfo->current_proto)
@@ -1142,8 +1141,7 @@ typedef enum {
PARAM_CAN_DESEGMENT,
PARAM_DESEGMENT_LEN,
PARAM_DESEGMENT_OFFSET,
- PARAM_PORT_TYPE,
- PARAM_ETHERTYPE
+ PARAM_PORT_TYPE
} pinfo_param_type_t;
static int pushnil_param(lua_State* L, packet_info* pinfo _U_, pinfo_param_type_t pt _U_ ) {
@@ -1220,9 +1218,6 @@ static int Pinfo_set_int(lua_State* L, packet_info* pinfo, pinfo_param_type_t pt
case PARAM_DESEGMENT_OFFSET:
pinfo->desegment_offset = (int)v;
return 0;
- case PARAM_ETHERTYPE:
- pinfo->ethertype = (guint32)v;
- return 0;
default:
g_assert(!"BUG: A bad parameter");
}
@@ -1372,9 +1367,6 @@ static const pinfo_method_t Pinfo_methods[] = {
/* WSLUA_ATTRIBUTE Pinfo_private RW Access to the private table entries */
{"private", Pinfo_private, pushnil_param, PARAM_NONE},
- /* WSLUA_ATTRIBUTE Pinfo_ethertype RW Ethernet Type Code, if this is an Ethernet packet */
- {"ethertype", Pinfo_ethertype, Pinfo_set_int, PARAM_ETHERTYPE},
-
/* WSLUA_ATTRIBUTE Pinfo_fragmented RO If the protocol is only a fragment */
{"fragmented", Pinfo_fragmented, pushnil_param, PARAM_NONE},