blob: f3293e8eee27cf6daa667490e247e468a2220e01 [file] [log] [blame]
Neale Rannsad422ed2016-11-02 14:20:04 +00001diff --git a/scapy/contrib/mpls.py b/scapy/contrib/mpls.py
Neale Rannsd792d9c2017-10-21 10:53:20 -07002index 640a0c5..944723a 100644
Neale Rannsad422ed2016-11-02 14:20:04 +00003--- a/scapy/contrib/mpls.py
4+++ b/scapy/contrib/mpls.py
Neale Rannsd792d9c2017-10-21 10:53:20 -07005@@ -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):
Neale Rannsad422ed2016-11-02 14:20:04 +000014
15 def guess_payload_class(self, payload):
Neale Rannsd792d9c2017-10-21 10:53:20 -070016- 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
Neale Ranns71275e32017-05-25 12:38:58 -070033@@ -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)