BIER
[vpp.git] / test / patches / scapy-2.3.3 / mpls.py.patch
1 diff --git a/scapy/contrib/mpls.py b/scapy/contrib/mpls.py
2 index 640a0c5..944723a 100644
3 --- a/scapy/contrib/mpls.py
4 +++ b/scapy/contrib/mpls.py
5 @@ -6,6 +6,7 @@
6  from scapy.packet import Packet, bind_layers, Padding
7  from scapy.fields import BitField,ByteField
8  from scapy.layers.inet import IP
9 +from scapy.contrib.bier import BIER
10  from scapy.layers.inet6 import IPv6
11  from scapy.layers.l2 import Ether, GRE
12  
13 @@ -17,9 +18,12 @@ class MPLS(Packet):
14  
15     def guess_payload_class(self, payload):
16 -       if len(payload) >= 1:
17 -           ip_version = (ord(payload[0]) >> 4) & 0xF
18 -           if ip_version == 4:
19 -               return IP
20 -           elif ip_version == 6:
21 -               return IPv6
22 -       return Padding
23 +         if not self.s:
24 +             return MPLS
25 +         ip_version = (ord(payload[0]) >> 4) & 0xF
26 +         if ip_version == 4:
27 +            return IP
28 +         elif ip_version == 5:
29 +            return BIER
30 +         elif ip_version == 6:
31 +            return IPv6
32 +         return Padding
33 @@ -27,3 +29,4 @@ class MPLS(Packet):
34  
35  bind_layers(Ether, MPLS, type=0x8847)
36  bind_layers(GRE, MPLS, proto=0x8847)
37 +bind_layers(MPLS, MPLS, s=0)