diff options
author | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2015-09-30 12:34:14 +0200 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-09-30 16:39:34 +0000 |
commit | 4573a39ec626745f3387f124476349076f81af6d (patch) | |
tree | fa2501303ed093a1849dcaeb967b4eb8fd86935d /epan/dissectors/packet-dns.c | |
parent | 826e2b64a21abababf2cddae927847d569abb17a (diff) |
DNS: Replace cinfo by pinfo->cinfo (no longer need to check if cinfo is not NULL)
Change-Id: Ib7cebd588924270b2003fad575f4cd0c3ec2678e
Reviewed-on: https://code.wireshark.org/review/10698
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-dns.c')
-rw-r--r-- | epan/dissectors/packet-dns.c | 212 |
1 files changed, 63 insertions, 149 deletions
diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c index 981a8327f0..7a112ffc69 100644 --- a/epan/dissectors/packet-dns.c +++ b/epan/dissectors/packet-dns.c @@ -1372,7 +1372,7 @@ rfc1867_angle(tvbuff_t *tvb, int offset, const char *nsew) static int dissect_dns_query(tvbuff_t *tvb, int offset, int dns_data_offset, - column_info *cinfo, proto_tree *dns_tree, gboolean is_mdns) + packet_info *pinfo, proto_tree *dns_tree, gboolean is_mdns) { int len; const guchar *name; @@ -1408,11 +1408,9 @@ dissect_dns_query(tvbuff_t *tvb, int offset, int dns_data_offset, */ name_out = format_text(name, strlen(name)); - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s %s", type_name, name_out); - if (is_mdns) { - col_append_fstr(cinfo, COL_INFO, ", \"%s\" question", qu ? "QU" : "QM"); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s %s", type_name, name_out); + if (is_mdns) { + col_append_fstr(pinfo->cinfo, COL_INFO, ", \"%s\" question", qu ? "QU" : "QM"); } if (dns_tree != NULL) { q_tree = proto_tree_add_subtree_format(dns_tree, tvb, offset, len, ett_dns_qd, &tq, "%s: type %s, class %s", @@ -1719,7 +1717,7 @@ compute_key_id(tvbuff_t *tvb, int offset, int size, guint8 algo) static int dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, - column_info *cinfo, proto_tree *dns_tree, packet_info *pinfo, + proto_tree *dns_tree, packet_info *pinfo, gboolean is_mdns) { int len; @@ -1763,12 +1761,11 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, data_offset += 2; cur_offset += 2; - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", type_name); - if (is_mdns && flush) { - col_append_str(cinfo, COL_INFO, ", cache flush"); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", type_name); + if (is_mdns && flush) { + col_append_str(pinfo->cinfo, COL_INFO, ", cache flush"); } + if (dns_tree != NULL) { /* * The name might contain octets that aren't printable characters, @@ -1804,9 +1801,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, const char *addr; addr = tvb_ip_to_str(tvb, cur_offset); - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", addr); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", addr); proto_item_append_text(trr, ", addr %s", addr); proto_tree_add_item(rr_tree, hf_dns_a, tvb, cur_offset, 4, ENC_BIG_ENDIAN); @@ -1827,9 +1822,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, ns_name_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &ns_name); name_out = format_text(ns_name, strlen(ns_name)); - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name_out); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name_out); proto_item_append_text(trr, ", ns %s", name_out); proto_tree_add_string(rr_tree, hf_dns_ns, tvb, cur_offset, ns_name_len, name_out); @@ -1842,9 +1835,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, int hostname_len; const guchar *hostname_str; - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); hostname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &hostname_str); proto_tree_add_string(rr_tree, hf_dns_md, tvb, cur_offset, hostname_len, hostname_str); @@ -1857,9 +1848,8 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, int hostname_len; const guchar *hostname_str; - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name); - } + + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); hostname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &hostname_str); proto_tree_add_string(rr_tree, hf_dns_mf, tvb, cur_offset, hostname_len, hostname_str); @@ -1874,9 +1864,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, cname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &cname); name_out = format_text(cname, strlen(cname)); - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name_out); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name_out); proto_item_append_text(trr, ", cname %s", name_out); proto_tree_add_string(rr_tree, hf_dns_cname, tvb, cur_offset, cname_len, name_out); @@ -1895,9 +1883,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, /* XXX Fix data length */ mname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &mname); name_out = format_text(mname, strlen(mname)); - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name_out); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name_out); proto_item_append_text(trr, ", mname %s", name_out); proto_tree_add_string(rr_tree, hf_dns_soa_mname, tvb, cur_offset, mname_len, name_out); cur_offset += mname_len; @@ -1935,9 +1921,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, int hostname_len; const guchar *hostname_str; - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); hostname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &hostname_str); proto_tree_add_string(rr_tree, hf_dns_mb, tvb, cur_offset, hostname_len, hostname_str); @@ -1950,9 +1934,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, int hostname_len; const guchar *hostname_str; - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); hostname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &hostname_str); proto_tree_add_string(rr_tree, hf_dns_mg, tvb, cur_offset, hostname_len, hostname_str); @@ -1965,9 +1947,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, int hostname_len; const guchar *hostname_str; - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); hostname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &hostname_str); proto_tree_add_string(rr_tree, hf_dns_mr, tvb, cur_offset, hostname_len, hostname_str); @@ -1977,9 +1957,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, case T_NULL: /* Null (10) */ { - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); proto_tree_add_item(rr_tree, hf_dns_null, tvb, cur_offset, data_len, ENC_NA); } break; @@ -1998,9 +1976,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, wmem_strbuf_t *bitnames = wmem_strbuf_new_label(wmem_packet_scope()); wks_addr = tvb_ip_to_str(tvb, cur_offset); - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", wks_addr); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", wks_addr); proto_item_append_text(trr, ", addr %s", wks_addr); proto_tree_add_item(rr_tree, hf_dns_wks_address, tvb, cur_offset, 4, ENC_BIG_ENDIAN); cur_offset += 4; @@ -2062,9 +2038,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, /* XXX Fix data length */ pname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &pname); name_out = format_text(pname, strlen(pname)); - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name_out); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name_out); proto_item_append_text(trr, ", %s", name_out); proto_tree_add_string(rr_tree, hf_dns_ptr_domain_name, tvb, cur_offset, pname_len, name_out); @@ -2087,12 +2061,8 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, os_offset = cpu_offset + 1 + cpu_len; os_len = tvb_get_guint8(tvb, os_offset); os = tvb_get_string_enc(wmem_packet_scope(), tvb, os_offset + 1, os_len, ENC_ASCII|ENC_NA); - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %.*s %.*s", cpu_len, cpu, - os_len, os); - } - proto_item_append_text(trr, ", CPU %.*s, OS %.*s", - cpu_len, cpu, os_len, os); + col_append_fstr(pinfo->cinfo, COL_INFO, " %.*s %.*s", cpu_len, cpu, os_len, os); + proto_item_append_text(trr, ", CPU %.*s, OS %.*s", cpu_len, cpu, os_len, os); proto_tree_add_item(rr_tree, hf_dns_hinfo_cpu_length, tvb, cur_offset, 1, ENC_BIG_ENDIAN); cur_offset += 1; @@ -2112,9 +2082,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, int rmailbx_len, emailbx_len; const guchar *rmailbx_str, *emailbx_str; - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); rmailbx_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &rmailbx_str); proto_tree_add_string(rr_tree, hf_dns_minfo_r_mailbox, tvb, cur_offset, rmailbx_len, rmailbx_str); @@ -2136,9 +2104,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, /* XXX Fix data length */ mx_name_len = get_dns_name(tvb, cur_offset + 2, 0, dns_data_offset, &mx_name); name_out = format_text(mx_name, strlen(mx_name)); - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %u %s", preference, name_out); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %u %s", preference, name_out); proto_item_append_text(trr, ", preference %u, mx %s", preference, name_out); proto_tree_add_item(rr_tree, hf_dns_mx_preference, tvb, cur_offset, 2, ENC_BIG_ENDIAN); @@ -2177,9 +2143,8 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, int mbox_dname_len, txt_dname_len; const guchar *mbox_dname, *txt_dname; - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); + mbox_dname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &mbox_dname); proto_tree_add_string(rr_tree, hf_dns_rp_mailbox, tvb, cur_offset, mbox_dname_len, mbox_dname); cur_offset += mbox_dname_len; @@ -2195,9 +2160,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, const guchar *host_name; int host_name_len; - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); host_name_len = get_dns_name(tvb, cur_offset + 2, 0, dns_data_offset, &host_name); @@ -2214,9 +2177,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, { guint8 x25_len; - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); proto_tree_add_item(rr_tree, hf_dns_x25_length, tvb, cur_offset, 1, ENC_BIG_ENDIAN); x25_len = tvb_get_guint8(tvb, cur_offset); @@ -2234,9 +2195,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, guint8 isdn_address_len, isdn_sa_len; int rr_len = data_len; - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); proto_tree_add_item(rr_tree, hf_dns_isdn_length, tvb, cur_offset, 1, ENC_BIG_ENDIAN); isdn_address_len = tvb_get_guint8(tvb, cur_offset); @@ -2263,9 +2222,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, const guchar *host_name; int host_name_len; - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); host_name_len = get_dns_name(tvb, cur_offset + 2, 0, dns_data_offset, &host_name); @@ -2280,9 +2237,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, case T_NSAP: /* for NSAP address, NSAP style A record (22) */ { - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); proto_tree_add_item(rr_tree, hf_dns_nsap_rdata, tvb, cur_offset, data_len, ENC_NA); } break; @@ -2293,9 +2248,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, int nsap_ptr_owner_len; const guchar *nsap_ptr_owner; - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); nsap_ptr_owner_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &nsap_ptr_owner); proto_tree_add_string(rr_tree, hf_dns_nsap_ptr_owner, tvb, cur_offset, nsap_ptr_owner_len, nsap_ptr_owner); @@ -2358,9 +2311,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, int px_map822_len, px_mapx400_len; const guchar *px_map822_dnsname, *px_mapx400_dnsname; - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); proto_tree_add_item(rr_tree, hf_dns_px_preference, tvb, cur_offset, 2, ENC_BIG_ENDIAN); cur_offset += 2; @@ -2379,9 +2330,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, { guint8 long_len, lat_len, alt_len; - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); proto_tree_add_item(rr_tree, hf_dns_gpos_longitude_length, tvb, cur_offset, 1, ENC_BIG_ENDIAN); long_len = tvb_get_guint8(tvb, cur_offset); cur_offset += 1; @@ -2414,9 +2363,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, const char *addr6; addr6 = tvb_ip6_to_str(tvb, cur_offset); - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", addr6); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", addr6); proto_item_append_text(trr, ", addr %s", addr6); proto_tree_add_item(rr_tree, hf_dns_aaaa, tvb, cur_offset, 16, ENC_NA); @@ -2483,9 +2430,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, next_domain_name_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &next_domain_name); name_out = format_text(next_domain_name, strlen(next_domain_name)); - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name_out); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name_out); proto_item_append_text(trr, ", next domain name %s", name_out); proto_tree_add_string(rr_tree, hf_dns_nxt_next_domain_name, tvb, cur_offset, next_domain_name_len, name_out); cur_offset += next_domain_name_len; @@ -2522,9 +2467,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, proto_tree_add_string(rr_tree, hf_dns_srv_target, tvb, cur_offset, target_len, name_out); - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %u %u %u %s", priority, weight, port, name_out); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %u %u %u %s", priority, weight, port, name_out); proto_item_append_text(trr, ", priority %u, weight %u, port %u, target %s", priority, weight, port, name_out); @@ -2587,9 +2530,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, proto_tree_add_string(rr_tree, hf_dns_naptr_replacement, tvb, offset, replacement_len, name_out); - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %u %u %s", order, preference, flags); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %u %u %s", order, preference, flags); proto_item_append_text(trr, ", order %u, preference %u, flags %s", order, preference, flags); @@ -2606,9 +2547,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, /* XXX Fix data length */ kx_name_len = get_dns_name(tvb, cur_offset + 2, 0, dns_data_offset, &kx_name); name_out = format_text(kx_name, strlen(kx_name)); - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %u %s", tvb_get_ntohs(tvb, cur_offset), name_out); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %u %s", tvb_get_ntohs(tvb, cur_offset), name_out); proto_item_append_text(trr, ", preference %u, kx %s", tvb_get_ntohs(tvb, cur_offset), name_out); proto_tree_add_item(rr_tree, hf_dns_kx_preference, tvb, cur_offset, 2, ENC_BIG_ENDIAN); @@ -2678,12 +2617,10 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, name_out = format_text(pname, strlen(pname)); SET_ADDRESS(&suffix_addr, AT_IPv6, 16, suffix.bytes); - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %d %s %s", - pre_len, - address_to_str(wmem_packet_scope(), &suffix_addr), - name_out); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %d %s %s", + pre_len, + address_to_str(wmem_packet_scope(), &suffix_addr), + name_out); proto_tree_add_item(rr_tree, hf_dns_a6_prefix_len,tvb, a6_offset, 1, ENC_BIG_ENDIAN); a6_offset++; @@ -2712,9 +2649,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, dname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &dname); name_out = format_text(dname, strlen(dname)); - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name_out); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name_out); proto_item_append_text(trr, ", dname %s", name_out); proto_tree_add_string(rr_tree, hf_dns_dname, tvb, cur_offset, dname_len, name_out); @@ -2834,10 +2769,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, guint8 afdpart_len; guint8 *addr_copy; - - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); while (rr_len > 1) { @@ -3032,10 +2964,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, next_domain_name_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &next_domain_name); name_out = format_text(next_domain_name, strlen(next_domain_name)); - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name_out); - } - + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name_out); proto_item_append_text(trr, ", next domain name %s", name_out); proto_tree_add_string(rr_tree, hf_dns_nsec_next_domain_name, tvb, cur_offset, next_domain_name_len, name_out); cur_offset += next_domain_name_len; @@ -3089,10 +3018,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, case T_DHCID: /* DHCID (49) */ { - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name); - } - + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); proto_tree_add_item(rr_tree, hf_dns_dhcid_rdata, tvb, cur_offset, data_len, ENC_NA); @@ -3143,9 +3069,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, case T_NSEC3PARAM: /* NSEC3PARAM (51) */ { int salt_len; - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); proto_tree_add_item(rr_tree, hf_dns_nsec3_algo, tvb, cur_offset, 1, ENC_BIG_ENDIAN); cur_offset +=1; @@ -3169,9 +3093,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, case T_TLSA: /* DNS-Based Authentication of Named Entities (52) */ { int rr_len = data_len; - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); proto_tree_add_item(rr_tree, hf_dns_tlsa_certificate_usage, tvb, cur_offset, 1, ENC_BIG_ENDIAN); cur_offset ++; @@ -3199,9 +3121,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, int rendezvous_len; const guchar *rend_server_dns_name; - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name); hit_len = tvb_get_guint8(tvb, cur_offset); proto_tree_add_item(rr_tree, hf_dns_hip_hit_length, tvb, cur_offset, 1, ENC_BIG_ENDIAN); @@ -3601,9 +3521,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, dname_len = get_dns_name(tvb, cur_offset, 0, dns_data_offset, &dname); name_out = format_text(dname, strlen(dname)); proto_tree_add_string(rr_tree, hf_dns_winsr_name_result_domain, tvb, cur_offset, dname_len, name_out); - if (cinfo != NULL) { - col_append_fstr(cinfo, COL_INFO, " %s", name_out); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name_out); proto_item_append_text(trr, ", name result domain %s", name_out); } break; @@ -3631,7 +3549,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, static int dissect_query_records(tvbuff_t *tvb, int cur_off, int dns_data_offset, - int count, column_info *cinfo, proto_tree *dns_tree, gboolean isupdate, + int count, packet_info *pinfo, proto_tree *dns_tree, gboolean isupdate, gboolean is_mdns) { int start_off, add_off; @@ -3644,7 +3562,7 @@ dissect_query_records(tvbuff_t *tvb, int cur_off, int dns_data_offset, qatree = proto_tree_add_subtree(dns_tree, tvb, start_off, -1, ett_dns_qry, &ti, s); while (count-- > 0) { - add_off = dissect_dns_query(tvb, cur_off, dns_data_offset, cinfo, qatree, + add_off = dissect_dns_query(tvb, cur_off, dns_data_offset, pinfo, qatree, is_mdns); cur_off += add_off; } @@ -3656,7 +3574,7 @@ dissect_query_records(tvbuff_t *tvb, int cur_off, int dns_data_offset, static int dissect_answer_records(tvbuff_t *tvb, int cur_off, int dns_data_offset, - int count, column_info *cinfo, proto_tree *dns_tree, const char *name, + int count, proto_tree *dns_tree, const char *name, packet_info *pinfo, gboolean is_mdns) { int start_off, add_off; @@ -3669,7 +3587,7 @@ dissect_answer_records(tvbuff_t *tvb, int cur_off, int dns_data_offset, } while (count-- > 0) { add_off = dissect_dns_answer( - tvb, cur_off, dns_data_offset, cinfo, qatree, pinfo, is_mdns); + tvb, cur_off, dns_data_offset, qatree, pinfo, is_mdns); cur_off += add_off; } if (ti) { @@ -3716,7 +3634,7 @@ dissect_dns_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (flags & F_RESPONSE) { if (rcode != RCODE_NOERROR) { - col_append_fstr(pinfo-> cinfo, COL_INFO, " %s", + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val_to_str(rcode, rcode_vals, "Unknown error (%u)")); } } @@ -3942,8 +3860,7 @@ dissect_dns_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (quest > 0) { /* If this is a response, don't add information about the queries to the summary, just add information about the answers. */ - cur_off += dissect_query_records(tvb, cur_off, dns_data_offset, quest, - (!(flags & F_RESPONSE) ? pinfo->cinfo : NULL), + cur_off += dissect_query_records(tvb, cur_off, dns_data_offset, quest, pinfo, dns_tree, isupdate, is_mdns); dns_stats->qname_len = name_len; dns_stats->qname_labels = qname_labels_count(name, name_len); @@ -3953,25 +3870,22 @@ dissect_dns_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* If this is a request, don't add information about the answers to the summary, just add information about the queries. */ cur_off += dissect_answer_records(tvb, cur_off, dns_data_offset, ans, - ((flags & F_RESPONSE) ? pinfo->cinfo : NULL), - dns_tree, (isupdate ? - "Prerequisites" : "Answers"), + dns_tree, + (isupdate ? "Prerequisites" : "Answers"), pinfo, is_mdns); } /* Don't add information about the authoritative name servers, or the additional records, to the summary. */ if (auth > 0) { - cur_off += dissect_answer_records(tvb, cur_off, dns_data_offset, auth, - NULL, dns_tree, + cur_off += dissect_answer_records(tvb, cur_off, dns_data_offset, auth, dns_tree, (isupdate ? "Updates" : "Authoritative nameservers"), pinfo, is_mdns); } if (add > 0) { - dissect_answer_records(tvb, cur_off, dns_data_offset, add, - NULL, dns_tree, "Additional records", + dissect_answer_records(tvb, cur_off, dns_data_offset, add, dns_tree, "Additional records", pinfo, is_mdns); } tap_queue_packet(dns_tap, pinfo, dns_stats); |