-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
Description
Hi,
In case Packet was initialized from buffer (__init__ with _pkt ), dissect was already done.
show2() currently will do the dissect again, which looks redundant to me.
What about idea of adding such conceptual check inside show2():
if self.explicit:
self.show(...)
else:
self.__class__(...).show(...) # current behaviour
EDIT:
It's bad idea "as is", payloads (or payloads of payloads etc.) might have been changed.
It could work however if all the layers of packet are not changed a.k.a. explicit.
Something like adding new function:
def is_whole_explicit(self):
l = self
while l:
if not l.explicit:
return False
l = l.payload
return True
...and then, use it as criteria in show2() to determine if we need to use __class__ and dissect again or use the show() on the packet.
Thanks,
Yaroslav.
Reactions are currently unavailable