On Tue, Jun 7, 2016 at 1:49 AM, Numan Siddique <nusid...@redhat.com> wrote:

> OVN implements a native DHCP support which caters to the common
> use case of providing an IP address to a booting instance by
> providing stateless replies to DHCP requests based on statically
> configured address mappings. To do this it allows a short list of
> DHCP options to be configured and applied at each compute host
> running ovn-controller.
>
> A new table 'Subnet' is added in OVN NB DB to store the DHCP options.
>
> For each logical port following flows are added if the CMS has defined
> DHCP options in the 'Subnet' column
>
>  - A logical flow which copies the DHCP options to the DHCP
>    request packets using the 'put_dhcp_opts' action and advances the
>    packet to the next stage.
>
>  - A logical flow which implements the DHCP reponder by sending
>    the DHCP reply back to the inport once the 'put_dhcp_opts' action
>    is applied.
>
> Signed-Off-by: Numan Siddique <nusid...@redhat.com>
> ---
>  ovn/northd/ovn-northd.8.xml   |  89 +++++++++++-
>  ovn/northd/ovn-northd.c       | 265 ++++++++++++++++++++++++++++++++++-
>  ovn/ovn-nb.ovsschema          |  19 ++-
>  ovn/ovn-nb.xml                | 314
> +++++++++++++++++++++++++++++++++++++++++-
>  ovn/utilities/ovn-nbctl.8.xml |  29 ++++
>  ovn/utilities/ovn-nbctl.c     | 196 ++++++++++++++++++++++++++
>  tests/ovn.at                  | 250 +++++++++++++++++++++++++++++++++
>  tests/test-ovn-dhcp.c         | 135 ++++++++++++++++++
>  8 files changed, 1287 insertions(+), 10 deletions(-)
>
>
Hi Numan,

I see that this version is beind superseded... but may I point out a
feedback
on something that looks missing.

<snip>



> diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
>
index cac0148..325fbc0 100644
> --- a/ovn/northd/ovn-northd.c
> +++ b/ovn/northd/ovn-northd.c
>
>
<snip>


>  static void
>  build_acls(struct ovn_datapath *od, struct hmap *lflows, struct hmap
> *ports)
>  {
> @@ -1475,6 +1555,36 @@ build_acls(struct ovn_datapath *od, struct hmap
> *lflows, struct hmap *ports)
>                            acl->match, "drop;");
>          }
>      }
> +
> +    /* Add 34000 priority flow to allow DHCP reply from ovn-controller to
> all
> +     * logical ports of the datapath if the CMS has configured DHCP
> options*/
> +    if (od->nbs && od->nbs->n_ports && od->nbs->n_subnets) {
> +        for (size_t i = 0; i < od->nbs->n_subnets; i++) {
> +             if (!(od->nbs->subnets[i]->gateway_ip &&
> +                   od->nbs->subnets[i]->enable_dhcp &&
> +                   od->nbs->subnets[i]->ip_version == 4)) {
> +                 continue;
> +             }
> +
> +             const char *server_id = smap_get(
> +                 &od->nbs->subnets[i]->dhcp_options, "server_id");
> +             const char *server_mac = smap_get(
> +                 &od->nbs->subnets[i]->dhcp_options, "server_mac");
> +             const char *lease_time = smap_get(
> +                 &od->nbs->subnets[i]->dhcp_options, "lease_time");
> +             if (server_id && server_mac && lease_time) {
> +                 struct ds match = DS_EMPTY_INITIALIZER;
> +                 const char *actions = has_stateful ? "ct_commit; next;" :
> +                                       "next;";
> +                 ds_put_format(&match, "eth.src == %s && ip4.src == %s &&"
> +                               " udp && udp.src == 67 && udp.dst == 68",
> +                               server_mac, server_id);
> +                 ovn_lflow_add(
> +                     lflows, od, S_SWITCH_OUT_ACL, 34000, ds_cstr(&match),
> +                     actions);
>

ds_destroy(&match);    <== missing that, right?


> +             }
> +        }
> +    }
>  }
>
>
<snip>

-- flaviof
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to