]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: remove peerlink_rif from the orig-mroute OIL when it is oper down
authorAnuradha Karuppiah <anuradhak@cumulusnetworks.com>
Thu, 6 Feb 2020 17:30:53 +0000 (09:30 -0800)
committerAnuradha Karuppiah <anuradhak@cumulusnetworks.com>
Fri, 14 Feb 2020 17:18:30 +0000 (09:18 -0800)
In an anycast VTEP setup the peerlink_rif is added as a static OIF
to the originating mroute (bypassing the pim state machine). This is
needed to ensure both MLAG switches rx a copy of encapsulated BUM flow.

We were not handling link state changes on this static OIF resulting
in the wrong vifi being used in the OIL (because of vifi re-allocation).
This commit re-acts to oper state changes by deleting the OIF on link
down and re-adding it on link up.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
pimd/pim_vxlan.c

index 41a57c267c8f2228c36be425b4453176560f7d5e..bd6998c4b8c5081577bf027c641a86db4df459f8 100644 (file)
@@ -788,7 +788,8 @@ bool pim_vxlan_do_mlag_reg(void)
  * to the MLAG peer which may mroute it over the underlay if there are any
  * interested receivers.
  */
-static void pim_vxlan_sg_peerlink_update(struct hash_backet *backet, void *arg)
+static void pim_vxlan_sg_peerlink_oif_update(struct hash_backet *backet,
+               void *arg)
 {
        struct interface *new_oif = (struct interface *)arg;
        struct pim_vxlan_sg *vxlan_sg = (struct pim_vxlan_sg *)backet->data;
@@ -827,8 +828,6 @@ void pim_vxlan_mlag_update(bool enable, bool peer_state, uint32_t role,
                                struct in_addr *reg_addr)
 {
        struct pim_instance *pim;
-       struct interface *old_oif;
-       struct interface *new_oif;
        char addr_buf[INET_ADDRSTRLEN];
        struct pim_interface *pim_ifp = NULL;
 
@@ -848,8 +847,6 @@ void pim_vxlan_mlag_update(bool enable, bool peer_state, uint32_t role,
         */
        pim = pim_get_pim_instance(VRF_DEFAULT);
 
-       old_oif = pim_vxlan_orig_mr_oif_get(pim);
-
        if (enable)
                vxlan_mlag.flags |= PIM_VXLAN_MLAGF_ENABLED;
        else
@@ -870,11 +867,6 @@ void pim_vxlan_mlag_update(bool enable, bool peer_state, uint32_t role,
                pim_vxlan_set_peerlink_rif(pim, peerlink_rif);
        else
                pim_vxlan_set_peerlink_rif(pim, NULL);
-
-       new_oif = pim_vxlan_orig_mr_oif_get(pim);
-       if (old_oif != new_oif)
-               hash_iterate(pim->vxlan.sg_hash, pim_vxlan_sg_peerlink_update,
-                       new_oif);
 }
 
 /****************************** misc callbacks *******************************/
@@ -972,6 +964,9 @@ static void pim_vxlan_set_peerlink_rif(struct pim_instance *pim,
                        struct interface *ifp)
 {
        struct interface *old_iif;
+       struct interface *new_iif;
+       struct interface *old_oif;
+       struct interface *new_oif;
 
        if (pim->vxlan.peerlink_rif == ifp)
                return;
@@ -983,22 +978,38 @@ static void pim_vxlan_set_peerlink_rif(struct pim_instance *pim,
                        ifp ? ifp->name : "-");
 
        old_iif = pim_vxlan_orig_mr_iif_get(pim);
+       old_oif = pim_vxlan_orig_mr_oif_get(pim);
        pim->vxlan.peerlink_rif = ifp;
-       ifp = pim_vxlan_orig_mr_iif_get(pim);
-       if (old_iif == ifp)
-               return;
 
-       if (PIM_DEBUG_VXLAN)
-               zlog_debug("%s: vxlan orig iif changed from %s to %s",
-                       __PRETTY_FUNCTION__, old_iif ? old_iif->name : "-",
-                       ifp ? ifp->name : "-");
+       new_iif = pim_vxlan_orig_mr_iif_get(pim);
+       if (old_iif != new_iif) {
+               if (PIM_DEBUG_VXLAN)
+                       zlog_debug("%s: vxlan orig iif changed from %s to %s",
+                               __PRETTY_FUNCTION__,
+                               old_iif ? old_iif->name : "-",
+                               new_iif ? new_iif->name : "-");
 
-       /* add/del upstream entries for the existing vxlan SG when the
-        * interface becomes available
-        */
-       if (pim->vxlan.sg_hash)
-               hash_iterate(pim->vxlan.sg_hash,
-                               pim_vxlan_sg_peerlink_rif_update, old_iif);
+               /* add/del upstream entries for the existing vxlan SG when the
+                * interface becomes available
+                */
+               if (pim->vxlan.sg_hash)
+                       hash_iterate(pim->vxlan.sg_hash,
+                                       pim_vxlan_sg_peerlink_rif_update,
+                                       old_iif);
+       }
+
+       new_oif = pim_vxlan_orig_mr_oif_get(pim);
+       if (old_oif != new_oif) {
+               if (PIM_DEBUG_VXLAN)
+                       zlog_debug("%s: vxlan orig oif changed from %s to %s",
+                               __PRETTY_FUNCTION__,
+                               old_oif ? old_oif->name : "-",
+                               new_oif ? new_oif->name : "-");
+               if (pim->vxlan.sg_hash)
+                       hash_iterate(pim->vxlan.sg_hash,
+                                       pim_vxlan_sg_peerlink_oif_update,
+                                       new_oif);
+       }
 }
 
 void pim_vxlan_add_vif(struct interface *ifp)