When removing an announced prefix inherit the metric and ext_tag from the
authorclaudio <claudio@openbsd.org>
Mon, 19 Jul 2010 09:16:30 +0000 (09:16 +0000)
committerclaudio <claudio@openbsd.org>
Mon, 19 Jul 2010 09:16:30 +0000 (09:16 +0000)
LSA that is currently in the tree. Pruning with default metrics is bad
since the checksum of the LSA is different and therefor an additional
update cycle is needed to convince the other systems.
OK bluhm@, sthen@

usr.sbin/ospfd/rde.c

index 1dd9657..0d7480c 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: rde.c,v 1.86 2010/07/01 21:19:57 bluhm Exp $ */
+/*     $OpenBSD: rde.c,v 1.87 2010/07/19 09:16:30 claudio Exp $ */
 
 /*
  * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -1182,6 +1182,20 @@ orig_asext_lsa(struct rroute *rr, u_int16_t age)
        lsa->hdr.ls_id = rr->kr.prefix.s_addr;
        lsa->data.asext.mask = prefixlen2mask(rr->kr.prefixlen);
 
+       if (age == MAX_AGE) {
+               /* inherit metric and ext_tag from the current LSA,
+                * some routers don't like to get withdraws that are
+                * different from what they have in their table.
+                */
+               struct vertex *v;
+               v = lsa_find(NULL, lsa->hdr.type, lsa->hdr.ls_id,
+                   lsa->hdr.adv_rtr);
+               if (v != NULL) {
+                       rr->metric = ntohl(v->lsa->data.asext.metric);
+                       rr->kr.ext_tag = ntohl(v->lsa->data.asext.ext_tag);
+               }
+       }
+
        /*
         * nexthop -- on connected routes we are the nexthop,
         * in other cases we may announce the true nexthop if the