2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 18:07:40 +00:00

29 Commits

Author SHA1 Message Date
Ben Pfaff
14347f3e82 stream-unix: Give accepted sockets distinct names for log messages.
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>
2017-12-08 14:21:19 -08:00
Xiao Liang
fd016ae3fb lib: Move lib/poll-loop.h to include/openvswitch
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>
2017-11-03 10:47:55 -07:00
Ben Pfaff
b7636967a8 stream: Make [p]stream_init() take ownership of 'name' parameter.
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>
2017-07-17 10:05:46 -07:00
Thadeu Lima de Souza Cascardo
dd23522f68 stream-unix: only use path-based socket names
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>
2016-07-19 20:06:45 -07:00
Ben Pfaff
c2e3cbaf7b stream: Eliminate pstream_set_dscp().
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>
2015-02-20 11:32:06 -08:00
Thomas Graf
e6211adce4 lib: Move vlog.h to <openvswitch/vlog.h>
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>
2014-12-15 14:15:19 +01:00
Gurucharan Shetty
b7cefbf7e5 stream-tcp: Call setsockopt TCP_NODELAY after TCP is connected.
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>
2014-10-23 11:07:32 -07:00
Lilijun
29058c4e16 pstream-unix: Increase listen count to 64 in punix_open().
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>
2014-09-30 08:39:39 -07:00
Arun Sharma
e731d71bf4 Add IPv6 support for OpenFlow, OVSDB, NetFlow, and sFlow.
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>
2014-02-06 16:08:34 -08:00
Ben Pfaff
10a89ef04d Replace all uses of strerror() by ovs_strerror(), for thread safety.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-28 16:09:38 -07:00
Pavithra Ramesh
2c487bc808 stream-unix: Use rundir as root for relative paths.
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>
2013-02-11 11:18:58 -08:00
Ben Pfaff
3e6c955de6 Remove useless use of <assert.h>.
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>
2013-01-16 16:03:55 -08:00
Ethan Jackson
c3f2538933 ovs-ofctl: Don't rely on stat() to check unix sockets.
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>
2012-11-20 14:41:04 -08:00
Isaku Yamahata
f89b7ce502 pstream: Add set_dscp method.
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>
2012-09-26 21:24:19 -07:00
Ben Pfaff
c146b2f86a stream-unix: Reduce connection failure log level from ERR to WARN.
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>
2012-09-17 09:58:30 -07:00
Ben Pfaff
5ca92d1d5d socket-util: Remove 'passcred' parameter from make_unix_socket().
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>
2012-07-18 10:29:20 -07:00
Raju Subramanian
e0edde6fee Global replace of Nicira Networks.
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>
2012-05-02 17:08:02 -07:00
Ethan Jackson
f1936eb651 stream: By default disable probing on unix sockets.
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>
2012-04-12 00:43:22 -07:00
Mehak Mahajan
f125905cdd Allow configuring DSCP on controller and manager connections.
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>
2012-03-23 18:13:08 -07:00
Ben Pfaff
7921b912de stream-unix: Do not bind a name for client sockets.
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>
2012-03-07 16:33:15 -08:00
Simon Horman
da327b18bd stream: Make classes const
The classes are never modified and may be declared constant.
2011-11-23 21:18:06 -08:00
Ben Pfaff
b7643a4c96 stream-unix: Fix naming of passive Unix streams.
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".
2011-07-26 16:50:07 -07:00
Ben Pfaff
d98e600755 vlog: Make client supply semicolon for VLOG_DEFINE_THIS_MODULE.
It's kind of odd for VLOG_DEFINE_THIS_MODULE to supply its own semicolon,
so this commit switches to the more common form.
2010-10-29 09:48:47 -07:00
Ben Pfaff
5136ce492c vlog: Introduce VLOG_DEFINE_THIS_MODULE for declaring vlog module in use.
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.
2010-07-21 15:47:09 -07:00
Ben Pfaff
3762274e63 Add some missing "#include"s.
These are required to build on FreeBSD 8.0.
2010-05-26 15:27:01 -07:00
Ben Pfaff
c69ee87c10 Merge "master" into "next".
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".
2010-02-11 11:11:23 -08:00
Ben Pfaff
539e96f623 stream: Add stream_run(), stream_run_wait() functions.
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.
2010-01-06 14:26:48 -08:00
Ben Pfaff
e6e6bdad78 Remove redundant calls to set_nonblocking().
These set_nonblocking() calls are on a fd returned by make_unix_socket(),
which has already set the fd nonblocking.
2009-12-11 17:00:28 -08:00
Ben Pfaff
c34b65c731 stream: New library for bidirectional streams (e.g. TCP, SSL, Unix sockets).
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.
2009-11-04 15:24:40 -08:00