[ovs-dev] [PATCH v5] ovn: Modify the DHCPv4 router option to optional

Guoshuai Li ligs at dtdream.com
Thu Mar 9 02:53:37 UTC 2017


Co-authored-by: Dong Jun <dongj at dtdream.com>
Signed-off-by: Dong Jun <dongj at dtdream.com>
Signed-off-by: Guoshuai Li <ligs at dtdream.com>
Acked-by: Numan Siddique <nusiddiq at redhat.com>
---
 NEWS                    |  2 ++
 ovn/northd/ovn-northd.c | 10 +++-------
 ovn/ovn-nb.xml          | 16 ++++++++--------
 3 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/NEWS b/NEWS
index ce9fe88..853b5ef 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ Post-v2.7.0
        `egress_pkt_mark` OVSDB option.
    - EMC insertion probability is reduced to 1% and is configurable via
      the new 'other_config:emc-insert-inv-prob' option.
+   - OVN:
+     * Modify the DHCPv4 router option to optional in northbound databases.
 
 v2.7.0 - xx xxx xxxx
 ---------------------
diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index cc9b934..8c8f16b 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -2279,11 +2279,9 @@ build_dhcpv4_action(struct ovn_port *op, ovs_be32 offer_ip,
         &op->nbsp->dhcpv4_options->options, "server_mac");
     const char *lease_time = smap_get(
         &op->nbsp->dhcpv4_options->options, "lease_time");
-    const char *router = smap_get(
-            &op->nbsp->dhcpv4_options->options, "router");
 
-    if (!(server_ip && server_mac && lease_time && router)) {
-        /* "server_id", "server_mac", "lease_time" and "router" should be
+    if (!(server_ip && server_mac && lease_time)) {
+        /* "server_id", "server_mac" and "lease_time" should be
          * present in the dhcp_options. */
         static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
         VLOG_WARN_RL(&rl, "Required DHCPv4 options not defined for lport - %s",
@@ -2826,9 +2824,7 @@ build_acls(struct ovn_datapath *od, struct hmap *lflows)
                 &od->nbs->ports[i]->dhcpv4_options->options, "server_mac");
             const char *lease_time = smap_get(
                 &od->nbs->ports[i]->dhcpv4_options->options, "lease_time");
-            const char *router = smap_get(
-                &od->nbs->ports[i]->dhcpv4_options->options, "router");
-            if (server_id && server_mac && lease_time && router) {
+            if (server_id && server_mac && lease_time) {
                 struct ds match = DS_EMPTY_INITIALIZER;
                 const char *actions =
                     has_stateful ? "ct_commit; next;" : "next;";
diff --git a/ovn/ovn-nb.xml b/ovn/ovn-nb.xml
index 88a6082..46a25f6 100644
--- a/ovn/ovn-nb.xml
+++ b/ovn/ovn-nb.xml
@@ -1393,14 +1393,6 @@
           The Ethernet address for the DHCP server to use.
         </column>
 
-        <column name="options" key="router">
-          <p>
-            The IP address of a gateway for the client to use.  This should be
-            in the subnet of the offered IP.  The DHCPv4 option code for this
-            option is 3.
-          </p>
-        </column>
-
         <column name="options" key="lease_time"
                 type='{"type": "integer", "minInteger": 0, "maxInteger": 4294967295}'>
           <p>
@@ -1422,6 +1414,14 @@
           DHCPv4 options and their codes.
         </p>
 
+        <column name="options" key="router">
+          <p>
+            The IP address of a gateway for the client to use.  This should be
+            in the subnet of the offered IP.  The DHCPv4 option code for this
+            option is 3.
+          </p>
+        </column>
+
         <column name="options" key="netmask">
           <p>
             The DHCPv4 option code for this option is 1.
-- 
2.10.1.windows.1



More information about the dev mailing list