[ovs-git] [openvswitch/ovs] c2f4db: ovs-ofctl: Fix crash with replace-flows and diff-f...

GitHub noreply at github.com
Wed Aug 31 00:30:41 UTC 2016


  Branch: refs/heads/branch-2.6
  Home:   https://github.com/openvswitch/ovs
  Commit: c2f4db76a5aad14e12230089b87c7d2cca7eb8a1
      https://github.com/openvswitch/ovs/commit/c2f4db76a5aad14e12230089b87c7d2cca7eb8a1
  Author: Jesse Gross <jesse at kernel.org>
  Date:   2016-08-30 (Tue, 30 Aug 2016)

  Changed paths:
    M tests/ovs-ofctl.at
    M utilities/ovs-ofctl.c

  Log Message:
  -----------
  ovs-ofctl: Fix crash with replace-flows and diff-flows with tunnel metadata.

When flows are read by ovs-ofctl (either from a switch or a file),
tunnel metadata space is dynamically allocated since there isn't a
preset table. This works well for single flows but doesn't handle
groups of flows that must be compared to each other. In this case,
each flow will have its own independent allocation making comparisons
meaningless.

Even worse is that when these matches are later serialized (either
for display or in NXM format), the metadata allocation has been
stripped off of the matches. The serialization code then attempts to
use the global table, which is also not available, leading to a
dereference of a NULL pointer.

Solving this problem requires building an overall metadata table.
Since we don't know the maximum size of a field (particularly for
flows read from a file), it's necessary to do this in two passes.
The first pass records the maximum size for each field as well as
stores the received matches. The second pass creates a metadata
table based on the sizes, adjusts the match layout based on the new
allocation, and then replays the stored matches for comparison.
Later serialization will used the generated table to output the
flows.

Signed-off-by: Jesse Gross <jesse at kernel.org>
Acked-by: Ben Pfaff <blp at ovn.org>


  Commit: f104f2f8a8b2406415628708559ec350018f34fa
      https://github.com/openvswitch/ovs/commit/f104f2f8a8b2406415628708559ec350018f34fa
  Author: Jesse Gross <jesse at kernel.org>
  Date:   2016-08-30 (Tue, 30 Aug 2016)

  Changed paths:
    M tests/ovs-ofctl.at
    M utilities/ovs-ofctl.c

  Log Message:
  -----------
  ovs-ofctl: Extract tunnel metadata correctly when sorting flows.

When flow fields are sorted before dumping in ovs-ofctl, each
significant field is extracted for sorting. However, in the case of
tunnel metadata a mapping table is necessary to know where each
field begins and ends. This information is current stripped off before
fetching the field data and returned field is simply zeroed. This
makes sorting based on tunnel metadata non-deterministic.

We have the tunnel allocation stored in match metadata with each
flow, so we can simply extract the data from there rather than
trying to build and populate a global mapping table.

Signed-off-by: Jesse Gross <jesse at kernel.org>
Acked-by: Ben Pfaff <blp at ovn.org>


Compare: https://github.com/openvswitch/ovs/compare/8d09d1b23116...f104f2f8a8b2


More information about the git mailing list