#include <config.h>#include <unistd.h>#include <netdb.h>#include <stdlib.h>#include <string.h>#include <sys/time.h>#include <time.h>#include <sys/socket.h>#include <netinet/in.h>#include <getopt.h>#include <dmalloc.h>#include "asn1.h"#include "snmp_api.h"#include "snmp_impl.h"#include "snmp_client.h"#include "snmp.h"#include "system.h"#include "read_config.h"#include "snmp_debug.h"#include "snmp_parse_args.h"#include "agent_trap.h"#include "callback.h"#include "agent_callbacks.h"#include "tools.h"#include "snmp_logging.h"#include "snmp_transport.h"#include "mib_module_config.h"Go to the source code of this file.
Data Structures | |
| struct | trap_sink |
Defines | |
| #define | SNMPV2_TRAPS_PREFIX SNMP_OID_SNMPMODULES,1,1,5 |
| #define | SNMPV2_TRAP_OBJS_PREFIX SNMP_OID_SNMPMODULES,1,1,4 |
| #define | SNMP_AUTHENTICATED_TRAPS_ENABLED 1 |
| #define | SNMP_AUTHENTICATED_TRAPS_DISABLED 2 |
| #define | MAX_ARGS 128 |
Functions | |
| int | add_trap_session (struct snmp_session *ss, int pdutype, int confirm, int version) |
| int | remove_trap_session (struct snmp_session *ss) |
| int | create_trap_session (char *sink, u_short sinkport, char *com, int version, int pdutype) |
| void | snmpd_free_trapsinks (void) |
| void | convert_v2_to_v1 (struct variable_list *vars, struct snmp_pdu *template_pdu) |
| void | send_enterprise_trap_vars (int trap, int specific, oid *enterprise, int enterprise_length, struct variable_list *vars) |
| void | send_trap_to_sess (struct snmp_session *sess, struct snmp_pdu *template_pdu) |
| void | send_trap_vars (int trap, int specific, struct variable_list *vars) |
| void | send_easy_trap (int trap, int specific) |
| void | send_v2trap (struct variable_list *vars) |
| void | send_trap_pdu (struct snmp_pdu *pdu) |
| void | snmpd_parse_config_authtrap (const char *token, char *cptr) |
| void | snmpd_parse_config_trapsink (const char *token, char *cptr) |
| void | snmpd_parse_config_trap2sink (const char *word, char *cptr) |
| void | snmpd_parse_config_informsink (const char *word, char *cptr) |
| void | snmpd_parse_config_trapsess (const char *word, char *cptr) |
| void | snmpd_parse_config_trapcommunity (const char *word, char *cptr) |
| void | snmpd_free_trapcommunity (void) |
Variables | |
| trap_sink * | sinks = NULL |
| timeval | starttime |
| oid | objid_enterprisetrap [] = { EXTENSIBLEMIB, 251 } |
| oid | version_id [] = { EXTENSIBLEMIB, AGENTID, OSTYPE } |
| int | enterprisetrap_len = OID_LENGTH( objid_enterprisetrap ) |
| int | version_id_len = OID_LENGTH( version_id ) |
| oid | cold_start_oid [] = { SNMPV2_TRAPS_PREFIX, 1 } |
| oid | warm_start_oid [] = { SNMPV2_TRAPS_PREFIX, 2 } |
| oid | link_down_oid [] = { SNMPV2_TRAPS_PREFIX, 3 } |
| oid | link_up_oid [] = { SNMPV2_TRAPS_PREFIX, 4 } |
| oid | auth_fail_oid [] = { SNMPV2_TRAPS_PREFIX, 5 } |
| oid | egp_xxx_oid [] = { SNMPV2_TRAPS_PREFIX, 99 } |
| oid | snmptrap_oid [] = { SNMPV2_TRAP_OBJS_PREFIX, 1, 0 } |
| oid | snmptrapenterprise_oid [] = { SNMPV2_TRAP_OBJS_PREFIX, 3, 0 } |
| oid | sysuptime_oid [] = { SNMP_OID_MIB2,1,3,0 } |
| int | snmptrap_oid_len = OID_LENGTH(snmptrap_oid) |
| int | snmptrapenterprise_oid_len = OID_LENGTH(snmptrapenterprise_oid) |
| int | sysuptime_oid_len = OID_LENGTH(sysuptime_oid) |
| int | snmp_enableauthentraps = SNMP_AUTHENTICATED_TRAPS_DISABLED |
| char * | snmp_trapcommunity = NULL |
|
|
Definition at line 654 of file agent_trap.c. |
|
|
Definition at line 83 of file agent_trap.c. |
|
|
Definition at line 91 of file agent_trap.c. |
|
|
Definition at line 101 of file agent_trap.c. |
|
|
Definition at line 100 of file agent_trap.c. |
|
||||||||||||||||||||
|
Definition at line 129 of file agent_trap.c. 00130 {
00131 if (snmp_callback_available(SNMP_CALLBACK_APPLICATION,
00132 SNMPD_CALLBACK_REGISTER_NOTIFICATIONS) ==
00133 SNMPERR_SUCCESS) {
00134 /* something else wants to handle notification registrations */
00135 struct agent_add_trap_args args;
00136 DEBUGMSGTL(("add_trap_session","adding callback trap sink\n"));
00137 args.ss = ss;
00138 args.confirm = confirm;
00139 snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
00140 SNMPD_CALLBACK_REGISTER_NOTIFICATIONS,
00141 (void *) &args);
00142 } else {
00143 /* no other support exists, handle it ourselves. */
00144 struct trap_sink *new_sink;
00145
00146 DEBUGMSGTL(("add_trap_session","adding internal trap sink\n"));
00147 new_sink = (struct trap_sink *) malloc (sizeof (*new_sink));
00148 if ( new_sink == NULL )
00149 return 0;
00150
00151 new_sink->sesp = ss;
00152 new_sink->pdutype = pdutype;
00153 new_sink->version = version;
00154 new_sink->next = sinks;
00155 sinks = new_sink;
00156 }
00157 return 1;
00158 }
|
|
||||||||||||
|
Definition at line 241 of file agent_trap.c. Referenced by send_enterprise_trap_vars().
00242 {
00243 struct variable_list *v, *trap_v=NULL, *ent_v=NULL;
00244 oid trap_prefix[] = { SNMPV2_TRAPS_PREFIX };
00245 int len;
00246
00247 for ( v = vars ; v ; v = v->next_variable ) {
00248 if ( snmp_oid_compare( v->name, v->name_length,
00249 snmptrap_oid, OID_LENGTH(snmptrap_oid)) == 0 )
00250 trap_v = v;
00251 if ( snmp_oid_compare( v->name, v->name_length,
00252 snmptrapenterprise_oid,
00253 OID_LENGTH(snmptrapenterprise_oid)) == 0 )
00254 ent_v = v;
00255 }
00256
00257 if ( !trap_v )
00258 return; /* Can't find v2 snmpTrapOID varbind */
00259
00260 /*
00261 * Is this a 'standard' trap?
00262 * Or at least, does it have the correct prefix?
00263 */
00264 if ( snmp_oid_compare( trap_v->val.objid, OID_LENGTH(trap_prefix),
00265 trap_prefix, OID_LENGTH(trap_prefix)) == 0 ) {
00266 template_pdu->trap_type = trap_v->val.objid[OID_LENGTH(trap_prefix)]-1;
00267 template_pdu->specific_type = 0;
00268 }
00269 else {
00270 len = trap_v->val_len /sizeof( oid );
00271 template_pdu->trap_type = 6; /* enterprise specific */
00272 template_pdu->specific_type = trap_v->val.objid[len-1];
00273 }
00274
00275 /*
00276 * TODO:
00277 * Extract the appropriate enterprise value from 'ent_v'
00278 * Remove uptime/trapOID varbinds from 'vars' list
00279 */
00280
00281 }
|
|
||||||||||||||||||||||||
|
Definition at line 178 of file agent_trap.c. 00181 {
00182 struct snmp_session session, *sesp;
00183
00184 memset (&session, 0, sizeof (struct snmp_session));
00185 session.peername = sink;
00186 session.version = version;
00187 if (com) {
00188 session.community = (u_char *)com;
00189 session.community_len = strlen (com);
00190 }
00191 session.remote_port = sinkport;
00192 sesp = snmp_open (&session);
00193
00194 if (sesp) {
00195 return( add_trap_session( sesp, pdutype, (pdutype==SNMP_MSG_INFORM), version ));
00196 }
00197
00198 /* diagnose snmp_open errors with the input struct snmp_session pointer */
00199 snmp_sess_perror("snmpd: create_trap_session", &session);
00200 return 0;
00201 }
|
|
|
Definition at line 160 of file agent_trap.c. 00160 {
00161 struct trap_sink *sp = sinks, *prev = 0;
00162 while (sp) {
00163 if (sp->sesp == ss) {
00164 if (prev) {
00165 prev->next = sp->next;
00166 } else {
00167 sinks = sp->next;
00168 }
00169 free_trap_session(sp);
00170 return 1;
00171 }
00172 prev = sp;
00173 sp = sp->next;
00174 }
00175 return 0;
00176 }
|
|
||||||||||||
|
Definition at line 528 of file agent_trap.c. 00530 {
00531 send_trap_vars( trap, specific, NULL );
00532 }
|
|
||||||||||||||||||||||||
|
Definition at line 283 of file agent_trap.c. 00287 {
00288 struct variable_list uptime_var, snmptrap_var, enterprise_var;
00289 struct variable_list *v2_vars, *last_var=NULL;
00290 struct snmp_pdu *template_pdu;
00291 struct timeval now;
00292 long uptime;
00293 in_addr_t *pdu_in_addr_t;
00294 struct trap_sink *sink;
00295 oid temp_oid[MAX_OID_LEN];
00296
00297 /*
00298 * Initialise SNMPv2 required variables
00299 */
00300 gettimeofday(&now, NULL);
00301 uptime = calculate_time_diff(&now, &starttime);
00302 memset (&uptime_var, 0, sizeof (struct variable_list));
00303 snmp_set_var_objid( &uptime_var, sysuptime_oid, OID_LENGTH(sysuptime_oid));
00304 snmp_set_var_value( &uptime_var, (u_char *)&uptime, sizeof(uptime) );
00305 uptime_var.type = ASN_TIMETICKS;
00306 uptime_var.next_variable = &snmptrap_var;
00307
00308 memset (&snmptrap_var, 0, sizeof (struct variable_list));
00309 snmp_set_var_objid( &snmptrap_var, snmptrap_oid, OID_LENGTH(snmptrap_oid));
00310 /* value set later .... */
00311 snmptrap_var.type = ASN_OBJECT_ID;
00312 if ( vars )
00313 snmptrap_var.next_variable = vars;
00314 else
00315 snmptrap_var.next_variable = &enterprise_var;
00316
00317 /* find end of provided varbind list,
00318 ready to append the enterprise info if necessary */
00319 last_var = vars;
00320 while ( last_var && last_var->next_variable )
00321 last_var = last_var->next_variable;
00322
00323 memset (&enterprise_var, 0, sizeof (struct variable_list));
00324 snmp_set_var_objid( &enterprise_var,
00325 snmptrapenterprise_oid, OID_LENGTH(snmptrapenterprise_oid));
00326 snmp_set_var_value( &enterprise_var, (u_char *)enterprise, enterprise_length*sizeof(oid));
00327 enterprise_var.type = ASN_OBJECT_ID;
00328 enterprise_var.next_variable = NULL;
00329
00330 v2_vars = &uptime_var;
00331
00332 /*
00333 * Create a template PDU, ready for sending
00334 */
00335 template_pdu = snmp_pdu_create( SNMP_MSG_TRAP );
00336 if ( template_pdu == NULL ) {
00337 /* Free memory if value stored dynamically */
00338 snmp_set_var_value( &enterprise_var, NULL, 0);
00339 return;
00340 }
00341 template_pdu->trap_type = trap;
00342 template_pdu->specific_type = specific;
00343 if ( snmp_clone_mem((void **)&template_pdu->enterprise,
00344 enterprise, enterprise_length*sizeof(oid))) {
00345 snmp_free_pdu( template_pdu );
00346 snmp_set_var_value( &enterprise_var, NULL, 0);
00347 return;
00348 }
00349 template_pdu->enterprise_length = enterprise_length;
00350 template_pdu->flags |= UCD_MSG_FLAG_FORCE_PDU_COPY;
00351
00352 pdu_in_addr_t = (in_addr_t *)template_pdu->agent_addr;
00353 *pdu_in_addr_t = get_myaddr();
00354 template_pdu->time = uptime;
00355
00356 /*
00357 * Now use the parameters to determine
00358 * which v2 variables are needed,
00359 * and what values they should take.
00360 */
00361 switch ( trap ) {
00362 case -1: /*
00363 * SNMPv2 only
00364 * Check to see whether the variables provided
00365 * are sufficient for SNMPv2 notifications
00366 */
00367 if (vars && snmp_oid_compare(vars->name, vars->name_length,
00368 sysuptime_oid, OID_LENGTH(sysuptime_oid)) == 0 )
00369 v2_vars = vars;
00370 else
00371 if (vars && snmp_oid_compare(vars->name, vars->name_length,
00372 snmptrap_oid, OID_LENGTH(snmptrap_oid)) == 0 )
00373 uptime_var.next_variable = vars;
00374 else {
00375 /* Hmmm... we don't seem to have a value - oops! */
00376 snmptrap_var.next_variable = vars;
00377 }
00378 last_var = NULL; /* Don't need enterprise info */
00379 convert_v2_to_v1( vars, template_pdu );
00380 break;
00381
00382 /* "Standard" SNMPv1 traps */
00383
00384 case SNMP_TRAP_COLDSTART:
00385 snmp_set_var_value( &snmptrap_var,
00386 (u_char *)cold_start_oid,
00387 sizeof(cold_start_oid));
00388 break;
00389 case SNMP_TRAP_WARMSTART:
00390 snmp_set_var_value( &snmptrap_var,
00391 (u_char *)warm_start_oid,
00392 sizeof(warm_start_oid));
00393 break;
00394 case SNMP_TRAP_LINKDOWN:
00395 snmp_set_var_value( &snmptrap_var,
00396 (u_char *)link_down_oid,
00397 sizeof(link_down_oid));
00398 break;
00399 case SNMP_TRAP_LINKUP:
00400 snmp_set_var_value( &snmptrap_var,
00401 (u_char *)link_up_oid,
00402 sizeof(link_up_oid));
00403 break;
00404 case SNMP_TRAP_AUTHFAIL:
00405 if (snmp_enableauthentraps == SNMP_AUTHENTICATED_TRAPS_DISABLED) {
00406 snmp_free_pdu(template_pdu);
00407 snmp_set_var_value( &enterprise_var, NULL, 0);
00408 return;
00409 }
00410 snmp_set_var_value( &snmptrap_var,
00411 (u_char *)auth_fail_oid,
00412 sizeof(auth_fail_oid));
00413 break;
00414 case SNMP_TRAP_EGPNEIGHBORLOSS:
00415 snmp_set_var_value( &snmptrap_var,
00416 (u_char *)egp_xxx_oid,
00417 sizeof(egp_xxx_oid));
00418 break;
00419
00420 case SNMP_TRAP_ENTERPRISESPECIFIC:
00421 memcpy( temp_oid,
00422 (char *)enterprise,
00423 (enterprise_length)*sizeof(oid));
00424 temp_oid[ enterprise_length ] = 0;
00425 temp_oid[ enterprise_length+1 ] = specific;
00426 snmp_set_var_value( &snmptrap_var,
00427 (u_char *)temp_oid,
00428 (enterprise_length+2)*sizeof(oid));
00429 snmptrap_var.next_variable = vars;
00430 last_var = NULL; /* Don't need version info */
00431 break;
00432 }
00433
00434
00435 /*
00436 * Now loop through the list of trap sinks,
00437 * sending an appropriately formatted PDU to each
00438 */
00439 for ( sink = sinks ; sink ; sink=sink->next ) {
00440 if ( sink->version == SNMP_VERSION_1 && trap == -1 )
00441 continue; /* Skip v1 sinks for v2 only traps */
00442 template_pdu->command = sink->pdutype;
00443
00444 if ( sink->version != SNMP_VERSION_1 ) {
00445 template_pdu->variables = v2_vars;
00446 if ( last_var )
00447 last_var->next_variable = &enterprise_var;
00448 }
00449 else
00450 template_pdu->variables = vars;
00451
00452 send_trap_to_sess(sink->sesp, template_pdu);
00453
00454 if ( sink->version != SNMP_VERSION_1 && last_var )
00455 last_var->next_variable = NULL;
00456 }
00457
00458 /* send stuff to registered callbacks */
00459 /* v2 traps/informs */
00460 template_pdu->variables = v2_vars;
00461 if ( last_var )
00462 last_var->next_variable = &enterprise_var;
00463
00464 snmp_call_callbacks(SNMP_CALLBACK_APPLICATION, SNMPD_CALLBACK_SEND_TRAP2,
00465 template_pdu);
00466
00467 if ( last_var )
00468 last_var->next_variable = NULL;
00469
00470 /* v1 traps */
00471 template_pdu->command = SNMP_MSG_TRAP;
00472 template_pdu->variables = vars;
00473
00474 snmp_call_callbacks(SNMP_CALLBACK_APPLICATION, SNMPD_CALLBACK_SEND_TRAP1,
00475 template_pdu);
00476
00477 /* Free memory if values stored dynamically */
00478 snmp_set_var_value( &enterprise_var, NULL, 0);
00479 snmp_set_var_value( &snmptrap_var, NULL, 0);
00480 /* Ensure we don't free anything we shouldn't */
00481 if ( last_var )
00482 last_var->next_variable = NULL;
00483 template_pdu->variables = NULL;
00484 snmp_free_pdu( template_pdu );
00485 }
|
|
|
Definition at line 540 of file agent_trap.c. 00541 {
00542 send_trap_vars( -1, -1, pdu->variables );
00543 }
|
|
||||||||||||
|
Definition at line 489 of file agent_trap.c. 00490 {
00491 struct snmp_pdu *pdu;
00492
00493 if (!sess || !template_pdu)
00494 return;
00495
00496 DEBUGMSGTL(("send_trap_to_sess","sending trap type=%d, version=%d\n",
00497 template_pdu->command, sess->version));
00498
00499 if (sess->version == SNMP_VERSION_1 &&
00500 (template_pdu->command == SNMP_MSG_TRAP2 ||
00501 template_pdu->command == SNMP_MSG_INFORM))
00502 return; /* Skip v1 sinks for v2 only traps */
00503 template_pdu->version = sess->version;
00504 pdu = snmp_clone_pdu( template_pdu );
00505 pdu->sessid = sess->sessid; /* AgentX only ? */
00506 if ( snmp_send( sess, pdu) == 0 ) {
00507 snmp_sess_perror ("snmpd: send_trap", sess);
00508 snmp_free_pdu( pdu );
00509 }
00510 else {
00511 snmp_increment_statistic(STAT_SNMPOUTTRAPS);
00512 snmp_increment_statistic(STAT_SNMPOUTPKTS);
00513 }
00514 }
|
|
||||||||||||||||
|
Definition at line 516 of file agent_trap.c. 00519 {
00520 if ( trap == SNMP_TRAP_ENTERPRISESPECIFIC )
00521 send_enterprise_trap_vars( trap, specific, objid_enterprisetrap,
00522 OID_LENGTH(objid_enterprisetrap), vars );
00523 else
00524 send_enterprise_trap_vars( trap, specific, version_id,
00525 OID_LENGTH(version_id), vars );
00526 }
|
|
|
Definition at line 534 of file agent_trap.c. 00535 {
00536 send_trap_vars( -1, -1, vars );
00537 }
|
|
|
Definition at line 718 of file agent_trap.c. 00719 {
00720 if (snmp_trapcommunity) {
00721 free(snmp_trapcommunity);
00722 snmp_trapcommunity = NULL;
00723 }
00724 }
|
|
|
Definition at line 225 of file agent_trap.c. |
|
||||||||||||
|
Definition at line 553 of file agent_trap.c. 00555 {
00556 int i;
00557
00558 i = atoi(cptr);
00559 if ( i == 0 ) {
00560 if ( !strcmp( cptr, "enable" ))
00561 i = SNMP_AUTHENTICATED_TRAPS_ENABLED;
00562 else if ( !strcmp( cptr, "disable" ))
00563 i = SNMP_AUTHENTICATED_TRAPS_DISABLED;
00564 }
00565 if (i < 1 || i > 2)
00566 config_perror("authtrapenable must be 1 or 2");
00567 else
00568 snmp_enableauthentraps = i;
00569 }
|
|
||||||||||||
|
Definition at line 627 of file agent_trap.c. 00628 {
00629 char tmpbuf[1024];
00630 char *sp, *cp, *pp = NULL;
00631 u_short sinkport;
00632
00633 if (!snmp_trapcommunity) snmp_trapcommunity = strdup("public");
00634 sp = strtok(cptr, " \t\n");
00635 cp = strtok(NULL, " \t\n");
00636 if (cp) pp = strtok(NULL, " \t\n");
00637 if (cp && pp) {
00638 sinkport = atoi(pp);
00639 if ((sinkport < 1) || (sinkport > 0xffff)) {
00640 config_perror("trapsink port out of range");
00641 sinkport = SNMP_TRAP_PORT;
00642 }
00643 } else {
00644 sinkport = SNMP_TRAP_PORT;
00645 }
00646 if (create_v2_inform_session(sp, sinkport,
00647 cp ? cp : snmp_trapcommunity) == 0) {
00648 sprintf(tmpbuf,"cannot create informsink: %s", cptr);
00649 config_perror(tmpbuf);
00650 }
00651 }
|
|
||||||||||||
|
Definition at line 600 of file agent_trap.c. 00601 {
00602 char tmpbuf[1024];
00603 char *sp, *cp, *pp = NULL;
00604 u_short sinkport;
00605
00606 if (!snmp_trapcommunity) snmp_trapcommunity = strdup("public");
00607 sp = strtok(cptr, " \t\n");
00608 cp = strtok(NULL, " \t\n");
00609 if (cp) pp = strtok(NULL, " \t\n");
00610 if (cp && pp) {
00611 sinkport = atoi(pp);
00612 if ((sinkport < 1) || (sinkport > 0xffff)) {
00613 config_perror("trapsink port out of range");
00614 sinkport = SNMP_TRAP_PORT;
00615 }
00616 } else {
00617 sinkport = SNMP_TRAP_PORT;
00618 }
00619 if (create_v2_trap_session(sp, sinkport,
00620 cp ? cp : snmp_trapcommunity) == 0) {
00621 sprintf(tmpbuf,"cannot create trap2sink: %s", cptr);
00622 config_perror(tmpbuf);
00623 }
00624 }
|
|
||||||||||||
|
Definition at line 711 of file agent_trap.c. 00712 {
00713 if (snmp_trapcommunity) free(snmp_trapcommunity);
00714 snmp_trapcommunity = (char *)malloc (strlen(cptr)+1);
00715 copy_nword(cptr, snmp_trapcommunity, strlen(cptr)+1);
00716 }
|
|
||||||||||||
|
Definition at line 678 of file agent_trap.c. 00678 {
00679 char *argv[MAX_ARGS];
00680 int argn, arg;
00681 struct snmp_session session, *ss;
00682
00683 /* inform or trap? default to trap */
00684 traptype = SNMP_MSG_TRAP2;
00685
00686 /* create the argv[] like array */
00687 argv[0] = strdup("snmpd-trapsess"); /* bogus entry for getopt() */
00688 for(argn = 1; cptr && argn < MAX_ARGS; argn++) {
00689 argv[argn] = strdup(cptr); /* more than enough room */
00690 }
00691
00692 arg = snmp_parse_args(argn, argv, &session, "C:", trapOptProc);
00693 do { free(argv[--argn]); } while (argn > 0);
00694
00695 ss = snmp_open (&session);
00696
00697 if (!ss) {
00698 config_perror("snmpd: failed to parse this line");
00699 snmp_sess_perror("snmpd: snmpd_parse_config_trapsess()", &session);
00700 return;
00701 }
00702
00703 if (ss->version == SNMP_VERSION_1) {
00704 add_trap_session(ss, SNMP_MSG_TRAP, 0, SNMP_VERSION_1);
00705 } else {
00706 add_trap_session( ss, traptype, (traptype==SNMP_MSG_INFORM), ss->version );
00707 }
00708 }
|
|
||||||||||||
|
Definition at line 571 of file agent_trap.c. 00573 {
00574 char tmpbuf[1024];
00575 char *sp, *cp, *pp = NULL;
00576 u_short sinkport;
00577
00578 if (!snmp_trapcommunity) snmp_trapcommunity = strdup("public");
00579 sp = strtok(cptr, " \t\n");
00580 cp = strtok(NULL, " \t\n");
00581 if (cp) pp = strtok(NULL, " \t\n");
00582 if (cp && pp) {
00583 sinkport = atoi(pp);
00584 if ((sinkport < 1) || (sinkport > 0xffff)) {
00585 config_perror("trapsink port out of range");
00586 sinkport = SNMP_TRAP_PORT;
00587 }
00588 } else {
00589 sinkport = SNMP_TRAP_PORT;
00590 }
00591 if (create_v1_trap_session(sp, sinkport,
00592 cp ? cp : snmp_trapcommunity) == 0) {
00593 sprintf(tmpbuf,"cannot create trapsink: %s", cptr);
00594 config_perror(tmpbuf);
00595 }
00596 }
|
|
|
Definition at line 88 of file agent_trap.c. |
|
|
Definition at line 84 of file agent_trap.c. |
|
|
Definition at line 89 of file agent_trap.c. |
|
|
Definition at line 80 of file agent_trap.c. |
|
|
Definition at line 86 of file agent_trap.c. |
|
|
Definition at line 87 of file agent_trap.c. |
|
|
Definition at line 78 of file agent_trap.c. |
|
|
Definition at line 74 of file agent_trap.c. |
|
|
Definition at line 103 of file agent_trap.c. |
|
|
Definition at line 104 of file agent_trap.c. |
|
|
Definition at line 92 of file agent_trap.c. |
|
|
Definition at line 95 of file agent_trap.c. |
|
|
Definition at line 93 of file agent_trap.c. |
|
|
Definition at line 96 of file agent_trap.c. |
|
|
Definition at line 76 of file agent_trap.c. |
|
|
Definition at line 94 of file agent_trap.c. |
|
|
Definition at line 97 of file agent_trap.c. |
|
|
Definition at line 79 of file agent_trap.c. |
|
|
Definition at line 81 of file agent_trap.c. |
|
|
Definition at line 85 of file agent_trap.c. |
1.2.11 written by Dimitri van Heesch,
© 1997-2001
[an error occurred while processing this directive]
[an error occurred while processing this directive]
Last modified: Wednesday, 01-Aug-2018 04:41:28 UTC
For questions regarding web content and site functionality, please write to the net-snmp-users mail list.