This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

How to set config to cut off captured packet length is larger than frame.cap_len

0

while we captured the packet, we want wireshark cut off the packet when the packet len is larger than frame.cap_len, is there any config in wireshark ui or commands parameter?

asked 22 Nov '16, 01:25

neil_hao's gravatar image

neil_hao
26101114
accept rate: 0%

edited 22 Nov '16, 01:26


2 Answers:

1

Go Capture -> Options (or click the target symbol directly) to open the list of capture interfaces. At the row representing the interface on which you are going to capture, double-click the word default in column Snaplen (B), change the 65535 value to 128, and press Enter. From now on, capture on this interface will be limited to 128 bytes per captured frame.

This instruction applies to Qt version of Wireshark. For GTK+ (legacy) Wireshark, the exact layout may differ, but the functionality is available too.

answered 22 Nov '16, 04:28

sindy's gravatar image

sindy
6.0k4851
accept rate: 24%

edited 22 Nov '16, 04:29

And if @Jaap has understood you better than me - Wireshark does not allow to truncate already captured packets when saving the capture to a file. The truncation must be done already while capturing. To reduce packet length in an existing capture file, a command-line command editcap -C 128:65535 infile outfile may be the way to do that.

(22 Nov '16, 04:43) sindy

1

By definition the packet is 'cut short' to the capture length, as this is the amount of octets captured for that frame.

If you seek to have the 'reported length', ie. length incurred from a packet header field, changed then that is not possible. Wireshark shows you the frame data as it is, without modification, and is capable of handling 'cut short' packets.

answered 22 Nov '16, 01:46

Jaap's gravatar image

Jaap ♦
11.7k16101
accept rate: 14%

we do not want modify ie in packet header field, but we want cut short the captured data packet len while we capture some pcap file . such as when the frame.cap_len is 128, we only want wireshark save the packets as 128 bytes. but in some sense. wireshark may save packets larger than 128 bytes by default configration.

(22 Nov '16, 03:51) neil_hao
1

You've got things the wrong way around. frame.cap_len is the result of a capture action, not the cause of it.

If you want to limit the amount of octets captured by Wireshark then go to menu Capture | Options..., and in the dialog set the value in the column 'snaplen' of your capture interface to the value you desire. 'Default' represents the value of 65535.

(22 Nov '16, 04:31) Jaap ♦