A zero snaplen means "snaplen unknown", as in "the file format from

which we read the data to be written doesn't record the snapshot
length".  A snapshot length of 0 in a pcap or pcap-ng file is not
handled well by many programs reading those files; for pcap files, we
write out WTAP_MAX_PACKET_SIZE as the snapshot length in that case, so
do so for pcap-ng files as well.

svn path=/trunk/; revision=38790
This commit is contained in:
Guy Harris 2011-08-30 06:01:44 +00:00
parent 0cf099392c
commit 4486bb9d85
1 changed files with 2 additions and 1 deletions

View File

@ -1958,7 +1958,8 @@ static gboolean pcapng_dump(wtap_dumper *wdh,
wblock.file_encap = NULL;
wblock.type = BLOCK_TYPE_IDB;
wblock.data.if_descr.link_type = wtap_wtap_encap_to_pcap_encap(phdr->pkt_encap);
wblock.data.if_descr.snap_len = wdh->snaplen; /* XXX */
wblock.data.if_descr.snap_len = (wdh->snaplen != 0) ? wdh->snaplen :
WTAP_MAX_PACKET_SIZE; /* XXX */
/* XXX - options unused */
wblock.data.if_descr.if_speed = -1;