minor efficiency
authorMike Karels <karels@ucbvax.Berkeley.EDU>
Wed, 11 Apr 1984 05:17:26 +0000 (21:17 -0800)
committerMike Karels <karels@ucbvax.Berkeley.EDU>
Wed, 11 Apr 1984 05:17:26 +0000 (21:17 -0800)
SCCS-vsn: sbin/routed/input.c 4.8

usr/src/sbin/routed/input.c

index 058e6f7..a09aea9 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)input.c    4.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)input.c    4.8 (Berkeley) %G%";
 #endif
 
 /*
 #endif
 
 /*
@@ -118,10 +118,11 @@ rip_input(from, size)
                        }
 
                        /*
                        }
 
                        /*
-                        * Update if from gateway, shorter, or getting
-                        * stale and equivalent.
+                        * Update if from gateway and different,
+                        * shorter, or getting stale and equivalent.
                         */
                         */
-                       if (equal(from, &rt->rt_router) ||
+                       if ((equal(from, &rt->rt_router) &&
+                           n->rip_metric != rt->rt_metric ) ||
                            (unsigned) (n->rip_metric) < rt->rt_metric ||
                            (rt->rt_timer > (EXPIRE_TIME/2) &&
                            rt->rt_metric == n->rip_metric)) {
                            (unsigned) (n->rip_metric) < rt->rt_metric ||
                            (rt->rt_timer > (EXPIRE_TIME/2) &&
                            rt->rt_metric == n->rip_metric)) {