]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Fix of using uninitialized Memory
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 9 Jun 2016 19:16:14 +0000 (15:16 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 9 Jun 2016 19:16:14 +0000 (15:16 -0400)
Valgrind is reporting that pimd is using uninitialized
memory for comparisons.  This commit addresses
the issues found there.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_iface.c
pimd/pim_ifchannel.c
pimd/pim_igmpv3.c
pimd/pim_pim.c

index 985a7588a7d76904a9fb601258c9f1a6f7186c12..b70cd4b03300c39868702d962af2ed81e87f7e3a 100644 (file)
@@ -115,6 +115,7 @@ struct pim_interface *pim_if_new(struct interface *ifp, int igmp, int pim)
   pim_ifp->igmp_socket_list = 0;
   pim_ifp->pim_neighbor_list = 0;
   pim_ifp->pim_ifchannel_list = 0;
+  pim_ifp->pim_generation_id = 0;
 
   /* list of struct igmp_sock */
   pim_ifp->igmp_socket_list = list_new();
index e801f4eeb561fce64d8a80ce3e2a1f467eec0ee1..ad97879d6d7927e7dcaeea0838f2e69288526500 100644 (file)
@@ -223,6 +223,11 @@ static struct pim_ifchannel *pim_ifchannel_new(struct interface *ifp,
   ch->t_ifjoin_prune_pending_timer = 0;
   ch->ifjoin_creation              = 0;
 
+  ch->ifassert_my_metric = pim_macro_ch_my_assert_metric_eval(ch);
+  ch->ifassert_winner_metric = pim_macro_ch_my_assert_metric_eval (ch);
+
+  ch->ifassert_winner.s_addr = 0;
+
   /* Assert state */
   ch->t_ifassert_timer   = 0;
   reset_ifassert_state(ch);
@@ -236,8 +241,6 @@ static struct pim_ifchannel *pim_ifchannel_new(struct interface *ifp,
   else
     PIM_IF_FLAG_UNSET_ASSERT_TRACKING_DESIRED(ch->flags);
 
-  ch->ifassert_my_metric = pim_macro_ch_my_assert_metric_eval(ch);
-
   /* Attach to list */
   listnode_add(pim_ifp->pim_ifchannel_list, ch);
 
index 8a32a3272953918bf1648e43786897bd785faf5c..180de9d71e2b8953d15e3dd68e827e4f16264055 100644 (file)
@@ -1661,14 +1661,9 @@ void pim_igmp_send_membership_query(struct igmp_group *group,
               querier_query_interval, qqic, checksum);
   }
 
-#if 0
   memset(&to, 0, sizeof(to));
-#endif
   to.sin_family = AF_INET;
   to.sin_addr = dst_addr;
-#if 0
-  to.sin_port = htons(0);
-#endif
   tolen = sizeof(to);
 
   sent = sendto(fd, query_buf, msg_size, MSG_DONTWAIT,
index 5912709fe688ea89715a212a186b748c76bd216a..a492d57db58561fe028673214b04fa61948ae531 100644 (file)
@@ -481,14 +481,9 @@ int pim_msg_send(int fd,
               *(uint16_t *) PIM_MSG_HDR_OFFSET_CHECKSUM(pim_msg));
   }
 
-#if 0
   memset(&to, 0, sizeof(to));
-#endif
   to.sin_family = AF_INET;
   to.sin_addr = dst;
-#if 0
-  to.sin_port = htons(0);
-#endif
   tolen = sizeof(to);
 
   if (PIM_DEBUG_PIM_PACKETDUMP_SEND) {