aboutsummaryrefslogtreecommitdiffstats
path: root/epan/packet.c
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2015-11-26 04:44:52 +0000
committerJoão Valverde <j@v6e.pt>2016-02-26 23:09:43 +0000
commite4c059f67f3b29bcc26b1faf111bf647ac630e04 (patch)
tree8ec634d7614f7a32c09c5cdb60d7509fc2dd2208 /epan/packet.c
parent92537916483ec721a638cdd7c416d099a45a9304 (diff)
Add free_address_wmem(), fix warnings [-Wcast-qual]
Try to improve address API and also fix some constness warnings by not overloading the 'data' pointer to store malloc'ed buffers (use private pointer for that instead). Second try, now passing test suite. Change-Id: Idc101cd866b6d4f13500c9d59da5c7a38847fb7f Reviewed-on: https://code.wireshark.org/review/13946 Petri-Dish: João Valverde <j@v6e.pt> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
Diffstat (limited to 'epan/packet.c')
-rw-r--r--epan/packet.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/epan/packet.c b/epan/packet.c
index 343eb3040d..f8066dedeb 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -471,12 +471,12 @@ dissect_record(epan_dissect_t *edt, int file_type_subtype,
edt->pi.fd = fd;
edt->pi.phdr = phdr;
edt->pi.pseudo_header = &phdr->pseudo_header;
- edt->pi.dl_src.type = AT_NONE;
- edt->pi.dl_dst.type = AT_NONE;
- edt->pi.net_src.type = AT_NONE;
- edt->pi.net_dst.type = AT_NONE;
- edt->pi.src.type = AT_NONE;
- edt->pi.dst.type = AT_NONE;
+ clear_address(&edt->pi.dl_src);
+ clear_address(&edt->pi.dl_dst);
+ clear_address(&edt->pi.net_src);
+ clear_address(&edt->pi.net_dst);
+ clear_address(&edt->pi.src);
+ clear_address(&edt->pi.dst);
edt->pi.ctype = CT_NONE;
edt->pi.noreassembly_reason = "";
edt->pi.ptype = PT_NONE;
@@ -537,12 +537,12 @@ dissect_file(epan_dissect_t *edt, struct wtap_pkthdr *phdr,
edt->pi.fd = fd;
edt->pi.phdr = phdr;
edt->pi.pseudo_header = &phdr->pseudo_header;
- edt->pi.dl_src.type = AT_NONE;
- edt->pi.dl_dst.type = AT_NONE;
- edt->pi.net_src.type = AT_NONE;
- edt->pi.net_dst.type = AT_NONE;
- edt->pi.src.type = AT_NONE;
- edt->pi.dst.type = AT_NONE;
+ clear_address(&edt->pi.dl_src);
+ clear_address(&edt->pi.dl_dst);
+ clear_address(&edt->pi.net_src);
+ clear_address(&edt->pi.net_dst);
+ clear_address(&edt->pi.src);
+ clear_address(&edt->pi.dst);
edt->pi.ctype = CT_NONE;
edt->pi.noreassembly_reason = "";
edt->pi.ptype = PT_NONE;
@@ -754,12 +754,12 @@ call_dissector_work_error(dissector_handle_t handle, tvbuff_t *tvb,
save_writable = col_get_writable(pinfo->cinfo);
col_set_writable(pinfo->cinfo, FALSE);
- save_dl_src = pinfo->dl_src;
- save_dl_dst = pinfo->dl_dst;
- save_net_src = pinfo->net_src;
- save_net_dst = pinfo->net_dst;
- save_src = pinfo->src;
- save_dst = pinfo->dst;
+ copy_address_shallow(&save_dl_src, &pinfo->dl_src);
+ copy_address_shallow(&save_dl_dst, &pinfo->dl_dst);
+ copy_address_shallow(&save_net_src, &pinfo->net_src);
+ copy_address_shallow(&save_net_dst, &pinfo->net_dst);
+ copy_address_shallow(&save_src, &pinfo->src);
+ copy_address_shallow(&save_dst, &pinfo->dst);
/* Dissect the contained packet. */
TRY {
@@ -770,12 +770,12 @@ call_dissector_work_error(dissector_handle_t handle, tvbuff_t *tvb,
* Restore the column writability and addresses.
*/
col_set_writable(pinfo->cinfo, save_writable);
- pinfo->dl_src = save_dl_src;
- pinfo->dl_dst = save_dl_dst;
- pinfo->net_src = save_net_src;
- pinfo->net_dst = save_net_dst;
- pinfo->src = save_src;
- pinfo->dst = save_dst;
+ copy_address_shallow(&pinfo->dl_src, &save_dl_src);
+ copy_address_shallow(&pinfo->dl_dst, &save_dl_dst);
+ copy_address_shallow(&pinfo->net_src, &save_net_src);
+ copy_address_shallow(&pinfo->net_dst, &save_net_dst);
+ copy_address_shallow(&pinfo->src, &save_src);
+ copy_address_shallow(&pinfo->dst, &save_dst);
/*
* Restore the current protocol, so any
@@ -812,12 +812,12 @@ call_dissector_work_error(dissector_handle_t handle, tvbuff_t *tvb,
ENDTRY;
col_set_writable(pinfo->cinfo, save_writable);
- pinfo->dl_src = save_dl_src;
- pinfo->dl_dst = save_dl_dst;
- pinfo->net_src = save_net_src;
- pinfo->net_dst = save_net_dst;
- pinfo->src = save_src;
- pinfo->dst = save_dst;
+ copy_address_shallow(&pinfo->dl_src, &save_dl_src);
+ copy_address_shallow(&pinfo->dl_dst, &save_dl_dst);
+ copy_address_shallow(&pinfo->net_src, &save_net_src);
+ copy_address_shallow(&pinfo->net_dst, &save_net_dst);
+ copy_address_shallow(&pinfo->src, &save_src);
+ copy_address_shallow(&pinfo->dst, &save_dst);
pinfo->want_pdu_tracking = 0;
return len;
}