]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Add the ability to never SPT switchover 337/head
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 5 Apr 2017 16:08:53 +0000 (12:08 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 5 Apr 2017 16:38:12 +0000 (12:38 -0400)
Add the ability to allow pim to determine if we should
allow spt-switchover or not on the LHR.

Signed-off-by: Donald Sharp
pimd/pim_cmd.c
pimd/pim_ifchannel.c
pimd/pim_upstream.c
pimd/pim_upstream.h
pimd/pim_vty.c
pimd/pimd.c
pimd/pimd.h

index 4b12f4831422946808b25d026d7f5d3247075c67..de2b7cbba6db84befdf469037f007d29c944b6cb 100644 (file)
@@ -3416,6 +3416,35 @@ pim_rp_cmd_worker (struct vty *vty, const char *rp, const char *group, const cha
   return CMD_SUCCESS;
 }
 
+DEFUN (ip_pim_spt_switchover_infinity,
+       ip_pim_spt_switchover_infinity_cmd,
+       "ip pim spt-switchover infinity-and-beyond",
+       IP_STR
+       PIM_STR
+       "SPT-Switchover\n"
+       "Never switch to SPT Tree\n")
+{
+  pimg->spt_switchover = PIM_SPT_INFINITY;
+
+  pim_upstream_remove_lhr_star_pimreg();
+  return CMD_SUCCESS;
+}
+
+DEFUN (no_ip_pim_spt_switchover_infinity,
+       no_ip_pim_spt_switchover_infinity_cmd,
+       "no ip pim spt-switchover infinity-and-beyond",
+       NO_STR
+       IP_STR
+       PIM_STR
+       "SPT_Switchover\n"
+       "Never switch to SPT Tree\n")
+{
+  pimg->spt_switchover = PIM_SPT_IMMEDIATE;
+
+  pim_upstream_add_lhr_star_pimreg();
+  return CMD_SUCCESS;
+}
+
 DEFUN (ip_pim_joinprune_time,
        ip_pim_joinprune_time_cmd,
        "ip pim join-prune-interval <60-600>",
@@ -6187,6 +6216,8 @@ void pim_cmd_init()
   install_element (CONFIG_NODE, &ip_pim_ssm_prefix_list_cmd);
   install_element (CONFIG_NODE, &ip_pim_register_suppress_cmd);
   install_element (CONFIG_NODE, &no_ip_pim_register_suppress_cmd);
+  install_element (CONFIG_NODE, &ip_pim_spt_switchover_infinity_cmd);
+  install_element (CONFIG_NODE, &no_ip_pim_spt_switchover_infinity_cmd);
   install_element (CONFIG_NODE, &ip_pim_joinprune_time_cmd);
   install_element (CONFIG_NODE, &no_ip_pim_joinprune_time_cmd);
   install_element (CONFIG_NODE, &ip_pim_keep_alive_cmd);
index e1697960e488ca2f85d873546ace9b63492fea6d..ebd36f8782509c45fa47abaa3e4ab54156dd9afd 100644 (file)
@@ -1006,7 +1006,8 @@ pim_ifchannel_local_membership_add(struct interface *ifp,
              pim_upstream_switch (child, PIM_UPSTREAM_JOINED);
            }
         }
-      pim_channel_add_oif(up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_IGMP);
+      if (pimg->spt_switchover != PIM_SPT_INFINITY)
+        pim_channel_add_oif(up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_IGMP);
     }
 
   return 1;
index 3e81aaf496f0269c0b8971c86334e5b8d8bdf4be..5743dac6548ad4235e68dfa6d02bf71e0d872d0f 100644 (file)
@@ -1676,6 +1676,42 @@ pim_upstream_sg_running (void *arg)
   return;
 }
 
+void
+pim_upstream_add_lhr_star_pimreg (void)
+{
+  struct pim_upstream *up;
+  struct listnode *node;
+
+  for (ALL_LIST_ELEMENTS_RO (pim_upstream_list, node, up))
+    {
+      if (up->sg.src.s_addr != INADDR_ANY)
+        continue;
+
+      if (!PIM_UPSTREAM_FLAG_TEST_SRC_IGMP (up->flags))
+        continue;
+
+      pim_channel_add_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_IGMP);
+    }
+}
+
+void
+pim_upstream_remove_lhr_star_pimreg (void)
+{
+  struct pim_upstream *up;
+  struct listnode *node;
+
+  for (ALL_LIST_ELEMENTS_RO (pim_upstream_list, node, up))
+    {
+      if (up->sg.src.s_addr != INADDR_ANY)
+        continue;
+
+      if (!PIM_UPSTREAM_FLAG_TEST_SRC_IGMP (up->flags))
+        continue;
+
+      pim_channel_del_oif (up->channel_oil, pim_regiface, PIM_OIF_FLAG_PROTO_IGMP);
+    }
+}
+
 void
 pim_upstream_init (void)
 {
index 94bc5a55b91c6480da2b7aae76991ddeebe818a3..a1af4483acd703695705ace44c8b66ef7e328fcd 100644 (file)
@@ -198,4 +198,7 @@ void pim_upstream_terminate (void);
 void join_timer_start (struct pim_upstream *up);
 int pim_upstream_compare (void *arg1, void *arg2);
 void pim_upstream_register_reevaluate (void);
+
+void pim_upstream_add_lhr_star_pimreg (void);
+void pim_upstream_remove_lhr_star_pimreg (void);
 #endif /* PIM_UPSTREAM_H */
index f4bfcc5ce004b414d045e9701b5637a86e490982..3d52dc9c41624a630c1e6f38e978ecebb565894e 100644 (file)
@@ -182,6 +182,12 @@ int pim_global_config_write(struct vty *vty)
                ssm->plist_name, VTY_NEWLINE);
       ++writes;
     }
+  if (pimg->spt_switchover == PIM_SPT_INFINITY)
+    {
+      vty_out (vty, "ip pim spt-switchover infinity-and-beyond%s",
+               VTY_NEWLINE);
+      ++writes;
+    }
 
   if (qpim_ssmpingd_list) {
     struct listnode *node;
index bdbd251e209722581d7f44539524863db9404312..eaef4ff5c0331bbe0a7fc78be7403c8a4ec30220 100644 (file)
@@ -249,6 +249,7 @@ pim_instance_init (vrf_id_t vrf_id, afi_t afi)
   pim->vrf_id = vrf_id;
   pim->afi = afi;
 
+  pim->spt_switchover = PIM_SPT_IMMEDIATE;
   pim->rpf_hash = hash_create_size (256, pim_rpf_hash_key, pim_rpf_equal);
 
   if (PIM_DEBUG_ZEBRA)
index 69aee28f8f86cbca70ee5edd902978e9e1d53fca..6c3dcfafcabea50fce4035cd8d2dbec66ed04f7d 100644 (file)
@@ -237,11 +237,19 @@ extern int32_t qpim_register_probe_time;
 #define PIM_DONT_DEBUG_MSDP_PACKETS        (qpim_debugs &= ~PIM_MASK_MSDP_PACKETS)
 #define PIM_DONT_DEBUG_MSDP_INTERNAL       (qpim_debugs &= ~PIM_MASK_MSDP_INTERNAL)
 
+enum pim_spt_switchover {
+  PIM_SPT_IMMEDIATE,
+  PIM_SPT_INFINITY,
+};
+
 /* Per VRF PIM DB */
 struct pim_instance
 {
   afi_t afi;
   vrf_id_t vrf_id;
+
+  enum pim_spt_switchover spt_switchover;
+
   struct hash *rpf_hash;
   void *ssm_info; /* per-vrf SSM configuration */
 };