Run DR election when hello packet is received.
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index d2f9eb8..c89f2b5 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -563,7 +563,7 @@
 	  "NonPri: Number of neighbors missing DR Priority hello option%s%s",
 	  VTY_NEWLINE, VTY_NEWLINE);
   
-  vty_out(vty, "Interface Address         DR              Uptime   Elections NonPri%s", VTY_NEWLINE);
+  vty_out(vty, "Interface Address         DR              Uptime   Elections Changes NonPri%s", VTY_NEWLINE);
 
   for (ALL_LIST_ELEMENTS_RO(iflist, node, ifp)) {
     struct pim_interface *pim_ifp;
@@ -587,12 +587,13 @@
     pim_inet4_dump("<dr?>", pim_ifp->pim_dr_addr,
 		   dr_str, sizeof(dr_str));
 
-    vty_out(vty, "%-9s %-15s %-15s %8s %9d %6d%s",
+    vty_out(vty, "%-9s %-15s %-15s %8s %9d %7d %6d%s",
 	    ifp->name,
 	    inet_ntoa(ifaddr),
 	    dr_str,
 	    dr_uptime,
 	    pim_ifp->pim_dr_election_count,
+	    pim_ifp->pim_dr_election_changes,
 	    pim_ifp->pim_dr_num_nondrpri_neighbors,
 	    VTY_NEWLINE);
   }
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index f0c3266..72626ec 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -226,7 +226,7 @@
   pim_ifp = ifp->info;
   zassert(pim_ifp);
 
-  pim_if_dr_election(ifp); /* Done TODO T30 */
+  pim_if_dr_election(ifp); /* router's own DR Priority (addr) changes -- Done TODO T30 */
   pim_if_update_join_desired(pim_ifp); /* depends on DR */
   pim_if_update_could_assert(ifp); /* depends on DR */
   pim_if_update_my_assert_metric(ifp); /* depends on could_assert */
diff --git a/pimd/pim_iface.h b/pimd/pim_iface.h
index 0a702c2..6a2f7c9 100644
--- a/pimd/pim_iface.h
+++ b/pimd/pim_iface.h
@@ -87,6 +87,7 @@
   /* DR Election */
   int64_t        pim_dr_election_last; /* timestamp */
   int            pim_dr_election_count;
+  int            pim_dr_election_changes;
   struct in_addr pim_dr_addr;
   uint32_t       pim_dr_priority;            /* config */
   int            pim_dr_num_nondrpri_neighbors; /* neighbors without dr_pri */
diff --git a/pimd/pim_neighbor.c b/pimd/pim_neighbor.c
index 51ce8c9..7d7b43a 100644
--- a/pimd/pim_neighbor.c
+++ b/pimd/pim_neighbor.c
@@ -132,7 +132,8 @@
     zlog_info("%s: DR was %s now is %s on interface %s",
 	      __PRETTY_FUNCTION__,
 	      dr_old_str, dr_new_str, ifp->name);
-    
+
+    ++pim_ifp->pim_dr_election_changes; 
     pim_if_update_join_desired(pim_ifp);
     pim_if_update_could_assert(ifp);
     pim_if_update_assert_tracking_desired(ifp);
@@ -191,7 +192,7 @@
       PIM Hello message is received, when a neighbor times out, or when a
       router's own DR Priority changes.
     */
-    pim_if_dr_election(neigh->interface);
+    pim_if_dr_election(neigh->interface); // router's own DR Priority changes
   }
 }
 
@@ -226,7 +227,7 @@
     PIM Hello message is received, when a neighbor times out, or when a
     router's own DR Priority changes.
   */
-  pim_if_dr_election(ifp);
+  pim_if_dr_election(ifp); // neighbor times out
 
   return 0;
 }
@@ -347,7 +348,7 @@
     PIM Hello message is received, when a neighbor times out, or when a
     router's own DR Priority changes.
   */
-  pim_if_dr_election(neigh->interface);
+  pim_if_dr_election(neigh->interface); // new neighbor -- should not trigger dr election...
 
   /*
     RFC 4601: 4.3.1.  Sending Hello Messages
diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c
index 8dd71d6..4fda26e 100644
--- a/pimd/pim_pim.c
+++ b/pimd/pim_pim.c
@@ -208,10 +208,14 @@
   }
 
   if (pim_type == PIM_MSG_TYPE_HELLO) {
-    return pim_hello_recv(ifp,
-			  ip_hdr->ip_src,
-			  pim_msg + PIM_MSG_HEADER_LEN,
-			  pim_msg_len - PIM_MSG_HEADER_LEN);
+    int result = pim_hello_recv(ifp,
+                 ip_hdr->ip_src,
+                 pim_msg + PIM_MSG_HEADER_LEN,
+                 pim_msg_len - PIM_MSG_HEADER_LEN);
+    if (!result) {
+      pim_if_dr_election(ifp); /* PIM Hello message is received */
+    }
+    return result;
   }
 
   neigh = pim_neighbor_find(ifp, ip_hdr->ip_src);
@@ -324,7 +328,10 @@
   }
 #endif
 
-  if (pim_pim_packet(ifp, buf, len)) {
+  int fail = pim_pim_packet(ifp, buf, len);
+  if (fail) {
+    zlog_warn("%s: pim_pim_packet() return=%d",
+              __PRETTY_FUNCTION__, fail);
     goto done;
   }
 
@@ -429,6 +436,7 @@
   /* DR Election */
   pim_ifp->pim_dr_election_last          = 0; /* timestamp */
   pim_ifp->pim_dr_election_count         = 0;
+  pim_ifp->pim_dr_election_changes       = 0;
   pim_ifp->pim_dr_num_nondrpri_neighbors = 0; /* neighbors without dr_pri */
   pim_ifp->pim_dr_addr                   = pim_ifp->primary_address;