blob: 2754e87ea666245ee3ee8a5b0f24fe25c2b2261d [file] [log] [blame]
Sreeju Sreedhare3fefd92019-04-02 15:57:15 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
17# Imported from scapy at revision 1270:113ef25f9583
18# This file is not included in the Ubuntu packages of scapy, so it is checked
19# in to our repo to simplify installation. This file is under the GPLv2.
20
21# http://trac.secdev.org/scapy/ticket/31
22
23# scapy.contrib.description = MPLS
24# scapy.contrib.status = loads
25
26from scapy.packet import Packet,bind_layers
27from scapy.fields import BitField,ByteField
28from scapy.layers.l2 import Ether
29
30class MPLS(Packet):
31 name = "MPLS"
32 fields_desc = [ BitField("label", 3, 20),
33 BitField("cos", 0, 3),
34 BitField("s", 1, 1),
35 ByteField("ttl", 0) ]
36
37bind_layers(Ether, MPLS, type=0x8847)
38
39# Not in upstream scapy
40bind_layers(MPLS, MPLS, s=0)