-
Notifications
You must be signed in to change notification settings - Fork 347
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
pbr: T6430: Allow forwarding into VRFs by name as well as route table IDs #3740
Conversation
❌ VyOS CLI smoketests failed! |
👍 |
I want to update this to also implement this for policy local-route, so withdrawing to draft. |
I guess we should not change two components even if they are similar in one PR |
Fair call - I'll put together another PR for local-route tomorrow. This one should be already good to go if it passes review. |
af86aa5
to
14c5754
Compare
Updated with smoke tests as requested by @nicolas-fort |
14c5754
to
089e61b
Compare
❌ |
Noticed a minor issue with completion ordering & missing extras while working on the local-route version of this, fixed. |
089e61b
to
98c0ed7
Compare
… IDs * PBR can only target table IDs up to 200 and the previous PR to extend the range was rejected * PBR with this PR can now also target VRFs directly by name, working around targeting problems for VRF table IDs outside the overlapping 100-200 range * Validation ensures rules can't target both a table ID and a VRF name (internally they are handled the same) * Added a simple accessor (get_vrf_table_id) for runtime mapping a VRF name to table ID, based on vyos.ifconfig.interface._set_vrf_ct_zone(). It does not replace that usage, as it deliberately does not handle non-VRF interface lookups (would fail with a KeyError). * Added route table ID lookup dict, global route table and VRF table defs to vyos.defaults. Table ID references have been updated in code touched by this PR. * Added a simple smoketest to validate 'set vrf' usage in PBR rules
98c0ed7
to
adeac78
Compare
Updated as requested with central default table IDs, manual tests and smoketests all OK. Additionally, in the spots where the table IDs were being defined as strings, they're now integers. Casts tweaked to match. They were always cast to ints anyway for the fwmark calculation. Multiple and overlapping table rules still work in tests. |
I did a last minor change in 9b99a01 which dropped your implementation of get_vrf_table_id, as we have this as a common utility function as of last week. |
CI integration 👍 passed! Details
|
Change Summary
My previous PR for simply extending the table ID range was rejected, so I've prepared another PR closer to my own use case for this - "policy based route leaking" between VRFs. It may or may not line up with Bernhard's intention from the original ticket.
This PR extends PBR syntax to allow "set vrf" as well as "set table", resolving table ID from an active VRF and then treating it the same as a "set table".
Types of changes
Related Task(s)
Related PR(s)
Component(s) name
Proposed changes
The use cases of this feature are limited and you will need to know exactly what you are doing to have it work properly, but for example, when I was experimenting with cross-VRF DNS lookup solutions, this would've been better than manipulating ip rules and nftables manually and externally.
How to test
Rules apply OK:
Looking at the results:
Attaching the PBRs to interfaces and watching traffic flow with tcpdump works as expected, the same as
set table
.Smoketest result
Checklist: