]> git.proxmox.com Git - mirror_frr.git/commitdiff
pimd: extern pim_null_register_send
authorAnuradha Karuppiah <anuradhak@cumulusnetworks.com>
Fri, 22 Mar 2019 17:01:40 +0000 (10:01 -0700)
committerAnuradha Karuppiah <anuradhak@cumulusnetworks.com>
Sat, 20 Apr 2019 15:33:22 +0000 (08:33 -0700)
pim_vxlan will use this for registering the local-VTEP-IP wth the RP
independent of the presence of BUM traffic.

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

index 386ed1d4240775ffeab660e64fbd86d208734ef1..e2f38aab8b189e196e0acb9a69f10a13df910445 100644 (file)
@@ -219,6 +219,45 @@ void pim_register_send(const uint8_t *buf, int buf_size, struct in_addr src,
        }
 }
 
+void pim_null_register_send(struct pim_upstream *up)
+{
+       struct ip ip_hdr;
+       struct pim_interface *pim_ifp;
+       struct pim_rpf *rpg;
+       struct in_addr src;
+
+       pim_ifp = up->rpf.source_nexthop.interface->info;
+       if (!pim_ifp) {
+               if (PIM_DEBUG_TRACE)
+                       zlog_debug(
+                               "%s: Cannot send null-register for %s no valid iif",
+                               __PRETTY_FUNCTION__, up->sg_str);
+               return;
+       }
+
+       rpg = RP(pim_ifp->pim, up->sg.grp);
+       if (!rpg) {
+               if (PIM_DEBUG_TRACE)
+                       zlog_debug(
+                               "%s: Cannot send null-register for %s no RPF to the RP",
+                               __PRETTY_FUNCTION__, up->sg_str);
+               return;
+       }
+
+       memset(&ip_hdr, 0, sizeof(struct ip));
+       ip_hdr.ip_p = PIM_IP_PROTO_PIM;
+       ip_hdr.ip_hl = 5;
+       ip_hdr.ip_v = 4;
+       ip_hdr.ip_src = up->sg.src;
+       ip_hdr.ip_dst = up->sg.grp;
+       ip_hdr.ip_len = htons(20);
+
+       /* checksum is broken */
+       src = pim_ifp->primary_address;
+       pim_register_send((uint8_t *)&ip_hdr, sizeof(struct ip),
+                       src, rpg, 1, up);
+}
+
 /*
  * 4.4.2 Receiving Register Messages at the RP
  *
index 906d093bb76ba575562750403c205f616d4e50f4..c5a28fee41b4c78dfebfa7396918169d2c74bb1c 100644 (file)
@@ -42,5 +42,6 @@ void pim_register_send(const uint8_t *buf, int buf_size, struct in_addr src,
 void pim_register_stop_send(struct interface *ifp, struct prefix_sg *sg,
                            struct in_addr src, struct in_addr originator);
 void pim_register_join(struct pim_upstream *up);
+void pim_null_register_send(struct pim_upstream *up);
 
 #endif
index c9ad1cf14282632ad34dfa810d6f9b5ee4140a27..dc37815bba001bbb556b52fddaa7d897203a2f79 100644 (file)
@@ -1417,8 +1417,6 @@ static int pim_upstream_register_stop_timer(struct thread *t)
        struct pim_interface *pim_ifp;
        struct pim_instance *pim;
        struct pim_upstream *up;
-       struct pim_rpf *rpg;
-       struct ip ip_hdr;
        up = THREAD_ARG(t);
        pim = up->channel_oil->pim;
 
@@ -1466,24 +1464,7 @@ static int pim_upstream_register_stop_timer(struct thread *t)
                                        __PRETTY_FUNCTION__);
                        return 0;
                }
-               rpg = RP(pim_ifp->pim, up->sg.grp);
-               if (!rpg) {
-                       if (PIM_DEBUG_TRACE)
-                               zlog_debug(
-                                       "%s: Cannot send register for %s no RPF to the RP",
-                                       __PRETTY_FUNCTION__, up->sg_str);
-                       return 0;
-               }
-               memset(&ip_hdr, 0, sizeof(struct ip));
-               ip_hdr.ip_p = PIM_IP_PROTO_PIM;
-               ip_hdr.ip_hl = 5;
-               ip_hdr.ip_v = 4;
-               ip_hdr.ip_src = up->sg.src;
-               ip_hdr.ip_dst = up->sg.grp;
-               ip_hdr.ip_len = htons(20);
-               // checksum is broken
-               pim_register_send((uint8_t *)&ip_hdr, sizeof(struct ip),
-                                 pim_ifp->primary_address, rpg, 1, up);
+               pim_null_register_send(up);
                break;
        default:
                break;