1 diff --git a/scapy/contrib/bier.py b/scapy/contrib/bier.py
5 +++ b/scapy/contrib/bier.py
7 +# http://trac.secdev.org/scapy/ticket/31
9 +# scapy.contrib.description = BIER
10 +# scapy.contrib.status = loads
12 +from scapy.packet import *
13 +from scapy.fields import *
14 +from scapy.layers.inet import IP, UDP
15 +from scapy.layers.inet6 import IPv6
26 +BIERnhcls = {1: "MPLS",
34 + fields_desc = [BitField("bsl", 0, 4),
35 + BitField("sd", 0, 8),
36 + BitField("set", 0, 8),
37 + BitField("cos", 0, 3),
38 + BitField("s", 1, 1),
39 + ByteField("ttl", 0)]
44 + fields_desc = [BitField("id", 5, 4),
45 + BitField("version", 0, 4),
46 + BitFieldLenField("length", BIERLength.BIER_LEN_256, 4,
47 + length_of=lambda x:(x.BitString >> 8)),
48 + BitField("entropy", 0, 20),
49 + BitField("OAM", 0, 2),
50 + BitField("RSV", 0, 2),
51 + BitField("DSCP", 0, 6),
52 + BitEnumField("Proto", 2, 6, BIERnhcls),
53 + ShortField("BFRID", 0),
54 + StrLenField("BitString",
56 + length_from=lambda x:(8 << x.length))]
59 +bind_layers(BIER, IP, Proto=4)
60 +bind_layers(BIER, IPv6, Proto=5)
61 +bind_layers(UDP, BIFT, dport=8138)
62 +bind_layers(BIFT, BIER)