]> git.puffer.fish Git - matthieu/frr.git/commitdiff
* ospf_vty.c: Make "show ip ospf neighbor xxx" commands work.
authorhasso <hasso>
Sun, 21 Aug 2005 20:01:15 +0000 (20:01 +0000)
committerhasso <hasso>
Sun, 21 Aug 2005 20:01:15 +0000 (20:01 +0000)
  Interface should be specified by name now.

[backport candidate]

ospfd/ChangeLog
ospfd/ospf_vty.c

index b546bbd118e938af66b70b33b10af4fe707bf513..07e2b15b2d541cf06490073735c3b9997aeff9db 100644 (file)
@@ -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
index 0f2a0fce5d9f339ec639a576236fa8425772a950..1c1f2fc6c01714017a1cdec50bff6b7065ff670e 100644 (file)
@@ -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;
 }