Skip to content

bgp route modify

Thomas Mangin edited this page May 29, 2026 · 3 revisions

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

Named route attribute modifier. Modifies route attributes on import or export without filtering. Plugin bgp-filter-modify, filter type modify.

The modifier always applies its declared operations: it unconditionally returns the modify action. For conditional modification, compose it with a match filter earlier in the chain (for example a community-match or AS-path-length filter that rejects first).

Category

Policy.

Configuration

Defined under bgp { policy { } } and referenced by name in peer filter chains:

bgp {
    policy {
        modify set-localpref {
            set {
                local-preference 200;
            }
        }
        modify prepend-twice {
            set {
                as-path-prepend 2;
            }
        }
        modify bump-pref {
            increment {
                local-preference 50;
            }
        }
        modify tag-and-scrub {
            set {
                community-add    [ 65000:100 ];
                community-remove [ 65000:999 ];
            }
        }
    }
    peer upstream {
        filter {
            import [ set-localpref ];
            export [ prepend-twice ];
        }
    }
}

A modify definition has three blocks: set, increment, and decrement. At least one operation must be present or the config is rejected.

set block (static)

set produces a fixed value at config time.

Leaf Type Description
local-preference uint32 Set LOCAL_PREF.
med uint32 Set MED.
origin igp, egp, incomplete Set ORIGIN.
next-hop IP address Set NEXT_HOP.
as-path-prepend uint8 (1-32) Prepend own AS N times.
community-add leaf-list Add standard communities (ASN:value or well-known name).
community-remove leaf-list Remove standard communities.
large-community-add leaf-list Add large communities (GA:LD1:LD2).
large-community-remove leaf-list Remove large communities.
extended-community-add leaf-list Add extended communities (for example rt:65000:100).
extended-community-remove leaf-list Remove extended communities.

Community values are validated at config time. Add and remove are emitted as text directives that the engine maps to wire-level add/remove operations.

increment and decrement blocks (dynamic)

increment and decrement read the current attribute value from the UPDATE at runtime and compute a new absolute value. Only three attributes are supported:

Leaf Type Description
local-preference uint32 Add to / subtract from LOCAL_PREF.
med uint32 Add to / subtract from MED.
aigp uint32 Add to / subtract from AIGP.

Each value must be a positive integer. Increment saturates at the uint32 maximum; decrement floors at 0. Targeting the same attribute with both set and increment/decrement is rejected as a conflict.

Source

internal/component/bgp/plugins/filter_modify/

Home

About

First Steps

Configuration

Operation

Interfaces

Plugins

Plugin Development

Chaos Testing

Blueprints

Development

Reference

Clone this wiki locally