This patch series introduces infrastructure and user-facing improvements for multi-table routing in OVS. The main motivation is to enable more advanced routing scenarios, such as policy-based routing with source address selectors. For example, this can be used to support OVN-Kubernetes multi-VTEP topology where nodes may have multiple SR-IOV network adapters and to facilitate selection of which VTEP to use to send/receive the packets to/from the wire.
The core of this series adds support for multiple routing tables within OVS. This is a prerequisite for importing non-default routing tables from the kernel and enables advanced routing lookups that consider parameters beyond just the destination address (e.g., source address). Additional routing tables are now created by reading the Routing Policy Database (RPDB) from the kernel. Only tables referenced by RPDB rules with a table lookup action are imported, and rule priorities and table IDs are preserved. The current implementation supports RPDB rules with a source address selector (`[not] from IP`). User interface improvements: - The `ovs-appctl ovs/route/show` command now accepts an optional `table=ID` or `table=all` parameter, allowing users to display routes from specific or all tables. - The `ovs-appctl ovs/route/add` and `ovs/route/del` commands accept a `table=ID` parameter for adding or deleting user routes in non-default tables. - A new `ovs-appctl ovs/route/rule/show` command is introduced to display the internal routing rules database, sorted by priority. - New `ovs-appctl ovs/route/rule/{add,del}` commands are introduced to add and delete user-configured routing rules in OVS. - The `ovs-appctl ovs/route/lookup` command now supports an optional `src=IP` parameter for lookups that match on source IP address. Example usage: - Show all routes, including those from non-default tables: ovs-appctl ovs/route/show table=all - Add a route to a specific table: ovs-appctl ovs/route/add 10.7.7.0/24 br-phy0 table=10 - Add user routing rules: ovs-appctl ovs/route/rule/add from=all table=10 - Show routing rules: ovs-appctl ovs/route/rule/show - Lookup a route with a source IP: ovs-appctl ovs/route/lookup 10.0.0.5 src=10.0.0.2 v2 -> v3: Changes based on Ilya's feedback: * Use cmap instead of hashmap for classifiers. * Don't treat standard tables in a special way. * Don't treat standard routing rules in a special way. * For src_ip validation in route lookup use local table only. * Add system test for un-supported routing rules. Not addressed: * Re: [ovs-dev] [PATCH v2 3/8] route-table: Introduce multi-table route lookup. > A lookup in the hash map may be better here instead of iteration. Please, see my reply in the v2 thread. v1 -> v2: Changes based on Ilya's feedback: * Split default classifier into three: local, main and default. * Rules based routing is the only way now. * The three default rules are always present, on non-Linux systems too. * Rules list is implemented with pvector instead of rculist. * Added more unit tests for rules, including tunnel-push-pop test. * Rules related appctl commands are grouped under ovs/route/rule/* prefix. * Implemented new appctl commands for adding and deleting user-configured rules. * Updated manpage and tunneling documentation with the new commands and parameters. Dima Chumak (10): ovs-router: Add infrastructure for multi-table routing. route-table: Introduce multi-table route lookup. doc: Fix font formatting in ofproto-tnl-unixctl.man. ovs-router: Add 'table=id' parameter in ovs/route/show. ovs-router: Drop 'local' flag from ovs_router_entry. ovs-router: Introduce ovs/route/rule/show command. ovs-router: Add system test for tables and rules. ovs-router: Add 'table=id' parameter in ovs/route/{add,del}. ovs-router: Add 'src=src_ip' parameter in ovs/route/lookup. ovs-router: Introduce ovs/route/rule/{add,del} commands. Documentation/howto/userspace-tunneling.rst | 20 +- NEWS | 11 +- lib/netdev-dummy.c | 12 +- lib/ovs-router.c | 794 +++++++++++++++++--- lib/ovs-router.h | 25 +- lib/packets.c | 20 + lib/packets.h | 2 + lib/route-table.c | 260 ++++++- lib/route-table.h | 21 +- ofproto/ofproto-tnl-unixctl.man | 61 +- tests/nsh.at | 9 +- tests/ofproto-dpif.at | 9 +- tests/ovs-router.at | 138 +++- tests/packet-type-aware.at | 15 +- tests/system-route.at | 179 +++++ tests/test-lib-route-table.c | 5 +- tests/tunnel-push-pop-ipv6.at | 30 +- tests/tunnel-push-pop.at | 165 +++- tests/tunnel.at | 6 +- 19 files changed, 1586 insertions(+), 196 deletions(-) -- 2.50.1 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev