Remove redundant members from wtap_syscall_header.

No need for len, and call caplen event_filelen and move it after
event_len.

Change-Id: I8b3825d4022ee083ee52f83f7a69f22829ed9fc4
Reviewed-on: https://code.wireshark.org/review/25698
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2018-02-08 18:38:22 -08:00
parent 1f5f63f8ef
commit 9425d6e901
4 changed files with 18 additions and 18 deletions

View File

@ -1718,7 +1718,7 @@ main(int argc, char *argv[])
break;
case REC_TYPE_SYSCALL:
caplen = rec->rec_header.syscall_header.caplen;
caplen = rec->rec_header.syscall_header.event_filelen;
do_mutation = TRUE;
break;
}

View File

@ -180,14 +180,16 @@ frame_data_init(frame_data *fdata, guint32 num, const wtap_rec *rec,
* XXX
*/
fdata->pkt_len = 0;
fdata->cum_bytes = 0;
fdata->cap_len = 0;
break;
case REC_TYPE_SYSCALL:
fdata->pkt_len = rec->rec_header.syscall_header.len;
fdata->cum_bytes = cum_bytes + rec->rec_header.syscall_header.len;
fdata->cap_len = rec->rec_header.syscall_header.caplen;
/*
* XXX - is cum_bytes supposed to count non-packet bytes?
*/
fdata->pkt_len = rec->rec_header.syscall_header.event_len;
fdata->cum_bytes = cum_bytes + rec->rec_header.syscall_header.event_len;
fdata->cap_len = rec->rec_header.syscall_header.event_filelen;
break;
}

View File

@ -2279,8 +2279,7 @@ pcapng_read_sysdig_event_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *p
wblock->rec->ts.secs = (time_t) (ts / 1000000000);
wblock->rec->ts.nsecs = (int) (ts % 1000000000);
wblock->rec->rec_header.syscall_header.caplen = block_read;
wblock->rec->rec_header.syscall_header.len = wblock->rec->rec_header.syscall_header.event_len;
wblock->rec->rec_header.syscall_header.event_filelen = block_read;
/* "Sysdig Event Block" read event data */
if (!wtap_read_packet_bytes(fh, wblock->frame_buffer,
@ -3236,13 +3235,13 @@ pcapng_write_sysdig_event_block(wtap_dumper *wdh, const wtap_rec *rec,
guint16 event_type;
/* Don't write anything we're not willing to read. */
if (rec->rec_header.syscall_header.caplen > WTAP_MAX_PACKET_SIZE_STANDARD) {
if (rec->rec_header.syscall_header.event_filelen > WTAP_MAX_PACKET_SIZE_STANDARD) {
*err = WTAP_ERR_PACKET_TOO_LARGE;
return FALSE;
}
if (rec->rec_header.syscall_header.caplen % 4) {
pad_len = 4 - (rec->rec_header.syscall_header.caplen % 4);
if (rec->rec_header.syscall_header.event_filelen % 4) {
pad_len = 4 - (rec->rec_header.syscall_header.event_filelen % 4);
} else {
pad_len = 0;
}
@ -3267,7 +3266,7 @@ pcapng_write_sysdig_event_block(wtap_dumper *wdh, const wtap_rec *rec,
/* write sysdig event block header */
bh.block_type = BLOCK_TYPE_SYSDIG_EVENT;
bh.block_total_length = (guint32)sizeof(bh) + SYSDIG_EVENT_HEADER_SIZE + rec->rec_header.syscall_header.caplen + pad_len + options_total_length + 4;
bh.block_total_length = (guint32)sizeof(bh) + SYSDIG_EVENT_HEADER_SIZE + rec->rec_header.syscall_header.event_filelen + pad_len + options_total_length + 4;
if (!wtap_dump_file_write(wdh, &bh, sizeof bh, err))
return FALSE;
@ -3302,9 +3301,9 @@ pcapng_write_sysdig_event_block(wtap_dumper *wdh, const wtap_rec *rec,
wdh->bytes_dumped += sizeof event_type;
/* write event data */
if (!wtap_dump_file_write(wdh, pd, rec->rec_header.syscall_header.caplen, err))
if (!wtap_dump_file_write(wdh, pd, rec->rec_header.syscall_header.event_filelen, err))
return FALSE;
wdh->bytes_dumped += rec->rec_header.syscall_header.caplen;
wdh->bytes_dumped += rec->rec_header.syscall_header.event_filelen;
/* write padding (if any) */
if (pad_len != 0) {

View File

@ -1258,15 +1258,14 @@ typedef struct {
typedef struct {
guint record_type; /* XXX match ft_specific_record_phdr so that we chain off of packet-pcapng_block for now. */
guint32 caplen; /* data length in the file */
guint32 len; /* data length on the wire */
int byte_order;
guint16 cpu_id;
/* guint32 sentinel; */
guint64 timestamp; /* ns since epoch */
guint64 timestamp; /* ns since epoch - XXX dup of ts */
guint64 thread_id;
guint32 event_len; /* XXX dup of wtap_pkthdr.len */
guint32 event_len; /* length of the event */
guint32 event_filelen; /* event data length in the file */
guint16 event_type;
guint16 cpu_id;
/* ... Event ... */
} wtap_syscall_header;