]> git.puffer.fish Git - matthieu/frr.git/commitdiff
2004-03-19 Jean-Yves Simon <lethalwp@tiscali.be>
authorpaul <paul>
Sat, 1 May 2004 20:45:38 +0000 (20:45 +0000)
committerpaul <paul>
Sat, 1 May 2004 20:45:38 +0000 (20:45 +0000)
        * ripd.c: make ripd also check on administrative distance of his
          own links to update routes.

ripd/ChangeLog
ripd/ripd.c

index 0d7b5bcdd78c7fd05a348b347afe020da363d001..13c34b58f371852e6c5d4fa4beb7eb69352267e3 100644 (file)
@@ -1,3 +1,8 @@
+2004-03-19 Jean-Yves Simon <lethalwp@tiscali.be>
+
+       * ripd.c: make ripd also check on administrative distance of his
+         own links to update routes.
+
 2004-03-18 sowmini.varadhan@sun.com
 
        * ripd.c: rip_send_packet can get null connected address when
index 22777e504eeed43bfc40a0f0e28f40438d78c7e1..dd9427c5597f239d94bc760ad091537718d23867 100644 (file)
@@ -387,7 +387,7 @@ rip_rte_process (struct rte *rte, struct sockaddr_in *from,
   int ret;
   struct prefix_ipv4 p;
   struct route_node *rp;
-  struct rip_info *rinfo;
+  struct rip_info *rinfo, rinfotmp;
   struct rip_interface *ri;
   struct in_addr *nexthop;
   u_char oldmetric;
@@ -560,13 +560,27 @@ rip_rte_process (struct rte *rte, struct sockaddr_in *from,
       if (same)
        rip_timeout_update (rinfo);
 
+
+      /* Fill in a minimaly temporary rip_info structure, for a future
+         rip_distance_apply() use) */
+      memset (&rinfo,0,sizeof(rinfotmp));
+      IPV4_ADDR_COPY (&rinfotmp.from, &from->sin_addr);
+      rinfotmp.rp=rinfo->rp;
+
+
       /* Next, compare the metrics.  If the datagram is from the same
         router as the existing route, and the new metric is different
         than the old one; or, if the new metric is lower than the old
-        one, or if the tag has been changed; do the following actions: */
-      if ((same && rinfo->metric != rte->metric) ||
-         (rte->metric < rinfo->metric) ||
-         (same && (rinfo->metric == rte->metric) && ntohs(rte->tag) != rinfo->tag))
+        one, or if the tag has been changed; or if there is a route
+        with a lower administrave distance; or an update of the
+        distance on the actual route; do the following actions: */
+      if (( same && rinfo->metric != rte->metric ) 
+          || ( rte->metric < rinfo->metric ) 
+          || ( (same)
+               && (rinfo->metric == rte->metric) 
+               && ntohs(rte->tag) != rinfo->tag ) 
+          || ( rinfo->distance > rip_distance_apply (&rinfotmp) ) 
+          || ( (rinfo->distance != rip_distance_apply (rinfo)) && same ))
        {
          /* - Adopt the route from the datagram.  That is, put the
             new metric in, and adjust the next hop address (if