Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/frr: Add 'redistribution map' option for route redistribution Routing -> BGP #4570

Open
3 tasks done
Jackwmtr opened this issue Mar 5, 2025 · 7 comments · May be fixed by #4578
Open
3 tasks done

net/frr: Add 'redistribution map' option for route redistribution Routing -> BGP #4570

Jackwmtr opened this issue Mar 5, 2025 · 7 comments · May be fixed by #4578
Assignees
Labels
feature Adding new functionality

Comments

@Jackwmtr
Copy link

Jackwmtr commented Mar 5, 2025

Important notices
Before you add a new report, we ask you kindly to acknowledge the following:

Is your feature request related to a problem? Please describe.
In my network, I need to redistribute routes from other protocols (e.g., OSPF or static) into BGP using FRR within OPNsense. However, the current FRR plugin lacks a "redistribution map" option, which prevents me from applying fine-grained control over which routes are redistributed. Without this, all routes from a protocol are redistributed indiscriminately, leading to unwanted routes in BGP or requiring manual CLI tweaks that don’t persist through the GUI.

Describe the solution you'd like
I’d like the FRR plugin to add a "Redistribution Map" field in the BGP configuration section of the OPNsense GUI (under Routing > BGP). This field would allow users to specify a route-map (e.g., route-map MY_MAP) to filter or modify routes during redistribution. In FRR terms, this would map to the configuration command:

redistribute route-map MY_MAP

Where could be ospf, static, connected, etc. The route-map itself could be defined in the existing "Route Maps" tab of the FRR plugin, ensuring consistency with current functionality.

This might be accomplished in the same way it does in the Routing -> OSPF allowing a user to define route redistribution map for OSPF (although it might be better to uses separate route maps for each type of redistribution as it is done in pfSense plugin).

Describe alternatives you've considered
Manual CLI Configuration: I can edit /usr/local/etc/frr/frr.conf manually to add redistribute ospf route-map MY_MAP, but this gets overwritten by the GUI on config sync or reboot.
Prefix Lists: While prefix lists in the BGP neighbor settings can filter outbound updates, they don’t apply to the redistribution process itself and are less flexible than route-maps.
External Workaround: Running FRR outside OPNsense is an option, but it defeats the purpose of using the integrated plugin.

Additional context
Files attached:
Examples of route map fields in ospf and the corresponding solution for pfSense

Image
Image

@Monviech
Copy link
Member

Monviech commented Mar 5, 2025

Can you show a vtysh example how the finished working configuration for BGP would look like, with a redistribution map attached?

vtysh
show running-config

@Jackwmtr
Copy link
Author

Jackwmtr commented Mar 5, 2025

Can you show a vtysh example how the finished working configuration for BGP would look like, with a redistribution map attached?

router bgp 65203
...
 !
 address-family ipv4 unicast
...
redistribute static route-map RMAP_S2BGP
redistribute ospf route-map RMAP_O2BGP
...
exit-address-family
...

route-map RMAP_S2BGP permit 10
 match ip address prefix-list IPPL_STATICFRR
 set community 65203:1111 additive
exit

route-map RMAP_O2BGP permit 10
 match ip address prefix-list IPPL-O2B
exit

@Monviech
Copy link
Member

Monviech commented Mar 5, 2025

So it looks like each redistribution needs the option to attach one route map which can be the same or a different one.

I'll look into this.

@Monviech Monviech self-assigned this Mar 5, 2025
@Monviech Monviech added the feature Adding new functionality label Mar 5, 2025
@Monviech
Copy link
Member

Monviech commented Mar 8, 2025

Image

 address-family ipv4 unicast
 redistribute ospf
 redistribute static route-map test1
 redistribute rip route-map test2
  neighbor 192.168.1.1 activate
 exit-address-family

Does this look as expected?

@Jackwmtr
Copy link
Author

Jackwmtr commented Mar 8, 2025

Looks very nice!
We can redistribute ospf routes with route map too, right?

p.s. redistribute static/connected would be nice too, like:

 address-family ipv4 unicast
  redistribute static route-map RMAP_S2BGP
  redistribute connected route-map RMAP_CONN2BGP

BTW/offtopic, would it be possible to do the same for OSPF routing protocol (In separate feature request, may be)? In current state it offers only one route map for any type of redistribution. specifying separate route maps for each type of redistribution would be a breeze.

@Monviech
Copy link
Member

Monviech commented Mar 8, 2025

It has the same options as the old field, check out the linked PR.

As for OSPF, it would be best to make this available at the same time since we can use the same migration script.

I want a separate issue for that. You can keep it short and link to this one. Thanks.

@Jackwmtr
Copy link
Author

Jackwmtr commented Mar 8, 2025

I want a separate issue for that. You can keep it short and link to this one. Thanks.

FYI, added #4580
Let me know if you need me to add comething to it.

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 a pull request may close this issue.

2 participants