Exemple #1
0
class ISIS_Ipv6Prefix(Packet):
    name = "ISIS IPv6 Prefix"
    fields_desc = [
        IntField("metric", 1),
        BitField("updown", 0, 1),
        BitField("external", 0, 1),
        BitField("subtlvindicator", 0, 1),
        BitField("reserved", 0, 5),
        FieldLenField("pfxlen", None, length_of="pfx", fmt="B"),
        IP6PrefixField("pfx",
                       None,
                       wordbytes=1,
                       length_from=lambda x: x.pfxlen),  # noqa: E501
        ConditionalField(
            FieldLenField("subtlvslen", None, length_of="subtlvs", fmt="B"),
            lambda pkt: pkt.subtlvindicator == 1),  # noqa: E501
        ConditionalField(
            PacketListField("subtlvs", [],
                            _ISIS_GuessSubTlvClass_2,
                            length_from=lambda x: x.subtlvslen),
            lambda pkt: pkt.subtlvindicator == 1)  # noqa: E501
    ]

    def extract_padding(self, s):
        return "", s
Exemple #2
0
class OSPFv3_AS_External_LSA(OSPF_BaseLSA):
    name = "OSPFv3 AS External LSA"
    fields_desc = [
        ShortField("age", 1),
        ShortEnumField("type", 0x4005, _OSPFv3_LStypes),
        IPField("id", "0.0.0.0"),
        IPField("adrouter", "1.1.1.1"),
        XIntField("seq", 0x80000001),
        XShortField("chksum", None),
        ShortField("len", None),
        FlagsField("flags", 0, 8, ["T", "F", "E"]),
        X3BytesField("metric", 20),
        FieldLenField("prefixlen", None, length_of="prefix",
                      fmt="B"),  # noqa: E501
        OSPFv3PrefixOptionsField(),
        ShortEnumField("reflstype", 0, _OSPFv3_LStypes),
        IP6PrefixField("prefix",
                       "2001:db8:0:42::/64",
                       wordbytes=4,
                       length_from=lambda pkt: pkt.prefixlen),  # noqa: E501
        ConditionalField(IP6Field("fwaddr", "::"),
                         lambda pkt: pkt.flags & 0x02 == 0x02),  # noqa: E501
        ConditionalField(IntField("tag", 0),
                         lambda pkt: pkt.flags & 0x01 == 0x01),  # noqa: E501
        ConditionalField(IPField("reflsid", 0), lambda pkt: pkt.reflstype != 0)
    ]  # noqa: E501
Exemple #3
0
class OSPFv3_Prefix_Item(Packet):
    name = "OSPFv3 Link Prefix Item"
    fields_desc = [FieldLenField("prefixlen", None, length_of="prefix", fmt="B"),  # noqa: E501
                   OSPFv3PrefixOptionsField(),
                   ShortField("metric", 10),
                   IP6PrefixField("prefix", "2001:db8:0:42::/64", wordbytes=4, length_from=lambda pkt: pkt.prefixlen)]  # noqa: E501

    def extract_padding(self, s):
        return "", s
Exemple #4
0
class OSPFv3_Inter_Area_Prefix_LSA(OSPF_BaseLSA):
    name = "OSPFv3 Inter Area Prefix LSA"
    fields_desc = [ShortField("age", 1),
                   ShortEnumField("type", 0x2003, _OSPFv3_LStypes),
                   IPField("id", "0.0.0.0"),
                   IPField("adrouter", "1.1.1.1"),
                   XIntField("seq", 0x80000001),
                   XShortField("chksum", None),
                   ShortField("len", None),
                   ByteField("reserved", 0),
                   X3BytesField("metric", 10),
                   FieldLenField("prefixlen", None, length_of="prefix", fmt="B"),  # noqa: E501
                   OSPFv3PrefixOptionsField(),
                   ShortField("reserved2", 0),
                   IP6PrefixField("prefix", "2001:db8:0:42::/64", wordbytes=4, length_from=lambda pkt: pkt.prefixlen)]  # noqa: E501