summaryrefslogtreecommitdiff
path: root/lib/stream-unix.c
Commit message (Collapse)AuthorAgeFilesLines
* stream-unix: Give accepted sockets distinct names for log messages.Ben Pfaff2017-12-081-3/+12
| | | | | | | | | | | | | | | | At least on Linux, when process A connects to process B over a Unix domain socket, unless process A bound its socket to a name before it made the connection, process B gets an empty peer name. Until now, OVS has just reported the name of the connection as "unix". This is not meaningful, of course. I do not know of a good general solution to this problem, but this commit attempts a step in the right direction by at least giving each connection of this kind a number: "unix#1", "unix#2", and so on. That way, in log messages one can at least see which messages are related to a particular connection. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* 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>
* stream: Make [p]stream_init() take ownership of 'name' parameter.Ben Pfaff2017-07-171-10/+7
| | | | | | | | | This will be a more sensible interface in an upcoming commit where many of the callers are assembling dynamic name strings anyway. Signed-off-by: Ben Pfaff <blp@ovn.org> Tested-by: Numan Siddique <nusiddiq@redhat.com> Acked-by: Numan Siddique <nusiddiq@redhat.com>
* stream-unix: only use path-based socket namesThadeu Lima de Souza Cascardo2016-07-191-1/+1
| | | | | | | | | | | | | | | | | | FreeBSD returns a socklen of sockaddr_storage when doing an accept on an unix STREAM socket. The current code will assume it means a sun_path larger than 0. That breaks some tests like the one below which don't expect to find "unix::" on the logs. As a Linux abstract address would not have a more useful name either, it's better to check that sun_path starts with a non-zero byte and return 0 length in case it doesn't. 402: ovs-ofctl replace-flows with --bundle FAILED (ovs-ofctl.at:2928) 2016-07-08T12:44:30.068Z|00020|vconn|DBG|unix:: sent (Success): OFPT_HELLO (OF1.6) (xid=0x1): Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* stream: Eliminate pstream_set_dscp().Ben Pfaff2015-02-201-3/+2
| | | | | | | | | | | | | | | | 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>
* stream-tcp: Call setsockopt TCP_NODELAY after TCP is connected.Gurucharan Shetty2014-10-231-2/+3
| | | | | | | | | | | | | | | | | | | | | On Windows platform, TCP_NODELAY can only be set when TCP is established. (This is an observed behavior and not written in any MSDN documentation.) The current code does not create any problems while running unit tests (because connections get established immediately) but is reportedly observed while connecting to a different machine. commit 8b76839(Move setsockopt TCP_NODELAY to when TCP is connected.) made changes to call setsockopt with TCP_NODELAY after TCP is connected only in lib/stream-ssl.c. We need the same change for stream-tcp too and this commit does that. Currently, a failure of setting TCP_NODELAY results in reporting the error and then closing the socket. This commit changes that behavior such that an error is reported if setting TCP_NODELAY fails, but the connection itself is not torn down. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* pstream-unix: Increase listen count to 64 in punix_open().Lilijun2014-09-301-1/+1
| | | | | | | | | | | | | | In my test with openstack setup, ovs-ofctl executes failed when there are many flow rules to be added by multiple threads. The error like this: ovs-ofctl: /var/run/openvswitch/br1.mgmt: failed to open socket (Protocol error) In the function listen(fd, 10) in punix_open(), the number 10 should be modified to more bigger, such as 64 maybe a proper value. Signed-off-by: Lilijun <jerry.lilijun@huawei.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Add IPv6 support for OpenFlow, OVSDB, NetFlow, and sFlow.Arun Sharma2014-02-061-6/+6
| | | | | | | | | | 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>
* Replace all uses of strerror() by ovs_strerror(), for thread safety.Ben Pfaff2013-06-281-3/+4
| | | | Signed-off-by: Ben Pfaff <blp@nicira.com>
* stream-unix: Use rundir as root for relative paths.Pavithra Ramesh2013-02-111-6/+14
| | | | | | | | | | | | | | Until now, "unix:" and "punix:" paths that are not absolute have been considered relative to the current working directory. It is more useful to consider them relative to the rundir, so this commit makes that change to the C and Python implementations of the stream code. This commit also relaxes the whitelist check in the bridge code so that any name that does not contain a "/" is considered OK. Signed-off-by: Pavithra Ramesh <paramesh@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Remove useless use of <assert.h>.Ben Pfaff2013-01-161-1/+0
| | | | | | | These files #included <assert.h> but didn't ever use assert. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* ovs-ofctl: Don't rely on stat() to check unix sockets.Ethan Jackson2012-11-201-1/+1
| | | | | | | | ESX supports unix sockets, but they don't manifest themselves in file system like they do on Linux. Instead of using stat to check if a unix socket exist, this patch simply tries to open it instead. Signed-off-by: Ethan Jackson <ethan@nicira.com>
* pstream: Add set_dscp method.Isaku Yamahata2012-09-261-2/+3
| | | | | | | | 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>
* stream-unix: Reduce connection failure log level from ERR to WARN.Ben Pfaff2012-09-171-1/+1
| | | | | | | | | Sometimes this just means that the daemon we're connecting to is restarting. Bug #13177. Reported-by: Scott Hendricks <shendricks@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* socket-util: Remove 'passcred' parameter from make_unix_socket().Ben Pfaff2012-07-181-2/+2
| | | | | | | Nothing in the tree ever tries to send or receive credentials over a Unix domain socket so there's no point in configuring them to be received. 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>
* stream: By default disable probing on unix sockets.Ethan Jackson2012-04-121-0/+2
| | | | | | | 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-2/+3
| | | | | | | | | | | 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>
* stream-unix: Do not bind a name for client sockets.Ben Pfaff2012-03-071-14/+5
| | | | | | | | | | | There's no reason for a Unix domain client socket to bind a name. I don't know why we've always done that. Stevens's "Unix Network Programming" Unix domain socket client example doesn't do a bind. Removes the 'unlink_path' parameter from new_fd_stream() since it is now always passed as NULL. Signed-off-by: Ben Pfaff <blp@nicira.com>
* stream: Make classes constSimon Horman2011-11-231-2/+2
| | | | The classes are never modified and may be declared constant.
* stream-unix: Fix naming of passive Unix streams.Ben Pfaff2011-07-261-2/+2
| | | | | | | Until now, pstream_get_name() would just return "punix" for passive Unix streams. This is uninformative and probably just a mistake, so this commit switches to using the full name passed in, e.g. "punix:/path/to/socket".
* 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.
* 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.
* Add some missing "#include"s.Ben Pfaff2010-05-261-0/+1
| | | | These are required to build on FreeBSD 8.0.
* Merge "master" into "next".Ben Pfaff2010-02-111-2/+3
| | | | | 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: Add stream_run(), stream_run_wait() functions.Ben Pfaff2010-01-061-0/+2
| | | | | | | 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.
* Remove redundant calls to set_nonblocking().Ben Pfaff2009-12-111-6/+0
| | | | | These set_nonblocking() calls are on a fd returned by make_unix_socket(), which has already set the fd nonblocking.
* stream: New library for bidirectional streams (e.g. TCP, SSL, Unix sockets).Ben Pfaff2009-11-041-0/+131
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.