2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

* {smux.c,zclient.c}: Change level of debug messages to LOG_DEBUG.
This commit is contained in:
ajs 2004-12-07 18:53:52 +00:00
parent 82146b8891
commit 8ddca7040d
3 changed files with 62 additions and 58 deletions

View File

@ -1,3 +1,7 @@
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* {smux.c,zclient.c}: Change level of debug messages to LOG_DEBUG.
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu> 2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* command.c: (config_write_host) Note that "log trap" is deprecated * command.c: (config_write_host) Note that "log trap" is deprecated

View File

@ -168,7 +168,7 @@ smux_oid_dump (const char *prefix, oid *oid, size_t oid_len)
sprintf (buf + strlen (buf), "%s%d", first ? "" : ".", (int) oid[i]); sprintf (buf + strlen (buf), "%s%d", first ? "" : ".", (int) oid[i]);
first = 0; first = 0;
} }
zlog_info ("%s: %s", prefix, buf); zlog_debug ("%s: %s", prefix, buf);
} }
int int
@ -279,8 +279,8 @@ smux_getresp_send (oid objid[], size_t objid_len, long reqid, long errstat,
if (debug_smux) if (debug_smux)
{ {
zlog_info ("SMUX GETRSP send"); zlog_debug ("SMUX GETRSP send");
zlog_info ("SMUX GETRSP reqid: %ld", reqid); zlog_debug ("SMUX GETRSP reqid: %ld", reqid);
} }
h1 = ptr; h1 = ptr;
@ -293,13 +293,13 @@ smux_getresp_send (oid objid[], size_t objid_len, long reqid, long errstat,
&reqid, sizeof (reqid)); &reqid, sizeof (reqid));
if (debug_smux) if (debug_smux)
zlog_info ("SMUX GETRSP errstat: %ld", errstat); zlog_debug ("SMUX GETRSP errstat: %ld", errstat);
ptr = asn_build_int (ptr, &len, ptr = asn_build_int (ptr, &len,
(u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
&errstat, sizeof (errstat)); &errstat, sizeof (errstat));
if (debug_smux) if (debug_smux)
zlog_info ("SMUX GETRSP errindex: %ld", errindex); zlog_debug ("SMUX GETRSP errindex: %ld", errindex);
ptr = asn_build_int (ptr, &len, ptr = asn_build_int (ptr, &len,
(u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
@ -322,7 +322,7 @@ smux_getresp_send (oid objid[], size_t objid_len, long reqid, long errstat,
asn_build_sequence(h1,&length,(u_char)SMUX_GETRSP,ptr-h1e); asn_build_sequence(h1,&length,(u_char)SMUX_GETRSP,ptr-h1e);
if (debug_smux) if (debug_smux)
zlog_info ("SMUX getresp send: %ld", (ptr - buf)); zlog_debug ("SMUX getresp send: %ld", (ptr - buf));
ret = send (smux_sock, buf, (ptr - buf), 0); ret = send (smux_sock, buf, (ptr - buf), 0);
} }
@ -339,15 +339,15 @@ smux_var (char *ptr, size_t len, oid objid[], size_t *objid_len,
u_char *val; u_char *val;
if (debug_smux) if (debug_smux)
zlog_info ("SMUX var parse: len %ld", len); zlog_debug ("SMUX var parse: len %ld", len);
/* Parse header. */ /* Parse header. */
ptr = asn_parse_header (ptr, &len, &type); ptr = asn_parse_header (ptr, &len, &type);
if (debug_smux) if (debug_smux)
{ {
zlog_info ("SMUX var parse: type %d len %ld", type, len); zlog_debug ("SMUX var parse: type %d len %ld", type, len);
zlog_info ("SMUX var parse: type must be %d", zlog_debug ("SMUX var parse: type must be %d",
(ASN_SEQUENCE | ASN_CONSTRUCTOR)); (ASN_SEQUENCE | ASN_CONSTRUCTOR));
} }
@ -370,7 +370,7 @@ smux_var (char *ptr, size_t len, oid objid[], size_t *objid_len,
smux_oid_dump ("Request OID", objid, *objid_len); smux_oid_dump ("Request OID", objid, *objid_len);
if (debug_smux) if (debug_smux)
zlog_info ("SMUX val_type: %d", val_type); zlog_debug ("SMUX val_type: %d", val_type);
/* Check request value type. */ /* Check request value type. */
if (debug_smux) if (debug_smux)
@ -379,46 +379,46 @@ smux_var (char *ptr, size_t len, oid objid[], size_t *objid_len,
case ASN_NULL: case ASN_NULL:
/* In case of SMUX_GET or SMUX_GET_NEXT val_type is set to /* In case of SMUX_GET or SMUX_GET_NEXT val_type is set to
ASN_NULL. */ ASN_NULL. */
zlog_info ("ASN_NULL"); zlog_debug ("ASN_NULL");
break; break;
case ASN_INTEGER: case ASN_INTEGER:
zlog_info ("ASN_INTEGER"); zlog_debug ("ASN_INTEGER");
break; break;
case ASN_COUNTER: case ASN_COUNTER:
case ASN_GAUGE: case ASN_GAUGE:
case ASN_TIMETICKS: case ASN_TIMETICKS:
case ASN_UINTEGER: case ASN_UINTEGER:
zlog_info ("ASN_COUNTER"); zlog_debug ("ASN_COUNTER");
break; break;
case ASN_COUNTER64: case ASN_COUNTER64:
zlog_info ("ASN_COUNTER64"); zlog_debug ("ASN_COUNTER64");
break; break;
case ASN_IPADDRESS: case ASN_IPADDRESS:
zlog_info ("ASN_IPADDRESS"); zlog_debug ("ASN_IPADDRESS");
break; break;
case ASN_OCTET_STR: case ASN_OCTET_STR:
zlog_info ("ASN_OCTET_STR"); zlog_debug ("ASN_OCTET_STR");
break; break;
case ASN_OPAQUE: case ASN_OPAQUE:
case ASN_NSAP: case ASN_NSAP:
case ASN_OBJECT_ID: case ASN_OBJECT_ID:
zlog_info ("ASN_OPAQUE"); zlog_debug ("ASN_OPAQUE");
break; break;
case SNMP_NOSUCHOBJECT: case SNMP_NOSUCHOBJECT:
zlog_info ("SNMP_NOSUCHOBJECT"); zlog_debug ("SNMP_NOSUCHOBJECT");
break; break;
case SNMP_NOSUCHINSTANCE: case SNMP_NOSUCHINSTANCE:
zlog_info ("SNMP_NOSUCHINSTANCE"); zlog_debug ("SNMP_NOSUCHINSTANCE");
break; break;
case SNMP_ENDOFMIBVIEW: case SNMP_ENDOFMIBVIEW:
zlog_info ("SNMP_ENDOFMIBVIEW"); zlog_debug ("SNMP_ENDOFMIBVIEW");
break; break;
case ASN_BIT_STR: case ASN_BIT_STR:
zlog_info ("ASN_BIT_STR"); zlog_debug ("ASN_BIT_STR");
break; break;
default: default:
zlog_info ("Unknown type"); zlog_debug ("Unknown type");
break; break;
} }
return ptr; return ptr;
@ -471,7 +471,7 @@ smux_set (oid *reqid, size_t *reqid_len,
if (result == 0) if (result == 0)
{ {
if (debug_smux) if (debug_smux)
zlog_info ("SMUX function call index is %d", v->magic); zlog_debug ("SMUX function call index is %d", v->magic);
statP = (*v->findVar) (v, suffix, &suffix_len, 1, statP = (*v->findVar) (v, suffix, &suffix_len, 1,
&val_len, &write_method); &val_len, &write_method);
@ -539,7 +539,7 @@ smux_get (oid *reqid, size_t *reqid_len, int exact,
if (result == 0) if (result == 0)
{ {
if (debug_smux) if (debug_smux)
zlog_info ("SMUX function call index is %d", v->magic); zlog_debug ("SMUX function call index is %d", v->magic);
*val = (*v->findVar) (v, suffix, &suffix_len, exact, *val = (*v->findVar) (v, suffix, &suffix_len, exact,
val_len, &write_method); val_len, &write_method);
@ -626,7 +626,7 @@ smux_getnext (oid *reqid, size_t *reqid_len, int exact,
if (result <= 0) if (result <= 0)
{ {
if (debug_smux) if (debug_smux)
zlog_info ("SMUX function call index is %d", v->magic); zlog_debug ("SMUX function call index is %d", v->magic);
if(result<0) if(result<0)
{ {
oid_copy(suffix, v->name, v->namelen); oid_copy(suffix, v->name, v->namelen);
@ -662,19 +662,19 @@ smux_parse_get_header (char *ptr, size_t *len, long *reqid)
ptr = asn_parse_int (ptr, len, &type, reqid, sizeof (*reqid)); ptr = asn_parse_int (ptr, len, &type, reqid, sizeof (*reqid));
if (debug_smux) if (debug_smux)
zlog_info ("SMUX GET reqid: %d len: %d", (int) *reqid, (int) *len); zlog_debug ("SMUX GET reqid: %d len: %d", (int) *reqid, (int) *len);
/* Error status. */ /* Error status. */
ptr = asn_parse_int (ptr, len, &type, &errstat, sizeof (errstat)); ptr = asn_parse_int (ptr, len, &type, &errstat, sizeof (errstat));
if (debug_smux) if (debug_smux)
zlog_info ("SMUX GET errstat %ld len: %ld", errstat, *len); zlog_debug ("SMUX GET errstat %ld len: %ld", errstat, *len);
/* Error index. */ /* Error index. */
ptr = asn_parse_int (ptr, len, &type, &errindex, sizeof (errindex)); ptr = asn_parse_int (ptr, len, &type, &errindex, sizeof (errindex));
if (debug_smux) if (debug_smux)
zlog_info ("SMUX GET errindex %ld len: %ld", errindex, *len); zlog_debug ("SMUX GET errindex %ld len: %ld", errindex, *len);
return ptr; return ptr;
} }
@ -691,7 +691,7 @@ smux_parse_set (char *ptr, size_t len, int action)
int ret; int ret;
if (debug_smux) if (debug_smux)
zlog_info ("SMUX SET(%s) message parse: len %ld", zlog_debug ("SMUX SET(%s) message parse: len %ld",
(RESERVE1 == action) ? "RESERVE1" : ((FREE == action) ? "FREE" : "COMMIT"), (RESERVE1 == action) ? "RESERVE1" : ((FREE == action) ? "FREE" : "COMMIT"),
len); len);
@ -703,7 +703,7 @@ smux_parse_set (char *ptr, size_t len, int action)
ret = smux_set (oid, &oid_len, val_type, val, val_len, action); ret = smux_set (oid, &oid_len, val_type, val, val_len, action);
if (debug_smux) if (debug_smux)
zlog_info ("SMUX SET ret %d", ret); zlog_debug ("SMUX SET ret %d", ret);
/* Return result. */ /* Return result. */
if (RESERVE1 == action) if (RESERVE1 == action)
@ -722,7 +722,7 @@ smux_parse_get (char *ptr, size_t len, int exact)
int ret; int ret;
if (debug_smux) if (debug_smux)
zlog_info ("SMUX GET message parse: len %ld", len); zlog_debug ("SMUX GET message parse: len %ld", len);
/* Parse GET message header. */ /* Parse GET message header. */
ptr = smux_parse_get_header (ptr, &len, &reqid); ptr = smux_parse_get_header (ptr, &len, &reqid);
@ -767,7 +767,7 @@ smux_parse_rrsp (char *ptr, size_t len)
ptr = asn_parse_int (ptr, &len, &val, &errstat, sizeof (errstat)); ptr = asn_parse_int (ptr, &len, &val, &errstat, sizeof (errstat));
if (debug_smux) if (debug_smux)
zlog_info ("SMUX_RRSP value: %d errstat: %ld", val, errstat); zlog_debug ("SMUX_RRSP value: %d errstat: %ld", val, errstat);
} }
/* Parse SMUX message. */ /* Parse SMUX message. */
@ -792,7 +792,7 @@ process_rest: /* see note below: YYY */
ptr = asn_parse_header (ptr, &len, &type); ptr = asn_parse_header (ptr, &len, &type);
if (debug_smux) if (debug_smux)
zlog_info ("SMUX message received type: %d rest len: %ld", type, len); zlog_debug ("SMUX message received type: %d rest len: %ld", type, len);
switch (type) switch (type)
{ {
@ -809,7 +809,7 @@ process_rest: /* see note below: YYY */
case SMUX_SOUT: case SMUX_SOUT:
/* SMUX_SOUT message is now valied for us. */ /* SMUX_SOUT message is now valied for us. */
if (debug_smux) if (debug_smux)
zlog_info ("SMUX_SOUT(%s)", rollback ? "rollback" : "commit"); zlog_debug ("SMUX_SOUT(%s)", rollback ? "rollback" : "commit");
if (sout_save_len > 0) if (sout_save_len > 0)
{ {
@ -844,32 +844,32 @@ process_rest: /* see note below: YYY */
case SMUX_CLOSE: case SMUX_CLOSE:
/* Close SMUX connection. */ /* Close SMUX connection. */
if (debug_smux) if (debug_smux)
zlog_info ("SMUX_CLOSE"); zlog_debug ("SMUX_CLOSE");
smux_parse_close (ptr, len); smux_parse_close (ptr, len);
return -1; return -1;
break; break;
case SMUX_RRSP: case SMUX_RRSP:
/* This is response for register message. */ /* This is response for register message. */
if (debug_smux) if (debug_smux)
zlog_info ("SMUX_RRSP"); zlog_debug ("SMUX_RRSP");
smux_parse_rrsp (ptr, len); smux_parse_rrsp (ptr, len);
break; break;
case SMUX_GET: case SMUX_GET:
/* Exact request for object id. */ /* Exact request for object id. */
if (debug_smux) if (debug_smux)
zlog_info ("SMUX_GET"); zlog_debug ("SMUX_GET");
smux_parse_get (ptr, len, 1); smux_parse_get (ptr, len, 1);
break; break;
case SMUX_GETNEXT: case SMUX_GETNEXT:
/* Next request for object id. */ /* Next request for object id. */
if (debug_smux) if (debug_smux)
zlog_info ("SMUX_GETNEXT"); zlog_debug ("SMUX_GETNEXT");
smux_parse_get (ptr, len, 0); smux_parse_get (ptr, len, 0);
break; break;
case SMUX_SET: case SMUX_SET:
/* SMUX_SET is supported with some limitations. */ /* SMUX_SET is supported with some limitations. */
if (debug_smux) if (debug_smux)
zlog_info ("SMUX_SET"); zlog_debug ("SMUX_SET");
/* save the data for future SMUX_SOUT */ /* save the data for future SMUX_SOUT */
memcpy (sout_save_buff, ptr, len); memcpy (sout_save_buff, ptr, len);
@ -897,7 +897,7 @@ smux_read (struct thread *t)
smux_read_thread = NULL; smux_read_thread = NULL;
if (debug_smux) if (debug_smux)
zlog_info ("SMUX read start"); zlog_debug ("SMUX read start");
/* Read message from SMUX socket. */ /* Read message from SMUX socket. */
len = recv (sock, buf, SMUXMAXPKTSIZE, 0); len = recv (sock, buf, SMUXMAXPKTSIZE, 0);
@ -921,7 +921,7 @@ smux_read (struct thread *t)
} }
if (debug_smux) if (debug_smux)
zlog_info ("SMUX read len: %d", len); zlog_debug ("SMUX read len: %d", len);
/* Parse the message. */ /* Parse the message. */
ret = smux_parse (buf, len); ret = smux_parse (buf, len);
@ -952,8 +952,8 @@ smux_open (int sock)
if (debug_smux) if (debug_smux)
{ {
smux_oid_dump ("SMUX open oid", smux_oid, smux_oid_len); smux_oid_dump ("SMUX open oid", smux_oid, smux_oid_len);
zlog_info ("SMUX open progname: %s", progname); zlog_debug ("SMUX open progname: %s", progname);
zlog_info ("SMUX open password: %s", smux_passwd); zlog_debug ("SMUX open password: %s", smux_passwd);
} }
ptr = buf; ptr = buf;
@ -1079,7 +1079,7 @@ smux_trap (oid *name, size_t namelen,
ret = smux_get (oid, &oid_len, 1, &val_type, &val, &val_len); ret = smux_get (oid, &oid_len, 1, &val_type, &val, &val_len);
if (debug_smux) if (debug_smux)
zlog_info ("smux_get result %d", ret); zlog_debug ("smux_get result %d", ret);
if (ret == 0) if (ret == 0)
ptr = snmp_build_var_op (ptr, oid, &oid_len, ptr = snmp_build_var_op (ptr, oid, &oid_len,
@ -1143,8 +1143,8 @@ smux_register (int sock)
if (debug_smux) if (debug_smux)
{ {
smux_oid_dump ("SMUX register oid", subtree->name, subtree->name_len); smux_oid_dump ("SMUX register oid", subtree->name, subtree->name_len);
zlog_info ("SMUX register priority: %ld", priority); zlog_debug ("SMUX register priority: %ld", priority);
zlog_info ("SMUX register operation: %ld", operation); zlog_debug ("SMUX register operation: %ld", operation);
} }
len = BUFSIZ; len = BUFSIZ;
@ -1163,7 +1163,7 @@ smux_connect (struct thread *t)
int ret; int ret;
if (debug_smux) if (debug_smux)
zlog_info ("SMUX connect try %d", fail + 1); zlog_debug ("SMUX connect try %d", fail + 1);
/* Clear thread poner of myself. */ /* Clear thread poner of myself. */
smux_connect_thread = NULL; smux_connect_thread = NULL;

View File

@ -91,7 +91,7 @@ zclient_init (struct zclient *zclient, int redist_default)
/* Schedule first zclient connection. */ /* Schedule first zclient connection. */
if (zclient_debug) if (zclient_debug)
zlog_info ("zclient start scheduled"); zlog_debug ("zclient start scheduled");
zclient_event (ZCLIENT_SCHEDULE, zclient); zclient_event (ZCLIENT_SCHEDULE, zclient);
} }
@ -101,7 +101,7 @@ void
zclient_stop (struct zclient *zclient) zclient_stop (struct zclient *zclient)
{ {
if (zclient_debug) if (zclient_debug)
zlog_info ("zclient stopped"); zlog_debug ("zclient stopped");
/* Stop threads. */ /* Stop threads. */
if (zclient->t_read) if (zclient->t_read)
@ -220,7 +220,7 @@ zclient_start (struct zclient *zclient)
int i; int i;
if (zclient_debug) if (zclient_debug)
zlog_info ("zclient_start is called"); zlog_debug ("zclient_start is called");
/* zclient is disabled. */ /* zclient is disabled. */
if (! zclient->enable) if (! zclient->enable)
@ -243,7 +243,7 @@ zclient_start (struct zclient *zclient)
if (zclient->sock < 0) if (zclient->sock < 0)
{ {
if (zclient_debug) if (zclient_debug)
zlog_info ("zclient connection fail"); zlog_debug ("zclient connection fail");
zclient->fail++; zclient->fail++;
zclient_event (ZCLIENT_CONNECT, zclient); zclient_event (ZCLIENT_CONNECT, zclient);
return -1; return -1;
@ -252,7 +252,7 @@ zclient_start (struct zclient *zclient)
/* Clear fail count. */ /* Clear fail count. */
zclient->fail = 0; zclient->fail = 0;
if (zclient_debug) if (zclient_debug)
zlog_info ("zclient connect success with socket [%d]", zclient->sock); zlog_debug ("zclient connect success with socket [%d]", zclient->sock);
/* Create read thread. */ /* Create read thread. */
zclient_event (ZCLIENT_READ, zclient); zclient_event (ZCLIENT_READ, zclient);
@ -286,7 +286,7 @@ zclient_connect (struct thread *t)
zclient->t_connect = NULL; zclient->t_connect = NULL;
if (zclient_debug) if (zclient_debug)
zlog_info ("zclient_connect is called"); zlog_debug ("zclient_connect is called");
return zclient_start (zclient); return zclient_start (zclient);
} }
@ -743,7 +743,7 @@ zclient_read (struct thread *thread)
if (nbytes == 0) if (nbytes == 0)
{ {
if (zclient_debug) if (zclient_debug)
zlog_info ("zclient connection closed socket [%d].", sock); zlog_debug ("zclient connection closed socket [%d].", sock);
zclient->fail++; zclient->fail++;
zclient_stop (zclient); zclient_stop (zclient);
zclient_event (ZCLIENT_CONNECT, zclient); zclient_event (ZCLIENT_CONNECT, zclient);
@ -754,7 +754,7 @@ zclient_read (struct thread *thread)
if (nbytes < 0 || nbytes != ZEBRA_HEADER_SIZE) if (nbytes < 0 || nbytes != ZEBRA_HEADER_SIZE)
{ {
if (zclient_debug) if (zclient_debug)
zlog_info ("Can't read all packet (length %d).", nbytes); zlog_debug ("Can't read all packet (length %d).", nbytes);
zclient->fail++; zclient->fail++;
zclient_stop (zclient); zclient_stop (zclient);
zclient_event (ZCLIENT_CONNECT, zclient); zclient_event (ZCLIENT_CONNECT, zclient);
@ -778,7 +778,7 @@ zclient_read (struct thread *thread)
if (nbytes != length) if (nbytes != length)
{ {
if (zclient_debug) if (zclient_debug)
zlog_info ("zclient connection closed socket [%d].", sock); zlog_debug ("zclient connection closed socket [%d].", sock);
zclient->fail++; zclient->fail++;
zclient_stop (zclient); zclient_stop (zclient);
zclient_event (ZCLIENT_CONNECT, zclient); zclient_event (ZCLIENT_CONNECT, zclient);
@ -786,7 +786,7 @@ zclient_read (struct thread *thread)
} }
if (zclient_debug) if (zclient_debug)
zlog_info("zclient 0x%p command 0x%x \n", zclient, command); zlog_debug("zclient 0x%p command 0x%x \n", zclient, command);
switch (command) switch (command)
{ {
@ -904,7 +904,7 @@ zclient_event (enum event event, struct zclient *zclient)
if (zclient->fail >= 10) if (zclient->fail >= 10)
return; return;
if (zclient_debug) if (zclient_debug)
zlog_info ("zclient connect schedule interval is %d", zlog_debug ("zclient connect schedule interval is %d",
zclient->fail < 3 ? 10 : 60); zclient->fail < 3 ? 10 : 60);
if (! zclient->t_connect) if (! zclient->t_connect)
zclient->t_connect = zclient->t_connect =