Preserve .overloaded_fields in .clone_with()

This fixes at least an issue fragmentation (for which a new test
has been added)
This commit is contained in:
Pierre LALET 2016-12-23 01:14:12 +01:00
parent 3579d73657
commit 9f2861fdbd
2 changed files with 7 additions and 0 deletions

View File

@ -656,6 +656,7 @@ Creates an EPS file describing a packet. If filename is not provided a temporary
pkt.explicit = 1
pkt.fields = kargs
pkt.default_fields = self.copy_fields_dict(self.default_fields)
pkt.overloaded_fields = self.overloaded_fields.copy()
pkt.time = self.time
pkt.underlayer = self.underlayer
pkt.post_transforms = self.post_transforms

View File

@ -4781,6 +4781,12 @@ assert frags[-1].flags == 0
assert all(len(p.payload) == 8 for p in frags[:-1])
assert len(frags[-1].payload) == ((payloadlen % fragsize) or fragsize)
= fragment() and overloaded_fields
pkt1 = Ether() / IP() / UDP()
pkt2 = fragment(pkt1)[0]
pkt3 = pkt2.__class__(str(pkt2))
assert pkt1[IP].proto == pkt2[IP].proto == pkt3[IP].proto
= defragment()
defrags = defragment(frags)
* we should have one single packet