Philippe Biondi | 22 Jun 2011 21:51

Re: show2() and self.__class__ question

Hi,

On Wed, 22 Jun 2011, Jill Kaminski wrote:

> I have created a new file named mpls.py under the layers/ directory to define 
> two new layers: MPLS and MPLS_MULTI.

First, be aware that there already exist the begining of a mpls extension 
in latest versions in contrib/mpls.py. However, I guess your work could 
enrich the existing implementation. Also, you'd better create new 
protocols in contrib/ so that I can easily distribute them in new 
releases.

> They are working properly, except when I have an MPLS_MULTI() after an 
> MPLS(), as in a = MPLS() / MPLS_MULTI().
> If I call a.show2(), the MPLS_MULTI layer is displayed as an MPLS.

You have an ambiguity here:

> bind_layers( MPLS,          MPLS,          bottom_of_stack=0 )
> bind_layers( MPLS,          MPLS_MULTI,    bottom_of_stack=0 )
> bind_layers( MPLS_MULTI,    MPLS,          bottom_of_stack=0 )
> bind_layers( MPLS_MULTI,    MPLS_MULTI,    bottom_of_stack=0 )

when bottom_of_stack=0, which should be the next header ? There is no way 
to choose. Scapy takes first one: MPLS.

---------------------------------------------------------------------
To unsubscribe, send a mail to scapy.ml-unsubscribe <at> secdev.org


Gmane