Skip to content

add path

Thomas Mangin edited this page Nov 9, 2026 · 8 revisions

Pre-Alpha. This page describes behavior that may change.

ADD-PATH (RFC 7911) lets BGP advertise more than one path per prefix by prefixing each NLRI with a 4-byte Path Identifier. The usual reason you turn it on is a route server: without ADD-PATH, the route server can only send one path per prefix to each client, and downstream routers cannot make their own best-path decisions. With ADD-PATH, every received path is forwarded, and downstream picks.

Enabling ADD-PATH

Global

capability {
    add-path {
        send true;
        receive true;
    }
}

That enables ADD-PATH for every family configured on the peer.

Per family

add-path {
    ipv4/unicast  send;
    ipv6/unicast  send/receive;
    ipv4/mpls-vpn receive;
}

Per-family settings override the global capability { add-path }. Use this when you want ADD-PATH on IPv4 unicast but not on the VPN family, or any other asymmetric setup.

A complete peer

bgp {
    peer client-a {
        connection {
            remote { ip 10.0.0.1; }
            local  { ip 10.0.0.254; }
        }
        session {
            asn { local 65000; remote 65001; }

            capability {
                add-path {
                    send true;
                    receive true;
                }
            }

            family {
                ipv4/unicast { prefix { maximum 1000000; } }
                ipv6/unicast { prefix { maximum 200000; } }
            }
        }
    }
}

Direction and mode

Each family can be configured with a direction (send, receive, or send/receive) and a mode (enable, require, or disable).

Direction Meaning
send Ze advertises multiple paths to the peer.
receive Ze accepts multiple paths from the peer.
send/receive Both.
Mode Meaning
enable (default) Negotiate ADD-PATH if the peer supports it.
disable Do not negotiate ADD-PATH for this family.
require Reject the peer if it does not support ADD-PATH.
refuse Reject the peer if it advertises ADD-PATH for this family.
add-path {
    ipv4/unicast send         require;
    ipv6/unicast send/receive enable;
}

require is the useful mode when the entire point of your deployment is multi-path forwarding: you want the session rejected if ADD-PATH cannot be negotiated.

What ADD-PATH does to the wire

Without ADD-PATH, each NLRI is the prefix length plus the prefix bytes.

[prefix-length][prefix-bytes]

With ADD-PATH, each NLRI is preceded by a 4-byte Path Identifier.

[4-byte path-id][prefix-length][prefix-bytes]

The same prefix can appear multiple times in one UPDATE with different path IDs, each carrying different attributes. The peer distinguishes them by the Path Identifier.

A withdrawal with ADD-PATH must include the same path ID used in the announcement to withdraw a specific path. Withdrawing without a path ID is not valid on an ADD-PATH session.

Ze generates its own Path Identifiers

RFC 7911 Section 2 requires a speaker that re-advertises a route to generate its own Path Identifier, and to assign it so that (prefix, identifier) uniquely names a path advertised to a neighbor. Ze does that on both forward rails, rather than relaying the identifier the source chose.

The reason is a route server. Each client picks its identifiers alone, so two clients that both pick 1 for one prefix would reach a third client as one (prefix, identifier) pair, and RFC 7911 Section 5 makes the receiver treat the second as a replacement for the first. One path is lost. A source that negotiated no ADD-PATH at all sends every path under identifier 0, so without regeneration every path from every ordinary client reached an ADD-PATH client as (prefix, 0).

Property Behaviour
Key The path at ingress: the source that sent it and the identifier that source used. Never the message and never the attributes.
Withdrawal A withdrawn route carries no path attributes, so the ingress key is the only one that can be recomputed when the path leaves. The withdrawal names the identifier Ze advertised.
Re-announcement A source that re-announces one path with changed attributes keeps the identifier it already has, so the destination sees a replacement rather than a duplicate.
Release Identifiers are released when the peer is removed, not when the session goes down. A peer that reconnects re-announces the same paths, and reusing its identifiers is the replacement its destinations expect.
Zero 0 is minted and accepted like any other value, which RFC 7911 Section 3 requires.

Regeneration runs whenever either side of the forward frames identifiers. A session where neither side negotiated ADD-PATH keeps its zero-copy forward.

Encoding context and zero-copy forwarding

This is where ADD-PATH interacts with Ze's cache-forward architecture. Peers that negotiate the same ADD-PATH direction and mode share an ContextID. Two peers with the same ContextID can receive the same cached wire bytes from the reactor without re-encoding.

A route server with four peers, all negotiating send/receive, gets one encoding context. When a route comes in from any of the four, the reactor can forward the cached bytes to the other three without any parsing or re-encoding. This is the zero-copy fast path.

Mixing ADD-PATH peers with non-ADD-PATH peers means you have two encoding contexts. Routes moving from an ADD-PATH peer to a non-ADD-PATH peer require a re-encode because the wire format differs.

ADD-PATH with the route server

ADD-PATH is particularly useful with the bgp-rs plugin. Without ADD-PATH, the route server can only forward one path per prefix to each client. With ADD-PATH, every received path is forwarded, which is what you want when the downstream routers should be making their own policy decisions.

The combination is documented in the route reflection page and the route server blueprint when that lands.

PATHS-LIMIT

PATHS-LIMIT (capability code 76, draft-abraitis-idr-addpath-paths-limit) lets the ADD-PATH receiver advertise the maximum number of paths it wants per prefix per family. This prevents uncontrolled path proliferation when a route server forwards all available paths.

The limit is direction-aware. The receiver's advertised limit constrains what the sender may send, and Ze keeps separate send-side and receive-side limit maps. The per-direction limit is folded into the encoding-context hash, so peers that negotiate the same ADD-PATH direction and the same path limit still share an encoding context and the zero-copy forward path.

Configuration

The path count limit is configured under capability { add-path } alongside the ADD-PATH direction:

capability {
    add-path {
        direction send/receive;
        limit { receive 10; }
    }
}

The limit container holds one path count per direction. Only receive exists: the number of paths per prefix Ze asks the peer to send. The container's receive is the default for all families, and a per-family entry can override it. The scalar spelling limit 10; was removed: Ze refuses a config that still carries it, and the error names the line to write instead, limit { receive VALUE; }.

capability {
    add-path {
        direction send;
        family {
            ipv4/unicast {
                direction send/receive;
                limit { receive 10; }
            }
            ipv6/unicast {
                direction receive;
                limit { receive 5; }
            }
        }
    }
}

Behaviour

When configured:

  • The receiver advertises the PATHS-LIMIT capability during OPEN, declaring the maximum paths per prefix it wants for each family.
  • Ze, as sender, enforces the peer's negotiated limit across batches on each destination connection, route-server fast-path forwarding included, sending the paths bgp-rib ranks best (below).
  • Ze, as receiver, enforces its own advertised limit on what arrives (below).
  • A receive limit on a family whose ADD-PATH direction does not include receive, or under mode disable, is neither advertised nor enforced. A family Ze holds no NLRI decoder for cannot be counted path by path, so a receive limit that would reach it is refused at load, naming the family and the fix.

Best paths under the peer's limit

Arrival order fills the slots first, but it does not decide what the peer keeps. When a path is suppressed at the limit, or a slot of a contested prefix is released, Ze asks bgp-rib to rank the prefix's paths and sends the best ones in place of the first arrivals. A held path the RIB no longer ranks among the best is withdrawn, then the better path is announced under its own path ID, so the peer never holds more paths than its limit, not even for one UPDATE. A path Ze originates itself, and a path graceful restart retains, keep their slots.

The election needs bgp-rib attached to every source peer with receive [ update-received ], which a route server or reflector configuration already has. Without it, the first paths to arrive keep their slots, each contested prefix increments ze_bgp_paths_limit_election_failed_total{peer,family}, and the session logs one warning per family.

Inbound enforcement

The receive limit Ze advertises is also the ceiling it applies to the paths it accepts, so a peer that ignores capability 76 (BIRD has no support for it) cannot grow Ze's Adj-RIB-In past the number Ze asked for.

Event Effect
New path below the limit Admit the path and count its ID
New path at the limit Drop that path only. Every other route in the same UPDATE installs normally
Replacement with an admitted path ID Accept it without consuming another slot
Withdrawal of an admitted path ID Remove the ID and free its slot
Withdrawal of a refused path ID Accept it; it frees no slot
UPDATE whose only paths were all refused Consume it without delivering anything; the session stays up
Session reconnect Start with an empty count

The check runs after RFC 7606 error handling and before the prefix limits. Selection is by arrival order: a better path that arrives later is dropped until a withdrawal frees a slot, and the peer must announce it again. Each refused path increments ze_bgp_paths_limit_refused_total{peer,family}, and the first refusal for a route logs one warning.

Mode enforcement

Per-family ADD-PATH mode is enforced during OPEN negotiation. A family configured with mode require rejects the peer if ADD-PATH cannot be negotiated for that family. A family configured with mode refuse rejects the peer if the remote side advertises ADD-PATH for that family. This enforcement is per-family, not global.

The limit is enforced. When a peer advertises a limit for a family, Ze sends it at most that many paths per prefix and drops the rest. Before this, the capability was negotiated and displayed but nothing enforced it, so the peer received every path.

See also

Adapted from main/docs/guide/add-path.md.

Home

About

First Steps

Configuration

Operation

Interfaces

Plugins

Plugin Development

Chaos Testing

Blueprints

Development

Reference

Clone this wiki locally