[ovs-dev] [IPv6 v2 10/10] ovn: Add support for IPv6 dynamic bindings.

Justin Pettit jpettit at ovn.org
Mon Aug 1 05:13:45 UTC 2016


> On Jul 29, 2016, at 12:53 PM, Ben Pfaff <blp at ovn.org> wrote:
> 
> On Thu, Jul 28, 2016 at 11:26:20PM -0700, Justin Pettit wrote:
>> This commit also introduces "get_nd" and "put_nd" logical actions.
>> 
>> Signed-off-by: Justin Pettit <jpettit at ovn.org>
> 
> struct put_mac_binding might include a string buffer directly; not sure
> there's value in the extra allocation here.

Agreed.

> In pinctrl_handle_put_mac_binding(), the parentheses around the call
> to hash_2words() look funny to me here:
> +    uint32_t hash = hash_string(ip_s, (hash_2words(dp_key, port_key)));

Must be from all that Lisp programming I do on the side.

> s/Solictation/Solicitation/ in ovn-northd.8.xml.

Argh.  I knew I was going to do that somewhere.

I've added an incremental in case you're interested.

--Justin


-=-=-=-=-=-=-=-=-

diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c
index ed12dd3..f0faa85 100644
--- a/ovn/controller/pinctrl.c
+++ b/ovn/controller/pinctrl.c
@@ -540,7 +540,7 @@ struct put_mac_binding {
     /* Key. */
     uint32_t dp_key;
     uint32_t port_key;
-    char *ip_s;
+    char ip_s[INET6_ADDRSTRLEN + 1];
 
     /* Value. */
     struct eth_addr mac;
@@ -592,7 +592,7 @@ pinctrl_handle_put_mac_binding(const struct flow *md,
         ovs_be128 ip6 = hton128(flow_get_xxreg(md, 0));
         inet_ntop(AF_INET6, &ip6, ip_s, sizeof(ip_s));
     }
-    uint32_t hash = hash_string(ip_s, (hash_2words(dp_key, port_key)));
+    uint32_t hash = hash_string(ip_s, hash_2words(dp_key, port_key));
     struct put_mac_binding *pmb
         = pinctrl_find_put_mac_binding(dp_key, port_key, ip_s, hash);
     if (!pmb) {
@@ -605,7 +605,7 @@ pinctrl_handle_put_mac_binding(const struct flow *md,
         hmap_insert(&put_mac_bindings, &pmb->hmap_node, hash);
         pmb->dp_key = dp_key;
         pmb->port_key = port_key;
-        pmb->ip_s = xstrdup(ip_s);
+        memcpy(pmb->ip_s, ip_s, sizeof pmb->ip_s);
     }
     pmb->timestamp = time_msec();
     pmb->mac = headers->dl_src;
@@ -687,7 +687,6 @@ flush_put_mac_bindings(void)
 {
     struct put_mac_binding *pmb;
     HMAP_FOR_EACH_POP (pmb, hmap_node, &put_mac_bindings) {
-        free(pmb->ip_s);
         free(pmb);
     }
 }
diff --git a/ovn/northd/ovn-northd.8.xml b/ovn/northd/ovn-northd.8.xml
index d533ad1..7797417 100644
--- a/ovn/northd/ovn-northd.8.xml
+++ b/ovn/northd/ovn-northd.8.xml
@@ -852,7 +852,7 @@ output;
       <li>
         <p>
           Reply to IPv6 Neighbor Solicitations.  These flows reply to
-          Neighbor Solictation requests for the router's own IPv6
+          Neighbor Solicitation requests for the router's own IPv6
           address and populate the logical router's mac binding table.
           For each router port <var>P</var> that owns IPv6 address
           <var>A</var>, solicited node address <var>S</var>, and





More information about the dev mailing list