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§
- Ethernet
Segment Identifier - 10-byte Ethernet Segment Identifier (RFC 7432 §5).
- Ethernet
TagId - Ethernet Tag ID — 32-bit namespace identifier within an EVI (RFC 7432 §7.1).
- Evpn
EadPer Es - Type 1: Ethernet Auto-Discovery per-ES route (RFC 7432 §7.1).
- Evpn
EadPer Evi - Type 1: Ethernet Auto-Discovery per-EVI route (RFC 7432 §7.1).
- EvpnEs
- Type 4: Ethernet Segment route (RFC 7432 §7.4).
- Evpn
Imet - Type 3: Inclusive Multicast Ethernet Tag route (RFC 7432 §7.3).
- Evpn
IpPrefix Route - Type 5: IP Prefix route (RFC 9136).
- Evpn
MacIp - Type 2: MAC/IP Advertisement route (RFC 7432 §7.2).
- MacAddress
- 48-bit Ethernet MAC address.
- Mpls
Label - A 3-byte MPLS label field (RFC 3032) as carried in EVPN NLRI.
- Route
Distinguisher - Route Distinguisher (RFC 4364 §4.2) — 8-byte administratively-assigned identifier that makes VPN routes unique across EVIs.
Enums§
- Evpn
IpPrefix Value - An IP prefix encoded inside an EVPN Type 5 NLRI — IPv4 or IPv6.
- Evpn
Route - A single EVPN NLRI entry (RFC 7432 §7), one of five route types.
- Evpn
Route Key - Identifying subset of an EVPN route — the fields that make two routes
distinct per RFC 7432. Suitable as a
HashMapkey in the RIB. - Route
Distinguisher Parse Error - Errors returned by
RouteDistinguisher::from_strwhen 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.