[ovs-git] [openvswitch/ovs] 909c89: ofp-actions: Make all actions a multiple of OFPACT...

Ben Pfaff noreply at github.com
Wed Feb 27 17:31:15 UTC 2019


  Branch: refs/heads/branch-2.9
  Home:   https://github.com/openvswitch/ovs
  Commit: 909c89b842844ce7fd59eb275f0c8042a7f38151
      https://github.com/openvswitch/ovs/commit/909c89b842844ce7fd59eb275f0c8042a7f38151
  Author: Ben Pfaff <blp at ovn.org>
  Date:   2019-02-27 (Wed, 27 Feb 2019)

  Changed paths:
    M include/openvswitch/ofp-actions.h
    M lib/ofp-actions.c
    M ofproto/connmgr.c
    M ofproto/fail-open.c

  Log Message:
  -----------
  ofp-actions: Make all actions a multiple of OFPACT_ALIGNTO bytes.

The functions to put ofpacts into ofpbufs have always padded them to
OFPACT_ALIGNTO boundaries, but the underlying structures weren't
necessarily padded out.  That led to difficulties in a few places where
structures were allocated on the stack instead in an ofpbuf, because
functions like ofpact_init_*() would access beyond the end of the actual
structure.  This is true, for example, in test_multipath_main() in
tests/test-multipath.c, which allocates a struct ofpact_multipath on the
stack, and in lswitch_handshake() in learning-switch.c, which allocates
a struct ofpact_output on the stack.

It's possible to fix these individual cases, but it's possible that there
are others that haven't been identified.  This commit addresses the issue
another way, by padding all of the ofpact structures to a full multiple
of OFPACT_ALIGNTO and adding assertions to ensure that it can't be screwed
up in the future.

This commit removes the OFPACT_*_SIZE enums, because they are now
equivalent to sizeof(struct ofpact_*) in every case.

Acked-by: Mark Michelson <mmichels at redhat.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>




More information about the git mailing list