summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_snmp.c8
-rw-r--r--lib/smux.c12
-rw-r--r--lib/smux.h4
-rw-r--r--ospfd/ospf_snmp.c4
-rw-r--r--ripd/rip_snmp.c8
-rw-r--r--zebra/zebra_snmp.c5
6 files changed, 30 insertions, 11 deletions
diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c
index 598fc3cd..6e9beab4 100644
--- a/bgpd/bgp_snmp.c
+++ b/bgpd/bgp_snmp.c
@@ -242,6 +242,7 @@ struct variable bgp_variables[] =
{BGP4PATHATTRUNKNOWN, OCTET_STRING, RONLY, bgp4PathAttrTable,
3, {6, 1, 14}},
};
+
static u_char *
bgpVersion (struct variable *v, oid name[], size_t *length, int exact,
@@ -874,7 +875,12 @@ bgpTrapBackwardTransition (struct peer *peer)
void
bgp_snmp_init ()
{
- smux_init (bgpd_oid, sizeof bgpd_oid / sizeof (oid));
+ struct bgp_master *bm;
+
+ if ( !(bm = bgp_get_master ()) )
+ return;
+
+ smux_init (bm->master, bgpd_oid, sizeof bgpd_oid / sizeof (oid));
REGISTER_MIB("mibII/bgp", bgp_variables, variable, bgp_oid);
smux_start ();
}
diff --git a/lib/smux.c b/lib/smux.c
index 952c5a81..c6884d1b 100644
--- a/lib/smux.c
+++ b/lib/smux.c
@@ -29,7 +29,6 @@
#include <snmp.h>
#include <snmp_impl.h>
-#include "smux.h"
#include "log.h"
#include "thread.h"
#include "linklist.h"
@@ -37,6 +36,7 @@
#include "version.h"
#include "memory.h"
#include "sockunion.h"
+#include "smux.h"
#define min(A,B) ((A) < (B) ? (A) : (B))
@@ -81,6 +81,9 @@ struct cmd_node smux_node =
SMUX_NODE,
"" /* SMUX has no interface. */
};
+
+/* thread master */
+static struct thread_master *master;
void *
oid_copy (void *dest, void *src, size_t size)
@@ -1224,7 +1227,7 @@ smux_stop ()
}
}
-extern struct thread_master *master;
+
void
smux_event (enum smux_event event, int sock)
@@ -1471,7 +1474,7 @@ smux_tree_cmp(struct subtree *tree1, struct subtree *tree2)
/* Initialize some values then schedule first SMUX connection. */
void
-smux_init (oid defoid[], size_t defoid_len)
+smux_init (struct thread_master *tm, oid defoid[], size_t defoid_len)
{
/* Set default SMUX oid. */
smux_default_oid = defoid;
@@ -1480,6 +1483,9 @@ smux_init (oid defoid[], size_t defoid_len)
smux_oid = smux_default_oid;
smux_oid_len = smux_default_oid_len;
smux_passwd = smux_default_passwd;
+
+ /* copy callers thread master */
+ master = tm;
/* Make MIB tree. */
treelist = list_new();
diff --git a/lib/smux.h b/lib/smux.h
index 91c3d46f..1d259932 100644
--- a/lib/smux.h
+++ b/lib/smux.h
@@ -144,12 +144,12 @@ struct trap_object
(u_char *) &snmp_in_addr_val \
)
-void smux_init (oid [], size_t);
+void smux_init (struct thread_master *tm, oid [], size_t);
void smux_start (void);
void smux_register_mib(char *, struct variable *, size_t, int, oid [], size_t);
int smux_header_generic (struct variable *, oid [], size_t *, int, size_t *,
WriteMethod **);
-int smux_trap (oid *, size_t, oid *, size_t, struct trap_object *, size_t, unsigned int);
+int smux_trap (oid *, size_t, oid *, size_t, struct trap_object *, size_t, unsigned int, u_char);
int oid_compare (oid *, int, oid *, int);
void oid2in_addr (oid [], int, struct in_addr *);
diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c
index 2e1a9b3c..41955ba5 100644
--- a/ospfd/ospf_snmp.c
+++ b/ospfd/ospf_snmp.c
@@ -2477,9 +2477,11 @@ ospfAreaAggregateEntry (struct variable *v, oid *name, size_t *length,
void
ospf_snmp_init ()
{
+ struct ospf *ospf;
+
ospf_snmp_iflist = list_new ();
ospf_snmp_vl_table = route_table_init ();
- smux_init (ospfd_oid, sizeof (ospfd_oid) / sizeof (oid));
+ smux_init (om->master, ospfd_oid, sizeof (ospfd_oid) / sizeof (oid));
REGISTER_MIB("mibII/ospf", ospf_variables, variable, ospf_oid);
smux_start ();
}
diff --git a/ripd/rip_snmp.c b/ripd/rip_snmp.c
index 5a5060fd..72f0ff2d 100644
--- a/ripd/rip_snmp.c
+++ b/ripd/rip_snmp.c
@@ -152,6 +152,8 @@ struct variable rip_variables[] =
{RIP2PEERRCVBADROUTES, COUNTER, RONLY, rip2PeerTable,
3, {4, 1, 6}}
};
+
+extern struct thread_master *master;
static u_char *
rip2Globals (struct variable *v, oid name[], size_t *length,
@@ -406,9 +408,9 @@ rip2IfConfSend (struct rip_interface *ri)
return ripVersion1;
else if (rip)
{
- if (rip->version == RIPv2)
+ if (rip->version_send == RIPv2)
return ripVersion2;
- else if (rip->version == RIPv1)
+ else if (rip->version_send == RIPv1)
return ripVersion1;
}
return doNotSend;
@@ -573,7 +575,7 @@ rip_snmp_init ()
{
rip_ifaddr_table = route_table_init ();
- smux_init (ripd_oid, sizeof (ripd_oid) / sizeof (oid));
+ smux_init (master, ripd_oid, sizeof (ripd_oid) / sizeof (oid));
REGISTER_MIB("mibII/rip", rip_variables, variable, rip_oid);
smux_start ();
}
diff --git a/zebra/zebra_snmp.c b/zebra/zebra_snmp.c
index 051aaaa7..5095095c 100644
--- a/zebra/zebra_snmp.c
+++ b/zebra/zebra_snmp.c
@@ -37,6 +37,7 @@
#include "table.h"
#include "zebra/rib.h"
+#include "zebra/zserv.h"
#define IPFWMIB 1,3,6,1,2,1,4,24
#define ZEBRAOID 1,3,6,1,4,1,3317,1,2,1
@@ -83,6 +84,8 @@
#define IPADDRESS ASN_IPADDRESS
#define OBJECTIDENTIFIER ASN_OBJECT_ID
+extern struct zebra_t zebrad;
+
oid ipfw_oid [] = { IPFWMIB };
oid zebra_oid [] = { ZEBRAOID };
@@ -561,7 +564,7 @@ ipCidrTable (struct variable *v, oid objid[], size_t *objid_len,
void
zebra_snmp_init ()
{
- smux_init (zebra_oid, sizeof (zebra_oid) / sizeof (oid));
+ smux_init (zebrad.master, zebra_oid, sizeof (zebra_oid) / sizeof (oid));
REGISTER_MIB("mibII/ipforward", zebra_variables, variable, ipfw_oid);
smux_start ();
}