Closed ebertland closed 6 years ago
Based on your description is assume the callflow (by ovverwriting bin()) is: "overwritten bin()" -> "super.bin()" -> _update_fields() -> "overwritten bin() returns response of super.bin() + padding", so the padding isn't considered in _update_fields(). One option would be something like:
def bin(self, update_auto_fields=True):
# TODO: change body length to multiple of 4
return pypacker.Packet.bin(self, update_auto_fields=update_auto_fields)
Update: Length should be updated now with current master
Response timeout, closing ticket.
In a custom layer5 protocol, I added variable padding to ensure that the number of bytes of the payload (body bytes of the TCP segment) is a multiple of 4. I followed an example and did this by adding the pad byte string to the end in the protocol's bin() implementation. The IP.len is not recomputed after this, so it is always off by the size of the variable pad.
I tried both released version 4.0 and the current HEAD of master.