Consistently refer to blocks that have been modified as "modified".

"User" sounds as if the blocks belong to the user; at most, the current
user might have modified them directly, but they might also have, for
example, run a Lua script that, unknown to them, modified comments.
Also, a file might have "user comments" added by a previous user, who
them wrote the file and and provided it to the current user.

"Modified" seems a bit clearer than "changed".
This commit is contained in:
Guy Harris 2021-07-07 22:43:29 -07:00
parent 6dfa2cb0ae
commit dd5907d2a3
20 changed files with 80 additions and 74 deletions

View File

@ -131,8 +131,8 @@ extern void cap_file_init(capture_file *cf);
const char *cap_file_provider_get_interface_name(struct packet_provider_data *prov, guint32 interface_id); const char *cap_file_provider_get_interface_name(struct packet_provider_data *prov, guint32 interface_id);
const char *cap_file_provider_get_interface_description(struct packet_provider_data *prov, guint32 interface_id); const char *cap_file_provider_get_interface_description(struct packet_provider_data *prov, guint32 interface_id);
wtap_block_t cap_file_provider_get_user_block(struct packet_provider_data *prov, const frame_data *fd); wtap_block_t cap_file_provider_get_modified_block(struct packet_provider_data *prov, const frame_data *fd);
void cap_file_provider_set_user_block(struct packet_provider_data *prov, frame_data *fd, const wtap_block_t new_block); void cap_file_provider_set_modified_block(struct packet_provider_data *prov, frame_data *fd, const wtap_block_t new_block);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -558,8 +558,8 @@ libwireshark.so.0 libwireshark0 #MINVER#
epan_get_compiled_version_info@Base 1.9.1 epan_get_compiled_version_info@Base 1.9.1
epan_get_interface_description@Base 2.3.0 epan_get_interface_description@Base 2.3.0
epan_get_interface_name@Base 1.99.2 epan_get_interface_name@Base 1.99.2
epan_get_modified_block@Base 3.5.0
epan_get_runtime_version_info@Base 1.9.1 epan_get_runtime_version_info@Base 1.9.1
epan_get_user_block@Base 3.5.0
epan_get_version@Base 1.9.1 epan_get_version@Base 1.9.1
epan_get_version_number@Base 2.5.0 epan_get_version_number@Base 2.5.0
epan_init@Base 2.9.0 epan_init@Base 2.9.0

View File

@ -2186,12 +2186,12 @@ main(int argc, char *argv[])
temp_rec = *rec; temp_rec = *rec;
/* The comment is not modified by dumper, cast away. */ /* The comment is not modified by dumper, cast away. */
wtap_block_add_string_option(rec->block, OPT_COMMENT, (char *)comment, strlen((char *)comment)); wtap_block_add_string_option(rec->block, OPT_COMMENT, (char *)comment, strlen((char *)comment));
temp_rec.has_block_changed = TRUE; temp_rec.block_was_modified = TRUE;
rec = &temp_rec; rec = &temp_rec;
} else { } else {
/* Copy and change rather than modify returned rec */ /* Copy and change rather than modify returned rec */
temp_rec = *rec; temp_rec = *rec;
temp_rec.has_block_changed = FALSE; temp_rec.block_was_modified = FALSE;
rec = &temp_rec; rec = &temp_rec;
} }
} }

View File

@ -449,10 +449,10 @@ epan_new(struct packet_provider_data *prov,
} }
wtap_block_t wtap_block_t
epan_get_user_block(const epan_t *session, const frame_data *fd) epan_get_modified_block(const epan_t *session, const frame_data *fd)
{ {
if (session->funcs.get_user_block) if (session->funcs.get_modified_block)
return session->funcs.get_user_block(session->prov, fd); return session->funcs.get_modified_block(session->prov, fd);
return NULL; return NULL;
} }

View File

@ -50,7 +50,7 @@ struct packet_provider_funcs {
const nstime_t *(*get_frame_ts)(struct packet_provider_data *prov, guint32 frame_num); const nstime_t *(*get_frame_ts)(struct packet_provider_data *prov, guint32 frame_num);
const char *(*get_interface_name)(struct packet_provider_data *prov, guint32 interface_id); const char *(*get_interface_name)(struct packet_provider_data *prov, guint32 interface_id);
const char *(*get_interface_description)(struct packet_provider_data *prov, guint32 interface_id); const char *(*get_interface_description)(struct packet_provider_data *prov, guint32 interface_id);
wtap_block_t (*get_user_block)(struct packet_provider_data *prov, const frame_data *fd); wtap_block_t (*get_modified_block)(struct packet_provider_data *prov, const frame_data *fd);
}; };
/** /**
@ -154,7 +154,7 @@ typedef struct epan_session epan_t;
WS_DLL_PUBLIC epan_t *epan_new(struct packet_provider_data *prov, WS_DLL_PUBLIC epan_t *epan_new(struct packet_provider_data *prov,
const struct packet_provider_funcs *funcs); const struct packet_provider_funcs *funcs);
WS_DLL_PUBLIC wtap_block_t epan_get_user_block(const epan_t *session, const frame_data *fd); WS_DLL_PUBLIC wtap_block_t epan_get_modified_block(const epan_t *session, const frame_data *fd);
WS_DLL_PUBLIC const char *epan_get_interface_name(const epan_t *session, guint32 interface_id); WS_DLL_PUBLIC const char *epan_get_interface_name(const epan_t *session, guint32 interface_id);

View File

@ -219,7 +219,7 @@ frame_data_init(frame_data *fdata, guint32 num, const wtap_rec *rec,
fdata->tsprec = (unsigned int)rec->tsprec; fdata->tsprec = (unsigned int)rec->tsprec;
fdata->abs_ts = rec->ts; fdata->abs_ts = rec->ts;
fdata->has_phdr_block = (rec->block != NULL); fdata->has_phdr_block = (rec->block != NULL);
fdata->has_user_block = 0; fdata->has_modified_block = 0;
fdata->need_colorize = 0; fdata->need_colorize = 0;
fdata->color_filter = NULL; fdata->color_filter = NULL;
fdata->shift_offset.secs = 0; fdata->shift_offset.secs = 0;

View File

@ -85,7 +85,7 @@ typedef struct _frame_data {
unsigned int ignored : 1; /**< 1 = ignore this frame, 0 = normal */ unsigned int ignored : 1; /**< 1 = ignore this frame, 0 = normal */
unsigned int has_ts : 1; /**< 1 = has time stamp, 0 = no time stamp */ unsigned int has_ts : 1; /**< 1 = has time stamp, 0 = no time stamp */
unsigned int has_phdr_block : 1; /** 1 = there's a block (possibly with options) for this packet */ unsigned int has_phdr_block : 1; /** 1 = there's a block (possibly with options) for this packet */
unsigned int has_user_block : 1; /** 1 = user changed block (or its options) for this packet */ unsigned int has_modified_block : 1; /** 1 = block for this packet has been modified */
unsigned int need_colorize : 1; /**< 1 = need to (re-)calculate packet color */ unsigned int need_colorize : 1; /**< 1 = need to (re-)calculate packet color */
unsigned int tsprec : 4; /**< Time stamp precision -2^tsprec gives up to femtoseconds */ unsigned int tsprec : 4; /**< Time stamp precision -2^tsprec gives up to femtoseconds */
nstime_t abs_ts; /**< Absolute timestamp */ nstime_t abs_ts; /**< Absolute timestamp */

View File

@ -583,9 +583,12 @@ dissect_record(epan_dissect_t *edt, int file_type_subtype,
frame_delta_abs_time(edt->session, fd, fd->frame_ref_num, &edt->pi.rel_ts); frame_delta_abs_time(edt->session, fd, fd->frame_ref_num, &edt->pi.rel_ts);
/* pkt block use first user, later from rec */ /*
if (fd->has_user_block) { * If the block has been modified, use the modified block,
frame_dissector_data.pkt_block = epan_get_user_block(edt->session, fd); * otherwise use the block from the file.
*/
if (fd->has_modified_block) {
frame_dissector_data.pkt_block = epan_get_modified_block(edt->session, fd);
} }
else if (fd->has_phdr_block) { else if (fd->has_phdr_block) {
frame_dissector_data.pkt_block = rec->block; frame_dissector_data.pkt_block = rec->block;
@ -657,9 +660,12 @@ dissect_file(epan_dissect_t *edt, wtap_rec *rec,
TRY { TRY {
/* pkt block use first user, later from rec */ /*
if (fd->has_user_block) { * If the block has been modified, use the modified block,
file_dissector_data.pkt_block = epan_get_user_block(edt->session, fd); * otherwise use the block from the file.
*/
if (fd->has_modified_block) {
file_dissector_data.pkt_block = epan_get_modified_block(edt->session, fd);
} }
else if (fd->has_phdr_block) { else if (fd->has_phdr_block) {
file_dissector_data.pkt_block = rec->block; file_dissector_data.pkt_block = rec->block;

View File

@ -541,12 +541,12 @@ WSLUA_METHOD Dumper_dump_current(lua_State* L) {
/* /*
* wtap_dump does not modify rec.block, so it should be possible to * wtap_dump does not modify rec.block, so it should be possible to
* pass epan_get_user_block() or lua_pinfo->rec->block directly. * pass epan_get_modified_block() or lua_pinfo->rec->block directly.
* Temporarily duplicating the memory should not hurt though. * Temporarily duplicating the memory should not hurt though.
*/ */
if (lua_pinfo->fd->has_user_block) { if (lua_pinfo->fd->has_modified_block) {
rec.block = epan_get_user_block(lua_pinfo->epan, lua_pinfo->fd); rec.block = epan_get_modified_block(lua_pinfo->epan, lua_pinfo->fd);
rec.has_block_changed = TRUE; rec.block_was_modified = TRUE;
} else if (lua_pinfo->fd->has_phdr_block) { } else if (lua_pinfo->fd->has_phdr_block) {
rec.block = lua_pinfo->rec->block; rec.block = lua_pinfo->rec->block;
} }

28
file.c
View File

@ -252,7 +252,7 @@ ws_epan_new(capture_file *cf)
ws_get_frame_ts, ws_get_frame_ts,
cap_file_provider_get_interface_name, cap_file_provider_get_interface_name,
cap_file_provider_get_interface_description, cap_file_provider_get_interface_description,
cap_file_provider_get_user_block cap_file_provider_get_modified_block
}; };
return epan_new(&cf->provider, &funcs); return epan_new(&cf->provider, &funcs);
@ -4003,9 +4003,9 @@ cf_update_section_comment(capture_file *cf, gchar *comment)
wtap_block_t wtap_block_t
cf_get_packet_block(capture_file *cf, const frame_data *fd) cf_get_packet_block(capture_file *cf, const frame_data *fd)
{ {
/* fetch user block */ /* If this block has been modified, fetch the modified version */
if (fd->has_user_block) if (fd->has_modified_block)
return wtap_block_ref(cap_file_provider_get_user_block(&cf->provider, fd)); return wtap_block_ref(cap_file_provider_get_modified_block(&cf->provider, fd));
/* fetch phdr block */ /* fetch phdr block */
if (fd->has_phdr_block) { if (fd->has_phdr_block) {
@ -4033,20 +4033,20 @@ cf_get_packet_block(capture_file *cf, const frame_data *fd)
* Update(replace) the block on a capture from a frame * Update(replace) the block on a capture from a frame
*/ */
gboolean gboolean
cf_set_user_packet_block(capture_file *cf, frame_data *fd, const wtap_block_t new_block) cf_set_modified_block(capture_file *cf, frame_data *fd, const wtap_block_t new_block)
{ {
wtap_block_t pkt_block = cf_get_packet_block(cf, fd); wtap_block_t pkt_block = cf_get_packet_block(cf, fd);
/* It's possible to edit the user block "in place" by doing a call to /* It's possible to further modify the modified block "in place" by doing
* cf_get_packet_block() that returns an already created user block, * a call to cf_get_packet_block() that returns an already created modified
* editing that, and calling this function. * block, modifying that, and calling this function.
* If the caller did that, then the block pointers will be equal. * If the caller did that, then the block pointers will be equal.
*/ */
if (pkt_block == new_block) { if (pkt_block == new_block) {
/* No need to save anything here, the caller changes went right /* No need to save anything here, the caller changes went right
* onto the block. * onto the block.
* Unfortunately we don't have a way to know how many comments were in the block * Unfortunately we don't have a way to know how many comments were in the block
* before the caller edited it. * before the caller modified it.
*/ */
} }
else { else {
@ -4056,7 +4056,7 @@ cf_set_user_packet_block(capture_file *cf, frame_data *fd, const wtap_block_t ne
if (new_block) if (new_block)
cf->packet_comment_count += wtap_block_count_option(new_block, OPT_COMMENT); cf->packet_comment_count += wtap_block_count_option(new_block, OPT_COMMENT);
cap_file_provider_set_user_block(&cf->provider, fd, new_block); cap_file_provider_set_modified_block(&cf->provider, fd, new_block);
expert_update_comment_count(cf->packet_comment_count); expert_update_comment_count(cf->packet_comment_count);
} }
@ -4147,12 +4147,12 @@ save_record(capture_file *cf, frame_data *fdata, wtap_rec *rec,
/* Make changes based on anything that the user has done but that /* Make changes based on anything that the user has done but that
hasn't been saved yet. */ hasn't been saved yet. */
if (fdata->has_user_block) if (fdata->has_modified_block)
pkt_block = cap_file_provider_get_user_block(&cf->provider, fdata); pkt_block = cap_file_provider_get_modified_block(&cf->provider, fdata);
else else
pkt_block = rec->block; pkt_block = rec->block;
new_rec.block = pkt_block; new_rec.block = pkt_block;
new_rec.has_block_changed = fdata->has_user_block ? TRUE : FALSE; new_rec.block_was_modified = fdata->has_modified_block ? TRUE : FALSE;
/* XXX - what if times have been shifted? */ /* XXX - what if times have been shifted? */
/* and save the packet */ /* and save the packet */
@ -4770,7 +4770,7 @@ cf_save_records(capture_file *cf, const char *fname, guint save_format,
// XXX: This also ignores non-comment options like verdict // XXX: This also ignores non-comment options like verdict
fdata->has_phdr_block = FALSE; fdata->has_phdr_block = FALSE;
fdata->has_user_block = FALSE; fdata->has_modified_block = FALSE;
} }
if (cf->provider.frames_edited_blocks) { if (cf->provider.frames_edited_blocks) {

2
file.h
View File

@ -706,7 +706,7 @@ wtap_block_t cf_get_packet_block(capture_file *cf, const frame_data *fd);
* @param fd the frame_data structure for the frame * @param fd the frame_data structure for the frame
* @param new_block the block replacing the old block * @param new_block the block replacing the old block
*/ */
gboolean cf_set_user_packet_block(capture_file *cf, frame_data *fd, wtap_block_t new_block); gboolean cf_set_modified_block(capture_file *cf, frame_data *fd, wtap_block_t new_block);
/** /**
* What types of comments does this file have? * What types of comments does this file have?

View File

@ -70,7 +70,7 @@ cap_file_provider_get_interface_description(struct packet_provider_data *prov, g
} }
wtap_block_t wtap_block_t
cap_file_provider_get_user_block(struct packet_provider_data *prov, const frame_data *fd) cap_file_provider_get_modified_block(struct packet_provider_data *prov, const frame_data *fd)
{ {
if (prov->frames_edited_blocks) if (prov->frames_edited_blocks)
return (wtap_block_t)g_tree_lookup(prov->frames_edited_blocks, fd); return (wtap_block_t)g_tree_lookup(prov->frames_edited_blocks, fd);
@ -80,7 +80,7 @@ cap_file_provider_get_user_block(struct packet_provider_data *prov, const frame_
} }
void void
cap_file_provider_set_user_block(struct packet_provider_data *prov, frame_data *fd, wtap_block_t new_block) cap_file_provider_set_modified_block(struct packet_provider_data *prov, frame_data *fd, wtap_block_t new_block)
{ {
if (!prov->frames_edited_blocks) if (!prov->frames_edited_blocks)
prov->frames_edited_blocks = g_tree_new_full(frame_cmp, NULL, NULL, (GDestroyNotify)wtap_block_unref); prov->frames_edited_blocks = g_tree_new_full(frame_cmp, NULL, NULL, (GDestroyNotify)wtap_block_unref);
@ -88,5 +88,5 @@ cap_file_provider_set_user_block(struct packet_provider_data *prov, frame_data *
/* insert new packet block */ /* insert new packet block */
g_tree_replace(prov->frames_edited_blocks, fd, (gpointer)new_block); g_tree_replace(prov->frames_edited_blocks, fd, (gpointer)new_block);
fd->has_user_block = TRUE; fd->has_modified_block = TRUE;
} }

View File

@ -241,7 +241,7 @@ sharkd_epan_new(capture_file *cf)
sharkd_get_frame_ts, sharkd_get_frame_ts,
cap_file_provider_get_interface_name, cap_file_provider_get_interface_name,
cap_file_provider_get_interface_description, cap_file_provider_get_interface_description,
cap_file_provider_get_user_block cap_file_provider_get_modified_block
}; };
return epan_new(&cf->provider, &funcs); return epan_new(&cf->provider, &funcs);
@ -769,25 +769,25 @@ sharkd_filter(const char *dftext, guint8 **result)
} }
/* /*
* Get the user block if available, nothing otherwise. * Get the modified block if available, nothing otherwise.
* Must be cloned if changes desired. * Must be cloned if changes desired.
*/ */
wtap_block_t wtap_block_t
sharkd_get_user_block(const frame_data *fd) sharkd_get_modified_block(const frame_data *fd)
{ {
return cap_file_provider_get_user_block(&cfile.provider, fd); return cap_file_provider_get_modified_block(&cfile.provider, fd);
} }
/* /*
* Gets the user block if available, otherwise the packet's default block, * Gets the modified block if available, otherwise the packet's default block,
* or a new packet block. * or a new packet block.
* User must wtap_block_unref() it when done. * User must wtap_block_unref() it when done.
*/ */
wtap_block_t wtap_block_t
sharkd_get_packet_block(const frame_data *fd) sharkd_get_packet_block(const frame_data *fd)
{ {
if (fd->has_user_block) if (fd->has_modified_block)
return wtap_block_ref(cap_file_provider_get_user_block(&cfile.provider, fd)); return wtap_block_ref(cap_file_provider_get_modified_block(&cfile.provider, fd));
if (fd->has_phdr_block) if (fd->has_phdr_block)
{ {
wtap_rec rec; /* Record metadata */ wtap_rec rec; /* Record metadata */
@ -814,9 +814,9 @@ sharkd_get_packet_block(const frame_data *fd)
} }
int int
sharkd_set_user_block(frame_data *fd, wtap_block_t new_block) sharkd_set_modified_block(frame_data *fd, wtap_block_t new_block)
{ {
cap_file_provider_set_user_block(&cfile.provider, fd, new_block); cap_file_provider_set_modified_block(&cfile.provider, fd, new_block);
return 0; return 0;
} }

View File

@ -36,9 +36,9 @@ int sharkd_filter(const char *dftext, guint8 **result);
frame_data *sharkd_get_frame(guint32 framenum); frame_data *sharkd_get_frame(guint32 framenum);
int sharkd_dissect_columns(frame_data *fdata, guint32 frame_ref_num, guint32 prev_dis_num, column_info *cinfo, gboolean dissect_color); int sharkd_dissect_columns(frame_data *fdata, guint32 frame_ref_num, guint32 prev_dis_num, column_info *cinfo, gboolean dissect_color);
int sharkd_dissect_request(guint32 framenum, guint32 frame_ref_num, guint32 prev_dis_num, sharkd_dissect_func_t cb, guint32 dissect_flags, void *data); int sharkd_dissect_request(guint32 framenum, guint32 frame_ref_num, guint32 prev_dis_num, sharkd_dissect_func_t cb, guint32 dissect_flags, void *data);
wtap_block_t sharkd_get_user_block(const frame_data *fd); wtap_block_t sharkd_get_modified_block(const frame_data *fd);
wtap_block_t sharkd_get_packet_block(const frame_data *fd); wtap_block_t sharkd_get_packet_block(const frame_data *fd);
int sharkd_set_user_block(frame_data *fd, wtap_block_t new_block); int sharkd_set_modified_block(frame_data *fd, wtap_block_t new_block);
const char *sharkd_version(void); const char *sharkd_version(void);
/* sharkd_daemon.c */ /* sharkd_daemon.c */

View File

@ -1444,9 +1444,9 @@ sharkd_session_process_frames(const char *buf, const jsmntok_t *tokens, int coun
sharkd_json_value_anyf("num", "%u", framenum); sharkd_json_value_anyf("num", "%u", framenum);
if (fdata->has_user_block || fdata->has_phdr_block) if (fdata->has_modified_block || fdata->has_phdr_block)
{ {
if (!fdata->has_user_block || sharkd_get_user_block(fdata) != NULL) if (!fdata->has_modified_block || sharkd_get_modified_block(fdata) != NULL)
sharkd_json_value_anyf("ct", "true"); sharkd_json_value_anyf("ct", "true");
} }
@ -3355,8 +3355,8 @@ sharkd_session_process_frame_cb(epan_dissect_t *edt, proto_tree *tree, struct ep
sharkd_json_result_prologue(rpcid); sharkd_json_result_prologue(rpcid);
if (fdata->has_user_block) if (fdata->has_modified_block)
pkt_block = sharkd_get_user_block(fdata); pkt_block = sharkd_get_modified_block(fdata);
else if (fdata->has_phdr_block) else if (fdata->has_phdr_block)
pkt_block = pi->rec->block; pkt_block = pi->rec->block;
@ -4241,7 +4241,7 @@ sharkd_session_process_setcomment(char *buf, const jsmntok_t *tokens, int count)
} }
else else
{ {
sharkd_set_user_block(fdata, pkt_block); sharkd_set_modified_block(fdata, pkt_block);
sharkd_json_simple_ok(rpcid); sharkd_json_simple_ok(rpcid);
} }

View File

@ -1415,7 +1415,7 @@ void PacketList::addPacketComment(QString new_comment)
QByteArray ba = new_comment.toLocal8Bit(); QByteArray ba = new_comment.toLocal8Bit();
wtap_block_add_string_option(pkt_block, OPT_COMMENT, ba.data(), ba.size()); wtap_block_add_string_option(pkt_block, OPT_COMMENT, ba.data(), ba.size());
cf_set_user_packet_block(cap_file_, fdata, pkt_block); cf_set_modified_block(cap_file_, fdata, pkt_block);
redrawVisiblePackets(); redrawVisiblePackets();
} }
@ -1441,7 +1441,7 @@ void PacketList::setPacketComment(guint c_number, QString new_comment)
wtap_block_set_nth_string_option_value(pkt_block, OPT_COMMENT, c_number, ba.data(), ba.size()); wtap_block_set_nth_string_option_value(pkt_block, OPT_COMMENT, c_number, ba.data(), ba.size());
} }
cf_set_user_packet_block(cap_file_, fdata, pkt_block); cf_set_modified_block(cap_file_, fdata, pkt_block);
redrawVisiblePackets(); redrawVisiblePackets();
} }
@ -1495,7 +1495,7 @@ void PacketList::deleteAllPacketComments()
for (i = 0; i < n_comments; i++) { for (i = 0; i < n_comments; i++) {
wtap_block_remove_nth_option_instance(pkt_block, OPT_COMMENT, 0); wtap_block_remove_nth_option_instance(pkt_block, OPT_COMMENT, 0);
} }
cf_set_user_packet_block(cap_file_, fdata, pkt_block); cf_set_modified_block(cap_file_, fdata, pkt_block);
} }
cap_file_->packet_comment_count = 0; cap_file_->packet_comment_count = 0;

View File

@ -60,11 +60,11 @@ export_pdu_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt, const
rec.rec_header.packet_header.pkt_encap = exp_pdu_tap_data->pkt_encap; rec.rec_header.packet_header.pkt_encap = exp_pdu_tap_data->pkt_encap;
/* rec.opt_block is not modified by wtap_dump, but if for some reason the /* rec.opt_block is not modified by wtap_dump, but if for some reason the
* epan_get_user_block() or pinfo->rec->block are invalidated, * epan_get_modified_block() or pinfo->rec->block are invalidated,
* copying it here does not hurt. (Can invalidation really happen?) */ * copying it here does not hurt. (Can invalidation really happen?) */
if (pinfo->fd->has_user_block) { if (pinfo->fd->has_modified_block) {
rec.block = epan_get_user_block(edt->session, pinfo->fd); rec.block = epan_get_modified_block(edt->session, pinfo->fd);
rec.has_block_changed = TRUE; rec.block_was_modified = TRUE;
} else if (pinfo->fd->has_phdr_block) { } else if (pinfo->fd->has_phdr_block) {
rec.block = pinfo->rec->block; rec.block = pinfo->rec->block;
} }

View File

@ -1982,11 +1982,11 @@ static gboolean erf_dump(
* construct a new header with additional Host ID and Anchor ID * construct a new header with additional Host ID and Anchor ID
* and insert a metadata record before that frame */ * and insert a metadata record before that frame */
/*XXX: The user may have changed the comment to cleared! */ /*XXX: The user may have changed the comment to cleared! */
if(rec->has_block_changed) { if(rec->block_was_modified) {
if (encap == WTAP_ENCAP_ERF) { if (encap == WTAP_ENCAP_ERF) {
/* XXX: What about ERF-in-pcapng with existing comment (that wasn't /* XXX: What about ERF-in-pcapng with existing comment (that wasn't
* modified)? */ * modified)? */
if(rec->has_block_changed) { if(rec->block_was_modified) {
memmove(&other_phdr, pseudo_header, sizeof(union wtap_pseudo_header)); memmove(&other_phdr, pseudo_header, sizeof(union wtap_pseudo_header));
if(!erf_write_anchor_meta_update_phdr(wdh, dump_priv, rec, &other_phdr, err)) return FALSE; if(!erf_write_anchor_meta_update_phdr(wdh, dump_priv, rec, &other_phdr, err)) return FALSE;
pseudo_header = &other_phdr; pseudo_header = &other_phdr;

View File

@ -1516,7 +1516,7 @@ wtap_init_rec(wtap *wth, wtap_rec *rec)
rec->rec_header.packet_header.pkt_encap = wth->file_encap; rec->rec_header.packet_header.pkt_encap = wth->file_encap;
rec->tsprec = wth->file_tsprec; rec->tsprec = wth->file_tsprec;
rec->block = NULL; rec->block = NULL;
rec->has_block_changed = FALSE; rec->block_was_modified = FALSE;
} }
gboolean gboolean
@ -1675,7 +1675,7 @@ wtap_rec_cleanup(wtap_rec *rec)
{ {
wtap_block_unref(rec->block); wtap_block_unref(rec->block);
rec->block = NULL; rec->block = NULL;
rec->has_block_changed = FALSE; rec->block_was_modified = FALSE;
ws_buffer_free(&rec->options_buf); ws_buffer_free(&rec->options_buf);
} }

View File

@ -1343,8 +1343,8 @@ typedef struct {
wtap_custom_block_header custom_block_header; wtap_custom_block_header custom_block_header;
} rec_header; } rec_header;
wtap_block_t block; /* packet block; holds comments and verdicts in its options */ wtap_block_t block ; /* packet block; holds comments and verdicts in its options */
gboolean has_block_changed; /* TRUE if ANY aspect of the block has changed */ gboolean block_was_modified; /* TRUE if ANY aspect of the block has been modified */
/* /*
* We use a Buffer so that we don't have to allocate and free * We use a Buffer so that we don't have to allocate and free