Rich Lane | 8f2861e | 2013-01-11 09:13:20 -0800 | [diff] [blame] | 1 | # Imported from scapy at revision 1270:113ef25f9583 |
| 2 | # This file is not included in the Ubuntu packages of scapy, so it is checked |
| 3 | # in to our repo to simplify installation. This file is under the GPLv2. |
| 4 | |
| 5 | # http://trac.secdev.org/scapy/ticket/31 |
| 6 | |
| 7 | # scapy.contrib.description = MPLS |
| 8 | # scapy.contrib.status = loads |
| 9 | |
| 10 | from scapy.packet import Packet,bind_layers |
| 11 | from scapy.fields import BitField,ByteField |
| 12 | from scapy.layers.l2 import Ether |
| 13 | |
| 14 | class MPLS(Packet): |
| 15 | name = "MPLS" |
| 16 | fields_desc = [ BitField("label", 3, 20), |
| 17 | BitField("cos", 0, 3), |
| 18 | BitField("s", 1, 1), |
| 19 | ByteField("ttl", 0) ] |
| 20 | |
| 21 | bind_layers(Ether, MPLS, type=0x8847) |
| 22 | |
| 23 | # Not in upstream scapy |
| 24 | bind_layers(MPLS, MPLS, s=0) |