summaryrefslogtreecommitdiff
path: root/tests/test-vconn.c
Commit message (Collapse)AuthorAgeFilesLines
* windows: Fix return value in case of named pipe send failureAlin Gabriel Serdean2018-05-081-4/+0
| | | | | | | | | | | | | | | | Named pipes should emulate UNIX socket behavior. Until now the named pipes returned WSA (Windows implementation of BSD sockets errors) return codes, for send errors. In case of a disconnected named pipe (UNIX socket) send error, we should return EPIPE. Fixes: `check_logs` transient errors when checking for EPIPE. Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org> Acked-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com> Acked-by: Ben Pfaff <blp@ovn.org>
* ofp-util, ofp-parse: Break up into many separate modules.Ben Pfaff2018-02-131-1/+0
| | | | | | | | | | | | ofp-util had been far too large and monolithic for a long time. This commit breaks it up into units that make some logical sense. It also moves the pieces of ofp-parse that were specific to each unit into the relevant unit. Most of this commit is just moving code around. Signed-off-by: Ben Pfaff <blp@ovn.org> Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
* lib: Move lib/poll-loop.h to include/openvswitchXiao Liang2017-11-031-1/+1
| | | | | | | | Poll-loop is the core to implement main loop. It should be available in libopenvswitch. Signed-off-by: Xiao Liang <shaw.leon@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* OpenFlow: Enable OpenFlow 1.4 by default.Ben Pfaff2017-05-011-7/+7
| | | | | | | Open vSwitch now supports all OpenFlow 1.4 required features, so enable it by default. Signed-off-by: Ben Pfaff <blp@ovn.org>
* Add read-only option to ovs-dpctl and ovs-ofctl commands.Ryan Moats2016-08-151-9/+9
| | | | | | | | | ovs-dpctl and ovs-ofctl lack a read-only option to prevent running of commands that perform read-write operations. Add it and the necessary scaffolding to each. Signed-off-by: Ryan Moats <rmoats@us.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Move lib/ofp-msgs.h to include/openvswitch directoryBen Warren2016-04-141-4/+4
| | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Move lib/ofp-util.h to include/openvswitch directoryBen Warren2016-04-141-1/+1
| | | | | | | | This commit also adds several #include directives in source files in order to make the 'ofp-util.h' move possible Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* 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>
* command-line: add ovs_cmdl_contextRussell Bryant2015-03-171-17/+22
| | | | | | | | | | | | | | | | | | | | | | | I started working on a new command line utility that used this shared code. I wanted the ability to pass some data from common initialization code to all of the commands. You can find a similar pattern in ovs-vsctl. This patch updates the command handler to take a new struct, ovs_cmdl_context, instead of argc and argv directly. It includes argc and argv, but also includes an opaque type (void *), where the user of this API can attach its custom data it wants passed along to command handlers. This patch affected the ovstest sub-programs, as well. The patch includes a bit of an odd hack to OVSTEST_REGISTER() to avoid making the main() function of the sub-programs take a ovs_cmdl_context. The test main() functions still receive argc and argv directly, as that seems more natural. The test-subprograms themselves are able to make use of a context internally, though. Signed-off-by: Russell Bryant <rbryant@redhat.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* command-line: add ovs_cmdl_ prefixRussell Bryant2015-03-161-2/+2
| | | | | | | | | | | | | | | | | The coding style guidelines include the following: - Pick a unique name prefix (ending with an underscore) for each module, and apply that prefix to all of that module's externally visible names. Names of macro parameters, struct and union members, and parameters in function prototypes are not considered externally visible for this purpose. This patch adds the new prefix to the externally visible names. This makes it a bit more obvious what code is coming from common command line handling code. Signed-off-by: Russell Bryant <rbryant@redhat.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofpbuf: Simplify ofpbuf API.Pravin B Shelar2015-03-031-5/+5
| | | | | | | | | | | | 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>
* vlog: Rename the currently used term 'facility' as 'destination'.Gurucharan Shetty2015-01-081-1/+1
| | | | | | | | | | | | In OVS, we currently use the term 'facility' to mean the place where we log (syslog, console or file). In Linux's syslog() and rfc5424, the term 'facility' is used to specify what type of program is logging the message (e.g: LOG_DAEMON). This causes confusion while reading vlog's code. This commit changes the term 'facility' to 'destination'. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* lib: Move vconn.h to <openvswitch/vconn.h>Thomas Graf2014-12-151-1/+1
| | | | | | | | Also moves definitions for struct vconn and pvconn to the public header. The provider interface is kept private. Signed-off-by: Thomas Graf <tgraf@noironetworks.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_assert, tests: Support NDEBUG.Jarno Rajahalme2014-10-301-4/+3
| | | | | | | | | | | | | | | | | ./configure accepts --enable-ndebug option. Make ovs_assert() honor it, and make sure all test programs disable it. The order of include files in test programs is also made uniform: 1. #include <config.h> 2. #undef NDEBUG 3. Include file of the test subject (to make sure it itself has sufficient include directives). 4. System includes in alphapetical order. 5. OVS includes in aplhapetical order. Suggested-by: Ben Pfaff <blp@nicira.com> Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* command-line: Add function to print command usage.Alex Wang2014-10-281-9/+9
| | | | | | | | | | | | | This commit adds a new variable in 'struct command' for recording the command usage. Also, a new function is added to print the usage given the array of defined commands. Later patch will use the output in bash command-line completion script. Signed-off-by: Alex Wang <alexw@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* Use xstrdup() instead of strdup(), xmalloc() instead of malloc().Ben Pfaff2014-07-221-1/+1
| | | | | Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Justin Pettit <jpettit@nicira.com>
* test-vconn: Change the expected error for Windows.Gurucharan Shetty2014-07-011-2/+14
| | | | | | | | | | On Windows ECONNRESET is WSAECONNRESET. Also, "unix" connections are done through TCP sockets. For the 'refuse-connection' test, the error message for Windows is WSAECONNRESET instead of EPIPE. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
* Enable OpenFlow 1.0, 1.1, 1.2, and 1.3 by default.Ben Pfaff2014-04-301-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The Open vSwitch software switch now supports all the required features of OpenFlow 1.0 through 1.3, with one known trivial exception[*]. Enable them by default in ovs-vswitchd. For now, ovs-ofctl only enables OpenFlow 1.0 by default. This is because ovs-ofctl implements command such as "add-flow" as raw OpenFlow requests, but those requests have subtly different semantics in different OpenFlow versions. For example: - In OpenFlow 1.0, a "mod-flow" operation that does not find any existing flow to modify adds a new flow. - In OpenFlow 1.1, a "mod-flow" operation that does not find any existing flow to modify adds a new flow, but only if the mod-flow did not match on the flow cookie. - In OpenFlow 1.2 and a later, a "mod-flow" operation never adds a new flow. [*] OpenFlow 1.1, but not any earlier or later version of OpenFlow, requires support for VLANs introduced by Ethertype 0x88a8, but Open vSwitch does not support this Ethertype. Signed-off-by: Ben Pfaff <blp@nicira.com> Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
* unit-test: Link 29 test programs into ovstestAndy Zhou2014-04-031-5/+6
| | | | | | | | | | | | | | Improve link speed by linking 29 test programs into ovstest. On my machine, running the following command against a fully built tree: $ touch lib/random.c; time make Improve the overall build time from 7 seconds to 3.5 seconds. Signed-off-by: Andy Zhou <azhou@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* ofpbuf: Introduce access api for base, data and size.Pravin Shelar2014-03-301-5/+5
| | | | | | | These functions will be used by later patches. Following patch does not change functionality. Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
* fatal-signal: SIGPIPE for Windows.Gurucharan Shetty2014-02-261-1/+2
| | | | | | | | | Windows does not have a SIGPIPE. We ignore SIGPIPE for Linux. To compile on Windows, carve out a new function to ignore SIGPIPE on Linux. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* Replace all uses of strerror() by ovs_strerror(), for thread safety.Ben Pfaff2013-06-281-6/+6
| | | | Signed-off-by: Ben Pfaff <blp@nicira.com>
* vconn: Fix parameters for vconn_open(), vconn_open_block(), pvconn_open().Ben Pfaff2013-01-041-5/+5
| | | | | | | | | | | The customary parameter order in Open vSwitch is to put input parameters before output parameters, but vconn_open() and pvconn_open() had the 'dscp' input parameter at the end, which bugged me a bit. Also, vconn_open_block() didn't take a 'dscp' parameter at all even though it's otherwise a wrapper around vconn_open(). This commit fixes all that up. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* vconn: Replace minimum version with bitmap of allowed versions.Simon Horman2012-11-041-8/+4
| | | | | | | | | | | | | | This is in preparation for allowing the range of allowed OpenFlow versions to be configured. As part of this change pvconn_open() is now paramatised over the allowed versions. this is to avoid avoids needing to provide version information as a parameter to pvconn_accept(). This will in turn avoid the need to pass version information to connmgr_run(). Signed-off-by: Simon Horman <horms@verge.net.au> [blp@nicira.com simplified slightly and generalize log messages] Signed-off-by: Ben Pfaff <blp@nicira.com>
* lib: Accomodate FreeBSD return value for ssl connection.Ed Maste2012-10-231-1/+8
| | | | | | | | | On FreeBSD I see ECONNRESET being returned from check_connection_completion in ssl_connect. This happens before entering the SSL states, which return EPROTO on failure. Signed-off-by: Ed Maste <emaste@adaranet.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* vconn: Ensure that vconn_run() is enough to complete a connection.Ben Pfaff2012-08-071-6/+12
| | | | | | | | | | | | | | | | | | Until now, it seems that all vconn users have immediately started reading messages from the connection. Today, however, I added a new user that only wants to read packets after the OpenFlow version is negotiated, so it never called vconn_recv() before that happened. It turns out that if you do this, the version never gets negotiated at all. This commit fixes the problem by ensuring that vconn_run() will continue version negotiation if it isn't done yet. This changes the error return that I get for Unix sockets in the test-vconn "accept-then-close" test from EPIPE to ECONNRESET, so this commit also adjusts that test to accept either error code; both of them seem reasonable enough to me. Signed-off-by: Ben Pfaff <blp@nicira.com>
* test-vconn: Also accept EPIPE for TCP connection failures.Ben Pfaff2012-07-311-7/+18
| | | | | | | | Ed Maste reports that write() to a socket where the other side has closed returns EPIPE on FreeBSD and ECONNRESET on Linux. Reported-by: Ed Maste <emaste@freebsd.org> Signed-off-by: Ben Pfaff <blp@nicira.com>
* test-vconn: Block in three cases where a race is visible on FreeBSD.Ben Pfaff2012-07-311-3/+3
| | | | | | | | On FreeBSD, sometimes plain vconn_connect() or vconn_recv() reports EAGAIN in these cases. Reported-by: Ed Maste <emaste@freebsd.org> Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofp-msgs: New approach to encoding and decoding OpenFlow headers.Ben Pfaff2012-07-301-31/+37
| | | | | | | | | | | | | | | | OpenFlow headers are not as uniform as they could be, with size, alignment, and numbering changes from one version to another and across varieties (e.g. ordinary messages vs. "stats" messages). Until now the Open vSwitch internal APIs haven't done a good job of abstracting those differences in header formats. This commit changes that; from this commit forward very little code actually needs to understand the header format or numbering. Instead, it can just encode or decode, or pull or put, the header using a more abstract API using the ofpraw_, ofptype_, and other APIs in the new ofp-msgs module. Signed-off-by: Ben Pfaff <blp@nicira.com> Tested-by: Simon Horman <horms@verge.net.au> Reviewed-by: Simon Horman <horms@verge.net.au>
* Avoid implementation-defined strerror behaviourEd Maste2012-07-271-1/+2
| | | | | | | | | | | | | | | | | POSIX states that the string returned by strerror() may be overwritten by a subsequent call (i.e., because it returns a pointer to a static buffer). Make a copy of one of the two strerror() strings to avoid this. Background: FreeBSD historically returned such a pointer only in the case of an invalid errno. With the addition of NLS strerror was changed to do so for all calls. Prior to this change I had confusing results from the test suite like "... is 22 (Invalid argument) but should be 0 (Invalid argument)". Signed-off-by: Ed Maste <emaste@adaranet.com> Signed-off-by: Ben Pfaff <blp@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>
* Allow configuring DSCP on controller and manager connections.Mehak Mahajan2012-03-231-6/+11
| | | | | | | | | | | The changes allow the user to specify a separate dscp value for the controller connection and the manager connection. The value will take effect on resetting the connections. If no value is specified a default value of 192 is chosen for each of the connections. Feature #10074 Requested-by: Rajiv Ramanathan <rramanathan@nicira.com> Signed-off-by: Mehak Mahajan <mmahajan@nicira.com>
* Begin breaking openflow-1.0.h into common and version-specific definitions.Ben Pfaff2012-03-071-10/+10
| | | | | | | | | | | | | | | | | | | | | | The intention is that, as each OpenFlow 1.1 and 1.2 feature is added to Open vSwitch, the corresponding protocol definitions will be broken up this way: - Definitions that are the same in OF1.0 and OF1.1 will retain the "OFP" or "ofp" prefix and move to openflow-common.h. - Definitions that are specific to OF1.0 will be renamed with an "OFP10" or "ofp10" prefix and stay in openflow-1.0.h. - Definitions that are specific to OF1.1 or to OF1.1 and OF1.2 will be renamed with an "OFP11" or "ofp11" prefix and move to openflow-1.1.h. - Definitions that are specific to OF1.2 will be renamed with an "OFP12" or "ofp12" prefix and move to openflow-1.2.h. This commit starts this process with some basic OpenFlow definitions. Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
* vconn: Remove unnecessary forward declarations and #includes from header.Ben Pfaff2011-10-041-0/+1
| | | | | This required fix-ups in a few other files that accidentally depended upon vconn.h including those other headers.
* Fix incorrect byte order annotations.Ben Pfaff2011-05-161-3/+3
| | | | | | | These are not actual bugs, just deceptive use of the wrong function or type. Found by sparse.
* vlog: Make the vlog module catalog program-specific.Ben Pfaff2010-07-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | Until now, the collection of vlog modules supported by a given OVS program was not specific to that program. That means that, for example, even though ovs-dpctl does not have anything to do with jsonrpc, it still has a vlog module for it. This is confusing, at best. This commit fixes the problem on some systems, in particular on ones that use GCC and the GNU linker. It uses the feature of the GNU linker described in its manual as: If an orphaned section's name is representable as a C identifier then the linker will automatically see PROVIDE two symbols: __start_SECNAME and __end_SECNAME, where SECNAME is the name of the section. These indicate the start address and end address of the orphaned section respectively. Systems that don't support these features retain the earlier behavior. This commit also fixes the annoyance that modifying lib/vlog-modules.def causes all sources files that #include "vlog.h" to recompile.
* vlog: Remove explicit calls to vlog_init().Ben Pfaff2010-07-211-1/+0
| | | | This is no longer necessary.
* timeval: Make time_init() static and remove calls to it.Ben Pfaff2010-07-211-1/+0
| | | | | | Since the timeval module now initializes itself on-demand, there is no longer any need to initialize it explicitly, or to provide an interface to do so.
* vconn: Fix tracking of "connected" state.Ben Pfaff2010-06-241-1/+3
| | | | | | | | | | | | | | | | | | | | | While I was looking at the rconn code for connection backoff and retry, I noticed that ovs-vswitchd was logging the following on each connection attempt: Jun 11 15:17:41|00020|vconn_stream|ERR|send: Connection refused The "send:" part didn't make much sense. The configured controller was not actually running, so the vconn code should not have been able to connect at all, so the message should have been about a connection failing, not about sending on a completed connection failing. Investigation showed that different parts of the library have different ideas about return value semantics. vconn_open() and stream_open() both return 0 if a connection succeeded or if one is in progress, but some of its callers thought that it returned 0 if the connection succeeded and EAGAIN if the connection was in progress. This commit fixes up the callers that had the wrong idea, by making them instead all vconn_connect() or stream_connect() to determine whether the connection is complete.
* tests: Remove incorrect OVS_UNUSED from declaration.Ben Pfaff2010-05-261-1/+1
|
* Merge "master" into "next".Ben Pfaff2010-02-111-9/+9
|\ | | | | | | | | The main change here is the need to update all of the uses of UNUSED in the next branch to OVS_UNUSED as it is now spelled on "master".
| * Rename UNUSED macro to OVS_UNUSED to avoid naming conflict.Ben Pfaff2010-02-111-2/+2
| | | | | | | | Requested by Jean Tourrilhes <jt@hpl.hp.com>.
* | tests: Remove write-only variables.Ben Pfaff2010-02-111-2/+2
| | | | | | | | Found by Clang (http://clang-analyzer.llvm.org/).
* | tests: Make test-vconn build and pass tests without OpenSSL.Ben Pfaff2010-01-081-0/+2
| |
* | tests: Improve vconn tests.Ben Pfaff2010-01-081-42/+48
| |
* | vconn: Test SSL vconns too.Ben Pfaff2010-01-071-107/+120
| | | | | | | | | | | | This test should help avoid simple bugs in the SSL vconn and SSL stream implementations in the future. It would have found the bugs fixed by recent commits.
* | vconn: Convert vconn code to modern OVS structure.Ben Pfaff2010-01-061-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | The vconn code is a relative fossil as OVS code goes. It was written before we had really figured how code should fit together. Part of that history is that it used poll_fd_callback() to register callbacks without the assistance of other code. That isn't how the rest of OVS works now; this code is the only remaining user of that function. To make it more like the rest of the system, this code gets rid of the use of poll_fd_callback(). It also adds vconn_run() and vconn_run_wait() functions and calls to them from the places where they are now required.
* | Clean-up compiler warnings about ignoring return valuesJustin Pettit2009-12-151-1/+1
|/ | | | | | | Some systems complain when certain functions' return values are not checked. This commit fixes those warnings. Creating ignore() function suggested by Ben Pfaff.
* tests: Cleanup getsockname argument warningJustin Pettit2009-08-251-1/+1
| | | | | The second argument was being passed in as a sockaddr_in, when it should be a sockaddr. This commit cleans up the warning by casting it.