mld

package
v0.783.0 Latest Latest
Warning

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

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

Documentation

Overview

Package mld decodes MLD — Multicast Listener Discovery — the IPv6 multicast-group membership protocol carried in ICMPv6: MLDv1 (RFC 2710) and MLDv2 (RFC 3810). MLD is the IPv6 counterpart of IGMP: a host emits an MLD Report to tell the on-link router which IPv6 multicast groups it wants to receive, and routers emit Queries to refresh that state. It is a network-reconnaissance source — an MLD Report reveals exactly which multicast groups a host has joined (and, via the MLDv2 source-filter records, which senders it includes or excludes), exposing the host's multicast-based services: mDNS / Bonjour (ff02::fb), LLMNR (ff02::1:3), SSDP / UPnP, the all-DHCP-servers group, PTP, and IPTV / streaming groups. An MLD Query reveals the active querier and its robustness / interval parameters. It is the IPv6 companion to the project's internal/igmp (v1/v2) and internal/igmpv3 (IPv4 multicast), and the MLD member of the ICMPv6 family alongside internal/ndp.

Wrap-vs-native judgement

Native. MLD is a small ICMPv6 message: a fixed header + a multicast
address, and for MLDv2 either a source list (Query) or a list of group
records (each a fixed header + an array of 16-byte source addresses,
Report). A byte-field read + two walks; stdlib only (net for the IPv6
formatting), no new go.mod dep.

Verifiable / no confidently-wrong output

The MLDv1 Query / Report / Done layout, the MLDv2 Query (with the
S / QRV / QQIC fields and source list) and the MLDv2 Report group-record
array were verified field-for-field against scapy's MLD layers
(ICMPv6MLQuery / ICMPv6MLReport / ICMPv6MLDone / ICMPv6MLQuery2 /
ICMPv6MLReport2 / ICMPv6MLDMultAddrRec) and RFC 2710 / RFC 3810. The MLDv2
Maximum-Response-Code and QQIC floating-point encodings (RFC 3810 §5.1.3 /
§5.1.9) are decoded. The ICMPv6 checksum is computed over an IPv6
pseudo-header that is not present in a bare MLD capture, so it is surfaced
as raw hex without a validity claim (matching internal/ndp). A type 130
Query is dispatched to MLDv1 vs MLDv2 by length (RFC 3810 §8.1: an MLDv2
Query is ≥ 28 bytes). A non-MLD ICMPv6 type is rejected.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GroupRecord

type GroupRecord struct {
	RecordType       int      `json:"record_type"`
	RecordTypeName   string   `json:"record_type_name"`
	MulticastAddress string   `json:"multicast_address"`
	Sources          []string `json:"sources,omitempty"`
	AuxDataHex       string   `json:"aux_data_hex,omitempty"`
}

GroupRecord is one MLDv2 multicast address record from a Report.

type Result

type Result struct {
	Type        int    `json:"type"`
	TypeName    string `json:"type_name"`
	Code        int    `json:"code"`
	ChecksumHex string `json:"checksum_hex"`
	MLDVersion  int    `json:"mld_version,omitempty"`

	// Query / v1 Report / v1 Done
	MaxResponseDelayMs int    `json:"max_response_delay_ms,omitempty"`
	MulticastAddress   string `json:"multicast_address,omitempty"`
	GeneralQuery       bool   `json:"general_query,omitempty"`

	// MLDv2 Query extras
	SuppressRouterProcessing bool     `json:"suppress_router_side_processing,omitempty"`
	QRV                      int      `json:"qrv,omitempty"`
	QQICSeconds              int      `json:"qqic_seconds,omitempty"`
	QuerierSources           []string `json:"querier_sources,omitempty"`

	// MLDv2 Report
	Records []GroupRecord `json:"records,omitempty"`

	Notes []string `json:"notes,omitempty"`
}

Result is the decoded view of an MLD (Multicast Listener Discovery) message.

func Decode

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

Decode parses an MLD message (the ICMPv6 payload, starting at the ICMPv6 Type byte) 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