Skip to content

net/frr: add per-neighbor local-as option for BGP#5308

Merged
Monviech merged 2 commits intoopnsense:masterfrom
danohn:master
Mar 12, 2026
Merged

net/frr: add per-neighbor local-as option for BGP#5308
Monviech merged 2 commits intoopnsense:masterfrom
danohn:master

Conversation

@danohn
Copy link
Copy Markdown
Contributor

@danohn danohn commented Mar 11, 2026

Important notices
Before you submit a pull request, we ask you kindly to acknowledge the following:

If AI was used, please disclose:

  • Model used: GPT-5.3-Codex
  • Extent of AI involvement: Assisted with implementing the model/form/template changes; changes were reviewed and tested on 2 dev OPNsense VM's.

Related issue
If this pull request relates to an issue, link it here:

closes #5307


Describe the problem
The FRR plugin currently does not allow setting a BGP local-as on a per-neighbor basis. This blocks common interoperability/migration scenarios where a specific peer requires a different local AS than the router’s global BGP AS.


Describe the proposed solution
This pull request adds neighbor-level local-as support in the FRR plugin:

  • Add localas to the BGP neighbor model (IntegerField, range 1..4294967295)
  • Add a Local AS field to the BGP neighbor edit dialog
  • Render neighbor <address> local-as <asn> in bgpd.conf when configured

The change is backward compatible: no local-as command is emitted unless explicitly configured for a neighbor.

@Monviech
Copy link
Copy Markdown
Member

Monviech commented Mar 11, 2026

I guess this looks fine and the change is minimal. The question is how often is this needed. The frr plugin exists since years and you seem to be the first one who misses this.

How common is that migration szenario you are describing? (I don't have a lot of (practical) bgp experience))

There are so many options in the plugin already, we have to be careful to be selective at this point.

@danohn
Copy link
Copy Markdown
Contributor Author

danohn commented Mar 11, 2026

I guess this looks fine and the change is minimal. The question is how often is this needed. The frr plugin exists since years and you seem to be the first one who misses this.

How common is that migration szenario you are describing? (I don't have a lot of (practical) bgp experience))

There are so many options in the plugin already, we have to be careful to be selective at this point.

Thanks for taking a look.

You’re right that it’s not a common configuration, which is probably why it hasn’t come up before. However, it is a standard BGP feature used in scenarios like ASN migrations or when peering with providers that require a specific ASN. For example, with AWS Direct Connect it’s fairly common to run a private ASN internally but present a different ASN to AWS using local-as at the neighbor level.

FRR already supports this natively; the PR simply exposes that existing option in the plugin UI. Since it’s optional and only used when explicitly configured, it shouldn’t affect normal setups.

@Monviech
Copy link
Copy Markdown
Member

That sounds good enough for me. Thank you.

Can you bump the minor version in the Makefile and add a changelog to pkg-descr in the style of the other changelogs (contributed by and the pull request link)

Please also do a PR to add this to the documentation here (just the option is enough)
https://github.com/opnsense/docs/blob/7cc8408c4a45bb82c7a83c3fac74b27dbb22e518/source/manual/dynamic_routing.rst

@Monviech Monviech self-assigned this Mar 11, 2026
@Monviech Monviech added the feature Adding new functionality label Mar 11, 2026
@danohn
Copy link
Copy Markdown
Contributor Author

danohn commented Mar 11, 2026

That sounds good enough for me. Thank you.

Can you bump the minor version in the Makefile and add a changelog to pkg-descr in the style of the other changelogs (contributed by and the pull request link)

Thanks @Monviech, here is the commit: d49eed3. I'll work on the docs now in a seperate PR.

@danohn
Copy link
Copy Markdown
Contributor Author

danohn commented Mar 11, 2026

Seperate docs PR done 🙂

@Monviech Monviech merged commit e389a81 into opnsense:master Mar 12, 2026
@Monviech
Copy link
Copy Markdown
Member

Merged, thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Adding new functionality

Development

Successfully merging this pull request may close these issues.

os-frr: add support for per-neighbor local-as in BGP

2 participants