* ospf_ase.c: Don't show messages related to the ase calculations if

we are not debugging.
This commit is contained in:
hasso 2005-02-21 14:58:42 +00:00
parent e8274dcde1
commit e40dcce1f5
2 changed files with 57 additions and 29 deletions

View File

@ -1,3 +1,8 @@
2005-02-21 Hasso Tepper <hasso at quagga.net>
* ospf_ase.c: Don't show messages related to the ase calculations if
we are not debugging.
2005-02-19 Hasso Tepper <hasso at quagga.net> 2005-02-19 Hasso Tepper <hasso at quagga.net>
* ospf_api.h: char isn't always signed, but it has to be it here. * ospf_api.h: char isn't always signed, but it has to be it here.

View File

@ -184,31 +184,36 @@ ospf_ase_calculate_asbr_route (struct ospf *ospf,
if (asbr_route == NULL) if (asbr_route == NULL)
{ {
zlog_info ("ospf_ase_calculate(): Route to ASBR %s not found", if (IS_DEBUG_OSPF (lsa, LSA))
inet_ntoa (asbr.prefix)); zlog_debug ("ospf_ase_calculate(): Route to ASBR %s not found",
inet_ntoa (asbr.prefix));
return NULL; return NULL;
} }
if (!(asbr_route->u.std.flags & ROUTER_LSA_EXTERNAL)) if (!(asbr_route->u.std.flags & ROUTER_LSA_EXTERNAL))
{ {
zlog_info ("ospf_ase_calculate(): Originating router is not an ASBR"); if (IS_DEBUG_OSPF (lsa, LSA))
zlog_debug ("ospf_ase_calculate(): Originating router is not an ASBR");
return NULL; return NULL;
} }
if (al->e[0].fwd_addr.s_addr != 0) if (al->e[0].fwd_addr.s_addr != 0)
{ {
zlog_info ("ospf_ase_calculate(): " if (IS_DEBUG_OSPF (lsa, LSA))
"Forwarding address is not 0.0.0.0."); zlog_debug ("ospf_ase_calculate(): "
"Forwarding address is not 0.0.0.0.");
if (! ospf_ase_forward_address_check (ospf, al->e[0].fwd_addr)) if (! ospf_ase_forward_address_check (ospf, al->e[0].fwd_addr))
{ {
zlog_info ("ospf_ase_calculate(): " if (IS_DEBUG_OSPF (lsa, LSA))
"Forwarding address is one of our addresses, Ignore."); zlog_debug ("ospf_ase_calculate(): "
"Forwarding address is one of our addresses, Ignore.");
return NULL; return NULL;
} }
zlog_info ("ospf_ase_calculate(): " if (IS_DEBUG_OSPF (lsa, LSA))
"Looking up in the Network Routing Table."); zlog_debug ("ospf_ase_calculate(): "
"Looking up in the Network Routing Table.");
/* Looking up the path to the fwd_addr from Network route. */ /* Looking up the path to the fwd_addr from Network route. */
asbr.family = AF_INET; asbr.family = AF_INET;
@ -219,8 +224,9 @@ ospf_ase_calculate_asbr_route (struct ospf *ospf,
if (rn == NULL) if (rn == NULL)
{ {
zlog_info ("ospf_ase_calculate(): " if (IS_DEBUG_OSPF (lsa, LSA))
"Couldn't find a route to the forwarding address."); zlog_debug ("ospf_ase_calculate(): "
"Couldn't find a route to the forwarding address.");
return NULL; return NULL;
} }
@ -228,8 +234,9 @@ ospf_ase_calculate_asbr_route (struct ospf *ospf,
if ((asbr_route = rn->info) == NULL) if ((asbr_route = rn->info) == NULL)
{ {
zlog_info ("ospf_ase_calculate(): " if (IS_DEBUG_OSPF (lsa, LSA))
"Somehow OSPF route to ASBR is lost"); zlog_debug ("ospf_ase_calculate(): "
"Somehow OSPF route to ASBR is lost");
return NULL; return NULL;
} }
} }
@ -255,13 +262,15 @@ ospf_ase_calculate_new_route (struct ospf_lsa *lsa,
if (!IS_EXTERNAL_METRIC (al->e[0].tos)) if (!IS_EXTERNAL_METRIC (al->e[0].tos))
{ {
zlog_info ("Route[External]: type-1 created."); if (IS_DEBUG_OSPF (lsa, LSA))
zlog_debug ("Route[External]: type-1 created.");
new->path_type = OSPF_PATH_TYPE1_EXTERNAL; new->path_type = OSPF_PATH_TYPE1_EXTERNAL;
new->cost = asbr_route->cost + metric; /* X + Y */ new->cost = asbr_route->cost + metric; /* X + Y */
} }
else else
{ {
zlog_info ("Route[External]: type-2 created."); if (IS_DEBUG_OSPF (lsa, LSA))
zlog_debug ("Route[External]: type-2 created.");
new->path_type = OSPF_PATH_TYPE2_EXTERNAL; new->path_type = OSPF_PATH_TYPE2_EXTERNAL;
new->cost = asbr_route->cost; /* X */ new->cost = asbr_route->cost; /* X */
new->u.ext.type2_cost = metric; /* Y */ new->u.ext.type2_cost = metric; /* Y */
@ -305,18 +314,21 @@ ospf_ase_calculate_route (struct ospf *ospf, struct ospf_lsa * lsa)
return 0; return 0;
} }
zlog_info ("Route[External]: Calculate AS-external-LSA to %s/%d", if (IS_DEBUG_OSPF (lsa, LSA))
inet_ntoa (al->header.id), ip_masklen (al->mask)); zlog_debug ("Route[External]: Calculate AS-external-LSA to %s/%d",
inet_ntoa (al->header.id), ip_masklen (al->mask));
/* (1) If the cost specified by the LSA is LSInfinity, or if the /* (1) If the cost specified by the LSA is LSInfinity, or if the
LSA's LS age is equal to MaxAge, then examine the next LSA. */ LSA's LS age is equal to MaxAge, then examine the next LSA. */
if ((metric = GET_METRIC (al->e[0].metric)) >= OSPF_LS_INFINITY) if ((metric = GET_METRIC (al->e[0].metric)) >= OSPF_LS_INFINITY)
{ {
zlog_info ("Route[External]: Metric is OSPF_LS_INFINITY"); if (IS_DEBUG_OSPF (lsa, LSA))
zlog_debug ("Route[External]: Metric is OSPF_LS_INFINITY");
return 0; return 0;
} }
if (IS_LSA_MAXAGE (lsa)) if (IS_LSA_MAXAGE (lsa))
{ {
zlog_info ("Route[External]: AS-external-LSA is MAXAGE"); if (IS_DEBUG_OSPF (lsa, LSA))
zlog_debug ("Route[External]: AS-external-LSA is MAXAGE");
return 0; return 0;
} }
@ -324,7 +336,8 @@ ospf_ase_calculate_route (struct ospf *ospf, struct ospf_lsa * lsa)
examine the next LSA. */ examine the next LSA. */
if (IS_LSA_SELF (lsa)) if (IS_LSA_SELF (lsa))
{ {
zlog_info ("Route[External]: AS-external-LSA is self originated"); if (IS_DEBUG_OSPF (lsa, LSA))
zlog_debug ("Route[External]: AS-external-LSA is self originated");
return 0; return 0;
} }
@ -345,12 +358,14 @@ ospf_ase_calculate_route (struct ospf *ospf, struct ospf_lsa * lsa)
asbr_route = ospf_find_asbr_route (ospf, ospf->new_rtrs, &asbr); asbr_route = ospf_find_asbr_route (ospf, ospf->new_rtrs, &asbr);
if (asbr_route == NULL) if (asbr_route == NULL)
{ {
zlog_info ("Route[External]: Can't find originating ASBR route"); if (IS_DEBUG_OSPF (lsa, LSA))
zlog_debug ("Route[External]: Can't find originating ASBR route");
return 0; return 0;
} }
if (!(asbr_route->u.std.flags & ROUTER_LSA_EXTERNAL)) if (!(asbr_route->u.std.flags & ROUTER_LSA_EXTERNAL))
{ {
zlog_info ("Route[External]: Originating router is not an ASBR"); if (IS_DEBUG_OSPF (lsa, LSA))
zlog_debug ("Route[External]: Originating router is not an ASBR");
return 0; return 0;
} }
@ -384,7 +399,9 @@ ospf_ase_calculate_route (struct ospf *ospf, struct ospf_lsa * lsa)
consider the next in the list. */ consider the next in the list. */
if (! ospf_ase_forward_address_check (ospf, al->e[0].fwd_addr)) if (! ospf_ase_forward_address_check (ospf, al->e[0].fwd_addr))
{ {
zlog_info ("Route[External]: Forwarding address is our router address"); if (IS_DEBUG_OSPF (lsa, LSA))
zlog_debug ("Route[External]: Forwarding address is our router "
"address");
return 0; return 0;
} }
@ -396,7 +413,9 @@ ospf_ase_calculate_route (struct ospf *ospf, struct ospf_lsa * lsa)
if (rn == NULL || (asbr_route = rn->info) == NULL) if (rn == NULL || (asbr_route = rn->info) == NULL)
{ {
zlog_info ("Route[External]: Can't find route to forwarding address"); if (IS_DEBUG_OSPF (lsa, LSA))
zlog_debug ("Route[External]: Can't find route to forwarding "
"address");
if (rn) if (rn)
route_unlock_node (rn); route_unlock_node (rn);
return 0; return 0;
@ -451,8 +470,9 @@ ospf_ase_calculate_route (struct ospf *ospf, struct ospf_lsa * lsa)
(struct prefix *) &p)) == NULL (struct prefix *) &p)) == NULL
|| (or = rn->info) == NULL) || (or = rn->info) == NULL)
{ {
zlog_info ("Route[External]: Adding a new route %s/%d", if (IS_DEBUG_OSPF (lsa, LSA))
inet_ntoa (p.prefix), p.prefixlen); zlog_debug ("Route[External]: Adding a new route %s/%d",
inet_ntoa (p.prefix), p.prefixlen);
ospf_route_add (ospf->new_external_route, &p, new, asbr_route); ospf_route_add (ospf->new_external_route, &p, new, asbr_route);
@ -491,7 +511,8 @@ ospf_ase_calculate_route (struct ospf *ospf, struct ospf_lsa * lsa)
/* New route is better */ /* New route is better */
if (ret < 0) if (ret < 0)
{ {
zlog_info ("Route[External]: New route is better"); if (IS_DEBUG_OSPF (lsa, LSA))
zlog_debug ("Route[External]: New route is better");
ospf_route_subst (rn, new, asbr_route); ospf_route_subst (rn, new, asbr_route);
if (al->e[0].fwd_addr.s_addr) if (al->e[0].fwd_addr.s_addr)
ospf_ase_complete_direct_routes (new, al->e[0].fwd_addr); ospf_ase_complete_direct_routes (new, al->e[0].fwd_addr);
@ -501,13 +522,15 @@ ospf_ase_calculate_route (struct ospf *ospf, struct ospf_lsa * lsa)
/* Old route is better */ /* Old route is better */
else if (ret > 0) else if (ret > 0)
{ {
zlog_info ("Route[External]: Old route is better"); if (IS_DEBUG_OSPF (lsa, LSA))
zlog_debug ("Route[External]: Old route is better");
/* do nothing */ /* do nothing */
} }
/* Routes are equal */ /* Routes are equal */
else else
{ {
zlog_info ("Route[External]: Routes are equal"); if (IS_DEBUG_OSPF (lsa, LSA))
zlog_debug ("Route[External]: Routes are equal");
ospf_route_copy_nexthops (or, asbr_route->paths); ospf_route_copy_nexthops (or, asbr_route->paths);
if (al->e[0].fwd_addr.s_addr) if (al->e[0].fwd_addr.s_addr)
ospf_ase_complete_direct_routes (or, al->e[0].fwd_addr); ospf_ase_complete_direct_routes (or, al->e[0].fwd_addr);