From ccb59b11047c71430eb55ed58eda94865bab20c8 Mon Sep 17 00:00:00 2001 From: hasso Date: Wed, 25 Aug 2004 09:10:37 +0000 Subject: SVN revisions 935-940 merge from Zebra CVS. --- ospf6d/ChangeLog | 5 +++++ ospf6d/ospf6_abr.c | 52 +++++++++++++++++++++++++++++++++++++++++++++----- ospf6d/ospf6_abr.h | 1 + ospf6d/ospf6_area.c | 2 ++ ospf6d/ospf6_asbr.c | 5 +---- ospf6d/ospf6_flood.c | 10 ++++++++-- ospf6d/ospf6_intra.c | 29 +++++++++++++++++++++++----- ospf6d/ospf6_lsa.c | 3 ++- ospf6d/ospf6_lsa.h | 3 ++- ospf6d/ospf6_lsdb.c | 5 +++++ ospf6d/ospf6_message.c | 6 +++--- ospf6d/ospf6_route.c | 15 +++++++++++++++ ospf6d/ospf6_route.h | 4 ++-- ospf6d/ospf6_top.c | 6 ++++-- ospf6d/ospf6d.h | 2 +- 15 files changed, 122 insertions(+), 26 deletions(-) (limited to 'ospf6d') diff --git a/ospf6d/ChangeLog b/ospf6d/ChangeLog index 43225bf2..e802e329 100644 --- a/ospf6d/ChangeLog +++ b/ospf6d/ChangeLog @@ -1,3 +1,8 @@ +2004-08-19 Yasuhiro Ohara + + * ospf6_asbr.c: Bug in ASBR check fixed. + * ospf6d.h: version 0.9.7k + 2004-08-19 Yasuhiro Ohara * ospf6_asbr.c: Bug in AS-External Origination fixed. diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c index e9dc238a..2d4b10f9 100644 --- a/ospf6d/ospf6_abr.c +++ b/ospf6d/ospf6_abr.c @@ -499,6 +499,7 @@ ospf6_abr_examin_summary (struct ospf6_lsa *lsa, struct ospf6_area *oa) u_int8_t prefix_options = 0; u_int32_t cost = 0; int i; + char buf[64]; if (IS_OSPF6_DEBUG_ABR) zlog_info ("Examin %s in area %s", lsa->name, oa->name); @@ -511,6 +512,7 @@ ospf6_abr_examin_summary (struct ospf6_lsa *lsa, struct ospf6_area *oa) prefix.family = AF_INET6; prefix.prefixlen = prefix_lsa->prefix.prefix_length; ospf6_prefix_in6_addr (&prefix.u.prefix6, &prefix_lsa->prefix); + prefix2str (&prefix, buf, sizeof (buf)); table = oa->ospf6->route_table; type = OSPF6_DEST_TYPE_NETWORK; prefix_options = prefix_lsa->prefix.prefix_options; @@ -522,6 +524,7 @@ ospf6_abr_examin_summary (struct ospf6_lsa *lsa, struct ospf6_area *oa) router_lsa = (struct ospf6_inter_router_lsa *) OSPF6_LSA_HEADER_END (lsa->header); ospf6_linkstate_prefix (router_lsa->router_id, htonl (0), &prefix); + inet_ntop (AF_INET, &router_lsa->router_id, buf, sizeof (buf)); table = oa->ospf6->brouter_table; type = OSPF6_DEST_TYPE_ROUTER; options[0] = router_lsa->options[0]; @@ -532,15 +535,18 @@ ospf6_abr_examin_summary (struct ospf6_lsa *lsa, struct ospf6_area *oa) else assert (0); - for (route = ospf6_route_lookup (&prefix, table); - route && ospf6_route_is_prefix (&prefix, route); - route = ospf6_route_next (route)) + /* Find existing route */ + route = ospf6_route_lookup (&prefix, table); + if (route) + ospf6_route_lock (route); + while (route && ospf6_route_is_prefix (&prefix, route)) { if (route->path.area_id == oa->area_id && route->path.origin.type == lsa->header->type && route->path.origin.id == lsa->header->id && route->path.origin.adv_router == lsa->header->adv_router) old = route; + route = ospf6_route_next (route); } /* (1) if cost == LSInfinity or if the LSA is MaxAge */ @@ -589,6 +595,7 @@ ospf6_abr_examin_summary (struct ospf6_lsa *lsa, struct ospf6_area *oa) ospf6_linkstate_prefix (lsa->header->adv_router, htonl (0), &abr_prefix); abr_entry = ospf6_route_lookup (&abr_prefix, oa->ospf6->brouter_table); if (abr_entry == NULL || abr_entry->path.area_id != oa->area_id || + CHECK_FLAG (abr_entry->flag, OSPF6_ROUTE_REMOVE) || ! CHECK_FLAG (abr_entry->path.router_bits, OSPF6_ROUTER_BIT_B)) { if (IS_OSPF6_DEBUG_ABR) @@ -602,7 +609,7 @@ ospf6_abr_examin_summary (struct ospf6_lsa *lsa, struct ospf6_area *oa) in the routing table. Always install the path by substituting old route (if any). */ if (old) - route = old; + route = ospf6_route_copy (old); else route = ospf6_route_create (); @@ -622,10 +629,45 @@ ospf6_abr_examin_summary (struct ospf6_lsa *lsa, struct ospf6_area *oa) route->nexthop[i] = abr_entry->nexthop[i]; if (IS_OSPF6_DEBUG_ABR) - zlog_info ("Install route"); + zlog_info ("Install route: %s", buf); ospf6_route_add (route, table); } +void +ospf6_abr_examin_brouter (u_int32_t router_id) +{ + struct ospf6_lsa *lsa; + struct ospf6_area *oa; + listnode node; + u_int16_t type; + + if (IS_OSPF6_DEBUG_ABR) + { + char buf[16]; + inet_ntop (AF_INET, &router_id, buf, sizeof (buf)); + zlog_info ("Router entry of %s changed", buf); + zlog_info ("Examin summary LSAs originated by the router"); + } + + type = htons (OSPF6_LSTYPE_INTER_ROUTER); + for (node = listhead (ospf6->area_list); node; nextnode (node)) + { + oa = OSPF6_AREA (getdata (node)); + for (lsa = ospf6_lsdb_type_router_head (type, router_id, oa->lsdb); lsa; + lsa = ospf6_lsdb_type_router_next (type, router_id, lsa)) + ospf6_abr_examin_summary (lsa, oa); + } + + type = htons (OSPF6_LSTYPE_INTER_PREFIX); + for (node = listhead (ospf6->area_list); node; nextnode (node)) + { + oa = OSPF6_AREA (getdata (node)); + for (lsa = ospf6_lsdb_type_router_head (type, router_id, oa->lsdb); lsa; + lsa = ospf6_lsdb_type_router_next (type, router_id, lsa)) + ospf6_abr_examin_summary (lsa, oa); + } +} + /* Display functions */ int diff --git a/ospf6d/ospf6_abr.h b/ospf6d/ospf6_abr.h index 3257c734..ce3c19a0 100644 --- a/ospf6d/ospf6_abr.h +++ b/ospf6d/ospf6_abr.h @@ -61,6 +61,7 @@ void ospf6_abr_originate_summary_to_area (struct ospf6_route *route, struct ospf6_area *area); void ospf6_abr_originate_summary (struct ospf6_route *route); void ospf6_abr_examin_summary (struct ospf6_lsa *lsa, struct ospf6_area *oa); +void ospf6_abr_examin_brouter (u_int32_t router_id); int config_write_ospf6_debug_abr (struct vty *vty); void install_element_ospf6_debug_abr (); diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index fc2103ca..312d88fe 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -68,6 +68,7 @@ ospf6_area_lsdb_hook_add (struct ospf6_lsa *lsa) case OSPF6_LSTYPE_INTER_PREFIX: case OSPF6_LSTYPE_INTER_ROUTER: + ospf6_abr_examin_summary (lsa, (struct ospf6_area *) lsa->lsdb->data); break; default: @@ -94,6 +95,7 @@ ospf6_area_lsdb_hook_remove (struct ospf6_lsa *lsa) case OSPF6_LSTYPE_INTER_PREFIX: case OSPF6_LSTYPE_INTER_ROUTER: + ospf6_abr_examin_summary (lsa, (struct ospf6_area *) lsa->lsdb->data); break; default: diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 7884a6bf..3352465c 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -192,11 +192,8 @@ ospf6_asbr_lsa_add (struct ospf6_lsa *lsa) return; } - asbr_id.family = AF_INET; - asbr_id.prefixlen = 32; - asbr_id.u.prefix4.s_addr = lsa->header->adv_router; + ospf6_linkstate_prefix (lsa->header->adv_router, htonl (0), &asbr_id); asbr_entry = ospf6_route_lookup (&asbr_id, ospf6->brouter_table); - if (asbr_entry == NULL) { if (IS_OSPF6_DEBUG_ASBR) diff --git a/ospf6d/ospf6_flood.c b/ospf6d/ospf6_flood.c index 05112021..660e6369 100644 --- a/ospf6d/ospf6_flood.c +++ b/ospf6d/ospf6_flood.c @@ -220,7 +220,7 @@ ospf6_install_lsa (struct ospf6_lsa *lsa) } gettimeofday (&now, (struct timezone *) NULL); - if (ospf6_lsa_age_current (lsa) != MAXAGE) + if (! OSPF6_LSA_IS_MAXAGE (lsa)) lsa->expire = thread_add_timer (master, ospf6_lsa_expire, lsa, MAXAGE + lsa->birth.tv_sec - now.tv_sec); else @@ -843,11 +843,17 @@ ospf6_receive_lsa (struct ospf6_neighbor *from, } } + gettimeofday (&new->received, (struct timezone *) NULL); + if (IS_OSPF6_DEBUG_LSA (RECV)) zlog_info ("Flood, Install, Possibly acknowledge the received LSA"); /* (b) immediately flood and (c) remove from all retrans-list */ - ospf6_flood (from, new); + /* Prevent self-originated LSA to be flooded. this is to make + reoriginated instance of the LSA not to be rejected by other routers + due to MinLSArrival. */ + if (new->header->adv_router != from->ospf6_if->area->ospf6->router_id) + ospf6_flood (from, new); /* (c) Remove the current database copy from all neighbors' Link state retransmission lists. */ diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index 74a89642..8383fd9d 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -1036,6 +1036,9 @@ ospf6_intra_prefix_lsa_add (struct ospf6_lsa *lsa) char *start, *current, *end; char buf[64]; + if (OSPF6_LSA_IS_MAXAGE (lsa)) + return; + if (IS_OSPF6_DEBUG_ROUTE (INTRA)) zlog_info ("%s found", lsa->name); @@ -1081,10 +1084,12 @@ ospf6_intra_prefix_lsa_add (struct ospf6_lsa *lsa) break; route = ospf6_route_create (); - route->prefix.prefixlen = op->prefix_length; + + memset (&route->prefix, 0, sizeof (struct prefix)); route->prefix.family = AF_INET6; - memcpy (&route->prefix.u.prefix6, OSPF6_PREFIX_BODY (op), - OSPF6_PREFIX_SPACE (op->prefix_length)); + route->prefix.prefixlen = op->prefix_length; + ospf6_prefix_in6_addr (&route->prefix.u.prefix6, op); + route->type = OSPF6_DEST_TYPE_NETWORK; route->path.origin.type = lsa->header->type; route->path.origin.id = lsa->header->id; @@ -1147,6 +1152,7 @@ ospf6_intra_prefix_lsa_remove (struct ospf6_lsa *lsa) break; prefix_num--; + memset (&prefix, 0, sizeof (struct prefix)); prefix.family = AF_INET6; prefix.prefixlen = op->prefix_length; ospf6_prefix_in6_addr (&prefix.u.prefix6, op); @@ -1246,6 +1252,7 @@ ospf6_intra_brouter_calculation (struct ospf6_area *oa) struct ospf6_route *lsentry, *copy; void (*hook_add) (struct ospf6_route *) = NULL; void (*hook_remove) (struct ospf6_route *) = NULL; + char buf[16]; if (IS_OSPF6_DEBUG_ROUTE (INTRA)) zlog_info ("Border-router calculation for area %s", oa->name); @@ -1277,9 +1284,15 @@ ospf6_intra_brouter_calculation (struct ospf6_area *oa) copy = ospf6_route_copy (lsentry); copy->type = OSPF6_DEST_TYPE_ROUTER; - copy->prefix.family = AF_INET; - copy->prefix.prefixlen = 32; + copy->path.area_id = oa->area_id; ospf6_route_add (copy, oa->ospf6->brouter_table); + + if (IS_OSPF6_DEBUG_ROUTE (INTRA)) + { + inet_ntop (AF_INET, &ADV_ROUTER_IN_PREFIX (©->prefix), + buf, sizeof (buf)); + zlog_info ("Re-install router entry %s", buf); + } } oa->ospf6->brouter_table->hook_add = hook_add; @@ -1303,6 +1316,12 @@ ospf6_intra_brouter_calculation (struct ospf6_area *oa) else if (CHECK_FLAG (lsentry->flag, OSPF6_ROUTE_ADD) || CHECK_FLAG (lsentry->flag, OSPF6_ROUTE_CHANGE)) { + if (IS_OSPF6_DEBUG_ROUTE (INTRA)) + { + inet_ntop (AF_INET, &ADV_ROUTER_IN_PREFIX (&lsentry->prefix), + buf, sizeof (buf)); + zlog_info ("Call hook for router entry %s", buf); + } if (hook_add) (*hook_add) (lsentry); } diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 8eea002e..6c8341f7 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -497,8 +497,9 @@ ospf6_lsa_copy (struct ospf6_lsa *lsa) assert (copy->lock == 0); copy->birth = lsa->birth; - copy->installed = lsa->installed; copy->originated = lsa->originated; + copy->received = lsa->received; + copy->installed = lsa->installed; copy->lsdb = lsa->lsdb; return copy; diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h index 961f11e1..be284498 100644 --- a/ospf6d/ospf6_lsa.h +++ b/ospf6d/ospf6_lsa.h @@ -113,8 +113,9 @@ struct ospf6_lsa unsigned char flag; /* special meaning (e.g. floodback) */ struct timeval birth; /* tv_sec when LS age 0 */ - struct timeval installed; /* used by MinLSArrival check */ struct timeval originated; /* used by MinLSInterval check */ + struct timeval received; /* used by MinLSArrival check */ + struct timeval installed; struct thread *expire; struct thread *refresh; /* For self-originated LSA */ diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c index 247238b9..6cd633f5 100644 --- a/ospf6d/ospf6_lsdb.c +++ b/ospf6d/ospf6_lsdb.c @@ -174,6 +174,11 @@ ospf6_lsdb_add (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb) (*lsdb->hook_remove) (lsa); } } + else if (OSPF6_LSA_IS_MAXAGE (old)) + { + if (lsdb->hook_add) + (*lsdb->hook_add) (lsa); + } else { if (lsdb->hook_remove) diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index 7e022da5..276c847d 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -557,19 +557,19 @@ ospf6_dbdesc_recv_master (struct ospf6_header *oh, if (mine == NULL) { if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV)) - zlog_info ("Add request (No database copy)", his->name); + zlog_info ("Add request (No database copy)"); ospf6_lsdb_add (his, on->request_list); } else if (ospf6_lsa_compare (his, mine) < 0) { if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV)) - zlog_info ("Add request (Received MoreRecent)", his->name); + zlog_info ("Add request (Received MoreRecent)"); ospf6_lsdb_add (his, on->request_list); } else { if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV)) - zlog_info ("Discard (Existing MoreRecent)", his->name); + zlog_info ("Discard (Existing MoreRecent)"); ospf6_lsa_delete (his); } } diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index 1202a3ae..dae92226 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -201,10 +201,25 @@ static void _route_count_assert (struct ospf6_route_table *table) { struct ospf6_route *debug; + char buf[64]; int num = 0; for (debug = ospf6_route_head (table); debug; debug = ospf6_route_next (debug)) num++; + + if (num == table->count) + return; + + zlog_info ("PANIC !! table[%p]->count = %d, real = %d", + table, table->count, num); + for (debug = ospf6_route_head (table); debug; + debug = ospf6_route_next (debug)) + { + prefix2str (&debug->prefix, buf, sizeof (buf)); + zlog_info ("%p %p %s", debug->prev, debug->next, buf); + } + zlog_info ("DUMP END"); + assert (num == table->count); } #define ospf6_route_count_assert(t) (_route_count_assert (t)) diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h index 069502f5..3d3e1014 100644 --- a/ospf6d/ospf6_route.h +++ b/ospf6d/ospf6_route.h @@ -215,9 +215,9 @@ extern char *ospf6_path_type_substr[OSPF6_PATH_TYPE_MAX]; #define ospf6_linkstate_prefix_id(x) \ (*(u_int32_t *)(&(x)->u.prefix6.s6_addr[4])) -#define ID_IN_PREFIX(x) \ - (*(u_int32_t *)(&(x)->u.prefix6.s6_addr[0])) #define ADV_ROUTER_IN_PREFIX(x) \ + (*(u_int32_t *)(&(x)->u.prefix6.s6_addr[0])) +#define ID_IN_PREFIX(x) \ (*(u_int32_t *)(&(x)->u.prefix6.s6_addr[4])) /* Function prototype */ diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 57103160..b031330f 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -100,15 +100,17 @@ ospf6_top_route_hook_remove (struct ospf6_route *route) void ospf6_top_brouter_hook_add (struct ospf6_route *route) { - ospf6_abr_originate_summary (route); + ospf6_abr_examin_brouter (ADV_ROUTER_IN_PREFIX (&route->prefix)); ospf6_asbr_lsentry_add (route); + ospf6_abr_originate_summary (route); } void ospf6_top_brouter_hook_remove (struct ospf6_route *route) { - ospf6_abr_originate_summary (route); + ospf6_abr_examin_brouter (ADV_ROUTER_IN_PREFIX (&route->prefix)); ospf6_asbr_lsentry_remove (route); + ospf6_abr_originate_summary (route); } struct ospf6 * diff --git a/ospf6d/ospf6d.h b/ospf6d/ospf6d.h index 1b68a0fc..b08d07c9 100644 --- a/ospf6d/ospf6d.h +++ b/ospf6d/ospf6d.h @@ -22,7 +22,7 @@ #ifndef OSPF6D_H #define OSPF6D_H -#define OSPF6_DAEMON_VERSION "0.9.7j" +#define OSPF6_DAEMON_VERSION "0.9.7k" /* global variables */ extern int errno; -- cgit v1.2.1