+2004-10-13 Hasso Tepper <hasso at quagga.net>
+
+ * bgp_snmp.c: Remove defaults used to initialize smux connection to
+ snmpd. Connection is initialized only if smux peer is configured.
+
2004-10-13 Paul Jakma <paul@dishone.st>
* (global) more const'ification and fixups of types to clean up code.
#define BGPESTABLISHED 1
#define BGPBACKWARDTRANSITION 2
-/* Zebra enterprise BGP MIB. This variable is used for register
- OSPF MIB to SNMP agent under SMUX protocol. */
-#define BGPDMIB 1,3,6,1,4,1,3317,1,2,2
-
/* BGP MIB bgpVersion. */
#define BGPVERSION 0
/* BGP-MIB instances. */
oid bgp_oid [] = { BGP4MIB };
-oid bgpd_oid [] = { BGPDMIB };
/* IP address 0.0.0.0. */
static struct in_addr bgp_empty_addr = {0};
if ( !(bm = bgp_get_master ()) )
return;
- smux_init (bm->master, bgpd_oid, sizeof bgpd_oid / sizeof (oid));
+ smux_init (bm->master);
REGISTER_MIB("mibII/bgp", bgp_variables, variable, bgp_oid);
- smux_start ();
}
#endif /* HAVE_SNMP */
* command.c: Make CMD_ERR_NOTHING_TODO nonfatal if reading
configuration from file. Fixes critical bugzilla #113.
+ * smux.c, smux.h: Remove all defaults to initialize smux connection to
+ snmpd by default even if not configured to do so. "smux peer OID
+ <password>" initializes now connection and "no smux peer" terminates
+ it.
2004-10-13 Paul Jakma <paul@dishone.st>
struct list *treelist;
/* SMUX oid. */
-oid *smux_oid;
+oid *smux_oid = NULL;
size_t smux_oid_len;
-/* SMUX default oid. */
-oid *smux_default_oid;
-size_t smux_default_oid_len;
-
/* SMUX password. */
-char *smux_passwd;
-const char *smux_default_passwd = "";
+char *smux_passwd = NULL;
/* SMUX read threads. */
struct thread *smux_read_thread;
return CMD_WARNING;
}
- if (smux_oid && smux_oid != smux_default_oid)
- free (smux_oid);
+ if (smux_oid)
+ {
+ free (smux_oid);
+ smux_oid = NULL;
+ }
/* careful, smux_passwd might point to string constant */
- if (smux_passwd && smux_passwd != smux_default_passwd)
+ if (smux_passwd)
{
free (smux_passwd);
smux_passwd = NULL;
if (passwd_str)
smux_passwd = strdup (passwd_str);
+ else
+ smux_passwd = strdup ("");
- return CMD_SUCCESS;
+ return 0;
}
int
int
smux_peer_default ()
{
- if (smux_oid != smux_default_oid)
+ if (smux_oid)
{
free (smux_oid);
- smux_oid = smux_default_oid;
- smux_oid_len = smux_default_oid_len;
+ smux_oid = NULL;
}
/* careful, smux_passwd might be pointing at string constant */
- if (smux_passwd != smux_default_passwd)
+ if (smux_passwd)
{
free (smux_passwd);
- smux_passwd = (char *)smux_default_passwd;
+ smux_passwd = NULL;
}
+
return CMD_SUCCESS;
}
"SNMP MUX peer settings\n"
"Object ID used in SMUX peering\n")
{
- return smux_peer_oid (vty, argv[0], NULL);
+ if (smux_peer_oid (vty, argv[0], NULL) == 0)
+ {
+ smux_start();
+ return CMD_SUCCESS;
+ }
+ else
+ return CMD_WARNING;
}
DEFUN (smux_peer_password,
"SMUX peering object ID\n"
"SMUX peering password\n")
{
- return smux_peer_oid (vty, argv[0], argv[1]);
+ if (smux_peer_oid (vty, argv[0], argv[1]) == 0)
+ {
+ smux_start();
+ return CMD_SUCCESS;
+ }
+ else
+ return CMD_WARNING;
}
DEFUN (no_smux_peer,
no_smux_peer_cmd,
- "no smux peer OID",
+ "no smux peer",
NO_STR
"SNMP MUX protocol settings\n"
- "SNMP MUX peer settings\n"
- "Object ID used in SMUX peering\n")
+ "SNMP MUX peer settings\n")
{
+ smux_stop();
return smux_peer_default ();
}
-DEFUN (no_smux_peer_password,
- no_smux_peer_password_cmd,
+ALIAS (no_smux_peer,
+ no_smux_peer_oid_cmd,
+ "no smux peer OID",
+ NO_STR
+ "SNMP MUX protocol settings\n"
+ "SNMP MUX peer settings\n"
+ "SMUX peering object ID\n")
+
+ALIAS (no_smux_peer,
+ no_smux_peer_oid_password_cmd,
"no smux peer OID PASSWORD",
NO_STR
"SNMP MUX protocol settings\n"
"SNMP MUX peer settings\n"
"SMUX peering object ID\n"
"SMUX peering password\n")
-{
- return smux_peer_default ();
-}
int
config_write_smux (struct vty *vty)
int first = 1;
unsigned int i;
- if (smux_oid != smux_default_oid || smux_passwd != smux_default_passwd)
+ if (smux_oid)
{
vty_out (vty, "smux peer ");
for (i = 0; i < smux_oid_len; i++)
/* Initialize some values then schedule first SMUX connection. */
void
-smux_init (struct thread_master *tm, oid defoid[], size_t defoid_len)
+smux_init (struct thread_master *tm)
{
- /* Set default SMUX oid. */
- smux_default_oid = defoid;
- smux_default_oid_len = defoid_len;
-
- smux_oid = smux_default_oid;
- smux_oid_len = smux_default_oid_len;
-
- /* be careful with smux_passwd, points to string constant by default */
- smux_passwd = (char *)smux_default_passwd;
-
/* copy callers thread master */
master = tm;
install_element (CONFIG_NODE, &smux_peer_cmd);
install_element (CONFIG_NODE, &smux_peer_password_cmd);
install_element (CONFIG_NODE, &no_smux_peer_cmd);
- install_element (CONFIG_NODE, &no_smux_peer_password_cmd);
+ install_element (CONFIG_NODE, &no_smux_peer_oid_cmd);
+ install_element (CONFIG_NODE, &no_smux_peer_oid_password_cmd);
}
void
(u_char *) &snmp_in_addr_val \
)
-void smux_init (struct thread_master *tm, oid [], size_t);
+void smux_init (struct thread_master *tm);
void smux_start (void);
void smux_register_mib(const char *, struct variable *, size_t, int, oid [], size_t);
int smux_header_generic (struct variable *, oid [], size_t *, int, size_t *,
+2004-10-12 Hasso Tepper <hasso at quagga.net>
+
+ * ospf6_snmp.c: Remove defaults used to initialize smux connection to
+ snmpd. Connection is initialized only if smux peer is configured.
+
2004-10-11 Hasso Tepper <hasso at quagga.net>
* osp6_top.c, ospf6_top.h: Better handling for router-id. If we use
/* OSPFv3-MIB */
#define OSPFv3MIB 1,3,6,1,3,102
-/* Zebra enterprise ospf6d MIB */
-#define OSPF6DOID 1,3,6,1,4,1,3317,1,2,6
-
/* OSPFv3 MIB General Group values. */
#define OSPFv3ROUTERID 1
#define OSPFv3ADMINSTAT 2
/* OSPFv3-MIB instances. */
oid ospfv3_oid [] = { OSPFv3MIB };
-oid ospf6d_oid [] = { OSPF6DOID };
/* empty ID 0.0.0.0 e.g. empty router-id */
static struct in_addr ospf6_empty_id = {0};
void
ospf6_snmp_init (struct thread_master *master)
{
- smux_init (master, ospf6d_oid, sizeof (ospf6d_oid) / sizeof (oid));
+ smux_init (master);
REGISTER_MIB ("OSPFv3MIB", ospfv3_variables, variable, ospfv3_oid);
- smux_start ();
}
#endif /* HAVE_SNMP */
2004-10-13 Hasso Tepper <hasso at quagga.net>
* ospf_main.c: Unbreak compilation with ospfapi disabled.
+ * ospf_snmp.c: Remove defaults used to initialize smux connection to
+ snmpd. Connection is initialized only if smux peer is configured.
2004-10-12 Hasso Tepper <hasso at quagga.net>
/* OSPF2-MIB. */
#define OSPF2MIB 1,3,6,1,2,1,14
-/* Zebra enterprise OSPF MIB. This variable is used for register
- OSPF MIB to SNMP agent under SMUX protocol. */
-#define OSPFDOID 1,3,6,1,4,1,3317,1,2,5
-
/* OSPF MIB General Group values. */
#define OSPFROUTERID 1
#define OSPFADMINSTAT 2
/* OSPF-MIB instances. */
oid ospf_oid [] = { OSPF2MIB };
-oid ospfd_oid [] = { OSPFDOID };
/* IP address 0.0.0.0. */
static struct in_addr ospf_empty_addr = {0};
{
ospf_snmp_iflist = list_new ();
ospf_snmp_vl_table = route_table_init ();
- smux_init (om->master, ospfd_oid, sizeof (ospfd_oid) / sizeof (oid));
+ smux_init (om->master);
REGISTER_MIB("mibII/ospf", ospf_variables, variable, ospf_oid);
- smux_start ();
}
#endif /* HAVE_SNMP */
+2004-10-13 Hasso Tepper <hasso at quagga.net>
+
+ * ripd_snmp.c: Remove defaults used to initialize smux connection to
+ snmpd. Connection is initialized only if smux peer is configured.
+
2004-10-11 Hasso Tepper <hasso at quagga.net>
* *.c: Make more strings const.
/* RIPv2-MIB. */
#define RIPV2MIB 1,3,6,1,2,1,23
-/* Zebra enterprise RIP MIB. This variable is used for register
- RIPv2-MIB to SNMP agent under SMUX protocol. */
-#define RIPDOID 1,3,6,1,4,1,3317,1,2,3
-
/* RIPv2-MIB rip2Globals values. */
#define RIP2GLOBALROUTECHANGES 1
#define RIP2GLOBALQUERIES 2
/* RIP-MIB instances. */
oid rip_oid [] = { RIPV2MIB };
-oid ripd_oid [] = { RIPDOID };
/* Interface cache table sorted by interface's address. */
struct route_table *rip_ifaddr_table;
{
rip_ifaddr_table = route_table_init ();
- smux_init (master, ripd_oid, sizeof (ripd_oid) / sizeof (oid));
+ smux_init (master);
REGISTER_MIB("mibII/rip", rip_variables, variable, rip_oid);
- smux_start ();
}
#endif /* HAVE_SNMP */
+2004-10-13 Hasso Tepper <hasso at quagga.net>
+
+ * zebra_snmp.c: Remove defaults used to initialize smux connection to
+ snmpd. Connection is initialized only if smux peer is configured.
+
2004-10-12 Hasso Tepper <hasso at quagga.net>
* zebra_vty.c: Unbreak "show ip route" command help and make it work
#include "zebra/zserv.h"
\f
#define IPFWMIB 1,3,6,1,2,1,4,24
-#define ZEBRAOID 1,3,6,1,4,1,3317,1,2,1
/* ipForwardTable */
#define IPFORWARDDEST 1
extern struct zebra_t zebrad;
oid ipfw_oid [] = { IPFWMIB };
-oid zebra_oid [] = { ZEBRAOID };
/* Hook functions. */
u_char * ipFwNumber ();
void
zebra_snmp_init ()
{
- smux_init (zebrad.master, zebra_oid, sizeof (zebra_oid) / sizeof (oid));
+ smux_init (zebrad.master);
REGISTER_MIB("mibII/ipforward", zebra_variables, variable, ipfw_oid);
- smux_start ();
}
#endif /* HAVE_SNMP */