[ripd] Fix logic to send updates on all connected addresses.

2006-04-28 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* ripd.c: (rip_update_process) Try to fix the logic for sending
	  an updated on each connected network.  The new code will
	  attempt to send the update on each connected network, whereas
	  the previous code seemed to be attempting to avoid sending
	  more than one RIPv1 update on a given interface, but was coded
	  incorrectly.  The actual effect of the old code was to send
	  an update only on the first connected address in the cases
	  where the interface is not multicast, or RIPv2 is not being used.
diff --git a/ripd/ChangeLog b/ripd/ChangeLog
index d795509..89302d5 100644
--- a/ripd/ChangeLog
+++ b/ripd/ChangeLog
@@ -1,3 +1,14 @@
+2006-04-28 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+	* ripd.c: (rip_update_process) Try to fix the logic for sending
+	  an updated on each connected network.  The new code will
+	  attempt to send the update on each connected network, whereas
+	  the previous code seemed to be attempting to avoid sending
+	  more than one RIPv1 update on a given interface, but was coded
+	  incorrectly.  The actual effect of the old code was to send
+	  an update only on the first connected address in the cases
+	  where the interface is not multicast, or RIPv2 is not being used.
+
 2006-01-30 Alain Ritoux <alain.ritoux@6wind.com>
 
         * ripd.c: correct bug that allowed route learnt through RIP to take
diff --git a/ripd/ripd.c b/ripd/ripd.c
index c8aa522..e91adb8 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -2498,42 +2498,28 @@
 
       if (ri->running)
 	{
+	  /* 
+	   * If there is no version configuration in the interface,
+	   * use rip's version setting. 
+	   */
+	  int vsend = ((ri->ri_send == RI_RIP_UNSPEC) ?
+		       rip->version_send : ri->ri_send);
+
 	  if (IS_RIP_DEBUG_EVENT) 
-	    {
-	      if (ifp->name) 
-		zlog_debug ("SEND UPDATE to %s ifindex %d",
-			   ifp->name, ifp->ifindex);
-	      else
-		zlog_debug ("SEND UPDATE to _unknown_ ifindex %d",
-			   ifp->ifindex);
-	    }
+	    zlog_debug("SEND UPDATE to %s ifindex %d",
+		       (ifp->name ? ifp->name : "_unknown_"), ifp->ifindex);
 
           /* send update on each connected network */
 	  for (ALL_LIST_ELEMENTS (ifp->connected, ifnode, ifnnode, connected))
 	    {
-	      struct prefix_ipv4 *ifaddr;
-              int done = 0;
-	      /* 
-               * If there is no version configuration in the interface,
-               * use rip's version setting. 
-               */
-	      int vsend = ((ri->ri_send == RI_RIP_UNSPEC) ?
-			   rip->version_send : ri->ri_send);
-
-              ifaddr = (struct prefix_ipv4 *) connected->address;
-
-	      if (ifaddr->family != AF_INET)
-		continue;
-
-              if ((vsend & RIPv1) && !done)
-	        rip_update_interface (connected, RIPv1, route_type);
-              if ((vsend & RIPv2) && if_is_multicast(ifp))
-	        rip_update_interface (connected, RIPv2, route_type);
-              done = 1;
-              if (!(vsend & RIPv2) || !if_is_multicast(ifp))
-                break;
-		
-	  }
+	      if (connected->address->family == AF_INET)
+	        {
+		  if (vsend & RIPv1)
+		    rip_update_interface (connected, RIPv1, route_type);
+		  if ((vsend & RIPv2) && if_is_multicast(ifp))
+		    rip_update_interface (connected, RIPv2, route_type);
+		}
+	    }
 	}
     }