oam

package
v0.739.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package oam decodes Ethernet OAM / Connectivity Fault Management (CFM) frames — IEEE 802.1ag / ITU-T Y.1731, EtherType 0x8902. It is an L2 service-topology reconnaissance source and so joins the project's LAN decoder family (dtp, vtp, vqp, gxrp, stp, maccontrol): the Continuity Check Message (CCM) is a multicast frame a maintenance endpoint emits continuously, and it advertises the Maintenance Domain **level**, the Maintenance Entity Group (**MEG / MA**) identifier and the source **MEP ID** — so a captured CCM stream maps out the L2 maintenance topology (which bridges are MEPs, at which MD level, in which maintenance association), and the RDI flag flags a remote defect. Loopback (LBM/LBR) and Linktrace (LTM/LTR) are the L2 ping / traceroute of the same framework.

Wrap-vs-native judgement

Native. A CFM PDU is a 4-byte common header (MD level + version,
opcode, flags, TLV offset) followed by an opcode-specific body and a
TLV list. A byte-field read + an opcode switch; stdlib only, no new
go.mod dep.

Verifiable / no confidently-wrong output

The common header and the CCM body (sequence / MEP ID / MEG ID) were
verified field-for-field against scapy's OAM layer
(scapy.contrib.oam). CFM defines 24 opcodes with varied,
often-vendor-extended bodies, so only the universally-present common
header (decoded for every opcode, naming the OAM function and MD
level) and the CCM body (the recon headline) are decoded; every other
opcode's body, and the trailing TLV list, are surfaced as raw hex
with the opcode named — never guessed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	MDLevel    int    `json:"md_level"`
	Version    int    `json:"version"`
	Opcode     int    `json:"opcode"`
	OpcodeName string `json:"opcode_name"`
	Flags      int    `json:"flags"`
	TLVOffset  int    `json:"tlv_offset"`

	// CCM (opcode 1).
	RDI        *bool   `json:"rdi,omitempty"`
	Period     *int    `json:"ccm_period,omitempty"`
	PeriodName string  `json:"ccm_period_name,omitempty"`
	SeqNum     *uint32 `json:"sequence_number,omitempty"`
	MEPID      *int    `json:"mep_id,omitempty"`
	MEGID      string  `json:"meg_id,omitempty"`
	MEGIDHex   string  `json:"meg_id_hex,omitempty"`

	BodyHex string   `json:"body_hex,omitempty"`
	TLVHex  string   `json:"tlv_hex,omitempty"`
	Notes   []string `json:"notes,omitempty"`
}

Result is the decoded view of an Ethernet OAM / CFM PDU.

func Decode

func Decode(input string) (*Result, error)

Decode parses an Ethernet OAM / CFM PDU (the EtherType-0x8902 payload) from hex (whitespace / ':' / '-' / '_' separators and a '0x' prefix tolerated).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL