OSPFv1 - Open Shortest Path First Version 1¶
pcapkit.protocols.application.ospfv1.protocol contains
OSPFv1, which implements an
extractor for Open Shortest Path First version 1 (OSPFv1) [RFC 1131], obsoleted
by RFC 1247. Its header (RFC 1131 Section A.2) is laid out as OSPFv2’s:
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 |
|
Authentication Type |
16 |
128 |
|
Authentication |
It defines packet types 1 to 5 alone (Section A.2) and AuType 0 and 1 alone
(Appendix E), which Packet and
Authentication name, rather than OSPFv2’s
IANA registries. Its Authentication field is kept as captured: the cryptographic
authentication of RFC 2328 Appendix D.3 is OSPFv2’s.
Added in version 1.8.1.
- class pcapkit.protocols.application.ospfv1.protocol.OSPFv1(file, length=None, /, *, version=None, layer=None, protocol=None, context=None)[source]¶
-
This class implements Open Shortest Path First version 1.
Added in version 1.8.1.
Properties
Methods
- read(length=None, **kwargs)[source]¶
Read Open Shortest Path First version 1.
Structure of OSPFv1 header [RFC 1131]:
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 | AuType | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Authentication | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Authentication | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters:
- Return type:
- Returns:
Parsed packet data.
- Raises:
ProtocolError – If the Version is not 1.
- make(*, version=1, type=Packet.Hello, packet_length=None, router_id='0.0.0.0', area_id='0.0.0.0', checksum=None, auth_type=Authentication.No_authentication, auth_data=b'\x00\x00\x00\x00\x00\x00\x00\x00', payload=b'', trailer=b'', **kwargs)[source]¶
Make (construct) packet data.
- Parameters:
version (
int) – OSPF version number,1.packet_length (
int|None) – Packet length (header included). If not given, it is computed as 24 plus the length ofpayload.router_id (
IPv4Address|str|bytes) – Router ID.area_id (
IPv4Address|str|bytes) – Area ID.checksum (
bytes|None) – Checksum; ifNoneandCHECKSUM_COMPUTEis on, computed over the packet but its Authentication field (RFC 1131 Section A.2); zero otherwise.auth_type (
Authentication|int) – Authentication type.auth_data (
bytes) – Authentication data, 8 octets.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 1; ifauth_datais not 8 octets ofbytes; ifpacket_lengthis not anintin0..65535; ifchecksumis not two octets; or iftype(8 bits) orauth_type(16 bits) is a name, abool, or a member or code its field cannot carry.
Data Models
Utilities
Header Schemas¶
- class pcapkit.protocols.application.ospfv1.schema.OSPFv1(version=NO_VALUE, type=NO_VALUE, length=NO_VALUE, router_id=NO_VALUE, area_id=NO_VALUE, checksum=NO_VALUE, auth_type=NO_VALUE, auth_data=NO_VALUE, payload=NO_VALUE, trailer=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for OSPFv1 packet: the 24-octet header of RFC 1131 Section A.2, laid out as OSPFv2’s.
RFC 1131 defines AuType 0 and 1 alone (Appendix E), as
Authenticationnames them, and each leaves the 64-bit Authentication field to the scheme, so the field is kept as its octets whatever the AuType.Added in version 1.8.1.
- router_id: IPv4Address = <IPv4AddressField router_id>¶
Router ID.
- area_id: IPv4Address = <IPv4AddressField area_id>¶
Area ID.
- auth_type: Authentication = <EnumField auth_type>¶
Authentication type.
- trailer: bytes = <PayloadField trailer>¶
Octets captured past the Packet Length; compare
OSPFv2.trailer.
Data Models¶
- class pcapkit.protocols.application.ospfv1.data.OSPFv1(version, type, len, router_id, area_id, chksum, autype, auth)[source]¶
Bases:
ProtocolData model for OSPFv1 packet (RFC 1131 Section A.2).
Added in version 1.8.1.
- router_id: IPv4Address¶
Router ID.
- area_id: IPv4Address¶
Area ID.
- autype: Authentication¶
Authentication type.
- checksum_status: ChecksumStatus¶
Outcome of verifying
chksum, present only whenCHECKSUM_VERIFYis on.