From c89c05dd04d097bd8213125a42d67204bb681de5 Mon Sep 17 00:00:00 2001 From: hasso Date: Sun, 4 Sep 2005 21:36:36 +0000 Subject: * *.c: Try to be less verbose by default (without any debug options on). * isis_lsp.c (lsp_build_nonpseudo): Use stream_reset() instead of touching endp directly. * isis_lsp.c (lsp_build_pseudo): Ditto. --- isisd/ChangeLog | 8 ++++++++ isisd/isis_circuit.c | 10 +++++++--- isisd/isis_csm.c | 9 +++++---- isisd/isis_dr.c | 3 ++- isisd/isis_events.c | 14 ++++++++------ isisd/isis_lsp.c | 16 +++++++--------- isisd/isis_main.c | 4 +--- isisd/isis_pdu.c | 22 +++++++++++++--------- isisd/isis_spf.c | 5 +++-- isisd/isis_zebra.c | 18 ++++++++++++------ isisd/isisd.c | 6 ++++-- isisd/isisd.h | 1 + 12 files changed, 71 insertions(+), 45 deletions(-) diff --git a/isisd/ChangeLog b/isisd/ChangeLog index d418d63b..822d856b 100644 --- a/isisd/ChangeLog +++ b/isisd/ChangeLog @@ -1,3 +1,11 @@ +2005-09-05 Hasso Tepper + + * *.c: Try to be less verbose by default (without any debug options + on). + * isis_lsp.c (lsp_build_nonpseudo): Use stream_reset() instead of + touching endp directly. + * isis_lsp.c (lsp_build_pseudo): Ditto. + 2005-09-03 Hasso Tepper * isis_lsp.c: Yet another regression introduced by stream cleanup. diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index b99fa5da..e885a658 100644 --- a/isisd/isis_circuit.c +++ b/isisd/isis_circuit.c @@ -404,7 +404,9 @@ isis_circuit_if_add (struct isis_circuit *circuit, struct interface *ifp) } else { - zlog_warn ("isis_circuit_if_add: unsupported media"); + /* It's normal in case of loopback etc. */ + if (isis->debugs & DEBUG_EVENTS) + zlog_debug ("isis_circuit_if_add: unsupported media"); } for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, conn)) @@ -842,7 +844,8 @@ DEFUN (ip_router_isis, if (c->ipv6_router == 0) { #endif /* HAVE_IPV6 */ - vty_out (vty, "ISIS circuit is already defined%s", VTY_NEWLINE); + /* FIXME: Find the way to warn only vty users. */ + /* vty_out (vty, "ISIS circuit is already defined%s", VTY_NEWLINE); */ return CMD_WARNING; #ifdef HAVE_IPV6 } @@ -852,7 +855,8 @@ DEFUN (ip_router_isis, /* this is here for ciscopability */ if (!area) { - vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); + /* FIXME: Find the way to warn only vty users. */ + /* vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); */ return CMD_WARNING; } diff --git a/isisd/isis_csm.c b/isisd/isis_csm.c index 58a0b295..80d0c906 100644 --- a/isisd/isis_csm.c +++ b/isisd/isis_csm.c @@ -77,8 +77,8 @@ isis_csm_state_change (int event, struct isis_circuit *circuit, void *arg) int old_state; old_state = circuit ? circuit->state : C_STATE_NA; - - zlog_debug ("CSM_EVENT: %s", EVENT2STR (event)); + if (isis->debugs & DEBUG_EVENTS) + zlog_debug ("CSM_EVENT: %s", EVENT2STR (event)); switch (old_state) { @@ -178,8 +178,9 @@ isis_csm_state_change (int event, struct isis_circuit *circuit, void *arg) zlog_warn ("Invalid circuit state %d", old_state); } - zlog_debug ("CSM_STATE_CHANGE: %s -> %s ", STATE2STR (old_state), - circuit ? STATE2STR (circuit->state) : STATE2STR (C_STATE_NA)); + if (isis->debugs & DEBUG_EVENTS) + zlog_debug ("CSM_STATE_CHANGE: %s -> %s ", STATE2STR (old_state), + circuit ? STATE2STR (circuit->state) : STATE2STR (C_STATE_NA)); return circuit; } diff --git a/isisd/isis_dr.c b/isisd/isis_dr.c index a5891f94..335946c8 100644 --- a/isisd/isis_dr.c +++ b/isisd/isis_dr.c @@ -307,7 +307,8 @@ isis_dr_commence (struct isis_circuit *circuit, int level) { u_char old_dr[ISIS_SYS_ID_LEN + 2]; - zlog_debug ("isis_dr_commence l%d", level); + if (isis->debugs & DEBUG_EVENTS) + zlog_debug ("isis_dr_commence l%d", level); /* Lets keep a pause in DR election */ circuit->u.bc.run_dr_elect[level - 1] = 0; diff --git a/isisd/isis_events.c b/isisd/isis_events.c index d54036a5..a8e60d6d 100644 --- a/isisd/isis_events.c +++ b/isisd/isis_events.c @@ -283,8 +283,9 @@ isis_event_adjacency_state_change (struct isis_adjacency *adj, int newstate) if (!adj || !adj->circuit || !adj->circuit->area) return; - zlog_debug ("ISIS-Evt (%s) Adjacency State change", - adj->circuit->area->area_tag); + if (isis->debugs & DEBUG_EVENTS) + zlog_debug ("ISIS-Evt (%s) Adjacency State change", + adj->circuit->area->area_tag); /* LSP generation again */ lsp_regenerate_schedule (adj->circuit->area); @@ -304,8 +305,8 @@ isis_event_dis_status_change (struct thread *thread) /* invalid arguments */ if (!circuit || !circuit->area) return 0; - - zlog_debug ("ISIS-Evt (%s) DIS status change", circuit->area->area_tag); + if (isis->debugs & DEBUG_EVENTS) + zlog_debug ("ISIS-Evt (%s) DIS status change", circuit->area->area_tag); /* LSP generation again */ lsp_regenerate_schedule (circuit->area); @@ -316,8 +317,9 @@ isis_event_dis_status_change (struct thread *thread) void isis_event_auth_failure (char *area_tag, const char *error_string, u_char *sysid) { - zlog_debug ("ISIS-Evt (%s) Authentication failure %s from %s", - area_tag, error_string, sysid_print (sysid)); + if (isis->debugs & DEBUG_EVENTS) + zlog_debug ("ISIS-Evt (%s) Authentication failure %s from %s", + area_tag, error_string, sysid_print (sysid)); return; } diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index cb7b93b4..2a9d1465 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -501,13 +501,11 @@ lsp_new (u_char * lsp_id, u_int16_t rem_lifetime, u_int32_t seq_num, stream_forward_endp (lsp->pdu, ISIS_FIXED_HDR_LEN + ISIS_LSP_HDR_LEN); - /* #ifdef EXTREME_DEBUG */ - /* logging */ - zlog_debug ("New LSP with ID %s-%02x-%02x seqnum %08x", sysid_print (lsp_id), - LSP_PSEUDO_ID (lsp->lsp_header->lsp_id), - LSP_FRAGMENT (lsp->lsp_header->lsp_id), - ntohl (lsp->lsp_header->seq_num)); - /* #endif EXTREME DEBUG */ + if (isis->debugs & DEBUG_EVENTS) + zlog_debug ("New LSP with ID %s-%02x-%02x seqnum %08x", + sysid_print (lsp_id), LSP_PSEUDO_ID (lsp->lsp_header->lsp_id), + LSP_FRAGMENT (lsp->lsp_header->lsp_id), + ntohl (lsp->lsp_header->seq_num)); return lsp; } @@ -1302,7 +1300,7 @@ lsp_build_nonpseudo (struct isis_lsp *lsp, struct isis_area *area) /* Reset stream endp. Stream is always there and on every LSP refresh only * TLV part of it is overwritten. So we must seek past header we will not * touch. */ - lsp->pdu->endp = 0; + stream_reset (lsp->pdu); stream_forward_endp (lsp->pdu, ISIS_FIXED_HDR_LEN + ISIS_LSP_HDR_LEN); /* @@ -1912,7 +1910,7 @@ lsp_build_pseudo (struct isis_lsp *lsp, struct isis_circuit *circuit, } /* Reset endp of stream to overwrite only TLV part of it. */ - lsp->pdu->endp = 0; + stream_reset (lsp->pdu); stream_forward_endp (lsp->pdu, ISIS_FIXED_HDR_LEN + ISIS_LSP_HDR_LEN); /* diff --git a/isisd/isis_main.c b/isisd/isis_main.c index a4f80582..2bb22cb6 100644 --- a/isisd/isis_main.c +++ b/isisd/isis_main.c @@ -325,9 +325,7 @@ main (int argc, char **argv, char **envp) /* Print banner. */ zlog_notice ("Quagga-ISISd %s starting: vty@%d", QUAGGA_VERSION, vty_port); -#ifdef HAVE_IPV6 - zlog_debug ("IPv6 enabled"); -#endif + /* Start finite state machine. */ while (thread_fetch (master, &thread)) thread_call (&thread); diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index e6a1e038..b15d4551 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -1121,14 +1121,17 @@ dontcheckadj: && circuit->u.bc.is_dr[level - 1] == 1)) { lsp->lsp_header->seq_num = htonl (ntohl (hdr->seq_num) + 1); - zlog_debug ("LSP LEN: %d", ntohs (lsp->lsp_header->pdu_len)); + if (isis->debugs & DEBUG_UPDATE_PACKETS) + zlog_debug ("LSP LEN: %d", + ntohs (lsp->lsp_header->pdu_len)); iso_csum_create (STREAM_DATA (lsp->pdu) + 12, ntohs (lsp->lsp_header->pdu_len) - 12, 12); ISIS_FLAGS_SET_ALL (lsp->SRMflags); - zlog_debug - ("ISIS-Upd (%s): (1) re-originating LSP %s new seq 0x%08x", - circuit->area->area_tag, rawlspid_print (hdr->lsp_id), - ntohl (lsp->lsp_header->seq_num)); + if (isis->debugs & DEBUG_UPDATE_PACKETS) + zlog_debug ("ISIS-Upd (%s): (1) re-originating LSP %s new " + "seq 0x%08x", circuit->area->area_tag, + rawlspid_print (hdr->lsp_id), + ntohl (lsp->lsp_header->seq_num)); lsp->lsp_header->rem_lifetime = htons (isis_jitter (circuit->area->max_lsp_lifetime[level - 1], @@ -1168,10 +1171,11 @@ dontcheckadj: ntohs (lsp->lsp_header->pdu_len) - 12, 12); ISIS_FLAGS_SET_ALL (lsp->SRMflags); - zlog_debug - ("ISIS-Upd (%s): (2) re-originating LSP %s new seq 0x%08x", - circuit->area->area_tag, rawlspid_print (hdr->lsp_id), - ntohl (lsp->lsp_header->seq_num)); + if (isis->debugs & DEBUG_UPDATE_PACKETS) + zlog_debug ("ISIS-Upd (%s): (2) re-originating LSP %s new seq " + "0x%08x", circuit->area->area_tag, + rawlspid_print (hdr->lsp_id), + ntohl (lsp->lsp_header->seq_num)); lsp->lsp_header->rem_lifetime = htons (isis_jitter (circuit->area->max_lsp_lifetime[level - 1], diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index dc5765a5..ba7acbfb 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -781,8 +781,9 @@ isis_spf_preload_tent (struct isis_spftree *spftree, if (listcount (adj_list) == 0) { list_delete (adj_list); - zlog_warn ("ISIS-Spf: no L%d adjacencies on circuit %s", - level, circuit->interface->name); + if (isis->debugs & DEBUG_SPF_EVENTS) + zlog_debug ("ISIS-Spf: no L%d adjacencies on circuit %s", + level, circuit->interface->name); continue; } anode = listhead (adj_list); diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c index 889c5bfb..a385e6b5 100644 --- a/isisd/isis_zebra.c +++ b/isisd/isis_zebra.c @@ -33,8 +33,10 @@ #include "stream.h" #include "linklist.h" +#include "isisd/dict.h" #include "isisd/isis_constants.h" #include "isisd/isis_common.h" +#include "isisd/isisd.h" #include "isisd/isis_circuit.h" #include "isisd/isis_csm.h" #include "isisd/isis_route.h" @@ -43,6 +45,8 @@ struct zclient *zclient = NULL; extern struct thread_master *master; +extern struct isis *isis; + struct in_addr router_id_zebra; /* Router-id update message from zebra. */ @@ -66,9 +70,9 @@ isis_zebra_if_add (int command, struct zclient *zclient, zebra_size_t length) ifp = zebra_interface_add_read (zclient->ibuf); - - zlog_debug ("Zebra I/F add: %s index %d flags %ld metric %d mtu %d", - ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu); + if (isis->debugs & DEBUG_ZEBRA) + zlog_debug ("Zebra I/F add: %s index %d flags %ld metric %d mtu %d", + ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu); if (if_is_operative (ifp)) isis_csm_state_change (IF_UP_FROM_Z, circuit_scan_by_ifp (ifp), ifp); @@ -92,8 +96,9 @@ isis_zebra_if_del (int command, struct zclient *zclient, zebra_size_t length) zlog_warn ("Zebra: got delete of %s, but interface is still up", ifp->name); - zlog_debug ("Zebra I/F delete: %s index %d flags %ld metric %d mtu %d", - ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu); + if (isis->debugs & DEBUG_ZEBRA) + zlog_debug ("Zebra I/F delete: %s index %d flags %ld metric %d mtu %d", + ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu); /* Cannot call if_delete because we should retain the pseudo interface @@ -560,7 +565,8 @@ isis_zebra_read_ipv4 (int command, struct zclient *zclient, if (command == ZEBRA_IPV4_ROUTE_ADD) { - zlog_debug ("IPv4 Route add from Z"); + if (isis->debugs & DEBUG_ZEBRA) + zlog_debug ("IPv4 Route add from Z"); } return 0; diff --git a/isisd/isisd.c b/isisd/isisd.c index e6679cf3..a8d6950a 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -171,7 +171,8 @@ isis_area_get (struct vty *vty, const char *area_tag) area->area_tag = strdup (area_tag); listnode_add (isis->area_list, area); - zlog_debug ("new IS-IS area instance %s", area->area_tag); + if (isis->debugs & DEBUG_EVENTS) + zlog_debug ("New IS-IS area instance %s", area->area_tag); vty->node = ISIS_NODE; vty->index = area; @@ -260,7 +261,8 @@ area_net_title (struct vty *vty, u_char *net_title) */ memcpy (isis->sysid, GETSYSID (addr, ISIS_SYS_ID_LEN), ISIS_SYS_ID_LEN); isis->sysid_set = 1; - zlog_debug ("Router has SystemID %s", sysid_print (isis->sysid)); + if (isis->debugs & DEBUG_EVENTS) + zlog_debug ("Router has SystemID %s", sysid_print (isis->sysid)); } else { diff --git a/isisd/isisd.h b/isisd/isisd.h index 77de12ec..7a9f7644 100644 --- a/isisd/isisd.h +++ b/isisd/isisd.h @@ -144,5 +144,6 @@ struct isis_area *isis_area_lookup (const char *); #define DEBUG_SPF_TRIGGERS (1<<8) #define DEBUG_RTE_EVENTS (1<<9) #define DEBUG_EVENTS (1<<10) +#define DEBUG_ZEBRA (1<<11) #endif /* ISISD_H */ -- cgit v1.2.1