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

Ben Pfaff noreply at github.com
Mon Mar 25 21:53:26 UTC 2019


  Branch: refs/heads/branch-2.11
  Home:   https://github.com/openvswitch/ovs
  Commit: 76f2c3b6c956c6fd0205d40c80cb3cbbbd86f567
      https://github.com/openvswitch/ovs/commit/76f2c3b6c956c6fd0205d40c80cb3cbbbd86f567
  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: 54f2d115a6140c20699e4091e87c0bb39a0a63c1
      https://github.com/openvswitch/ovs/commit/54f2d115a6140c20699e4091e87c0bb39a0a63c1
  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: 2924b48d4a60ab5e4769169f7f8931c64f7823a5
      https://github.com/openvswitch/ovs/commit/2924b48d4a60ab5e4769169f7f8931c64f7823a5
  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/6ffb91729518...2924b48d4a60


More information about the git mailing list