New version length checks & packets captured with a smaller snaplen #90
-
Hi @JulianSchmid, first of all thank you for the huge work behind v0.14. I noticed that now when packets have a smaller length than expected, an error is returned. The solution I figured out is to use instead Can you confirm that this strategy produces consistent results with In particular, there is one item of the
From the description it seems that in case the length is inconsistent, the length of the snapped packet would be used. So the result is what I expect, it's just that description that's leaving me with a doubt. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @GyulyVGC , First thanks for the thank you 😄.
But that does not explain what you describe here:
It should be equal or less. More data should appear, or at least etherparse (hopefully) should not be the root case of that. And if so, that would be a bug I would need to fix. Maybe the snaplen has an lower limit? How do you get the packet length? Is there some specific part you use (e.g. the returned "rest" slice)? Then I could have a quick look if there is an issue. Greets |
Beta Was this translation helpful? Give feedback.
Ah now I understand the question better. Etherparse will not modify any fields of the original headers, it only modifies the length of the slice stored in "LaxPacketHeaders::payload". The headers will be decoded with the original values (even if they are inconsistent).
So yes, reading the
Ipv6Hedaer::payload_len
&Ip4Header::total_len
will still give you the length of the original packet, even if the overall packet has been cut off.