summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_lsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospf6d/ospf6_lsa.c')
-rw-r--r--ospf6d/ospf6_lsa.c146
1 files changed, 51 insertions, 95 deletions
diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c
index 867dc3d9d8..acc8fe3804 100644
--- a/ospf6d/ospf6_lsa.c
+++ b/ospf6d/ospf6_lsa.c
@@ -13,10 +13,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with GNU Zebra; see the file COPYING. If not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
@@ -206,9 +205,7 @@ ospf6_lsa_age_set (struct ospf6_lsa *lsa)
assert (lsa && lsa->header);
- if (quagga_gettime (QUAGGA_CLK_MONOTONIC, &now) < 0)
- zlog_warn ("LSA: quagga_gettime failed, may fail LSA AGEs: %s",
- safe_strerror (errno));
+ monotime(&now);
lsa->birth.tv_sec = now.tv_sec - ntohs (lsa->header->age);
lsa->birth.tv_usec = now.tv_usec;
@@ -229,9 +226,7 @@ ospf6_lsa_age_current (struct ospf6_lsa *lsa)
assert (lsa->header);
/* current time */
- if (quagga_gettime (QUAGGA_CLK_MONOTONIC, &now) < 0)
- zlog_warn ("LSA: quagga_gettime failed, may fail LSA AGEs: %s",
- safe_strerror (errno));
+ monotime(&now);
if (ntohs (lsa->header->age) >= OSPF_LSA_MAXAGE)
{
@@ -512,7 +507,7 @@ ospf6_lsa_show (struct vty *vty, struct ospf6_lsa *lsa)
inet_ntop (AF_INET, &lsa->header->adv_router,
adv_router, sizeof (adv_router));
- quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
+ monotime(&now);
timersub (&now, &lsa->installed, &res);
timerstring (&res, duration, sizeof (duration));
@@ -699,7 +694,6 @@ ospf6_lsa_refresh (struct thread *thread)
struct ospf6_lsa *old, *self, *new;
struct ospf6_lsdb *lsdb_self;
- assert (thread);
old = (struct ospf6_lsa *) THREAD_ARG (thread);
assert (old && old->header);
@@ -725,8 +719,9 @@ ospf6_lsa_refresh (struct thread *thread)
new = ospf6_lsa_create (self->header);
new->lsdb = old->lsdb;
- new->refresh = thread_add_timer (master, ospf6_lsa_refresh, new,
- OSPF_LS_REFRESH_TIME);
+ new->refresh = NULL;
+ thread_add_timer(master, ospf6_lsa_refresh, new, OSPF_LS_REFRESH_TIME,
+ &new->refresh);
/* store it in the LSDB for self-originated LSAs */
ospf6_lsdb_add (ospf6_lsa_copy (new), lsdb_self);
@@ -817,33 +812,35 @@ ospf6_lsa_handler_name (struct ospf6_lsa_handler *h)
DEFUN (debug_ospf6_lsa_type,
debug_ospf6_lsa_hex_cmd,
- "debug ospf6 lsa (router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown)",
+ "debug ospf6 lsa <router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown> [<originate|examine|flooding>]",
DEBUG_STR
OSPF6_STR
"Debug Link State Advertisements (LSAs)\n"
- "Router LSA's\n"
- "Network LSA's\n"
- "Inter-Prefix LSA's\n"
- "Inter-Router LSA's\n"
- "AS-External LSA's\n"
- "Link LSA's\n"
- "Intra-Prefix LSA's\n"
- "Unknown LSA's\n"
- )
-{
+ "Display Router LSAs\n"
+ "Display Network LSAs\n"
+ "Display Inter-Area-Prefix LSAs\n"
+ "Display Inter-Router LSAs\n"
+ "Display As-External LSAs\n"
+ "Display Link LSAs\n"
+ "Display Intra-Area-Prefix LSAs\n"
+ "Display LSAs of unknown origin\n"
+ "Display details of LSAs\n"
+ "Dump LSAs\n"
+ "Display LSA's internal information\n")
+{
+ int idx_lsa = 3;
+ int idx_type = 4;
unsigned int i;
struct ospf6_lsa_handler *handler = NULL;
- assert (argc);
-
for (i = 0; i < vector_active (ospf6_lsa_handler_vector); i++)
{
handler = vector_slot (ospf6_lsa_handler_vector, i);
if (handler == NULL)
continue;
- if (strncmp (argv[0], ospf6_lsa_handler_name(handler), strlen(argv[0])) == 0)
+ if (strncmp (argv[idx_lsa]->arg, ospf6_lsa_handler_name(handler), strlen(argv[idx_lsa]->arg)) == 0)
break;
- if (! strcasecmp (argv[0], handler->name))
+ if (! strcasecmp (argv[idx_lsa]->arg, handler->name))
break;
handler = NULL;
}
@@ -851,13 +848,13 @@ DEFUN (debug_ospf6_lsa_type,
if (handler == NULL)
handler = &unknown_handler;
- if (argc >= 2)
+ if (argc == 5)
{
- if (! strcmp (argv[1], "originate"))
+ if (! strcmp (argv[idx_type]->text, "originate"))
SET_FLAG (handler->debug, OSPF6_LSA_DEBUG_ORIGINATE);
- if (! strcmp (argv[1], "examine"))
+ else if (! strcmp (argv[idx_type]->text, "examine"))
SET_FLAG (handler->debug, OSPF6_LSA_DEBUG_EXAMIN);
- if (! strcmp (argv[1], "flooding"))
+ else if (! strcmp (argv[idx_type]->text, "flooding"))
SET_FLAG (handler->debug, OSPF6_LSA_DEBUG_FLOOD);
}
else
@@ -866,68 +863,51 @@ DEFUN (debug_ospf6_lsa_type,
return CMD_SUCCESS;
}
-ALIAS (debug_ospf6_lsa_type,
- debug_ospf6_lsa_hex_detail_cmd,
- "debug ospf6 lsa (router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown) (originate|examine|flooding)",
- DEBUG_STR
- OSPF6_STR
- "Debug Link State Advertisements (LSAs)\n"
- "Router LSA's\n"
- "Network LSA's\n"
- "Inter-Prefix LSA's\n"
- "Inter-Router LSA's\n"
- "AS-External LSA's\n"
- "Link LSA's\n"
- "Intra-Prefix LSA's\n"
- "Unknown LSA's\n"
- "Originate\n"
- "Examine\n"
- "Flooding\n"
- )
-
DEFUN (no_debug_ospf6_lsa_type,
no_debug_ospf6_lsa_hex_cmd,
- "no debug ospf6 lsa (router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown)",
+ "no debug ospf6 lsa <router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown> [<originate|examine|flooding>]",
NO_STR
DEBUG_STR
OSPF6_STR
"Debug Link State Advertisements (LSAs)\n"
- "Router LSA's\n"
- "Network LSA's\n"
- "Inter-Prefix LSA's\n"
- "Inter-Router LSA's\n"
- "AS-External LSA's\n"
- "Link LSA's\n"
- "Intra-Prefix LSA's\n"
- "Unknown LSA's\n"
- )
-{
+ "Display Router LSAs\n"
+ "Display Network LSAs\n"
+ "Display Inter-Area-Prefix LSAs\n"
+ "Display Inter-Router LSAs\n"
+ "Display As-External LSAs\n"
+ "Display Link LSAs\n"
+ "Display Intra-Area-Prefix LSAs\n"
+ "Display LSAs of unknown origin\n"
+ "Display details of LSAs\n"
+ "Dump LSAs\n"
+ "Display LSA's internal information\n")
+{
+ int idx_lsa = 4;
+ int idx_type = 5;
u_int i;
struct ospf6_lsa_handler *handler = NULL;
- assert (argc);
-
for (i = 0; i < vector_active (ospf6_lsa_handler_vector); i++)
{
handler = vector_slot (ospf6_lsa_handler_vector, i);
if (handler == NULL)
continue;
- if (strncmp (argv[0], ospf6_lsa_handler_name(handler), strlen(argv[0])) == 0)
+ if (strncmp (argv[idx_lsa]->arg, ospf6_lsa_handler_name(handler), strlen(argv[idx_lsa]->arg)) == 0)
break;
- if (! strcasecmp (argv[0], handler->name))
+ if (! strcasecmp (argv[idx_lsa]->arg, handler->name))
break;
}
if (handler == NULL)
return CMD_SUCCESS;
- if (argc >= 2)
+ if (argc == 6)
{
- if (! strcmp (argv[1], "originate"))
+ if (! strcmp (argv[idx_type]->text, "originate"))
UNSET_FLAG (handler->debug, OSPF6_LSA_DEBUG_ORIGINATE);
- if (! strcmp (argv[1], "examine"))
+ if (! strcmp (argv[idx_type]->text, "examine"))
UNSET_FLAG (handler->debug, OSPF6_LSA_DEBUG_EXAMIN);
- if (! strcmp (argv[1], "flooding"))
+ if (! strcmp (argv[idx_type]->text, "flooding"))
UNSET_FLAG (handler->debug, OSPF6_LSA_DEBUG_FLOOD);
}
else
@@ -936,37 +916,13 @@ DEFUN (no_debug_ospf6_lsa_type,
return CMD_SUCCESS;
}
-ALIAS (no_debug_ospf6_lsa_type,
- no_debug_ospf6_lsa_hex_detail_cmd,
- "no debug ospf6 lsa (router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown) (originate|examine|flooding)",
- NO_STR
- DEBUG_STR
- OSPF6_STR
- "Debug Link State Advertisements (LSAs)\n"
- "Router LSA's\n"
- "Network LSA's\n"
- "Inter-Prefix LSA's\n"
- "Inter-Router LSA's\n"
- "AS-External LSA's\n"
- "Link LSA's\n"
- "Intra-Prefix LSA's\n"
- "Unknown LSA's\n"
- "Originate\n"
- "Examine\n"
- "Flooding\n"
- )
-
void
install_element_ospf6_debug_lsa (void)
{
install_element (ENABLE_NODE, &debug_ospf6_lsa_hex_cmd);
- install_element (ENABLE_NODE, &debug_ospf6_lsa_hex_detail_cmd);
install_element (ENABLE_NODE, &no_debug_ospf6_lsa_hex_cmd);
- install_element (ENABLE_NODE, &no_debug_ospf6_lsa_hex_detail_cmd);
install_element (CONFIG_NODE, &debug_ospf6_lsa_hex_cmd);
- install_element (CONFIG_NODE, &debug_ospf6_lsa_hex_detail_cmd);
install_element (CONFIG_NODE, &no_debug_ospf6_lsa_hex_cmd);
- install_element (CONFIG_NODE, &no_debug_ospf6_lsa_hex_detail_cmd);
}
int