Skip to main content

Module evpn

Module evpn 

Source
Expand description

EVPN NLRI types and codec (RFC 7432 + RFC 9136). RFC 7432 EVPN NLRI codec and types.

EVPN NLRI is a typed TLV format carried under AFI=25 / SAFI=70. Each NLRI entry has a 1-byte route type, 1-byte length, and a type-specific payload. Five route types are defined:

  • Type 1: Ethernet Auto-Discovery (EAD) — per-ES (ethernet_tag=MAX_ET) or per-EVI
  • Type 2: MAC/IP Advertisement
  • Type 3: Inclusive Multicast Ethernet Tag (IMET)
  • Type 4: Ethernet Segment (ES)
  • Type 5: IP Prefix Route (RFC 9136)

This module is the structural codec — no semantic interpretation of RDs, ESIs, MACs, or labels. Upstream layers (RIB, best-path) apply meaning.

The module intentionally splits route payload from route identity: EvpnRoute carries the full wire payload (needed for encoding and reflection), while EvpnRouteKey carries only the RFC 7432 identifying fields per route type (used as a HashMap key in the RIB).

Structs§

EthernetSegmentIdentifier
10-byte Ethernet Segment Identifier (RFC 7432 §5).
EthernetTagId
Ethernet Tag ID — 32-bit namespace identifier within an EVI (RFC 7432 §7.1).
EvpnEadPerEs
Type 1: Ethernet Auto-Discovery per-ES route (RFC 7432 §7.1).
EvpnEadPerEvi
Type 1: Ethernet Auto-Discovery per-EVI route (RFC 7432 §7.1).
EvpnEs
Type 4: Ethernet Segment route (RFC 7432 §7.4).
EvpnImet
Type 3: Inclusive Multicast Ethernet Tag route (RFC 7432 §7.3).
EvpnIpPrefixRoute
Type 5: IP Prefix route (RFC 9136).
EvpnMacIp
Type 2: MAC/IP Advertisement route (RFC 7432 §7.2).
MacAddress
48-bit Ethernet MAC address.
MplsLabel
A 3-byte MPLS label field (RFC 3032) as carried in EVPN NLRI.
RouteDistinguisher
Route Distinguisher (RFC 4364 §4.2) — 8-byte administratively-assigned identifier that makes VPN routes unique across EVIs.

Enums§

EvpnIpPrefixValue
An IP prefix encoded inside an EVPN Type 5 NLRI — IPv4 or IPv6.
EvpnRoute
A single EVPN NLRI entry (RFC 7432 §7), one of five route types.
EvpnRouteKey
Identifying subset of an EVPN route — the fields that make two routes distinct per RFC 7432. Suitable as a HashMap key in the RIB.
RouteDistinguisherParseError
Errors returned by RouteDistinguisher::from_str when a textual RD fails to parse against the RFC 4364 §4.2 encodings.

Functions§

decode_evpn_nlri
Decode one or more EVPN NLRI entries from a contiguous buffer.
encode_evpn_nlri
Encode a list of EVPN NLRI entries to wire bytes.