2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-25 15:07:05 +00:00
Commit Graph

2416 Commits

Author SHA1 Message Date
Ed Maste
62d86422f9 netdev-bsd: Use UINT64_MAX for unsupported stats.
As documented in netdev-provider.h for the get_stats method.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-03 14:05:05 -07:00
Ben Pfaff
e94f17a77a ofp-util: Fix type of 'port' param to ofputil_encode_dump_ports_request().
We always use unsigned types for port numbers elsewhere, so use one here
too.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-05-03 14:01:56 -07:00
Ben Pfaff
f44c514621 rconn: Discard messages received on monitor connections.
Otherwise, if a monitor connection happens to be talking to a (misguided?)
peer that sends it messages, such as replies to what the peer perceives as
echo requests meant for it, then the peer will eventually hang trying to
send data because the monitor connection never sinks it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-05-03 13:40:19 -07:00
Ben Pfaff
5ac7c4dcf5 rconn: Factor code out from copy_to_monitor().
This prepares for the introduction of a second user in the following
commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-03 13:40:06 -07:00
Ed Maste
44f645a583 socket-util: restore building on FreeBSD.
FreeBSD does not have EAI_ADDRFAMILY or EAI_NODATA and thus failed to build
after commit 3cbb5dc7e8 "socket-util: Use
getaddrinfo() instead of gethostbyname() for thread safety."

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-03 13:32:47 -07:00
Ben Pfaff
5b7126361f vconn: Mark class structures as const.
These data structures are never modified so it seems logical for them
to be const.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-03 13:29:49 -07:00
Ben Pfaff
a00d4bd036 ofp-util: Make names[] in ofputil_action_code_from_name() const-ier.
This changes allows the compiler to put 'names' in a read-only section.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-03 13:29:48 -07:00
Ben Pfaff
4b5f1d2cc3 vlog: Mark more static data const.
These data structures are never modified so this seems like a
logical change.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-03 13:29:48 -07:00
Ben Pfaff
112b76f6b9 stream-fd: Mark 'fd_pstream_class' const.
These data structures are never modified so this seems like a
logical change.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-03 13:29:47 -07:00
Ben Pfaff
edfbe9f7bc netdev: Make 'smap' variable const in netdev_set_qos().
This makes this code more obviously thread-safe.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-03 13:29:47 -07:00
Ben Pfaff
559eb2308b netdev-linux: Mark more static data as "const".
This makes this code more obviously thread-safe.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-03 13:29:47 -07:00
Ben Pfaff
e37726e467 hmap: Make HMAP_INITIALIZER a valid initializer for a const hmap.
Without this change, an initialization such as
    const struct hmap map = HMAP_INITIALIZER(&map);
yields a compiler warning "initialization discards qualifiers from pointer
target type".

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-03 13:29:46 -07:00
Ben Pfaff
d64e176c35 dpif-linux: Make dummy_action const in dpif_linux_init_flow_put().
This makes this code more obviously thread-safe.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-03 13:29:46 -07:00
Ben Pfaff
9b6937eb1f Use gmtime_r() and localtime_r() instead of non-thread-safe versions.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-02 15:49:36 -07:00
Ben Pfaff
3cbb5dc7e8 socket-util: Use getaddrinfo() instead of gethostbyname() for thread safety.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-02 14:34:45 -07:00
Ben Pfaff
92829687b4 Use pthread_sigmask() in place of sigprocmask(), for thread safety.
POSIX says that multithreaded programs must not use sigprocmask() but must
use pthread_sigmask() instead.  This commit makes that replacement.

The actual use of signals in Open vSwitch is still not thread safe
following this commit, but this change is a necessary prerequisite for
fixing the other problems.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-02 13:55:45 -07:00
Neil Mckee
743cea4543 Change sFlow model to reflect per-bridge sampling
Until now, we were presenting a separate sFlow data-source (sampler) for
each ifIndex-interface.  This caused problems with samples that did not
easily map to an ifIndex being aliased together and breaking the sFlow
containment rules.  This patch changes the model to present a single sFlow
data-source for each bridge.  Now we can still make all reasonable effort
to map packet samples to ingress/egress ifIndex numbers, knowing that the
fallback to "unknown" does not break the sFlow model.  Note that
interface-counter-polling is still handled the same way as before, with
sFlow counter-polling data only being exported for ifIndex-interfaces.

Signed-off-by: Neil Mckee <neil.mckee@inmon.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-02 12:37:28 -07:00
Ben Pfaff
48f6fbe197 dpif-linux: Close channel Netlink sockets when a port number gets recycled.
When ovs-vswitchd deletes a port with dpif_linux_port_del(), that function
uses del_channel() to delete the corresponding channel, including closing
its Netlink socket fd.  However, if the vport gets removed by some other
process (e.g. "ip link delete" for veths) then this function never gets
called and thus the channel never gets deleted.

This commit partially fixes the problem.  Now, if a port number gets
reused, add_channel() closes the old Netlink socket assigned to that port
before it installs the new one.

Bug #16784.
Reported-by: Paul Ingram <paul@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-02 10:10:42 -07:00
Ben Pfaff
12d7685905 dpif-linux: Use MAX_PORTS instead of hard-coded 65535.
MAX_PORTS is currently USHRT_MAX (also 65535).  I think that's a
coincidence; I don't remember MAX_PORTS being mentioned when the new
dpif_channel code was written.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-02 10:06:35 -07:00
Simon Horman
20131cefeb Make it more obvious that OVS_KEY_ATTR_MPLS may be an array
Note that OVS_KEY_ATTR_MPLS may be an array of ovs_key_mpls
and that the acceptable length may be restricted by the implementation.

Currently the user-space datapath and proposed kernel datapath
implementation restrict the length to a single element.

Also update the mpls_top_lse name of the element of struct ovs_key_mpls,
as it is an array of LSEs and thus not necessarily just the top LSE.

As requested by Jesse Gross

Cc: Jesse Gross <jesse@nicira.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jesse Gross <jesse@nicira.com>
2013-05-01 19:34:05 -07:00
Ben Pfaff
589b85e14b dpif-netdev: Shorten delay loops.
Um, I mean, remove useless code.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-30 15:17:53 -07:00
Gurucharan Shetty
7ffd3f6972 worker: Prevent worker from being responsible for pidfile deletion.
Currently we are creating the worker process after creation of the pidfile.
This means that the responsibility of deleting the pidfile after process
termination rests with the worker process.

When we restart openvswitch using the startup scripts, we SIGTERM the main
process and once it is cleaned up, we start ovs-vswitchd again. This results
in a race condition. The new ovs-vswitchd will create a pidfile because it is
unlocked. But, if the old worker process exits after the start of new
ovs-vswitchd, it will simply delete the pidfile underneath the new ovs-vswitchd.
This will eventually result in multiple ovs-vswitchd daemons.

This patch gives the responsibility of deleting the pidfile to the main
process.

Bug #16669.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
2013-04-29 15:09:48 -07:00
Ben Pfaff
488232b7ec netlink-socket: Use xmalloc() instead of malloc().
This was the only obvious use of bare malloc() in the tree, other
than in the implementation of wrapper functions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-29 15:05:56 -07:00
Ben Pfaff
0d121c7350 netlink-socket: Minor style fix.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-29 15:05:56 -07:00
Ben Pfaff
95ddb070ca timeval: Remove prototype for unimplemented function.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-29 15:02:26 -07:00
Ben Pfaff
086041cc8f dpif-netdev: Update max_mtu correctly.
What a dumb bug.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-29 13:54:57 -07:00
Jesse Gross
b13b6d4786 vxlan: Correct comments and NEWS to reflect IANA port assigment.
Signed-off-by: Jesse Gross <jesse@nicira.com>
2013-04-29 10:01:00 -07:00
Kyle Mestery
4f2abb7bf6 Update the default VXLAN destination UDP port to the IANA assigned port
VXLAN was recently assigned UDP port 4789 by IANA. This
comit updates the OVS VXLAN implementation to reflect the new UDP port
number.

Cc: Kenneth Duda <kduda@aristanetworks.com>
Signed-off-by: Kyle Mestery <kmestery@cisco.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
2013-04-26 11:39:52 -07:00
Simon Horman
392c30bac2 match: Correct formatting of MPLS
1. mpls or mplsm should be included in the formatted match  instead of
   dl_type=0xXXXX if the dl_type of the match is ETH_TYPE_MPLS or
   ETH_TYPE_MPLS_MCAST respectively. This is consistent with the treatment
   of other dl_types in match_format().

2. Add formatting of MPLS TTL to match_format().
   The format is mpls_ttl=YY.

3. Set the mpls_lse mask of a match to all 1's if
   the dl_type of the flow is ETH_TYPE_MPLS or ETH_TYPE_MPLS_MCAST.
   This will cause mpls_label=LLLL,mpls_tc=W,mpls_ttl=YY,mpls_bos=Z to
   be included with the match is formatted.

4. mpls(label:LLLL,tc:W,ttl:TT,bos:Z) and
   mplsm(label:LLLL,tc:W,ttl:TT,bos:Z) should not be included
   in a formatted match as this is not consistent with the
   formatting of other match elements.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-24 10:19:27 -07:00
Ben Pfaff
93456ec8b0 timeval: Check for HAVE_BACKTRACE instead of HAVE_EXECINFO_H.
Other code in the tree uses HAVE_BACKTRACE and then blindly includes
<execinfo.h> if it is present, so this doesn't make anything worse.

Once we do that, HAVE_EXECINFO_H has no further users, so this commit also
removes the check for <execinfo.h>

Reported-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-24 08:59:11 -07:00
Romain Lenglet
29089a540c Implement IPFIX export
Define a new NXAST_SAMPLE OpenFlow vendor action and the corresponding
OFPACT_SAMPLE OVS action, to do per-flow packet sampling, translated
into a new SAMPLE "flow_sample" dp action.

Make the userspace action's userdata size vary depending on the union
member used.  Add a new "flow_sample" upcall to do per-flow packet
sampling.  Add a new "ipfix" upcall to do per-bridge packet sampling
to IPFIX collectors.

Extend the OVSDB schema to support configuring IPFIX collector sets.
Add support for configuring multiple IPFIX collectors for per-flow
packet sampling.  Add support for configuring per-bridge IPFIX
sampling.

Automatically generate standard IPFIX entity definitions from the IANA
specs.  Send one IPFIX data record message for every packet sampled by
an OpenFlow sample action or received by a bridge configured with
IPFIX sampling, and periodically send IPFIX template set messages.

Signed-off-by: Romain Lenglet <rlenglet@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-22 14:33:58 -07:00
Jarno Rajahalme
fc80de30d4 odp-util: Keep base flow in sync with the kernel view.
Change the base flow only if a corresponding kernel action is generated
in commit_odp_tunnel_action().

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-22 09:06:01 -07:00
YAMAMOTO Takashi
339f0a19dc use RT_ROUNDUP on NetBSD
Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-22 08:52:47 -07:00
YAMAMOTO Takashi
14235530fa include some headers to satisfy header file dependencies on NetBSD-6
while this change don't seem to be necessary on NetBSD-current,
NetBSD-6 is the latest release at this point.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-22 08:52:37 -07:00
YAMAMOTO Takashi
e091ef84ca some ctype related casts to suppress gcc warnings on NetBSD
where it can't be EOF, cast a value to unsigned char before passing it
to ctype functions to avoid unintended sign extension.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-22 08:52:24 -07:00
YAMAMOTO Takashi
4ed6a64c61 change the type of popcount unsigned
it's a natural choice and compatible with a version found in NetBSD libc.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-22 08:51:22 -07:00
YAMAMOTO Takashi
edefaa2ef7 include strings.h for strcasecmp
while this is not the only place strcasecmp is used without an
explicit inclusion of the header, it's the only place gcc complains
on my environment.  for other places, probably the header is included
indirectly via other headers, i guess.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-22 08:46:13 -07:00
YAMAMOTO Takashi
bf1aa7a053 fix an obvious mistake in a test of IFM_ETHER
fix a bug in FreeBSD code.  the fix is suggested by Ed Maste.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-22 08:34:53 -07:00
Ben Pfaff
798e1352d0 ovsdb-server: Announce bound listening ports as status:bound_port.
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>
2013-04-18 16:43:15 -07:00
Ben Pfaff
df451457ad socket-util: Log kernel-chosen bound ports in inet_open_passive().
Usually, for passive sockets, one wishes to bind a particular well-known
port, so that clients can easily connect.  But automated tests cannot
necessarily bind a well-known port, because that would cause multiple
concurrent tests to interfere with each other or with a real instance of
the service running on the system.  They could bind to a randomly selected
port chosen by the user (the Open vSwitch automated tests currently do this)
but this leads to occasional "false negative" test failures when the port
selected happens to be in use.

The best alternative for automated tests is to let the kernel choose a
port that is not otherwise in use, which can be accomplished by specifying
port 0.  But in that case there is no easy way for other software to know
what port the kernel chose.  This commit fixes that problem one way by
logging the bound port when it is chosen by the kernel.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-18 16:43:15 -07:00
Ben Pfaff
1638b90642 Correctly implement the OpenFlow 1.2+ OXM_OF_IP_DSCP field.
NXM puts the DSCP value in bits 2-7 of NXM_OF_IP_TOS.
OXM puts the DSCP value in bits 0-6 of OXM_OF_IP_DSCP.

Before this commit, Open vSwitch incorrectly implemented OXM_OF_IP_DSCP
with the same format as NXM_OF_IP_TOS.  This commit fixes the problem and
adds a test (previously missing but I don't know why).

Reported-by: Hiroshi Miyata <miyahiro.dazu@gmail.com>
Tested-by: Hiroshi Miyata <miyahiro.dazu@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-18 09:40:48 -07:00
Ben Pfaff
1132692288 list: Style fixes.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-16 09:19:35 -07:00
Ben Pfaff
1c85959e0c memory: Avoid 100% CPU when there is nothing to report.
Commit b9de408768 (memory: Avoid an empty log message if there's nothing
to log.) introduced a 100% CPU usage condition when there is nothing to
log.  This fixes the problem.

Reported-by: Ansis Atteka <aatteka@nicira.com>
Acked-by: Ansis Atteka <aatteka@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-11 15:52:58 -07:00
Ansis Atteka
f28b6dd3f4 netlink-socket: Don't bother logging SO_RCVBUFFORCE failure
This patch fixes tests when they are run with "fakeroot debian/rules binary"
command.

The problem was that under fakeroot setsockopt() call could still return
EPERM and lead to a warning message being logged.

Signed-off-by: Ansis Atteka <aatteka@nicira.com>
2013-04-11 11:33:24 -07:00
Ben Pfaff
808311f6d9 sset: New function sset_sort().
This will have its first caller in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ansis Atteka <aatteka@nicira.com>
2013-04-10 18:10:58 -07:00
Ethan Jackson
fa717215da dpif-linux: Reset epoll() on channel deletion.
The list of epoll events contains references to channels which may
be stale when one of those channels is deleted.  The safest thing
to do is simply refresh epoll() whenever a channel is deleted.

Bug #16057.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
2013-04-10 13:05:04 -07:00
Romain Lenglet
ca03aae04a vlog: extend syslog format to make OVS logs easier to filter
Prepend "ovs|" to syslog logs to make them easier to filter out of all
LOG_DAEMON logs.

Signed-off-by: Romain Lenglet <rlenglet@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-05 09:00:22 -05:00
Ben Pfaff
b9de408768 memory: Avoid an empty log message if there's nothing to log.
I spotted this in a case where I ran ovsdb-server, by hand, on an empty
database.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-03 05:52:12 -07:00
Ben Pfaff
c86073a000 netdev: Remove netdev_is_open(), which has no users.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-04-01 15:49:32 -07:00
Ben Pfaff
7e3dfa3bc7 netdev: Remove netdev_exists(), which has no users.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-04-01 15:49:31 -07:00