> On Jul 29, 2016, at 12:46 PM, Ben Pfaff <b...@ovn.org> wrote:
> 
> On Thu, Jul 28, 2016 at 11:26:19PM -0700, Justin Pettit wrote:
>> Every IPv6-enabled interface is supposed to have a link-local address
>> available to it.  This commit adds a link local interface to each router
>> port and scopes link-local routes to the ingress port that received the
>> packet.
>> 
>> Signed-off-by: Justin Pettit <jpet...@ovn.org>
> 
> In add_route() in ovn-northd.c, I don't think that it's ideal to use a
> string comparison to compare an IPv6 address:
> +    struct ds match = DS_EMPTY_INITIALIZER;
> +    if (!strcmp("fe80::", network_s) && plen == 64) {

Fair point.  How about the incremental at the end?

--Justin


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

diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index f0f72f0..14ce1ba 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -2777,11 +2777,15 @@ add_route(struct hmap *lflows, const struct ovn_port 
*op,
           const char *gateway)
 {
     bool is_ipv4 = strchr(network_s, '.') ? true : false;
-
     struct ds match = DS_EMPTY_INITIALIZER;
-    if (!strcmp("fe80::", network_s) && plen == 64) {
-        /* Scope IPv6 link-local addresses to the local router port. */
-        ds_put_format(&match, "inport == %s && ", op->json_key);
+
+    /* IPv6 link-local addresses must be scoped to the local router port. */
+    if (!is_ipv4) {
+        struct in6_addr network;
+        ovs_assert(ipv6_parse(network_s, &network));
+        if (in6_is_lla(&network)) {
+            ds_put_format(&match, "inport == %s && ", op->json_key);
+        }
     }
     ds_put_format(&match, "ip%s.dst == %s/%d", is_ipv4 ? "4" : "6",
                   network_s, plen);


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

Reply via email to