From f92ed4df2d4720720080d8013da124a0eb956de7 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Sat, 15 Nov 2014 20:35:51 -0500 Subject: [PATCH] Remove ipproto member of packet_info. All situations can be handled with "shimmed" dissector functions. Change-Id: Ic85483b32d99d3270b193c9f6b29574d8fad46a8 Reviewed-on: https://code.wireshark.org/review/5327 Reviewed-by: Michael Mann Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte --- asn1/t38/packet-t38-template.c | 15 +-------- epan/dissectors/packet-catapult-dct2000.c | 12 ------- epan/dissectors/packet-gsm_ipa.c | 40 ++++++++++++++--------- epan/dissectors/packet-ip.c | 7 ++-- epan/dissectors/packet-ipv6.c | 8 +++-- epan/dissectors/packet-opensafety.c | 19 ++++++----- epan/dissectors/packet-rtp.c | 2 +- epan/dissectors/packet-stun.c | 22 ++++++++----- epan/dissectors/packet-t38.c | 19 ++--------- epan/packet_info.h | 1 - epan/wslua/wslua_pinfo.c | 4 --- ui/qt/packet_list.cpp | 7 ++-- 12 files changed, 66 insertions(+), 90 deletions(-) diff --git a/asn1/t38/packet-t38-template.c b/asn1/t38/packet-t38-template.c index 0a719463be..11a1aa2c42 100644 --- a/asn1/t38/packet-t38-template.c +++ b/asn1/t38/packet-t38-template.c @@ -615,19 +615,6 @@ dissect_t38_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } -static void -dissect_t38(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) -{ - if(pinfo->ipproto == IP_PROTO_TCP) - { - dissect_t38_tcp(tvb, pinfo, tree); - } - else if(pinfo->ipproto == IP_PROTO_UDP) - { - dissect_t38_udp(tvb, pinfo, tree); - } -} - /* Look for conversation info and display any setup info found */ void show_setup_info(tvbuff_t *tvb, proto_tree *tree, t38_conv *p_t38_conversation) @@ -732,7 +719,7 @@ proto_register_t38(void) proto_register_subtree_array(ett, array_length(ett)); expert_t38 = expert_register_protocol(proto_t38); expert_register_field_array(expert_t38, ei, array_length(ei)); - register_dissector("t38", dissect_t38, proto_t38); + register_dissector("t38_udp", dissect_t38_udp, proto_t38); /* Init reassemble tables for HDLC */ register_init_routine(t38_defragment_init); diff --git a/epan/dissectors/packet-catapult-dct2000.c b/epan/dissectors/packet-catapult-dct2000.c index e947d589b4..28307ecce5 100644 --- a/epan/dissectors/packet-catapult-dct2000.c +++ b/epan/dissectors/packet-catapult-dct2000.c @@ -2598,16 +2598,6 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Try to add right stuff to pinfo so conversation stuff works... */ pinfo->ptype = type_of_port; - switch (type_of_port) { - case PT_UDP: - pinfo->ipproto = IP_PROTO_UDP; - break; - case PT_TCP: - pinfo->ipproto = IP_PROTO_TCP; - break; - default: - pinfo->ipproto = IP_PROTO_NONE; - } /* Add addresses & ports into ipprim tree. Also set address info in pinfo for conversations... */ @@ -2764,8 +2754,6 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Add these SCTPPRIM fields inside an SCTPPRIM subtree */ sctpprim_tree = proto_item_add_subtree(ti_local, ett_catapult_dct2000_sctpprim); - pinfo->ipproto = IP_PROTO_SCTP; - /* Destination address */ if (dest_addr_offset != 0) { proto_item *addr_ti; diff --git a/epan/dissectors/packet-gsm_ipa.c b/epan/dissectors/packet-gsm_ipa.c index 2a1c4681d4..508c78d89b 100644 --- a/epan/dissectors/packet-gsm_ipa.c +++ b/epan/dissectors/packet-gsm_ipa.c @@ -78,7 +78,8 @@ void proto_reg_handoff_gsm_ipa(void); #define IPA_UDP_PORTS "3006" #define IPA_UDP_PORTS_DEFAULT "0" -static dissector_handle_t ipa_handle; +static dissector_handle_t ipa_tcp_handle; +static dissector_handle_t ipa_udp_handle; static range_t *global_ipa_tcp_ports = NULL; static range_t *global_ipa_udp_ports = NULL; static gboolean global_ipa_in_root = FALSE; @@ -281,7 +282,7 @@ dissect_osmo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ipatree, proto_tree /* Code to actually dissect the packets */ static void -dissect_ipa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +dissect_ipa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_udp) { gint remaining; gint header_length = 3; @@ -309,7 +310,7 @@ dissect_ipa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * We attempt to detect this by checking if the length from the * header + four bytes of the IPA header equals the remaining size. */ - if ((pinfo->ipproto == IP_PROTO_UDP) && (len + 4 == remaining)) { + if (is_udp && (len + 4 == remaining)) { header_length++; } @@ -372,6 +373,18 @@ dissect_ipa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } +static void +dissect_ipa_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + dissect_ipa(tvb, pinfo, tree, FALSE); +} + +static void +dissect_ipa_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + dissect_ipa(tvb, pinfo, tree, TRUE); +} + void proto_register_ipa(void) { module_t *ipa_module; @@ -433,19 +446,13 @@ void proto_register_ipa(void) &ett_ipaccess, }; - proto_ipa = - proto_register_protocol("GSM over IP protocol as used by ip.access", - "GSM over IP", "gsm_ipa"); - proto_ipaccess = - proto_register_protocol("GSM over IP ip.access CCM sub-protocol", - "IPA", "ipaccess"); + proto_ipa = proto_register_protocol("GSM over IP protocol as used by ip.access", "GSM over IP", "gsm_ipa"); + proto_ipaccess = proto_register_protocol("GSM over IP ip.access CCM sub-protocol", "IPA", "ipaccess"); proto_register_field_array(proto_ipa, hf, array_length(hf)); proto_register_field_array(proto_ipaccess, hf_ipa, array_length(hf_ipa)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("gsm_ipa", dissect_ipa, proto_ipa); - /* Register table for subdissectors */ osmo_dissector_table = register_dissector_table("ipa.osmo.protocol", "GSM over IP ip.access Protocol", @@ -488,20 +495,21 @@ void proto_reg_handoff_gsm_ipa(void) sub_handles[SUB_MGCP] = find_dissector("mgcp"); sub_handles[SUB_DATA] = find_dissector("data"); - ipa_handle = create_dissector_handle(dissect_ipa, proto_ipa); + ipa_tcp_handle = create_dissector_handle(dissect_ipa_tcp, proto_ipa); + ipa_udp_handle = create_dissector_handle(dissect_ipa_udp, proto_ipa); ipa_initialized = TRUE; } else { - dissector_delete_uint_range("tcp.port", ipa_tcp_ports, ipa_handle); + dissector_delete_uint_range("tcp.port", ipa_tcp_ports, ipa_tcp_handle); g_free(ipa_tcp_ports); - dissector_delete_uint_range("udp.port", ipa_udp_ports, ipa_handle); + dissector_delete_uint_range("udp.port", ipa_udp_ports, ipa_udp_handle); g_free(ipa_udp_ports); } ipa_tcp_ports = range_copy(global_ipa_tcp_ports); ipa_udp_ports = range_copy(global_ipa_udp_ports); - dissector_add_uint_range("udp.port", ipa_udp_ports, ipa_handle); - dissector_add_uint_range("tcp.port", ipa_tcp_ports, ipa_handle); + dissector_add_uint_range("udp.port", ipa_udp_ports, ipa_udp_handle); + dissector_add_uint_range("tcp.port", ipa_tcp_ports, ipa_tcp_handle); } /* diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c index ec081f382c..c34eddb7cd 100644 --- a/epan/dissectors/packet-ip.c +++ b/epan/dissectors/packet-ip.c @@ -482,12 +482,13 @@ static dissector_handle_t data_handle; static void ip_prompt(packet_info *pinfo, gchar* result) { - g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "IP protocol %u as", pinfo->ipproto); + g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "IP protocol %u as", + GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, proto_ip, 0))); } static gpointer ip_value(packet_info *pinfo) { - return GUINT_TO_POINTER(pinfo->ipproto); + return p_get_proto_data(pinfo->pool, pinfo, proto_ip, 0); } static const char* ip_conv_get_filter_type(conv_item_t* conv, conv_filter_type_e filter) @@ -2336,7 +2337,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) IPOPT_EOOL, &IP_OPT_TYPES, &ei_ip_opt_len_invalid, pinfo, field_tree, tf, iph); } - pinfo->ipproto = iph->ip_p; + p_add_proto_data(pinfo->pool, pinfo, proto_ip, 0, GUINT_TO_POINTER((guint)iph->ip_p)); tap_queue_packet(ip_tap, pinfo, iph); /* Skip over header + options */ diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c index 4806040739..9dad84d6d0 100644 --- a/epan/dissectors/packet-ipv6.c +++ b/epan/dissectors/packet-ipv6.c @@ -123,6 +123,7 @@ void proto_reg_handoff_ipv6(void); /* Protocol specific data indices */ #define IPV6_PROTO_NXT_HDR 0 +#define IPV6_PROTO_VALUE 1 static int ipv6_tap = -1; @@ -342,12 +343,13 @@ static expert_field ei_ipv6_routing_hdr_rpl_segments_ge0 = EI_INIT; static void ipv6_prompt(packet_info *pinfo, gchar* result) { - g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "IP protocol %u as", pinfo->ipproto); + g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "IP protocol %u as", + GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, proto_ipv6, IPV6_PROTO_VALUE))); } static gpointer ipv6_value(packet_info *pinfo) { - return GUINT_TO_POINTER(pinfo->ipproto); + return p_get_proto_data(pinfo->pool, pinfo, proto_ipv6, IPV6_PROTO_VALUE); } static void ipv6_next_header_prompt(packet_info *pinfo, gchar* result) @@ -2162,7 +2164,7 @@ again: proto_item_set_len (ipv6_item, offset); /* collect packet info */ - pinfo->ipproto = nxt; + p_add_proto_data(pinfo->pool, pinfo, proto_ipv6, IPV6_PROTO_VALUE, GUINT_TO_POINTER((guint)nxt)); tap_queue_packet(ipv6_tap, pinfo, &ipv6); if (offlg & IP6F_OFF_MASK || (ipv6_reassemble && offlg & IP6F_MORE_FRAG)) { diff --git a/epan/dissectors/packet-opensafety.c b/epan/dissectors/packet-opensafety.c index b26424bc46..47fdeb124e 100644 --- a/epan/dissectors/packet-opensafety.c +++ b/epan/dissectors/packet-opensafety.c @@ -2301,6 +2301,15 @@ dissect_opensafety_epl(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tr return result; } +static gboolean +dissect_opensafety_siii_udp(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ ) +{ + if ( ! global_enable_siii ) + return FALSE; + + return opensafety_package_dissector("openSAFETY/SercosIII UDP", "", FALSE, FALSE, 0, + message_tvb, pinfo, tree, OPENSAFETY_ACYCLIC_DATA ); +} static gboolean dissect_opensafety_siii(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ ) @@ -2311,12 +2320,6 @@ dissect_opensafety_siii(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *t if ( ! global_enable_siii ) return result; - if ( pinfo->ipproto == IP_PROTO_UDP ) - { - return opensafety_package_dissector("openSAFETY/SercosIII UDP", "", FALSE, FALSE, 0, - message_tvb, pinfo, tree, OPENSAFETY_ACYCLIC_DATA ); - } - /* We can assume to have a SercosIII package, as the SercosIII dissector won't detect * SercosIII-UDP packages, this is most likely SercosIII-over-ethernet */ @@ -2441,7 +2444,7 @@ apply_prefs ( void ) /* Sercos III dissector does not handle UDP transport, has to be handled * separately, everything else should be caught by the heuristic dissector */ - dissector_add_uint("udp.port", opensafety_udp_siii_port_number, find_dissector("opensafety_siii")); + dissector_add_uint("udp.port", opensafety_udp_siii_port_number, find_dissector("opensafety_siii_udp")); } @@ -2849,7 +2852,7 @@ proto_register_opensafety(void) /* Registering default and ModBus/TCP dissector */ new_register_dissector("opensafety_udpdata", dissect_opensafety_udpdata, proto_opensafety ); new_register_dissector("opensafety_mbtcp", dissect_opensafety_mbtcp, proto_opensafety ); - new_register_dissector("opensafety_siii", dissect_opensafety_siii, proto_opensafety ); + new_register_dissector("opensafety_siii_udp", dissect_opensafety_siii_udp, proto_opensafety ); new_register_dissector("opensafety_pnio", dissect_opensafety_pn_io, proto_opensafety); } diff --git a/epan/dissectors/packet-rtp.c b/epan/dissectors/packet-rtp.c index 439190eb4c..c832c0067b 100644 --- a/epan/dissectors/packet-rtp.c +++ b/epan/dissectors/packet-rtp.c @@ -3692,7 +3692,7 @@ proto_reg_handoff_rtp(void) classicstun_handle = find_dissector("classicstun"); classicstun_heur_handle = find_dissector("classicstun-heur"); stun_heur_handle = find_dissector("stun-heur"); - t38_handle = find_dissector("t38"); + t38_handle = find_dissector("t38_udp"); zrtp_handle = find_dissector("zrtp"); sprt_handle = find_dissector("sprt"); diff --git a/epan/dissectors/packet-stun.c b/epan/dissectors/packet-stun.c index 2f080b2900..255137f8c1 100644 --- a/epan/dissectors/packet-stun.c +++ b/epan/dissectors/packet-stun.c @@ -498,7 +498,7 @@ dissect_stun_message_channel_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree static int -dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean heur_check) +dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean heur_check, gboolean is_udp) { guint captured_length; guint16 msg_type; @@ -546,7 +546,7 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboole /* note that padding is only mandatory over streaming protocols */ - if (pinfo->ipproto == IP_PROTO_UDP) { + if (is_udp) { if (reported_length != (msg_length + CHANNEL_DATA_HDR_LEN)) return 0; } else { /* TCP */ @@ -1261,23 +1261,29 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboole } static int -dissect_stun(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +dissect_stun_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { - return dissect_stun_message(tvb, pinfo, tree, FALSE); + return dissect_stun_message(tvb, pinfo, tree, FALSE, TRUE); +} + +static int +dissect_stun_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +{ + return dissect_stun_message(tvb, pinfo, tree, FALSE, FALSE); } static int dissect_stun_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { tcp_dissect_pdus(tvb, pinfo, tree, TRUE, MIN_HDR_LEN, - get_stun_message_len, dissect_stun, data); + get_stun_message_len, dissect_stun_tcp_pdu, data); return tvb_reported_length(tvb); } static gboolean dissect_stun_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { - if (dissect_stun_message(tvb, pinfo, tree, TRUE) == 0) { + if (dissect_stun_message(tvb, pinfo, tree, TRUE, TRUE) == 0) { /* * It wasn't a valid STUN message, and wasn't * dissected as such. @@ -1621,7 +1627,7 @@ proto_register_stun(void) /* heuristic subdissectors (used for the DATA field) */ register_heur_dissector_list("stun", &heur_subdissector_list); - new_register_dissector("stun-udp", dissect_stun, proto_stun); + new_register_dissector("stun-udp", dissect_stun_udp, proto_stun); new_register_dissector("stun-heur", dissect_stun_heur, proto_stun); } @@ -1632,7 +1638,7 @@ proto_reg_handoff_stun(void) dissector_handle_t stun_udp_handle; stun_tcp_handle = new_create_dissector_handle(dissect_stun_tcp, proto_stun); - stun_udp_handle = new_create_dissector_handle(dissect_stun, proto_stun); + stun_udp_handle = new_create_dissector_handle(dissect_stun_udp, proto_stun); dissector_add_uint("tcp.port", TCP_PORT_STUN, stun_tcp_handle); dissector_add_uint("udp.port", UDP_PORT_STUN, stun_udp_handle); diff --git a/epan/dissectors/packet-t38.c b/epan/dissectors/packet-t38.c index baf2a6163b..6bc4495279 100644 --- a/epan/dissectors/packet-t38.c +++ b/epan/dissectors/packet-t38.c @@ -1202,19 +1202,6 @@ dissect_t38_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } -static void -dissect_t38(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) -{ - if(pinfo->ipproto == IP_PROTO_TCP) - { - dissect_t38_tcp(tvb, pinfo, tree); - } - else if(pinfo->ipproto == IP_PROTO_UDP) - { - dissect_t38_udp(tvb, pinfo, tree); - } -} - /* Look for conversation info and display any setup info found */ void show_setup_info(tvbuff_t *tvb, proto_tree *tree, t38_conv *p_t38_conversation) @@ -1331,7 +1318,7 @@ proto_register_t38(void) "OCTET_STRING", HFILL }}, /*--- End of included file: packet-t38-hfarr.c ---*/ -#line 671 "../../asn1/t38/packet-t38-template.c" +#line 658 "../../asn1/t38/packet-t38-template.c" { &hf_t38_setup, { "Stream setup", "t38.setup", FT_STRING, BASE_NONE, NULL, 0x0, "Stream setup, method and frame number", HFILL }}, @@ -1392,7 +1379,7 @@ proto_register_t38(void) &ett_t38_T_fec_data, /*--- End of included file: packet-t38-ettarr.c ---*/ -#line 718 "../../asn1/t38/packet-t38-template.c" +#line 705 "../../asn1/t38/packet-t38-template.c" &ett_t38_setup, &ett_data_fragment, &ett_data_fragments @@ -1410,7 +1397,7 @@ proto_register_t38(void) proto_register_subtree_array(ett, array_length(ett)); expert_t38 = expert_register_protocol(proto_t38); expert_register_field_array(expert_t38, ei, array_length(ei)); - register_dissector("t38", dissect_t38, proto_t38); + register_dissector("t38_udp", dissect_t38_udp, proto_t38); /* Init reassemble tables for HDLC */ register_init_routine(t38_defragment_init); diff --git a/epan/packet_info.h b/epan/packet_info.h index 8f58abe9e4..ff17d58f36 100644 --- a/epan/packet_info.h +++ b/epan/packet_info.h @@ -60,7 +60,6 @@ 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 ipproto; /**< IP protocol, if this is an IP 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 */ diff --git a/epan/wslua/wslua_pinfo.c b/epan/wslua/wslua_pinfo.c index abe78eb1c9..9fdb5a9ed6 100644 --- a/epan/wslua/wslua_pinfo.c +++ b/epan/wslua/wslua_pinfo.c @@ -949,9 +949,6 @@ WSLUA_ATTRIBUTE_BLOCK_NUMBER_GETTER(Pinfo,delta_ts,lua_delta_nstime_to_sec(obj, /* WSLUA_ATTRIBUTE Pinfo_delta_dis_ts RO Number of seconds passed since the last displayed packet. */ WSLUA_ATTRIBUTE_BLOCK_NUMBER_GETTER(Pinfo,delta_dis_ts,lua_delta_nstime_to_sec(obj, obj->ws_pinfo->fd, obj->ws_pinfo->fd->prev_dis_num)); -/* WSLUA_ATTRIBUTE Pinfo_ipproto RO IP Protocol id. */ -PINFO_NUMBER_GETTER(ipproto); - /* WSLUA_ATTRIBUTE Pinfo_circuit_id RW For circuit based protocols. */ PINFO_NUMBER_GETTER(circuit_id); PINFO_NUMBER_SETTER(circuit_id,guint32); @@ -1173,7 +1170,6 @@ WSLUA_ATTRIBUTES Pinfo_attributes[] = { WSLUA_ATTRIBUTE_ROREG(Pinfo,port_type), WSLUA_ATTRIBUTE_RWREG(Pinfo,src_port), WSLUA_ATTRIBUTE_RWREG(Pinfo,dst_port), - WSLUA_ATTRIBUTE_ROREG(Pinfo,ipproto), WSLUA_ATTRIBUTE_RWREG(Pinfo,circuit_id), WSLUA_ATTRIBUTE_ROREG(Pinfo,match), WSLUA_ATTRIBUTE_ROREG(Pinfo,curr_proto), diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp index 1ab73e1152..f55f3a432e 100644 --- a/ui/qt/packet_list.cpp +++ b/ui/qt/packet_list.cpp @@ -491,15 +491,14 @@ void PacketList::selectionChanged (const QItemSelection & selected, const QItemS void PacketList::contextMenuEvent(QContextMenuEvent *event) { QAction *action; - gboolean is_tcp = FALSE, is_udp = FALSE; + gboolean is_tcp = FALSE, is_udp = FALSE, is_sctp = FALSE; /* walk the list of a available protocols in the packet to see what we have */ if (cap_file_ != NULL && cap_file_->edt != NULL) - proto_get_frame_protocols(cap_file_->edt->pi.layers, NULL, &is_tcp, &is_udp, NULL, NULL); + proto_get_frame_protocols(cap_file_->edt->pi.layers, NULL, &is_tcp, &is_udp, &is_sctp, NULL); action = window()->findChild("actionSCTP"); - if (cap_file_ != NULL && cap_file_->edt != NULL && - cap_file_->edt->pi.ipproto == IP_PROTO_SCTP) + if (cap_file_ != NULL && cap_file_->edt != NULL && is_sctp) action->setEnabled(TRUE); else action->setEnabled(FALSE);