[ovs-dev] [PATCH v6 2/2] OVN: Add support for periodic router advertisements.

Ben Pfaff blp at ovn.org
Fri Jan 5 17:04:31 UTC 2018


On Wed, Nov 29, 2017 at 03:59:48PM -0600, Mark Michelson wrote:
> This change adds three new options to the Northbound
> Logical_Router_Port's ipv6_ra_configs option:
> 
> * send_periodic: If set to "true", then OVN will send periodic router
> advertisements out of this router port.
> * max_interval: The maximum amount of time to wait between sending
> periodic router advertisements.
> * min_interval: The minimum amount of time to wait between sending
> periodic router advertisements.
> 
> When send_periodic is true, then IPv6 RA configs, as well as some layer
> 2 and layer 3 information about the router port, are copied to the
> southbound database. From there, ovn-controller can use this information
> to know when to send periodic RAs and what to send in them.
> 
> Because periodic RAs originate from each ovn-controller, the new
> keep-local flag is set on the packet so that ports don't receive an
> overabundance of RAs.
> 
> Signed-off-by: Mark Michelson <mmichels at redhat.com>

Thanks a lot for the revised series.

I folded in the following changes and applied this series to master.

diff --git a/lib/packets.h b/lib/packets.h
index 8819f829970e..395599f08c92 100644
--- a/lib/packets.h
+++ b/lib/packets.h
@@ -1020,7 +1020,12 @@ BUILD_ASSERT_DECL(RA_MSG_LEN == sizeof(struct ovs_ra_msg));
  * 6.2.1
  */
 #define ND_RA_MAX_INTERVAL_DEFAULT 600
-#define ND_RA_MIN_INTERVAL_DEFAULT(max) ((max) >= 9 ? (max) / 3 : (max) * 3 / 4)
+
+static inline int
+nd_ra_min_interval_default(int max)
+{
+    return max >= 9 ? max / 3 : max * 3 / 4;
+}
 
 /*
  * Use the same struct for MLD and MLD2, naming members as the defined fields in
@@ -1420,7 +1425,7 @@ void compose_nd_ra(struct dp_packet *,
                    const struct in6_addr *ipv6_dst,
                    uint8_t cur_hop_limit, uint8_t mo_flags,
                    ovs_be16 router_lt, ovs_be32 reachable_time,
-                   ovs_be32 retrans_timer, ovs_be32 mtu);
+                   ovs_be32 retrans_timer, uint32_t mtu);
 void packet_put_ra_prefix_opt(struct dp_packet *,
                               uint8_t plen, uint8_t la_flags,
                               ovs_be32 valid_lifetime,
diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c
index cf414b8f229b..7542db3f4854 100644
--- a/ovn/controller/pinctrl.c
+++ b/ovn/controller/pinctrl.c
@@ -1167,7 +1167,7 @@ ipv6_ra_update_config(const struct sbrec_port_binding *pb)
     config->max_interval = smap_get_int(&pb->options, "ipv6_ra_max_interval",
             ND_RA_MAX_INTERVAL_DEFAULT);
     config->min_interval = smap_get_int(&pb->options, "ipv6_ra_min_interval",
-            ND_RA_MIN_INTERVAL_DEFAULT(config->max_interval));
+            nd_ra_min_interval_default(config->max_interval));
     config->mtu = smap_get_int(&pb->options, "ipv6_ra_mtu", ND_MTU_DEFAULT);
     config->la_flags = ND_PREFIX_ON_LINK;
 
@@ -1194,7 +1194,7 @@ ipv6_ra_update_config(const struct sbrec_port_binding *pb)
     }
 
     /* All nodes multicast addresses */
-    config->eth_dst = ETH_ADDR_C(33,33,00,00,00,01);
+    config->eth_dst = (struct eth_addr) ETH_ADDR_C(33,33,00,00,00,01);
     ipv6_parse("ff02::1", &config->ipv6_dst);
 
     const char *eth_addr = smap_get(&pb->options, "ipv6_ra_src_eth");
diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index fc14dc8c38eb..e3ddc1fd9bc1 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -4486,7 +4486,7 @@ copy_ra_to_sb(struct ovn_port *op, const char *address_mode)
     smap_add_format(&options, "ipv6_ra_max_interval", "%d", max_interval);
 
     int min_interval = smap_get_int(&op->nbrp->ipv6_ra_configs,
-            "min_interval", ND_RA_MIN_INTERVAL_DEFAULT(max_interval));
+            "min_interval", nd_ra_min_interval_default(max_interval));
     if (min_interval > ND_RA_MIN_INTERVAL_MAX(max_interval)) {
         min_interval = ND_RA_MIN_INTERVAL_MAX(max_interval);
     }


More information about the dev mailing list