diff options
Diffstat (limited to 'epan/dissectors/packet-wccp.c')
-rw-r--r-- | epan/dissectors/packet-wccp.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/epan/dissectors/packet-wccp.c b/epan/dissectors/packet-wccp.c index 70dd456668..88ce88f1d0 100644 --- a/epan/dissectors/packet-wccp.c +++ b/epan/dissectors/packet-wccp.c @@ -1870,29 +1870,24 @@ dissect_wccp2r1_address_table_info(tvbuff_t *tvb, int offset, wccp_wccp_address_table.in_use = TRUE; - if (info_tree) - tf = proto_tree_get_parent(info_tree); - if (length < 2*4) return length - 2*4; wccp_wccp_address_table.family = tvb_get_ntohs(tvb,offset); - if (pinfo && info_tree) - proto_tree_add_item(info_tree, hf_address_table_family, tvb, + + proto_tree_add_item(info_tree, hf_address_table_family, tvb, offset, 2, ENC_BIG_ENDIAN); EAT_AND_CHECK(2,2); address_length = tvb_get_ntohs(tvb,offset); - if (info_tree) - proto_tree_add_item(info_tree, hf_address_table_address_length, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(info_tree, hf_address_table_address_length, tvb, offset, 2, ENC_BIG_ENDIAN); EAT_AND_CHECK(2,2); wccp_wccp_address_table.table_length = tvb_get_ntohl(tvb,offset); - if (pinfo && info_tree) { - tf = proto_tree_add_item(info_tree, hf_address_table_length, tvb, offset, 4, ENC_BIG_ENDIAN); - element_tree = proto_item_add_subtree(tf, ett_table_element); - } + tf = proto_tree_add_item(info_tree, hf_address_table_length, tvb, offset, 4, ENC_BIG_ENDIAN); + element_tree = proto_item_add_subtree(tf, ett_table_element); + EAT(4); /* check if the length is valid and allocate the tables if needed*/ @@ -1901,7 +1896,7 @@ dissect_wccp2r1_address_table_info(tvbuff_t *tvb, int offset, if (wccp_wccp_address_table.table_ipv4 == NULL) wccp_wccp_address_table.table_ipv4 = (guint32 *) wmem_alloc(pinfo->pool, wccp_wccp_address_table.table_length * 4); - if ((address_length != 4) && (pinfo && info_tree)) { + if (address_length != 4) { expert_add_info_format(pinfo, tf, &ei_wccp_length_bad, "The Address length must be 4, but I found %d for IPv4 addresses. Correcting this.", address_length); @@ -1912,7 +1907,7 @@ dissect_wccp2r1_address_table_info(tvbuff_t *tvb, int offset, if (wccp_wccp_address_table.table_ipv6 == NULL) wccp_wccp_address_table.table_ipv6 = (struct e_in6_addr *) wmem_alloc(pinfo->pool, wccp_wccp_address_table.table_length * sizeof(struct e_in6_addr)); - if ((address_length != 16) && (pinfo && info_tree)) { + if (address_length != 16) { expert_add_info_format(pinfo, tf, &ei_wccp_length_bad, "The Address length must be 16, but I found %d for IPv6 addresses. Correcting this", address_length); @@ -1920,10 +1915,8 @@ dissect_wccp2r1_address_table_info(tvbuff_t *tvb, int offset, } break; default: - if (pinfo && info_tree) { - expert_add_info_format(pinfo, tf, &ei_wccp_address_table_family_unknown, + expert_add_info_format(pinfo, tf, &ei_wccp_address_table_family_unknown, "Unknown address family: %d", wccp_wccp_address_table.family); - } }; /* now read the addresses and print/store them */ @@ -1933,8 +1926,7 @@ dissect_wccp2r1_address_table_info(tvbuff_t *tvb, int offset, /* do we have space? */ if (length < address_length) { - if (pinfo && tf) - expert_add_info_format(pinfo, tf, &ei_wccp_length_bad, "Ran out of space to decode"); + expert_add_info_format(pinfo, tf, &ei_wccp_length_bad, "Ran out of space to decode"); /* first clean up: */ wccp_wccp_address_table.in_use = FALSE; |