summaryrefslogtreecommitdiff
path: root/lib/route-table.c
Commit message (Collapse)AuthorAgeFilesLines
* Move lib/ofpbuf.h to include/openvswitch directoryBen Warren2016-03-301-1/+1
| | | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Acked-by: Ryan Moats <rmoats@us.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* sflow: use ovs route API to get source IP address.Pravin B Shelar2016-03-241-4/+4
| | | | | Signed-off-by: Pravin B Shelar <pshelar@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* tunneling: Handle multiple ip address for given device.Pravin B Shelar2016-03-241-2/+0
| | | | | | | | | | | | 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>
* route: support IPv6 and use IPv4-mapped addressesThadeu Lima de Souza Cascardo2015-10-131-29/+75
| | | | | | | | 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>
* rtnetlink: Extend rtnetlink to support RTNLGRP_IPV4_IFADDR andAlex Wang2015-07-281-6/+6
| | | | | | | | | | | | RTNLGRP_IPV6_IFADDR. This commit renames the rtnetlink-link.{c,h} to rtnetlink.{c,h} and extends the module to support RTNLGRP_IPV4_IFADDR and RTNLGRP_IPV4_IFADDR multicast groups. A later patch will start using this module to react to interface address changes. Signed-off-by: Alex Wang <alexw@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* ofpbuf: Simplify ofpbuf API.Pravin B Shelar2015-03-031-1/+1
| | | | | | | | | | | | ofpbuf was complicated due to its wide usage across all layers of OVS, Now we have introduced independent dp_packet which can be used for datapath packet, we can simplify ofpbuf. Following patch removes DPDK mbuf and access API of ofpbuf members. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* lib: Move vlog.h to <openvswitch/vlog.h>Thomas Graf2014-12-151-1/+1
| | | | | | | | A new function vlog_insert_module() is introduced to avoid using list_insert() from the vlog.h header. Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Ben Pfaff <blp@nicira.com>
* ovs-router: non-Linux supportYAMAMOTO Takashi2014-12-101-1/+9
| | | | | | | | | | 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>
* route-table: Remove Unregister.Pravin B Shelar2014-12-011-44/+11
| | | | | | | | | | | | Since dpif registering for routing table at initialization there is no need to unregister it. Following patch removes support for turning routing table notifications on and off. Due to this change OVS always listens for these notifications. Reported-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
* dpctl: Fix crash.Pravin B Shelar2014-11-211-0/+1
| | | | | | | | | | 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>
* ovs-router: Fix build on NetBSDYAMAMOTO Takashi2014-11-111-0/+1
| | | | | | | | | | | | Split the linux-specific part of ovs-router.h into ovs-router-linux.h. The breakage was introduced by commit d9b4ebc5d15202bedad06969353435a4c1951c71 ("route-table: Use classifier to store routing table.") Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Acked-by: Ben Pfaff <blp@nicira.com>
* route-table: extract gw information.Pravin B Shelar2014-11-031-1/+8
| | | | | | | | | Routing table will be used by ovs userspace tunneling, it need to know gw address, following commit extract gw information from netlink message so that ovs can populate it in ovs route table. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Thomas Graf <tgraf@noironetworks.com>
* route-table: Use classifier to store routing table.Pravin B Shelar2014-11-031-112/+7
| | | | | | | | | | | 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>
* route-table: get rid of name-tablePravin B Shelar2014-11-031-127/+25
| | | | | | | | | | name table maintains device ifindex to name mapping. On any name table changes it invalidate name table and routing table. So rather than building two tables this patch moves dev name to routing entry and build routing table on any name table changes. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Thomas Graf <tgraf@noironetworks.com>
* route-table: Make route-table module thread-safe.Ryan Wilson2014-05-291-1/+22
| | | | | | | | | | | | | | | | | Due to patch fe83f8 (netdev: Remove netdev from global shash when the user is changing interface configuration), netdevs can be destructed and deallocated by revalidator and RCU threads. When netdevs with class vport are destroyed, the routing table is unregistered, possibly causing memory to be freed. This causes a race condition with the main thread which calls route_table_run periodically to check for routing table updates. This patch makes the route-table module thread-safe via a mutex. Bug #1258532 Signed-off-by: Ryan Wilson <wryan@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Alex Wang <alexw@nicira.com>
* netdev-vport: Checks tunnel status change when route-table is reset.Alex Wang2014-05-021-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 3e912ffcbb (netdev: Add 'change_seq' back to netdev.) added per- netdev change number for indicating status change. Future commits used this change number to optimize the netdev status update to database. However, the work also introduced the bug in the following scenario: - assume interface eth0 has address 1.2.3.4, eth1 has adddress 10.0.0.1. - assume tunnel port p1 is set with remote_ip=10.0.0.5. - after setup, 'ovs-vsctl list interface p1 status' should show the 'tunnel_egress_iface="eth1"'. - now if the address of eth1 is change to 0 via 'ifconfig eth1 0'. - expectedly, after change, 'ovs-vsctl list interface p1 status' should show the 'tunnel_egress_iface="eth0"' However, 'tunnel_egress_iface' will not be updated on current master. This is in that, the 'netdev-vport' module corresponding to p1 does not react to routing related changes. To fix the bug, this commit adds a change sequence number in the route- table module and makes netdev-vport check the sequence number for tunnel status update. Bug #1240626 Signed-off-by: Alex Wang <alexw@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* ofpbuf: Introduce access api for base, data and size.Pravin Shelar2014-03-301-1/+1
| | | | | | | These functions will be used by later patches. Following patch does not change functionality. Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
* netlink: Remove buffer from 'struct nl_dump'.Joe Stringer2014-02-271-4/+10
| | | | | | | | | This patch makes all of the users of 'struct nl_dump' allocate their own buffers to pass down to nl_dump_next(). This paves the way for allowing multithreaded flow dumping. Signed-off-by: Joe Stringer <joestringer@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* clang: Fix the alignment warning.Alex Wang2013-07-231-1/+1
| | | | | | | | This commit fixes the warning issued by 'clang' when pointer is casted to one with greater alignment. Signed-off-by: Alex Wang <alexw@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* netlink-socket: Simplify use of transactions and dumps.Ben Pfaff2013-07-181-23/+3
| | | | | | | This disentangles "struct nl_dump" from "struct nl_sock", clearing the way to make the use of either one thread-safe in an obviously correct manner. Signed-off-by: Ben Pfaff <blp@nicira.com>
* route-table: Make 'rtnl_sock' and 'attrs' local variables non-static.Ben Pfaff2013-06-051-4/+4
| | | | | | | | I don't see any reason for these to be static. CC: Ethan Jackson <ethan@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* Replace most uses of assert by ovs_assert.Ben Pfaff2013-01-161-3/+2
| | | | | | | | This is a straight search-and-replace, except that I also removed #include <assert.h> from each file where there were no assert calls left. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* Global replace of Nicira Networks.Raju Subramanian2012-05-021-1/+1
| | | | | | | | Replaced all instances of Nicira Networks(, Inc) to Nicira, Inc. Feature #10593 Signed-off-by: Raju Subramanian <rsubramanian@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Fix memory leaks.Ben Pfaff2012-04-251-1/+4
| | | | | | | Found by valgrind. Reported-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* route-table: Clear route_notifier after free.Jesse Gross2011-09-281-0/+1
| | | | | | If the routing table is destroyed and re-created then it will trigger another assertion because route_notifier is not NULL, even though it has already been freed.
* route-table: Close netlink notifier before closing nln.Jesse Gross2011-09-271-0/+1
| | | | | | | | | | | Commit 2ee6545f2bff7eb27e8c84965e3ff38dfa909bf6 "notifiers: Create and destroy nln_notifiers." requires callers to explicitly create and destroy netlink notifiers but route-table only did the creation part. This causes an assertion failure any time the netdev for a vport is destroyed (for example ovs-dpctl show when there is a tunnel port). Bug #7464
* notifiers: Create and destroy nln_notifiers.Ethan Jackson2011-09-161-6/+10
| | | | | | | | This patch changes the interface of netlink-notifier and rtnetlink-link. Now nln_notifiers are allocated and destroyed by the module instead of passed in by callers. This allows the definition of nln_notifier to be hidden, and generally cleans up the code.
* notifiers: Rename run and wait functions.Ethan Jackson2011-09-161-4/+4
| | | | | | | | It makes more sense to call nln_notifier_run() and nln_notifier_wait() simply nln_run() and nln_wait() since they don't operate on notifiers but the entire nln object. This patch changes the nln and the rtnetlink-link modules to the new convention.
* netlink-notifier: Rename rtnetlink code.Ethan Jackson2011-09-011-18/+14
| | | | | | This patch renames the rtnetlink module's code to "nln" for "netlink notifier". Callers are now required to pass in the netlink protocol to he newly renamed nln_create() function.
* lib: Rename rtnetlink.[ch] files.Ethan Jackson2011-09-011-1/+1
| | | | | | | | | | The only rtnetlink specific functionality contained in the rtnetlink module is the use of the NETLINK_ROUTE protocol. This can easily be passed in by callers. In preparation for generalization, this patch renames rtnetlink.[ch] to netlink-notifier.[ch]. Future patches will complete the transition.
* util: Don't read over 'size - 1' bytes of source string in ovs_strlcpy().Ben Pfaff2011-02-221-3/+2
| | | | | | | | | | | | | The blind replacement of strncpy() by ovs_strlcpy() is risky because strncpy() never reads more bytes from its source string than necessary to write its destination string, but ovs_strlcpy() and the OpenBSD function that inspired it both read the entire source string. This avoids that problem. Given that change, we can use ovs_strlcpy() in a few more places, and this commit does that too. Coverity #10697,10696,10695,10694,10693,10692,10691,10690.
* lib: Fix off-by-one error in route-table.Ethan Jackson2011-02-011-1/+1
|
* lib: route-table improvements.Ethan Jackson2011-01-311-2/+145
| | | | | | | | | | | | | | | | | | This commit makes several changes to the route_table code used to populate tunnel_egress_iface. - It removes name_table code from netdev-vport and puts it into route-table. - It no longer attempts to build the name_table dynamically by listening to rtnetlink-link notifications. Instead it dumps the entire table, and uses rtnetlink-link notifications to indicate a re-dump is required. - It forces rtnetlink-link notifications to re-dump the routing table. This fixes an issue where bringing an interface down or removing it altogether would not have the expected effect on related tunnel_egress_ifaces.
* netlink-socket: Add functions for joining and leaving multicast groups.Ben Pfaff2011-01-271-1/+1
| | | | | | | | | | | | | When this library was originally implemented, support for Linux 2.4 was important. The Netlink implementation in Linux only added support for joining and leaving multicast groups after a socket is bound as of Linux 2.6.14, so the library did not support it either. But the current version of Open vSwitch targets Linux 2.6.18 and over, so it's fine to add this support now, and this commit does so. This will be used more extensively in upcoming commits. Reviewed by Justin Pettit.
* route-table: Handle route updates more robustly.Ethan Jackson2011-01-141-26/+22
| | | | | | | | | The kernel does not broadcast rtnetlink route messages in all cases one would expect. This can cause stale entires to end up in the route table which may cause incorrect results for route_table_get_ifindex() queries. This commit causes rtnetlink route messages to dump the entire route table on the next route_table_get_ifindex() query.
* route-table: Process route messages more selectively.Ethan Jackson2011-01-141-0/+13
| | | | | This commit cleans up the routing table by preventing it from processing messages which are not relevant for our purposes.
* lib: Simplify rtnetlink routing functionality.Ethan Jackson2011-01-141-0/+338
This commit removes the rtnetlink-route module and replaces it with a much simpler to use route-table module. The route-table uses rtnetlink to maintain a routing table which may be used to query the egress interface of particular addresses. This commit also converts netdev-vport to use the new route-table module.