2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00
Commit Graph

16 Commits

Author SHA1 Message Date
Eelco Chaudron
0087594118 route-table: Rename bridge-related variables/arguments to netdev.
The route table APIs and variables previously referenced bridge
names. However, the API is generic enough to work with netdevs,
which is already used in some cases.

This patch renames function arguments and variables to reflect
netdevs rather than bridges for consistency.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-03-05 15:39:16 +01:00
Ihar Hrachyshka
7992a26ef4 netdev-dummy: Add local route entries for IP addresses.
To mimic what kernel routing subsystem does [1], add a local route
entry for every dummy IP address. This helps with OVN testing multiple
chassis on a single host and allows to run better unit tests for
userspace tunnels without adding route entries manually.  This is also
the only way to add 'local' route entries that are required for testing
'local_ip' functionality with native tunnels in userspace datapath
because route lookup will reject non-local source IPs.

There seems to be no way to explicitly remove an IP address from
netdev-dummy, hence no code path to handle route entry cleanup.
The port itself can be removed, but our tests do not normally do that.
Removal can be implemented later if necessary.

[1]: http://linux-ip.net/html/routing-tables.html#routing-table-local

"If the machine has several IP addresses on one Ethernet interface,
there will be a route to each locally hosted IP in the local routing
table. This is a normal side effect of bringing up an IP address on
an interface under linux."

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ihar Hrachyshka <ihrachys@redhat.com>
Co-authored-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2024-02-21 20:46:32 +01:00
Nobuhiro MIKI
49e534cd37 route-table: Retrieving the preferred source address from Netlink.
We can use the "ip route add ... src ..." command to set the preferred
source address for each entry in the kernel FIB. OVS has a mechanism to
cache the FIB, but the preferred source address is ignored and
calculated with its own logic. This patch resolves the difference
between kernel FIB and OVS route table cache by retrieving the
RTA_PREFSRC attribute of Netlink messages.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-03-07 19:16:20 +01:00
wenxu
c5bcbd58d6 ovs-router: Expose the ovs_router_get_netdev_source_address function.
Rename get_src_addr to ovs_router_get_netdev_source_address and expose
this function to be used in the next commit.

Signed-off-by: wenxu <wenxu@chinatelecom.cn>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-05-25 21:11:32 +02:00
wenxu
8e4e45887e ofproto-dpif-xlate: makes OVS native tunneling honor tunnel-specified source addresses
It makes OVS native tunneling honor tunnel-specified source addresses,
in the same way that Linux kernel tunneling honors them.

This patch made valid tun_src specified by flow-action can be used for
tunnel_src of packet. add a "local" property for a route entry and enhance
the priority of local route higher than user route.
Like the kernel space when lookup the route, if there are tun_src specified
by flow-action or port options. Check the tun_src wheather is a local
address, then lookup the route.

Signed-off-by: wenxu <wenxu@ucloud.cn>
Signed-off-by: frank.zeng <frank.zeng@ucloud.cn>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-04-18 16:31:15 -07:00
Ben Pfaff
898d7b0524 ovs-vswitchd: Do not use system routing table with --disable-system.
The --disable-system option indicates that the user wants to avoid using
the host's datapath.  This is also a good indication that the user does
not want to use other host resources such as the routing table, so this
commit implements that.

This fixes a failure in the test "ptap - recirculate after packet_type
change" when the host routing table contained an entry that affected the
generated flow.  Without this patch, the commands:

led to a failure in that test.

Reported-by: Timothy Redaelli <tredaelli@redhat.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2018-March/046406.html
Tested-By: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-04-03 11:10:37 -07:00
Ben Pfaff
b2befd5bb2 sparse: Add guards to prevent FreeBSD-incompatible #include order.
FreeBSD insists that <sys/types.h> be included before <netinet/in.h> and
that <netinet/in.h> be included before <arpa/inet.h>.  This adds guards to
the "sparse" headers to yield a warning if this order is violated.  This
commit also adjusts the order of many #includes to suit this requirement.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
2017-12-22 12:58:02 -08:00
Pravin B Shelar
ed52ca575f ovs-router: introduce pkt-mark.
OVS router is basically partial copy of linux kernel FIB.
kernel routing table uses skb-mark along with usual routing
parameters. Following patch brings in support for skb-mark
to ovs-router so that we can lookup route for given skb-mark.

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
2017-01-28 12:16:34 -08:00
Pravin B Shelar
ec6c537986 sflow: use ovs route API to get source IP address.
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
2016-03-24 09:30:57 -07:00
Pravin B Shelar
a8704b5027 tunneling: Handle multiple ip address for given device.
Device can have multiple IP address but netdev_get_in4/6()
returns only one configured IPv6 address. Following
patch fixes it.
OVS router is also updated to return source ip address for
given destination, This is required when interface has multiple
IP address configured.

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
2016-03-24 09:30:57 -07:00
Kevin Lo
eea429d98a ovs-router: fix compile error on FreeBSD
FreeBSD needs to include netinet/in.h to define struct in6_addr.

Signed-off-by: Kevin Lo <kevlo@FreeBSD.org>
Acked-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2015-12-04 08:06:26 -08:00
Thadeu Lima de Souza Cascardo
0b8da9ae1f route: support IPv6 and use IPv4-mapped addresses
This adds support for IPv6 in ovs-router and route-table. IPv4 is stored in
ovs-router using IPv4-mapped addresses.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
2015-10-13 14:37:33 -07:00
YAMAMOTO Takashi
88ffdc93c8 ovs-router: non-Linux support
Refactor ovs-router so that it can work with non-Linux platforms
at least in some extent, using the existing route-table code as
a fallback.  Known restriction: for such platforms, "ovs/router/show"
command does not show "Cached" kernel routes.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
2014-12-10 13:38:01 +09:00
Pravin B Shelar
1bc50ef389 dpctl: Fix crash.
ovs-dpctl crashed due to uninitialized router classifier. To
fix this issue move ovs router initialization to route table
module.

Reported-by: Madhu Challa <challa@noironetworks.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
2014-11-21 15:51:40 -08:00
YAMAMOTO Takashi
2d2b28d518 ovs-router: Fix build on NetBSD
Split the linux-specific part of ovs-router.h
into ovs-router-linux.h.

The breakage was introduced by
commit d9b4ebc5d1
("route-table: Use classifier to store routing table.")

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: Ben Pfaff <blp@nicira.com>
2014-11-11 10:44:52 +09:00
Pravin B Shelar
d9b4ebc5d1 route-table: Use classifier to store routing table.
Rather than using hmap for storing routing entries we can directly use
classifier which has support for priority and wildcard entries.
This makes route lookup lockless. This help when we use route lookup
for native tunneling.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
2014-11-03 13:27:31 -08:00