From cc02b632bbf412f306df4bb609fbcb92ebf95283 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Thu, 25 May 2017 12:36:22 -0700 Subject: [PATCH] MPLS label layering/stacking clears the EOS bit Signed-off-by: Neale Ranns --- scapy/contrib/mpls.py | 1 + test/regression.uts | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) 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]