2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +00:00
Commit Graph

17132 Commits

Author SHA1 Message Date
xurong00037997
2447bb085a ovn-controller: Call ofctrl_inject_pkt() with correct argument order.
Signed-off-by: Xu Rong <xu.rong@zte.com.cn>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-11-02 13:47:58 -07:00
Jaime Caamaño Ruiz
9a98793c09 datapath: Fix wrong push/pop ethernet validation
Upstream commit:
    commit 46ebe2834ba5b541f28ee72e556a3fed42c47570
    Author: Jaime Caamaño Ruiz <jcaamano@suse.com>
    Date:   Wed Oct 31 18:52:03 2018 +0100

    openvswitch: Fix push/pop ethernet validation

    When there are both pop and push ethernet header actions among the
    actions to be applied to a packet, an unexpected EINVAL (Invalid
    argument) error is obtained. This is due to mac_proto not being reset
    correctly when those actions are validated.

    Reported-at:
    https://mail.openvswitch.org/pipermail/ovs-discuss/2018-October/047554.html
    Fixes: 91820da6ae85 ("openvswitch: add Ethernet push and pop actions")
    Signed-off-by: Jaime Caamaño Ruiz <jcaamano@suse.com>

Tested-by: Greg Rose <gvrose8192@gmail.com>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2018-October/047554.html
Fixes: 6fcecb85ab ("datapath: add Ethernet push and pop actions")
Signed-off-by: Jaime Caamaño Ruiz <jcaamano@suse.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-11-02 13:44:53 -07:00
Ben Pfaff
0fb02e8e50 checkpatch: Speed up checking when spell checking not enabled.
On my machine it takes almost a second for enchant to read its dictionary.
This time is wasted when spell checking is not enabled.  This commit makes
checkpatch read the dictionary only when it will be used.

Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-11-02 13:40:54 -07:00
Ben Pfaff
3bd2e465a1 checkpatch: Add explicit test for mailing list as author.
Somehow some such patches snuck through.  checkpatch caught them (and the
committer missed that) but this makes it even more explicit.

Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-11-02 13:40:51 -07:00
Yifeng Sun
1d478a8008 ofp-actions: Let parse_UNROLL_XLATE return error message instead of aborting program
Currently, if unroll_xlate is passed to ovs-ofctl as one of actions,
let say 'ovs-ofctl add-flow br0 in_port=1,actions=unroll_xlate',
ovs-ofctl will crash. This patch fixes it by returning an error
message.

Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11184
Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-11-02 13:00:39 -07:00
Ben Pfaff
d119c626f9 Merge branch 'dpdk_merge' of https://github.com/istokes/ovs into HEAD 2018-11-02 11:48:06 -07:00
Yifeng Sun
9b3683ec82 oss-fuzz: Free error string in ofctl_parse_flow
This patch frees the leaked error string to stop oss-fuzz from
complaining.

Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11161
Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-11-02 11:31:39 -07:00
Yifeng Sun
6c793e8ee6 oss-fuzz: Use unsigned for left shift in ofctl_parse_flows__
Left shift int (1 here) can result in a negative value. This is an undefined
behavior according to ISO C99 (6.5.7).

The error message reported by oss-fuzz is:
runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

This patch fixes it by changing signed int to unsigned int.

Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11166
Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-11-02 11:30:49 -07:00
Ben Pfaff
80c42f7f21 ovsdb: Clarify that a server that leaves a cluster may never rejoin.
This wasn't clear from the documentation.

Reported-by; Paul Greenberg <greenpau@outlook.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-11-02 11:29:10 -07:00
Tiago Lam
3aaa620151 dp-packet: Fix allocated size on DPDK init.
When enabled with DPDK OvS deals with two types of packets, the ones
coming from the mempool and the ones locally created by OvS - which are
copied to mempool mbufs before output. In the latter, the space is
allocated from the system, while in the former the mbufs are allocated
from a mempool, which takes care of initialising them appropriately.

In the current implementation, during mempool's initialisation of mbufs,
dp_packet_set_allocated() is called from dp_packet_init_dpdk() without
considering that the allocated space, in the case of multi-segment
mbufs, might be greater than a single mbuf.  Furthermore, given that
dp_packet_init_dpdk() is on the code path that's called upon mempool's
initialisation, a call to dp_packet_set_allocated() is redundant, since
mempool takes care of initialising it.

To fix this, dp_packet_set_allocated() is no longer called after
initialisation of a mempool, only in dp_packet_init__(), which is still
called by OvS when initialising locally created packets.

Signed-off-by: Tiago Lam <tiago.lam@intel.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
2018-11-02 16:29:14 +00:00
Mark Kavanagh
4148de286c dp-packet: Init specific mbuf fields.
dp_packets are created using xmalloc(); in the case of OvS-DPDK, it's
possible the the resultant mbuf portion of the dp_packet contains
random data. For some mbuf fields, specifically those related to
multi-segment mbufs and/or offload features, random values may cause
unexpected behaviour, should the dp_packet's contents be later copied
to a DPDK mbuf. It is critical therefore, that these fields should be
initialized to 0.

This patch ensures that the following mbuf fields are initialized to
appropriate values on creation of a new dp_packet:
   - ol_flags=0
   - nb_segs=1
   - tx_offload=0
   - packet_type=0
   - next=NULL

Adapted from an idea by Michael Qiu <qiudayu@chinac.com>:
https://patchwork.ozlabs.org/patch/777570/

Co-authored-by: Tiago Lam <tiago.lam@intel.com>

Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Signed-off-by: Tiago Lam <tiago.lam@intel.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
2018-11-02 16:28:28 +00:00
Mark Kavanagh
dfaf00e8c3 netdev-dpdk: fix mbuf sizing
There are numerous factors that must be considered when calculating
the size of an mbuf:
- the data portion of the mbuf must be sized in accordance With Rx
  buffer alignment (typically 1024B). So, for example, in order to
  successfully receive and capture a 1500B packet, mbufs with a
  data portion of size 2048B must be used.
- in OvS, the elements that comprise an mbuf are:
  * the dp packet, which includes a struct rte mbuf (704B)
  * RTE_PKTMBUF_HEADROOM (128B)
  * packet data (aligned to 1k, as previously described)
  * RTE_PKTMBUF_TAILROOM (typically 0)

Some PMDs require that the total mbuf size (i.e. the total sum of all
of the above-listed components' lengths) is cache-aligned. To satisfy
this requirement, it may be necessary to round up the total mbuf size
with respect to cacheline size. In doing so, it's possible that the
dp_packet's data portion is inadvertently increased in size, such that
it no longer adheres to Rx buffer alignment. Consequently, the
following property of the mbuf no longer holds true:

    mbuf.data_len == mbuf.buf_len - mbuf.data_off

This creates a problem in the case of multi-segment mbufs, where that
assumption is assumed to be true for all but the final segment in an
mbuf chain. Resolve this issue by adjusting the size of the mbuf's
private data portion, as opposed to the packet data portion when
aligning mbuf size to cachelines.

Co-authored-by: Tiago Lam <tiago.lam@intel.com>

Fixes: 4be4d22 ("netdev-dpdk: clean up mbuf initialization")
Fixes: 31b88c9 ("netdev-dpdk: round up mbuf_size to cache_line_size")
CC: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Signed-off-by: Tiago Lam <tiago.lam@intel.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
2018-11-02 16:27:31 +00:00
Ian Stokes
31154f9523 netdev-dpdk: Add link speed to get_status().
Report the link speed of the device in netdev_dpdk_get_status()
function.

Link speed is already reported as part of the netdev_get_features()
function. However only link speeds defined in the OpenFlow specs are
supported so speeds such as 25 Gbps etc. are not shown. The link
speed for the device is available in Mbps in rte_eth_link.
This commit converts the link speed for a given dpdk device to an
easy to read string and reports it in get_status().

Suggested-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
2018-11-02 15:17:47 +00:00
Ian Stokes
dfcb5b8ad5 netdev-dpdk: Fix netdev_dpdk_get_features().
This commit fixes netdev_dpdk_get_features() by initializing a bitmap
that represents current features to zero and accounting for non defined
link speed values in the OpenFlow spec.

The current approach for retrieving netdev dpdk features uses a
pointer allocated in the stack without being initialized. As such there
is no guarantee that the bitmap will be accurate. Fix this by declaring
and initializing local variable 'feature' to be used when building the
bitmap, with its value then assigned to the pointer. Also account for
link speeds not defined in the OpenFlow spec by defaulting to
NETDEV_F_OTHER for undefined link speeds.

Fixes: 8a9562d21a ("dpif-netdev: Add DPDK netdev.")
Acked-by: Ilya Maximets <i.maximets@samsung.com>
Co-authored-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
2018-11-02 15:17:35 +00:00
Ilya Maximets
6c95dbf96b dpif-netdev: End the quiescent state for flow offloading thread.
Flow offloading thread uses concurrent hash maps which are
based on rcu protected variables. It must use them while in
active state. Working in a quiescent state could cause
segmentation faults because of possible cmap internal
structure changes.

Fixes: 02bb2824e5 ("dpif-netdev: do hw flow offload in a thread")
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
2018-11-02 15:17:19 +00:00
Ian Stokes
7207183c15 Docs: Remove HWOL DPDK limitation.
Partial offload support was added to OVS DPDK in OVS 2.10. As such
remove the limitation that OVS DPDK does not support HWOL from the
DPDK install documentation.

Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
2018-11-02 15:16:53 +00:00
Ian Stokes
8b7baf5f3f Docs: Remove zero-copy QEMU limitation.
Remove note regarding zero-copy compatibility with QEMU >= 2.7.

When zero-copy was introduced to OVS it was incompatible with QEMU >=
2.7. This issue has since been fixed in DPDK with commit
803aeecef123 ("vhost: fix dequeue zero copy with virtio1") and
backported to DPDK LTS branches. Remove the reference to this
issue in the zero-copy documentation.

Cc: Ciara Loftus <ciara.loftus@intel.com>
Acked-by: Ciara Loftus <ciara.loftus@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
2018-11-02 15:16:41 +00:00
Ilya Maximets
9474073615 netdev-dpdk: Dump flow patterns only if debug enabled.
No need to waste time for fields checking in case DBG disabled.
Additionally sequence of prints replaced with single print
to avoid output interrupting by other log messages.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
2018-11-02 15:16:14 +00:00
Ilya Maximets
faf71e4922 netdev-dpdk: Print port name in offload API messages.
This is useful for understanding which flows offloaded to
which ports.

Code refactored a bit to reduce number of casts.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
2018-11-02 15:15:27 +00:00
Ilya Maximets
5752eae485 dpif-netdev: Fix cmap node use after free on flow disassociation.
Data pointed by cmap node must not be freed while iterating.
ovsrcu_postpone should be used instead.

CC: Finn Christensen <fc@napatech.com>
Fixes: e8a2b5bf92 ("netdev-dpdk: implement flow offload with rte flow")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
2018-11-02 15:13:54 +00:00
Ilya Maximets
95ca79d542 netdev-dpdk: Secure flow offload API.
rte API is not thread safe. We have to get netdev mutex
before uing it and also before using fields of netdev structure.

This is important because offload API used from the separate
thread and could be used at the same time with other netdev
functions called from the main thread.

CC: Finn Christensen <fc@napatech.com>
Fixes: e8a2b5bf92 ("netdev-dpdk: implement flow offload with rte flow")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
2018-11-02 15:13:40 +00:00
Ilya Maximets
c0af6425d7 netdev-dpdk: Drop offload API for vhost ports.
vhost ports are not DPDK eth ports and has no rte_flow API.
Stop calling this API with DPDK_ETH_PORT_ID_INVALID to
avoid time wasting and errors in log.

Additionally, DPDK_FLOW_OFFLOAD_API definition moved to .c
file, because there is no need to expose it in header.

CC: Finn Christensen <fc@napatech.com>
Fixes: e8a2b5bf92 ("netdev-dpdk: implement flow offload with rte flow")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
2018-11-02 15:13:19 +00:00
Ben Pfaff
af26093ab1 connmgr: Improve interface for setting controllers.
Using an shash instead of an array simplifies the code for both the caller
and the callee.  Putting the set of allowed OpenFlow versions into the
ofproto_controller data structure also simplifies the overall function
interface slightly.

Tested-by: Yifeng Sun <pkusunyifeng@gmail.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-10-31 16:04:36 -07:00
Ben Pfaff
8645f9cd19 rconn: New function rconn_is_reliable().
This will have its first user in an upcoming commit.

Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-10-31 13:32:40 -07:00
Ben Pfaff
da0158d193 connmgr: Modernize coding style.
This moves declarations closer to first use and merges them with
initialization when possible, moves "for" loop variable declarations into
the "for" statements where possible, and otherwise makes this code look
like it was written a little more recently than it was.

Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-10-31 13:32:24 -07:00
Sriharsha Basavapatna
e6530a8d5d dpif: Restore a few lines with form feed characters
A few lines with form feed characters (ASCII: ^L) were accidentally
deleted by a recent commit to support rebalancing of offloaded flows.
This patch reverts those lines.

Fixes: 57924fc91c ("revalidator: Rebalance offloaded flows")
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-10-31 13:30:39 -07:00
Ben Pfaff
fd5261d11a contributing: Signed-off-by tags should come last.
Acked-by: Flavio Leitner <fbl@sysclose.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
Suggested-by: Gregory Rose <gvrose8192@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-10-31 13:26:59 -07:00
Ben Pfaff
f992b0977b submitting-patches: Advise not to wrap tags across multiple lines.
It makes parsing them more difficult.

Acked-by: Flavio Leitner <fbl@sysclose.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-10-31 13:24:49 -07:00
Ben Pfaff
2af1e18c74 ovn-northd: Fix memory leak in free_chassis_queueid().
Found by inspection.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Numan Siddique <nusiddiq@redhat.com>
2018-10-31 10:51:10 -07:00
Ben Pfaff
307912849e ovn-northd: Use structure assignment instead of memcpy().
Makes the code easier to read.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Numan Siddique <nusiddiq@redhat.com>
2018-10-31 10:51:09 -07:00
Ben Pfaff
729d2aaf83 ovn-northd: Improve hashing for chassis queues.
The key for a "struct ovn_chassis_qdisc_queues" is a Chassis UUID and a
queue_id, but only the UUID was being hashed, so if there was more than one
per chassis then they'd all end up in the same hash bucket, which is
needlessly inefficient.  (And if there's only one per chassis then why do
we bother allocating them at all?)

Found by inspection.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Numan Siddique <nusiddiq@redhat.com>
2018-10-31 10:50:47 -07:00
Yi-Hung Wei
21bc775f52 ovs-lib.in: Remove unnecessary conntrack flush
We introduced flush-conntrack in force-reload-kmod script by commit
8bea39b186 ("datapath: Prevent panic") to prevent kernel panic.
It turns out that the kernel panic is actually triggered by the
IPv4 secret timer, and it is fixed by commit
1219059847 ("compat: Initialize IPv4 reassembly secret timer").

This commit removes the unnecessary conntrack flush in the script.

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
CC: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
2018-10-31 10:38:08 -07:00
Ben Pfaff
923a45665e AUTHORS: Add Eric Lapointe.
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-10-31 10:36:41 -07:00
Eric Lapointe
e120ff1f8e python-c-ext: Fix memory leak in Parser_finish
The memory returned by json_parser_finish needs to be freed by the caller.

Signed-off-by: Eric Lapointe <elapointe@corsa.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-10-31 10:34:17 -07:00
Ben Pfaff
875894dad4 AUTHORS: Add Jianbo Liu.
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-10-30 11:41:38 -07:00
Jianbo Liu
a38dccb3ee dpif-netlink: Don't destroy and recreate port if it exists
In commit 7521e0cf9e ('ofproto-dpif: Let the dpif report when a port is
a duplicate'), the checking of port existence before adding was removed,
and it's up to the dpif to check if port exists and add only if needed.

But the port can't be added to datapath if already exists. Then it will
be destroyed and created again. This causes problem because configuration
may miss. For example, if creating two vxlan on the same port, its ingress
qdisc will be lost after recreated.

Fixes: 7521e0cf9e ("ofproto-dpif: Let the dpif report when a port is a duplicate.")
Signed-off-by: Jianbo Liu <jianbol@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-10-30 11:28:36 -07:00
Ilya Maximets
193f74f6de ofp-table: Fix table print format string.
This fixes travis build on OSX:

https://travis-ci.org/openvswitch/ovs/jobs/446920531

lib/ofp-table.c:1454:42: error: \
format specifies type 'unsigned char' but the argument has type 'int'
    ds_put_format(s, "\n  table %"PRIu8, table);
                                ~~       ^~~~~

CC: Ben Pfaff <blp@ovn.org>
Fixes: b47e7e2bac ("ofp-table: Always format the table number in table features.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-10-30 09:53:38 -07:00
Ilya Maximets
9bccc3ff03 manpages: Include ovs.tmac in most man roots.
This allows to not redefine common macroses in every single
file and allowes using things like .EX without warying about
compatibility.
manpages.mk updated automatically.

Files that are already complete pages (i.e. has no *.in sources)
wasn't touched, because this will require additional file
manipulations and changes in makefiles/specs without serious
profit.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-10-30 07:24:55 -07:00
Ben Pfaff
b47e7e2bac ofp-table: Always format the table number in table features.
Table features should indicate the table number as well as the table
name.  Before this, the first line for each table looked like this:
   table myname ("myname"):
but it's more useful if it's:
   table 123 ("myname"):

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
2018-10-26 15:19:44 -07:00
Ben Pfaff
dccab9b15e ofp-table: Ignore bits that have to change according to OpenFlow.
OpenFlow table feature replies contain a per-table bitmap that indicates
which tables a flow can point to in goto_table actions.  OpenFlow requires
that a table only be able to go to higher-numbered tables.  This means that
a switch that is general as possible will always have different features
for every table, since each one will have a different bitmap.  This makes
the output of "ovs-ofctl dump-table-features" pretty long and ugly because
it has about 250 entries like this:

  table %d:
    metadata: match=0xffffffffffffffff write=0xffffffffffffffff
    max_entries=%d
    instructions (table miss and others):
      next tables: %d-253
      (same instructions)
      (same actions)
    (same matching)

This commit changes the logic that prints table features messages so that
it considers two sequentially numbered tables to be the same if only the
bit that necessarily must be tunred off changes.  This reduces the hundreds
of entries above to just:

   tables 1...253: ditto

which is so much more readable.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
2018-10-26 15:19:40 -07:00
Ben Pfaff
9d36d7d728 ofp-table: Better summarize table features and statistics.
Before this patch, most dump-table-stats outputs would contain about
250 lines of the form:

  table #: ditto

With this patch, they have one line like this:

  tables 2...254: ditto

which is much easier to read.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
2018-10-26 15:19:37 -07:00
Ben Pfaff
df50117721 vconn: Avoid null dereference on error path.
Sometimes the 'errors' list is passed as null, and in that case it should
not be used.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
2018-10-26 15:19:31 -07:00
Zak Whittington
98a9272ba2 ofp-msgs: Added ONF_ and NXT_REQUESTFORWARD for OF1.0-1.3
Backported OFPT14_REQUESTFORWARD to OF1.0-1.3.
OF 1.0-1.2 use an NXT Nicira extension while OF 1.3
uses an ONF extension (ONF version is specified in a
previously published ONF spec sheet).

Includes ofp-print tests for multiple inner message
types, and multiple OF versions including the NXT and ONF.
Also includes more end-to-end ofproto tests for both
NXT OF1.0 and also ONF OF1.3.

VMware-BZ: 2136594
Signed-off-by: Zak Whittington <zwhitt.vmware@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-10-26 15:17:22 -07:00
Ben Pfaff
23b9ac1e5b ovs-ofctl: Update documentation for MPLS actions.
Reported-by: lidejun <lidejun1@huawei.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
2018-10-26 15:04:38 -07:00
Yifeng Sun
e612dd2f29 NSH: Fix NSH-related length macros that cause stack overflow
In the filed of ver_flags_ttl_len of struct nshhdr, there are only 6
bits that are used to indicate header's total length in 4-byte words.
Therefore, the max value for total is 252 (63x4), instead of 256 used
in present code base. This patch fixes it.

Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10855
Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-10-26 14:54:38 -07:00
Yifeng Sun
4e9c96f006 odp-util: Properly handle the return values of scan_XXX functions
Functions like scan_u8, return 0 when they failed to scan the expected
values. Function scan_geneve failed to check this situation. This leads
to using of uninitialized value of opt_len_mask. This patch fixes it
and further inspects and fixes all the problematic places where
the return values of scan_XXX functions are not properly handled.

Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10800
Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-10-26 14:46:41 -07:00
Yifeng Sun
ead2252b2b ofctl_parse_target: Only parse complete ofputil_flow_mod data.
When parse_ofp_flow_mod_str returns error, `fm` is incomplete and pointers
in it may be null, e.g. fm.match.flow. In this case, passing it to
ofctl_parse_flows__ may cause pointer errors because ofctl_parse_flows__
expects a valid input of type struct ofputil_flow_mod.

Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11110
Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-10-26 14:45:58 -07:00
Zak Whittington
7ed73428a6 bridge.c: prevent controller connects while flow-restore-wait
When force-reload-kmod is used, it shows an error when reinstalling
tlvs during "Restoring saved flows" step:
OFPT_ERROR (xid=0x4): NXTTMFC_ALREADY_MAPPED

This is caused by a race condition between the restore script,
which calls ofctl, and the connected controllers both adding back
the same TLVs.

The restore script already sets flow-restore-wait to true while
doing flow restoration, and sets it back to false after it is
done, and this patch utilizes that fact to prevent the TLV race.
It does this by preventing vswitchd from connecting to
controllers in the controller table while it is in a
flow-restore-wait state.

With this patch, when bridge_configure_remotes() calls
bridge_get_controllers(), it first checks if flow-restore-wait
has been set, and if so, it ignores any controllers in the
controller database and sets n_controllers to 0.

This solution does preserve the management service controller
which is added via bridge_ofproto_controller_for_mgmt() after
checking whether we should call bridge_get_controllers()
(and thus n_controllers is properly set to 1, etc)

VMware-BZ: 2195377
Signed-off-by: Zak Whittington <zwhitt.vmware@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-10-25 20:37:46 -07:00
Anand Kumar
555fe6c93c datapath-windows: Remove IP neighbor entries when internal adapter is down.
Remove the IP neighboring entries when adapter is down,
so that when 'OVS_IPHELPER_INSTANCE' is deleted, no stale entries
are present

Also fix accessing iphelper instance without acquiring the lock.

Signed-off-by: Anand Kumar <kumaranand@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
Tested-by: Alin Gabriel Serdean <aserdean@ovn.org>
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
2018-10-24 21:12:30 +03:00
Alin Gabriel Serdean
2ef3f75356 windows: Add set_detach function to daemon-windows.c
The daemon-windows file is missing a `set_detach` routine, so add it.

This will be useful in the long run.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Acked-by: Anand Kumar <kumaranand@vmware.com>
2018-10-24 14:39:04 +03:00