With truncated packets, len(pkt) is the truncated length, rather than the actual frame length.
I'm not aware of any good approach to get the original length. If only IP and IPv6 packets are of interest, using L3 size like p.payload.plen+40 if isinstance(p.payload, IPv6) else (p.payload.len if isinstance(p.payload, IP) else len(p)) could be a walkaround.
https://github.com/chicago-cdac/netml/blob/b895f6e4cbde6f08c61d0bdb28ea18dfbbf29bbe/src/netml/pparser/parser.py#L391-L398
With truncated packets, len(pkt) is the truncated length, rather than the actual frame length.
I'm not aware of any good approach to get the original length. If only IP and IPv6 packets are of interest, using L3 size like
p.payload.plen+40 if isinstance(p.payload, IPv6) else (p.payload.len if isinstance(p.payload, IP) else len(p))could be a walkaround.https://github.com/chicago-cdac/netml/blob/b895f6e4cbde6f08c61d0bdb28ea18dfbbf29bbe/src/netml/pparser/parser.py#L391-L398