]> git.proxmox.com Git - mirror_frr.git/commitdiff
BGP: Set advertisement interval when triggering IPv6 RAs
authorvivek <vivek@cumulusnetworks.com>
Thu, 12 May 2016 23:51:43 +0000 (16:51 -0700)
committervivek <vivek@cumulusnetworks.com>
Thu, 12 May 2016 23:51:43 +0000 (16:51 -0700)
This change extends the earlier change which added the ability in BGP to
trigger IPv6 Router Advertisements when an unnumbered neighbor is configured.
In addition to triggering the RAs, the advertisement interval is also set to
10 seconds. This is needed to handle the scenario where the peer may start
later.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-10896
Reviewed By: CCR-4693
Testing Done: Manual, bgp-min, bgp-smoke

bgpd/bgp_zebra.c
bgpd/bgpd.h
lib/zclient.c
lib/zclient.h
zebra/rtadv.c

index 377a6e08a688ca148ec1cfca4f4563959a19d2fd..457f865beababbc765c56e386601a8e5129c23a5 100644 (file)
@@ -2012,6 +2012,8 @@ bgp_zebra_instance_deregister (struct bgp *bgp)
 void
 bgp_zebra_initiate_radv (struct bgp *bgp, struct peer *peer)
 {
+  int ra_interval = BGP_UNNUM_DEFAULT_RA_INTERVAL;
+
   /* Don't try to initiate if we're not connected to Zebra */
   if (zclient->sock < 0)
     return;
@@ -2019,7 +2021,7 @@ bgp_zebra_initiate_radv (struct bgp *bgp, struct peer *peer)
   if (BGP_DEBUG (zebra, ZEBRA))
     zlog_debug("%u: Initiating RA for peer %s", bgp->vrf_id, peer->host);
 
-  zclient_send_interface_radv_req (zclient, bgp->vrf_id, peer->ifp, 1);
+  zclient_send_interface_radv_req (zclient, bgp->vrf_id, peer->ifp, 1, ra_interval);
 }
 
 void
@@ -2032,7 +2034,7 @@ bgp_zebra_terminate_radv (struct bgp *bgp, struct peer *peer)
   if (BGP_DEBUG (zebra, ZEBRA))
     zlog_debug("%u: Terminating RA for peer %s", bgp->vrf_id, peer->host);
 
-  zclient_send_interface_radv_req (zclient, bgp->vrf_id, peer->ifp, 0);
+  zclient_send_interface_radv_req (zclient, bgp->vrf_id, peer->ifp, 0, 0);
 }
 
 /* BGP has established connection with Zebra. */
index d15a58ecd4796badb115a87618c306682f9a691b..20f23e73cbfdcccca4e70333e70c4181d1d4b807 100644 (file)
@@ -32,6 +32,9 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 
 #define BGP_MAX_HOSTNAME 64    /* Linux max, is larger than most other sys */
 
+/* Default interval for IPv6 RAs when triggered by BGP unnumbered neighbor. */
+#define BGP_UNNUM_DEFAULT_RA_INTERVAL 10
+
 struct update_subgroup;
 struct bpacket;
 
index d1e9a96546f15a87110732111b3c3601416c8649..35a5b9e857877319df81962822b98d2cfc69db55 100644 (file)
@@ -484,7 +484,7 @@ zclient_send_dereg_requests (struct zclient *zclient, vrf_id_t vrf_id)
 /* Send request to zebra daemon to start or stop RA. */
 void
 zclient_send_interface_radv_req (struct zclient *zclient, vrf_id_t vrf_id,
-                                 struct interface *ifp, int enable)
+                                 struct interface *ifp, int enable, int ra_interval)
 {
   struct stream *s;
 
@@ -506,6 +506,7 @@ zclient_send_interface_radv_req (struct zclient *zclient, vrf_id_t vrf_id,
     zclient_create_header (s, ZEBRA_INTERFACE_DISABLE_RADV, vrf_id);
 
   stream_putl (s, ifp->ifindex);
+  stream_putl (s, ra_interval);
 
   stream_putw_at (s, 0, stream_get_endp (s));
 
index 726f254a2ae08ca131fb497b49373e6df4a9803c..ad82a21f3f27bc27acff62450c1509eb50d6d9e3 100644 (file)
@@ -176,7 +176,7 @@ extern void zclient_send_reg_requests (struct zclient *, vrf_id_t);
 extern void zclient_send_dereg_requests (struct zclient *, vrf_id_t);
 
 extern void zclient_send_interface_radv_req (struct zclient *zclient, vrf_id_t vrf_id,
-                                 struct interface *ifp, int enable);
+                                 struct interface *ifp, int enable, int ra_interval);
 
 /* Send redistribute command to zebra daemon. Do not update zclient state. */
 extern int zebra_redistribute_send (int command, struct zclient *, afi_t, int type, u_short instance, vrf_id_t vrf_id);
index 003459dd5fc8247cf2af4571e616cdbe5281135f..d4d48988c7e645d67ba3c58d646dddfb1762e551 100644 (file)
@@ -799,7 +799,8 @@ ipv6_nd_suppress_ra_set (struct interface *ifp, ipv6_nd_suppress_ra_status statu
  * Handle client (BGP) message to enable or disable IPv6 RA on an interface.
  * Note that while the client could request RA on an interface on which the
  * operator has not enabled RA, RA won't be disabled upon client request
- * if the operator has explicitly enabled RA.
+ * if the operator has explicitly enabled RA. The enable request can also
+ * specify a RA interval (in seconds).
  */
 void
 zebra_interface_radv_set (struct zserv *client, int sock, u_short length,
@@ -809,16 +810,18 @@ zebra_interface_radv_set (struct zserv *client, int sock, u_short length,
   unsigned int ifindex;
   struct interface *ifp;
   struct zebra_if *zif;
+  int ra_interval;
 
   s = client->ibuf;
 
-  /* Get interface index. */
+  /* Get interface index and RA interval. */
   ifindex = stream_getl (s);
+  ra_interval = stream_getl (s);
 
   if (IS_ZEBRA_DEBUG_EVENT)
-    zlog_debug("%u: IF %u RA %s from client %s",
+    zlog_debug("%u: IF %u RA %s from client %s, interval %ds",
                zvrf->vrf_id, ifindex, enable ? "enable" : "disable",
-               zebra_route_string(client->proto));
+               zebra_route_string(client->proto), ra_interval);
 
   /* Locate interface and check VRF match. */
   ifp = if_lookup_by_index_per_ns (zebra_ns_lookup (NS_DEFAULT), ifindex);
@@ -839,11 +842,19 @@ zebra_interface_radv_set (struct zserv *client, int sock, u_short length,
 
   zif = ifp->info;
   if (enable)
-    ipv6_nd_suppress_ra_set (ifp, RA_ENABLE);
+    {
+      ipv6_nd_suppress_ra_set (ifp, RA_ENABLE);
+      if (ra_interval &&
+          (ra_interval * 1000) < zif->rtadv.MaxRtrAdvInterval)
+        zif->rtadv.MaxRtrAdvInterval = ra_interval * 1000;
+    }
   else
     {
       if (!zif->rtadv.configured)
-        ipv6_nd_suppress_ra_set (ifp, RA_SUPPRESS);
+        {
+          zif->rtadv.MaxRtrAdvInterval = RTADV_MAX_RTR_ADV_INTERVAL;
+          ipv6_nd_suppress_ra_set (ifp, RA_SUPPRESS);
+        }
     }
 }