Commit 0ea8fb4a authored by Ondřej Zajíček's avatar Ondřej Zajíček

Fixes and enhancements in 'show ospf state' command.

Now it shows a distance, option to change showing reachable/all network
nodes and better handling of AS-external LSAs in multiple areas. The
command 'show ospf topology' was changed to not show stubnets in both
OSPFv2 and OSPFv3 (previously it displayed stubnets in OSPFv2).
parent 1d44ddf2
......@@ -490,13 +490,18 @@ This argument can be omitted if there exists only a single instance.
<tag>show ospf neighbors [<m/name/] ["<m/interface/"]</tag>
Show a list of OSPF neighbors and a state of adjacency to them.
<tag>show ospf state [<m/name/]</tag>
Show detailed information about OSPF areas based on a content of link-state database.
It shows network topology, aggregated networks and routers from other areas and external routes.
<tag>show ospf topology [<m/name/]</tag>
Show a topology of OSPF areas based on a content of link-state database.
It is just a stripped-down version of 'show ospf state'.
<tag>show ospf state [all] [<m/name/]</tag>
Show detailed information about OSPF areas based on a content
of the link-state database. It shows network topology, stub
networks, aggregated networks and routers from other areas and
external routes. The command shows information about reachable
network nodes, use option <cf/all/ to show information about
all network nodes in the link-state database.
<tag>show ospf topology [all] [<m/name/]</tag>
Show a topology of OSPF areas based on a content of the
link-state database. It is just a stripped-down version of
'show ospf state'.
<tag>show static [<m/name/]</tag>
Show detailed information about static routes.
......
......@@ -314,11 +314,21 @@ CF_CLI(SHOW OSPF NEIGHBORS, optsym opttext, [<name>] [\"<interface>\"], [[Show i
CF_CLI(SHOW OSPF INTERFACE, optsym opttext, [<name>] [\"<interface>\"], [[Show information about interface]])
{ ospf_sh_iface(proto_get_named($4, &proto_ospf), $5); };
CF_CLI(SHOW OSPF TOPOLOGY, optsym opttext, [<name>], [[Show information about OSPF network topology]])
{ ospf_sh_state(proto_get_named($4, &proto_ospf), 0); };
CF_CLI_HELP(SHOW OSPF TOPOLOGY, [all] [<name>], [[Show information about OSPF network topology]])
CF_CLI(SHOW OSPF STATE, optsym opttext, [<name>], [[Show information about OSPF network state]])
{ ospf_sh_state(proto_get_named($4, &proto_ospf), 1); };
CF_CLI(SHOW OSPF TOPOLOGY, optsym opttext, [<name>], [[Show information about reachable OSPF network topology]])
{ ospf_sh_state(proto_get_named($4, &proto_ospf), 0, 1); };
CF_CLI(SHOW OSPF TOPOLOGY ALL, optsym opttext, [<name>], [[Show information about all OSPF network topology]])
{ ospf_sh_state(proto_get_named($5, &proto_ospf), 0, 0); };
CF_CLI_HELP(SHOW OSPF STATE, [all] [<name>], [[Show information about OSPF network state]])
CF_CLI(SHOW OSPF STATE, optsym opttext, [<name>], [[Show information about reachable OSPF network state]])
{ ospf_sh_state(proto_get_named($4, &proto_ospf), 1, 1); };
CF_CLI(SHOW OSPF STATE ALL, optsym opttext, [<name>], [[Show information about all OSPF network state]])
{ ospf_sh_state(proto_get_named($5, &proto_ospf), 1, 0); };
CF_CLI(SHOW OSPF LSADB, optsym opttext, [<name>], [[Show content of OSPF LSA database]])
{ ospf_sh_lsadb(proto_get_named($4, &proto_ospf)); };
......
......@@ -804,5 +804,4 @@ ospf_iface_shutdown(struct ospf_iface *ifa)
{
init_list(&ifa->neigh_list);
hello_timer_hook(ifa->hello_timer);
ospf_sk_close(ifa);
}
......@@ -45,19 +45,16 @@ ospf_age(struct proto_ospf *po)
struct top_hash_entry *en, *nxt;
int flush = can_flush_lsa(po);
if (po->cleanup) OSPF_TRACE(D_EVENTS, "Running ospf_age cleanup");
WALK_SLIST_DELSAFE(en, nxt, po->lsal)
{
if (po->cleanup)
if (po->calcrt)
{
/* Cleanup before ospf_rt_spf() */
en->color = OUTSPF;
en->dist = LSINFINITY;
en->nhi = NULL;
en->nh = IPA_NONE;
en->lb = IPA_NONE;
DBG("Infinitying Type: %u, Id: %R, Rt: %R\n", en->lsa.type,
en->lsa.id, en->lsa.rt);
}
if (en->lsa.age == LSA_MAXAGE)
{
......@@ -88,7 +85,6 @@ ospf_age(struct proto_ospf *po)
en->lsa.age = LSA_MAXAGE;
}
}
po->cleanup = 0;
}
void
......
This diff is collapsed.
......@@ -722,7 +722,6 @@ struct proto_ospf
slist lsal; /* List of all LSA's */
int calcrt; /* Routing table calculation scheduled?
0=no, 1=normal, 2=forced reload */
int cleanup; /* Should I cleanup after RT calculation? */
list iface_list; /* Interfaces we really use */
list area_list;
int areano; /* Number of area I belong to */
......@@ -808,7 +807,7 @@ static inline void schedule_link_lsa(struct ospf_iface *ifa UNUSED) {}
void ospf_sh_neigh(struct proto *p, char *iff);
void ospf_sh(struct proto *p);
void ospf_sh_iface(struct proto *p, char *iff);
void ospf_sh_state(struct proto *p, int verbose);
void ospf_sh_state(struct proto *p, int verbose, int reachable);
void ospf_sh_lsadb(struct proto *p);
......
......@@ -681,6 +681,10 @@ ospf_rt_sum(struct ospf_area *oa)
if (!(abr->n.options & ORTA_ABR))
continue;
/* This check is not mentioned in RFC 2328 */
if (abr->n.type != RTS_OSPF)
continue;
/* 16.2. (5) */
orta nf = {
.type = RTS_OSPF_IA,
......@@ -966,6 +970,9 @@ ospf_ext_spf(struct proto_ospf *po)
nfa.metric2 = LSINFINITY;
}
/* Mark the LSA as reachable */
en->color = INSPF;
/* Whether the route is preferred in route selection according to 16.4.1 */
nfa.options = epath_preferred(&nf2->n) ? ORTA_PREF : 0;
......@@ -1046,8 +1053,6 @@ ospf_rt_spf(struct proto_ospf *po)
if (po->areano == 0) return;
po->cleanup = 1;
OSPF_TRACE(D_EVENTS, "Starting routing table calculation");
/* 16. (1) - Invalidate old routing table */
......
......@@ -22,7 +22,7 @@ struct top_hash_entry
bird_clock_t inst_t; /* Time of installation into DB */
ip_addr nh; /* Next hop */
ip_addr lb; /* In OSPFv2, link back address. In OSPFv3, any global address in the area useful for vlinks */
struct ospf_iface *nhi; /* Next hop interface */
struct ospf_iface *nhi; /* Next hop interface - valid only in ospf_rt_spf()*/
#ifdef OSPFv3
u32 lb_id; /* Interface ID of link back iface (for bcast or NBMA networks) */
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment