mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-03-11 17:08:46 +00:00
tmp
This commit is contained in:
parent
9a11ec8d83
commit
74c68fc89e
@ -106,6 +106,67 @@ ip4_from_oid(const struct oid *o)
|
||||
o->ids[8]) : IP4_NONE;
|
||||
}
|
||||
|
||||
static void
|
||||
print_bgp_record(struct bgp_config *config)
|
||||
{
|
||||
struct proto_config *cf = (struct proto_config *) config;
|
||||
struct proto *P = cf->proto;
|
||||
struct bgp_proto *bgp_proto = (struct bgp_proto *) cf->proto;
|
||||
struct bgp_conn *conn = bgp_proto->conn;
|
||||
|
||||
log(L_INFO " name: %s", cf->name);
|
||||
log(L_INFO "");
|
||||
log(L_INFO " rem. identifier: %u", bgp_proto->remote_id);
|
||||
log(L_INFO " local ip: %I", config->local_ip);
|
||||
log(L_INFO " remote ip: %I", config->remote_ip);
|
||||
log(L_INFO " local port: %u", config->local_port);
|
||||
log(L_INFO " remote port: %u", config->remote_port);
|
||||
|
||||
// crashes ?
|
||||
if (conn) {
|
||||
log(L_INFO " state: %u", conn->state);
|
||||
log(L_INFO " remote as: %u", conn->remote_caps->as4_number);
|
||||
}
|
||||
|
||||
|
||||
log(L_INFO " in updates: %u", bgp_proto->stats.rx_updates);
|
||||
log(L_INFO " out updates: %u", bgp_proto->stats.tx_updates);
|
||||
log(L_INFO " in total: %u", bgp_proto->stats.rx_messages);
|
||||
log(L_INFO " out total: %u", bgp_proto->stats.tx_messages);
|
||||
log(L_INFO " fsm transitions: %u",
|
||||
bgp_proto->stats.fsm_established_transitions);
|
||||
|
||||
// not supported yet
|
||||
log(L_INFO " fsm total time: --");
|
||||
log(L_INFO " retry interval: %u", config->connect_retry_time);
|
||||
|
||||
log(L_INFO " hold configurated: %u", config->hold_time );
|
||||
log(L_INFO " keep alive config: %u", config->keepalive_time );
|
||||
|
||||
// unknown
|
||||
log(L_INFO " min AS origin. int.: --");
|
||||
log(L_INFO " min route advertisement: %u", 0 );
|
||||
log(L_INFO " in update elapsed time: %u", 0 );
|
||||
|
||||
if (!conn)
|
||||
log(L_INFO " no connection established");
|
||||
|
||||
log(L_INFO " outgoinin_conn state %u", bgp_proto->outgoing_conn.state + 1);
|
||||
log(L_INFO " incoming_conn state: %u", bgp_proto->incoming_conn.state + 1);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
print_bgp_record_all(struct snmp_proto *p)
|
||||
{
|
||||
log(L_INFO "dumping watched bgp status");
|
||||
HASH_WALK(p->bgp_hash, next, peer)
|
||||
{
|
||||
print_bgp_record(peer->config);
|
||||
}
|
||||
HASH_WALK_END;
|
||||
}
|
||||
|
||||
/**
|
||||
* snmp_bgp_state - linearize oid from BGP4-MIB
|
||||
* @oid: prefixed object identifier from BGP4-MIB::bgp subtree
|
||||
@ -471,6 +532,11 @@ search_bgp_mib(struct snmp_proto *p, struct oid *o_start, struct oid *o_end, uin
|
||||
//u8 state_curr = snmp_bgp_state(o_start);
|
||||
//u8 state_end = (o_end) ? snmp_bgp_state(o_end) : 0;
|
||||
|
||||
|
||||
|
||||
// print debugging information
|
||||
print_bgp_record_all(p);
|
||||
|
||||
if (o_start->include && snmp_bgp_has_value(start_state) &&
|
||||
!is_dynamic(start_state) && o_start->n_subid == 3)
|
||||
{
|
||||
|
@ -66,7 +66,10 @@ snmp_startup_timeout(timer *t)
|
||||
static void
|
||||
snmp_startup(struct snmp_proto *p)
|
||||
{
|
||||
p->state = SNMP_INIT;
|
||||
|
||||
/* starting agentX communicaiton channel */
|
||||
|
||||
log(L_INFO "preparing lock");
|
||||
struct object_lock *lock;
|
||||
log(L_INFO "snmp_startup() object lock state %p", p->lock);
|
||||
@ -258,8 +261,8 @@ static void snmp_show_proto_info(struct proto *P)
|
||||
cli_msg(-1006, "");
|
||||
cli_msg(-1006, " rem. identifier: %u", bp->remote_id);
|
||||
// learn more !!
|
||||
cli_msg(-1006, " admin status: %s", (p->disabled) ? "start" :
|
||||
"stop");
|
||||
cli_msg(-1006, " admin status: %s", (p->disabled) ? "stop" :
|
||||
"start");
|
||||
// version ?
|
||||
cli_msg(-1006, " version: 4");
|
||||
cli_msg(-1006, " local ip: %u", bcf->local_ip);
|
||||
|
@ -106,4 +106,6 @@ struct snmp_proto {
|
||||
uint errs;
|
||||
};
|
||||
|
||||
#define snmp_log(x) log(L_INFO "snmp" x);
|
||||
|
||||
#endif
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "subagent.h"
|
||||
#include "snmp.h"
|
||||
#include "snmp_utils.h"
|
||||
#include "snmp_internal.h"
|
||||
|
||||
#define SNMP_EXPECTED(actual, expected) \
|
||||
bt_debug("%s expected: %3u actual: %3u\n", \
|
||||
|
@ -31,4 +31,5 @@ void snmp_oid_dump(struct oid *oid);
|
||||
|
||||
int snmp_oid_compare(struct oid *left, struct oid *right);
|
||||
|
||||
struct oid *snmp_prefixize(struct snmp_proto *p, struct oid *o, int byte_ord);
|
||||
#endif
|
||||
|
@ -13,8 +13,6 @@
|
||||
#include "snmp_utils.h"
|
||||
#include "bgp_mib.h"
|
||||
|
||||
#include "snmp_internal.h"
|
||||
|
||||
/* =============================================================
|
||||
* Problems
|
||||
* ------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user