Skip to content

Duplication of dissect in show2() in case Packet was made from buffer. #619

@ybrustin

Description

@ybrustin

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions