summaryrefslogtreecommitdiff
path: root/lib/stream.c
Commit message (Collapse)AuthorAgeFilesLines
* Move lib/ofp-print.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/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>
* Move lib/dynamic-string.h to include/openvswitch directoryBen Warren2016-03-191-1/+1
| | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Use the IANA-assigned ports for OpenFlow and OVSDB.Justin Pettit2015-03-121-6/+6
| | | | | | | | We've been warning about the change since 2.1, which was released a year ago. Signed-off-by: Justin Pettit <jpettit@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* stream: Eliminate pstream_set_dscp().Ben Pfaff2015-02-201-10/+1
| | | | | | | | | | | | | | | | This function is really of marginal utility. This commit drops it and makes the existing callers instead open a new pstream with the desired dscp. The ulterior motive here is that the set_dscp() function that actually sets the DSCP on a socket really wants to know the address family (AF_INET vs. AF_INET6). We could plumb that down through the stream code, and that's one reasonable option, but I thought that simply eliminating some calls to set_dscp() where we don't already have the address family handy was another reasonable way to go. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Alex Wang <alexw@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>
* util: Make WSAStartup available outside stream.c.Gurucharan Shetty2014-06-241-29/+0
| | | | | | | | | WSAStartup() needs to be called before using winsock2 related functions. We need this for almost all the utilities. So call it through OVS_CONSTRUCTOR. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* stream: Introduce [p]windows_[p]stream_class.Gurucharan Shetty2014-04-221-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | On Linux, we heavily use --remote=punix:* to listen for connections through unix domain sockets. We also use, unix:* to connect to a daemon that is listening on unix domain sockets. Many times, we create default unix domain sockets for listening and many utilities connect to these sockets by default. Windows does not have unix domain sockets. So far, we could just use ptcp:* and tcp:* for listening and initiating connections respectively. The drawback here is that one has to provide a specific TCP port. For unit tests, it looks useful to let kernel choose that port. As such, we can let that chosen kernel port be stored in the file specified with punix:* and unix:*. For this purpose, introduce a new [p]windows_[p]stream_class. Since it is just a wrapper around [p]tcp_[p]stream_class, add it to stream-tcp.c. commit cb54a8c (unixctl: Add support for Windows.) used the above concept for only control channel connections (i.e., --unixctl for daemons and its interaction with ovs-appctl). This commit adds the same support for all unix domain sockets. Now that we have a separate class [p]stream_class for hiding kernel assigned TCP port inside a file meant for unix domain sockets in windows, make unixctl use it. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* stream: Call WSAStartup() before calling any winsock functions.Gurucharan Shetty2014-03-181-0/+31
| | | | | | | | | | | | | | The WSAStartup function initiates use of the Winsock DLL by a process. The function should be called before any winsock related functions are called. Since, we use stream-fd-windows through pstream_open or stream_open add the WSAStartup() call there. The current version of the Windows Sockets specification is version 2.2 Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* Windows implementation of stream-fd.Linda Sun2014-02-251-2/+2
| | | | | | | | | Use send/recv for socket stream instead of read/write. Use event handle for polling on socket stream. Check windows specific return code. Signed-off-by: Linda Sun <lsun@vmware.com> Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
* socket-util: Unix socket related calls for non-windows platform.Gurucharan Shetty2014-02-211-0/+4
| | | | | | Don't try to compile Unix socket related functions for Windows. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
* Add IPv6 support for OpenFlow, OVSDB, NetFlow, and sFlow.Arun Sharma2014-02-061-4/+4
| | | | | | | | | | Does not add IPv6 support for in-band control. Co-authored-by: Ben Pfaff <blp@nicira.com> Signed-off-by: Nandan Nivgune <nandan.nivgune@calsoftinc.com> Signed-off-by: Abhijit Bhopatkar <abhijit.bhopatkar@calsoftinc.com> Signed-off-by: Arun Sharma <arun.sharma@calsoftinc.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Remove stream, vconn, and rconn functions to get local/remote IPs/ports.Ben Pfaff2013-12-171-56/+0
| | | | | | | | These functions don't have any ultimate users. The in-band control code used to use them, but not anymore, so we might as well delete them all. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* Rename NOT_REACHED to OVS_NOT_REACHEDHarold Lim2013-12-171-1/+1
| | | | | | | | This allows other libraries to use util.h that has already defined NOT_REACHED. Signed-off-by: Harold Lim <haroldl@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* stream: Log a warning when the default OpenFlow or OVSDB port is used.Justin Pettit2013-10-011-0/+13
| | | | | | | | | | Both OpenFlow and OVSDB have new IANA-assigned port numbers. We still default to the original values (6633 and 6632, respectively), but this commit logs a warning. In the future, we will switch to the official values (6653 and 6640, respectively). Signed-off-by: Justin Pettit <jpettit@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* Don't differentiate between TCP and SSL ports for OpenFlow and OVSDB.Justin Pettit2013-10-011-33/+24
| | | | | | | | | | | | The OVS code has always made a distinction between the unencrypted (TCP) and SSL port numbers for the OpenFlow and OVSDB protocols. The default port numbers for both protocols has changed, and there continues to be no distinction between the unencrypted and SSL versions. This commit removes the distinction in port numbers. A future patch will recognize the change in default port number. Signed-off-by: Justin Pettit <jpettit@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* Remove unused variables and functions.Jarno Rajahalme2013-09-271-3/+0
| | | | | | | | Found by Clang. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* ovsdb-server: Announce bound listening ports as status:bound_port.Ben Pfaff2013-04-181-1/+16
| | | | | | | | | The administrator can request that OVSDB bind any available TCP port, but in that case there is no easy way to find out what port it has bound. This commit adds that information as the "bound_port" key in the "status" column. Signed-off-by: Ben Pfaff <blp@nicira.com>
* Replace most uses of assert by ovs_assert.Ben Pfaff2013-01-161-19/+18
| | | | | | | | 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>
* pstream: Add set_dscp method.Isaku Yamahata2012-09-261-0/+9
| | | | | | | | Introduce set_dscp method to pstream. This will be used by dynamic dscp change of listening socket. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofp-msgs: New approach to encoding and decoding OpenFlow headers.Ben Pfaff2012-07-301-2/+2
| | | | | | | | | | | | | | | | 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>
* 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>
* stream: By default disable probing on unix sockets.Ethan Jackson2012-04-121-0/+19
| | | | | | | There isn't a lot of value in sending inactivity probes on unix sockets. This patch changes the default to disable them. Signed-off-by: Ethan Jackson <ethan@nicira.com>
* Allow configuring DSCP on controller and manager connections.Mehak Mahajan2012-03-231-8/+10
| | | | | | | | | | | 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-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* vswitchd: In-band rules for Controller are missing after executing ↵Ansis Atteka2011-12-191-1/+21
| | | | | | | | | | | | | | | | | force-reload-kmod command In current implementation vswitchd adds Controller in-band rules only if there is a route in kernel routing table that might route traffic to the Controller. But, when executing force-reload-kmod command, network configuration (e.g. assigned IP addresses, routes) are flushed away, hence Controller in-band rules are not added. This commit fixes this limitation and allows vswitchd to add Controller in-band rules even if there are no routes in the kernel routing table. Issue: #8625 Signed-off-by: Ansis Atteka <aatteka@nicira.com>
* stream: Make classes constSimon Horman2011-11-231-14/+14
| | | | The classes are never modified and may be declared constant.
* stream: Fix uninitialized values in stream_init().Ben Pfaff2011-11-021-0/+1
| | | | | | | | | stream_init() didn't initialize the remote_ip, remote_port, local_ip, or local_port members of the stream, so "unix" streams that don't have any of those would get random values instead. Reported-by: "Voravit T." <voravit@kth.se> Reported-by: Jari Sundell <sundell.software@gmail.com>
* stream: Make stream_report_content() tolerate negative size.Ben Pfaff2011-02-231-2/+2
| | | | | | | | A negative size probably means that a system call failed. The caller could set that to 0 but we might as well just tolerate it in stream_report_content() by making the parameter type signed. Coverity #10718.
* stream: Fix error message.Ben Pfaff2011-01-271-3/+3
| | | | | This message is supposed to be helpful but with the arguments in the wrong order it was just confusing.
* coverage: Make the coverage counters catalog program-specific.Ben Pfaff2010-11-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now, the collection of coverage counters 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 mac_learning, it still has a coverage counter 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 files that include coverage counters must be listed on COVERAGE_FILES in lib/automake.mk. This commit also fixes the annoyance that modifying any source file that includes a coverage counter caused all programs that link against libopenvswitch.a to relink, even programs that the source file was not linked into. For example, modifying ofproto/ofproto.c (which includes coverage counters) caused tests/test-aes128 to relink, even though test-aes128 does not link again ofproto.o.
* Convert stream and vconn interfaces to use ovs_be16, ovs_be32.Ben Pfaff2010-11-291-8/+8
|
* vlog: Make client supply semicolon for VLOG_DEFINE_THIS_MODULE.Ben Pfaff2010-10-291-1/+1
| | | | | It's kind of odd for VLOG_DEFINE_THIS_MODULE to supply its own semicolon, so this commit switches to the more common form.
* stream, vconn: Fix comments.Ben Pfaff2010-08-251-4/+4
| | | | | | | All streams and all vconns are "active", so there's no point in noting that requirement in comments. (A long time ago, active and passive vconns were conflated instead of having passive vconns broken out as pvconns. But active and passive streams have always been distinct.)
* vlog: Make the vlog module catalog program-specific.Ben Pfaff2010-07-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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: Introduce VLOG_DEFINE_THIS_MODULE for declaring vlog module in use.Ben Pfaff2010-07-211-2/+2
| | | | | | | Adding a macro to define the vlog module in use adds a level of indirection, which makes it easier to change how the vlog module must be defined. A followup commit needs to do that, so getting these widespread changes out of the way first should make that commit easier to review.
* vconn: Fix tracking of "connected" state.Ben Pfaff2010-06-241-6/+8
| | | | | | | | | | | | | | | | | | | | | 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.
* Diagnose attempts to connect the wrong protocol to a network port.Ben Pfaff2010-05-111-0/+61
| | | | | | | | Sometimes, when a user asks me to help debug a problem, it turns out that an SSL connection was being made on a TCP port, or vice versa, or that an OpenFlow connection was being made on a JSON-RPC port, or vice versa, and so on. This commit adds log messages that diagnose this kind of problem, e.g. "tcp:127.0.0.1:6633: received JSON-RPC data on OpenFlow channel".
* Make fatal signals cause an exit more promptly in special cases.Ben Pfaff2010-04-131-0/+4
| | | | | | | | | | | | | | The fatal-signal library notices and records fatal signals (e.g. SIGTERM) and terminates the process on the next trip through poll_block(). But some special utilities do not always invoke poll_block() promptly, e.g. "ovs-ofctl monitor" does not call poll_block() as long as OpenFlow messages are available. But these special cases seem like they are all likely to call into functions that themselves block (those with "_block" in their names). So make a new rule that such functions should always call fatal_signal_run(), either directly or through poll_block(). This commit implements and documents that rule. Bug #2625.
* vconn-stream: Factor out port defaults into public helper functions.Ben Pfaff2010-04-121-0/+69
| | | | These functions will be used elsewhere in an upcoming commit.
* stream: Generalize stream_open_block().Ben Pfaff2010-04-121-4/+12
| | | | | | This change makes it possible to separate opening a stream from blocking on connection completion. This avoids some code redundancy in an upcoming commit.
* stream: New functions stream_verify_name() and pstream_verify_name().Ben Pfaff2010-04-121-40/+118
| | | | | | | | These functions can be useful for checking whether a given name is an active or passive connection method. The implementation is cut-and-paste from vconn_verify_name() and pvconn_verify_name().
* Merge "master" into "next".Ben Pfaff2010-02-111-1/+1
| | | | | 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".
* stream: Really enable SSL streams.Ben Pfaff2010-01-071-0/+6
| | | | SSL streams were supposed to work, but they didn't. Oops.
* Add SSL support to "stream" library and OVSDB.Ben Pfaff2010-01-061-1/+21
|
* stream: Add stream_run(), stream_run_wait() functions.Ben Pfaff2010-01-061-2/+27
| | | | | | | SSL, which will be added in an upcoming commit, requires some background processing, which is best done in a "run" function in our architecture. This commit adds stream_run() and stream_run_wait() and calls to them from the places where they will be required.
* Check invariants earlier in vconn and stream code.Ben Pfaff2010-01-061-0/+1
| | | | | | | These invariants are checked by vconn_open() and stream_open(), but there is no reason not to check them earlier also. vconn and stream creation don't have to go through vconn_open() and stream_open(), so this ensures that the invariants get checked either way.
* stream: New function pstream_accept_block().Ben Pfaff2009-11-121-0/+21
|
* stream: New library for bidirectional streams (e.g. TCP, SSL, Unix sockets).Ben Pfaff2009-11-041-0/+490
This code is heavily based on the vconn code. Eventually we should make the stream-based vconns (currently that's all of them) a wrapper around streams, but I haven't done that yet. SSL is not implemented yet.