]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pimd: Add null_register bit to pim_register_send
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 18 Jul 2016 00:18:33 +0000 (20:18 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 22 Dec 2016 01:26:02 +0000 (20:26 -0500)
When sending a pim register message to an RP, we need
the ability to set the null bit in the message.  This
adds the ability to do so.

Additionally we need to switch the ip_hdr to a const uint8_t *buf
because pim_register_send really shouldn't know or care about
the fact it's a 'struct ip'.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_mroute.c
pimd/pim_register.c
pimd/pim_register.h

index bf996a738b1c293497d8884382ee2e055c721c0a..83a3b1045d98dcd676d2814d7aee923ae86f738c 100644 (file)
@@ -198,7 +198,7 @@ pim_mroute_msg_wholepkt (int fd, struct interface *ifp, const char *buf,
    * If we've received a register suppress
    */
   if (!up->t_rs_timer)
-    pim_register_send((const struct ip *)(buf + sizeof(struct ip)), rpg);
+    pim_register_send((uint8_t *)buf + sizeof(struct ip), ntohs (ip_hdr->ip_len), rpg, 0);
 
   return 0;
 }
index a3e63f0285ff25ee26f74eb5d43f83bbba003d77..2876dec83f0b90645eeffe0bfdf60485bf528fb3 100644 (file)
@@ -119,13 +119,12 @@ pim_register_stop_recv (void)
 }
 
 void
-pim_register_send (const struct ip *ip_hdr, struct pim_rpf *rpg)
+pim_register_send (const uint8_t *buf, int buf_size, struct pim_rpf *rpg, int null_register)
 {
   unsigned char buffer[3000];
   unsigned char *b1;
   struct pim_interface *pinfo;
   struct interface *ifp;
-  uint32_t plen;
 
   ifp = rpg->source_nexthop.interface;
   pinfo = (struct pim_interface *)ifp->info;
@@ -135,17 +134,18 @@ pim_register_send (const struct ip *ip_hdr, struct pim_rpf *rpg)
   }
 
   memset(buffer, 0, 3000);
+  b1 = buffer + PIM_MSG_HEADER_LEN;
+  *b1 |= null_register << 31;
   b1 = buffer + PIM_MSG_REGISTER_LEN;
 
-  plen = ntohs(ip_hdr->ip_len);
-  memcpy(b1, (const unsigned char *)ip_hdr, plen);
+  memcpy(b1, (const unsigned char *)buf, buf_size);
 
-  pim_msg_build_header(buffer, plen + PIM_MSG_REGISTER_LEN, PIM_MSG_TYPE_REGISTER);
+  pim_msg_build_header(buffer, buf_size + PIM_MSG_REGISTER_LEN, PIM_MSG_TYPE_REGISTER);
 
   if (pim_msg_send(pinfo->pim_sock_fd,
                   rpg->rpf_addr,
                   buffer,
-                  plen + PIM_MSG_REGISTER_LEN,
+                  buf_size + PIM_MSG_REGISTER_LEN,
                   ifp->name)) {
     if (PIM_DEBUG_PIM_TRACE) {
       zlog_debug("%s: could not send PIM register message on interface %s",
index 4749480b9d70db4cf0262ea095ffdb5638ff8d1c..3de1557966ee2355c8611a1af4230a0f3fb7bc0c 100644 (file)
@@ -41,6 +41,6 @@ int pim_register_recv (struct interface *ifp,
                       struct in_addr src_addr,
                       uint8_t *tlv_buf, int tlv_buf_size);
 
-void pim_register_send (const struct ip *msg, struct pim_rpf *rpg);
+void pim_register_send (const uint8_t *buf, int buf_size, struct pim_rpf *rpg, int null_register);
 
 #endif