pimd: Fix of using uninitialized Memory
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>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index 2533d0f..ddad6cb 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -107,6 +107,7 @@
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();
diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c
index e801f4e..ad97879 100644
--- a/pimd/pim_ifchannel.c
+++ b/pimd/pim_ifchannel.c
@@ -223,6 +223,11 @@
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 @@
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);
diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c
index 8a32a32..180de9d 100644
--- a/pimd/pim_igmpv3.c
+++ b/pimd/pim_igmpv3.c
@@ -1661,14 +1661,9 @@
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,
diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c
index c522475..c52b0d3 100644
--- a/pimd/pim_pim.c
+++ b/pimd/pim_pim.c
@@ -473,14 +473,9 @@
*(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) {