OSPFv3 - Open Shortest Path First Version 3¶
pcapkit.protocols.application.ospfv3.protocol contains
OSPFv3, which implements an
extractor for OSPF for IPv6 (OSPFv3) [RFC 5340], whose 16-octet header
(RFC 5340 Appendix A.3.1) has an Instance ID and a reserved octet in place of
OSPFv2’s AuType and Authentication:
Octets |
Bits |
Name |
Description |
|---|---|---|---|
0 |
0 |
|
Version Number |
1 |
8 |
|
Type |
2 |
16 |
|
Packet Length (header included) |
4 |
32 |
|
Router ID |
8 |
64 |
|
Area ID |
12 |
96 |
|
Checksum |
14 |
112 |
|
Instance ID |
15 |
120 |
|
Reserved |
Added in version 1.8.1.
- class pcapkit.protocols.application.ospfv3.protocol.OSPFv3(file, length=None, /, *, version=None, layer=None, protocol=None, context=None)[source]¶
-
This class implements OSPF for IPv6 (OSPF version 3).
Its checksum covers an IPv6 pseudo-header (RFC 5340 Appendix A.3.1), so it is neither verified nor computed.
Added in version 1.8.1.
Properties
Methods
- read(length=None, **kwargs)[source]¶
Read OSPF for IPv6.
Structure of OSPFv3 header [RFC 5340]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Version # | Type | Packet length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Router ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Area ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Checksum | Instance ID | 0 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters:
- Return type:
- Returns:
Parsed packet data.
- Raises:
ProtocolError – If the Version is not 3.
- make(*, version=3, type=Packet.Hello, packet_length=None, router_id='0.0.0.0', area_id='0.0.0.0', checksum=None, instance_id=0, reserved=b'\x00', payload=b'', trailer=b'', **kwargs)[source]¶
Make (construct) packet data.
- Parameters:
version (
int) – OSPF version number,3.packet_length (
int|None) – Packet length (header included). If not given, it is computed as 16 plus the length ofpayload.router_id (
IPv4Address|str|bytes) – Router ID.area_id (
IPv4Address|str|bytes) – Area ID.checksum (
bytes|None) – Checksum, zero ifNone: it covers an IPv6 pseudo-header, so none is computed.instance_id (
int) – Instance ID.reserved (
bytes) – The reserved octet after the Instance ID.payload (
bytes|ProtocolBase|Schema) – Payload data.trailer (
bytes) – Octets after the packet, outside the Packet Length; written as is.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed packet data.
- Raises:
ProtocolError – If
versionis not 3; ifpacket_lengthis not anintin0..65535; ifchecksumis not two octets; ifinstance_idis not anintin0..255; ifreservedis not one octet; or iftypeis a name, abool, or a member or code its 8 bits cannot carry.
Data Models
Utilities
Header Schemas¶
- class pcapkit.protocols.application.ospfv3.schema.OSPFv3(version=NO_VALUE, type=NO_VALUE, length=NO_VALUE, router_id=NO_VALUE, area_id=NO_VALUE, checksum=NO_VALUE, instance_id=NO_VALUE, reserved=NO_VALUE, payload=NO_VALUE, trailer=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for OSPFv3 packet: the 16-octet header of RFC 5340 Appendix A.3.1, which has an Instance ID and a reserved octet in place of OSPFv2’s AuType and Authentication fields.
Added in version 1.8.1.
- router_id: IPv4Address = <IPv4AddressField router_id>¶
Router ID.
- area_id: IPv4Address = <IPv4AddressField area_id>¶
Area ID.
- trailer: bytes = <PayloadField trailer>¶
Octets captured past the Packet Length; compare
OSPFv2.trailer.
Data Models¶
- class pcapkit.protocols.application.ospfv3.data.OSPFv3(version, type, len, router_id, area_id, chksum, instance_id, reserved)[source]¶
Bases:
ProtocolData model for OSPFv3 packet (RFC 5340 Appendix A.3.1).
Added in version 1.8.1.
- router_id: IPv4Address¶
Router ID.
- area_id: IPv4Address¶
Area ID.