[ovs-git] [openvswitch/ovs] 6e5f49: OVN: Use offset instead of pointer into ofpbuf

Ben Pfaff noreply at github.com
Mon Mar 25 21:52:43 UTC 2019


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: 6e5f4942df949985ee2b67a11af03f2ebb7814ce
      https://github.com/openvswitch/ovs/commit/6e5f4942df949985ee2b67a11af03f2ebb7814ce
  Author: Mark Michelson <mmichels at redhat.com>
  Date:   2019-03-25 (Mon, 25 Mar 2019)

  Changed paths:
    M ovn/lib/actions.c

  Log Message:
  -----------
  OVN: Use offset instead of pointer into ofpbuf

In general, maintaining a pointer into an ofpbuf is risky. As the ofpbuf
grows, it can reallocate its data. If this happens, then pointers into
the data will become invalid.

A safer practice is to track an offset into the ofpbuf's data where a
structure you are interested in is kept. This way, if the ofpbuf data is
reallocated, you can find your structure again by using the offset.

In practice, this patch is not fixing any issues with OVN. Even though
the ra pointer is pointing to ofpbuf data that can be reallocated, it
will never actually happen. ovn-northd and all test cases always encode
the address mode first, meaning we will only ever read from the ra
pointer before the ofpbuf has a chance to expand.

However, this base work is essential for an upcoming patch in this series.

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


  Commit: 36ffc4666c4c1b098089d6817a7b0abdcc0bb943
      https://github.com/openvswitch/ovs/commit/36ffc4666c4c1b098089d6817a7b0abdcc0bb943
  Author: Mark Michelson <mmichels at redhat.com>
  Date:   2019-03-25 (Mon, 25 Mar 2019)

  Changed paths:
    M ovn/lib/actions.c
    M ovn/lib/ovn-l7.h
    M ovn/northd/ovn-northd.c
    M tests/ovn.at

  Log Message:
  -----------
  OVN: Always send prefix option in RAs

OVN's behavior when sending router advertisements has been to include IP
prefix information only if the address mode is set to "slaac" or
"dhcp_stateless". In these modes, sending the prefix to the client is
necessary so that it may automatically provision its IP address. We do
not send the prefix option when the address mode is set to
"dhcp_stateful" since there is no need for the client to automatically
provision an IP address.

This logic is flawed, however. When using dhcp_stateful, we provide a
managed IPv6 address for a client. However, because we do not provide
prefix information in our RAs, the client does not know the prefix
length for the address it has been allocated. With dhclient, we have
seen it assume either /64 or /128, depending on which version is being
used. This may not accurately reflect the prefix length being used by
the DHCP server though.

The fix here is to always send prefix information in our RAs, regardless
of address mode. The key difference lies in how we set the A
(autonomous addressing) flag. For slaac and dhcp_stateless address
modes, we will set this flag, indicating the client should provision its
own address based on the prefix we have sent. For dhcp_stateful, we will
not set this flag. This way, it is clear the prefix is informational,
and the client should not try to provision its own IPv6 address.

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


  Commit: c7ea79f544752d498429e4962e8bdaf6d4b90630
      https://github.com/openvswitch/ovs/commit/c7ea79f544752d498429e4962e8bdaf6d4b90630
  Author: Mark Michelson <mmichels at redhat.com>
  Date:   2019-03-25 (Mon, 25 Mar 2019)

  Changed paths:
    M lib/packets.h
    M ovn/controller/pinctrl.c
    M tests/ovn.at

  Log Message:
  -----------
  OVN: Make periodic RAs consistent with RA responder.

This commit makes periodic RAs from OVN consistent with the RAs sent in
response to RSs. Specifically, this ensures that prefix flags are set
correctly for each address mode.

This commit also gets rid of some redundant definitions for RA prefix
option flags from packets.h in favor of the ones in ovn-l7.h.

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


Compare: https://github.com/openvswitch/ovs/compare/3594ffab6b4b...c7ea79f54475


More information about the git mailing list