diff --git a/scapy/contrib/mpls.py b/scapy/contrib/mpls.py index 8041562a1..732cf2a11 100644 --- a/scapy/contrib/mpls.py +++ b/scapy/contrib/mpls.py @@ -41,3 +41,4 @@ class MPLS(Packet): bind_layers(Ether, MPLS, type=0x8847) bind_layers(GRE, MPLS, proto=0x8847) +bind_layers(MPLS, MPLS, s=0) diff --git a/test/regression.uts b/test/regression.uts index bf50c24b0..02e741310 100644 --- a/test/regression.uts +++ b/test/regression.uts @@ -8492,3 +8492,20 @@ class Test(Packet): pkt = Test(str(Test(Values=[0, 0, 0, 0, 1, 1, 1, 1]))) assert(pkt.BitCount == 8) assert(pkt.ByteCount == 1) + +############ +############ ++ MPLS tests + += MPLS - build/dissection +from scapy.contrib.mpls import MPLS +p1 = MPLS()/IP()/UDP() +assert(p1[MPLS].s == 1) +p2 = MPLS()/MPLS()/IP()/UDP() +assert(p2[MPLS].s == 0) + +p1[MPLS] +p1[IP] +p2[MPLS] +p2[MPLS:1] +p2[IP]