diff options
author | hasso <hasso> | 2005-08-21 20:01:15 +0000 |
---|---|---|
committer | hasso <hasso> | 2005-08-21 20:01:15 +0000 |
commit | bb5b7552cc4f067fbb25f7a8f0c4fe558a508f3f (patch) | |
tree | 67adaa204f37ea8c57ef8b0c893ed1e21b7d52bb | |
parent | 54bedb55d9f4185e35307a4178ad8d73a9a8857d (diff) |
* ospf_vty.c: Make "show ip ospf neighbor xxx" commands work.
Interface should be specified by name now.
[backport candidate]
-rw-r--r-- | ospfd/ChangeLog | 5 | ||||
-rw-r--r-- | ospfd/ospf_vty.c | 63 |
2 files changed, 35 insertions, 33 deletions
diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog index b546bbd1..07e2b15b 100644 --- a/ospfd/ChangeLog +++ b/ospfd/ChangeLog @@ -1,3 +1,8 @@ +2005-08-21 Hasso Tepper <hasso at quagga.net> + + * ospf_vty.c: Make "show ip ospf neighbor xxx" commands work. + Interface should be specified by name now. + 2005-08-17 Hasso Tepper <hasso at quagga.net> * ospf_vty.c: Check carefully if interface exists before trying to diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 0f2a0fce..1c1f2fc6 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -2835,7 +2835,7 @@ DEFUN (show_ip_ospf_neighbor_all, DEFUN (show_ip_ospf_neighbor_int, show_ip_ospf_neighbor_int_cmd, - "show ip ospf neighbor A.B.C.D", + "show ip ospf neighbor IFNAME", SHOW_STR IP_STR "OSPF information\n" @@ -2843,15 +2843,13 @@ DEFUN (show_ip_ospf_neighbor_int, "Interface name\n") { struct ospf *ospf; - struct ospf_interface *oi; - struct in_addr addr; - int ret; - - ret = inet_aton (argv[0], &addr); - if (!ret) + struct interface *ifp; + struct route_node *rn; + + ifp = if_lookup_by_name (argv[0]); + if (!ifp) { - vty_out (vty, "Please specify interface address by A.B.C.D%s", - VTY_NEWLINE); + vty_out (vty, "No such interface.%s", VTY_NEWLINE); return CMD_WARNING; } @@ -2862,13 +2860,17 @@ DEFUN (show_ip_ospf_neighbor_int, return CMD_SUCCESS; } - if ((oi = ospf_if_is_configured (ospf, &addr)) == NULL) - vty_out (vty, "No such interface address%s", VTY_NEWLINE); - else + vty_out (vty, "%sNeighbor ID Pri State Dead " + "Time Address Interface RXmtL " + "RqstL DBsmL%s", VTY_NEWLINE, VTY_NEWLINE); + + for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) { - vty_out (vty, "%sNeighbor ID Pri State Dead " - "Time Address Interface RXmtL " - "RqstL DBsmL%s", VTY_NEWLINE, VTY_NEWLINE); + struct ospf_interface *oi = rn->info; + + if (oi == NULL) + continue; + show_ip_ospf_neighbor_sub (vty, oi); } @@ -3090,24 +3092,24 @@ DEFUN (show_ip_ospf_neighbor_detail_all, DEFUN (show_ip_ospf_neighbor_int_detail, show_ip_ospf_neighbor_int_detail_cmd, - "show ip ospf neighbor A.B.C.D detail", + "show ip ospf neighbor IFNAME detail", SHOW_STR IP_STR "OSPF information\n" "Neighbor list\n" - "Interface address\n" + "Interface name\n" "detail of all neighbors") { struct ospf *ospf; struct ospf_interface *oi; - struct in_addr addr; - int ret; - - ret = inet_aton (argv[0], &addr); - if (!ret) + struct interface *ifp; + struct route_node *rn, *nrn; + struct ospf_neighbor *nbr; + + ifp = if_lookup_by_name (argv[0]); + if (!ifp) { - vty_out (vty, "Please specify interface address by A.B.C.D%s", - VTY_NEWLINE); + vty_out (vty, "No such interface.%s", VTY_NEWLINE); return CMD_WARNING; } @@ -3118,19 +3120,14 @@ DEFUN (show_ip_ospf_neighbor_int_detail, return CMD_SUCCESS; } - if ((oi = ospf_if_is_configured (ospf, &addr)) == NULL) - vty_out (vty, "No such interface address%s", VTY_NEWLINE); - else - { - struct route_node *rn; - struct ospf_neighbor *nbr; - for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) - if ((nbr = rn->info)) + for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) + if ((oi = rn->info)) + for (nrn = route_top (oi->nbrs); nrn; nrn = route_next (nrn)) + if ((nbr = nrn->info)) if (nbr != oi->nbr_self) if (nbr->state != NSM_Down) show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); - } return CMD_SUCCESS; } |