* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
#include "memory.h"
#include "linklist.h"
#include "version.h"
+#include "lib_errors.h"
static int agentx_enabled = 0;
FD_ZERO(&fds);
snmp_select_info(&maxfd, &fds, &timeout, &block);
- if (!block)
- timeout_thr = thread_add_timer_tv(agentx_tm, agentx_timeout,
- NULL, &timeout);
+ if (!block) {
+ timeout_thr = NULL;
+ thread_add_timer_tv(agentx_tm, agentx_timeout, NULL, &timeout,
+ &timeout_thr);
+ }
ln = listhead(events);
thr = ln ? listgetdata(ln) : NULL;
/* need listener, but haven't hit one where it would be */
else if (FD_ISSET(fd, &fds)) {
struct listnode *newln;
- thr = thread_add_read(agentx_tm, agentx_read, NULL, fd);
+ thr = NULL;
+ thread_add_read(agentx_tm, agentx_read, NULL, fd, &thr);
newln = listnode_add_before(events, ln, thr);
thr->arg = newln;
}
}
/* AgentX node. */
-static struct cmd_node agentx_node = {
- SMUX_NODE, "" /* AgentX has no interface. */
-};
+static struct cmd_node agentx_node = {SMUX_NODE,
+ "", /* AgentX has no interface. */
+ 1};
/* Logging NetSNMP messages */
static int agentx_log_callback(int major, int minor, void *serverarg,
msg[strlen(msg) - 1] = '\0';
switch (slm->priority) {
case LOG_EMERG:
- zlog_err("snmp[emerg]: %s", msg ? msg : slm->msg);
+ flog_err(EC_LIB_SNMP, "snmp[emerg]: %s", msg ? msg : slm->msg);
break;
case LOG_ALERT:
- zlog_err("snmp[alert]: %s", msg ? msg : slm->msg);
+ flog_err(EC_LIB_SNMP, "snmp[alert]: %s", msg ? msg : slm->msg);
break;
case LOG_CRIT:
- zlog_err("snmp[crit]: %s", msg ? msg : slm->msg);
+ flog_err(EC_LIB_SNMP, "snmp[crit]: %s", msg ? msg : slm->msg);
break;
case LOG_ERR:
- zlog_err("snmp[err]: %s", msg ? msg : slm->msg);
+ flog_err(EC_LIB_SNMP, "snmp[err]: %s", msg ? msg : slm->msg);
break;
case LOG_WARNING:
- zlog_warn("snmp[warning]: %s", msg ? msg : slm->msg);
+ flog_warn(EC_LIB_SNMP, "snmp[warning]: %s",
+ msg ? msg : slm->msg);
break;
case LOG_NOTICE:
zlog_notice("snmp[notice]: %s", msg ? msg : slm->msg);
static int config_write_agentx(struct vty *vty)
{
if (agentx_enabled)
- vty_out(vty, "agentx%s", VTY_NEWLINE);
- return 0;
+ vty_out(vty, "agentx\n");
+ return 1;
}
DEFUN (agentx_enable,
agentx_enable_cmd,
"agentx",
- "SNMP AgentX protocol settings\n"
- "SNMP AgentX settings\n")
+ "SNMP AgentX protocol settings\n")
{
if (!agentx_enabled) {
init_snmp(FRR_SMUX_NAME);
events = list_new();
agentx_events_update();
agentx_enabled = 1;
- return CMD_SUCCESS;
}
- vty_out(vty, "SNMP AgentX already enabled%s", VTY_NEWLINE);
- return CMD_WARNING;
+
+ return CMD_SUCCESS;
}
DEFUN (no_agentx,
no_agentx_cmd,
"no agentx",
NO_STR
- "SNMP AgentX protocol settings\n"
- "SNMP AgentX settings\n")
+ "SNMP AgentX protocol settings\n")
{
if (!agentx_enabled)
return CMD_SUCCESS;
- vty_out(vty, "SNMP AgentX support cannot be disabled once enabled%s",
- VTY_NEWLINE);
- return CMD_WARNING;
+ vty_out(vty, "SNMP AgentX support cannot be disabled once enabled\n");
+ return CMD_WARNING_CONFIG_FAILED;
}
void smux_init(struct thread_master *tm)
size_t enamelen, const oid *name, size_t namelen,
const oid *iname, size_t inamelen,
const struct trap_object *trapobj, size_t trapobjlen,
- u_char sptrap)
+ uint8_t sptrap)
{
oid objid_snmptrap[] = {1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0};
size_t objid_snmptrap_len = sizeof objid_snmptrap / sizeof(oid);
notification_oid_len = enamelen + 1;
snmp_varlist_add_variable(¬ification_vars, objid_snmptrap,
objid_snmptrap_len, ASN_OBJECT_ID,
- (u_char *)notification_oid,
+ (uint8_t *)notification_oid,
notification_oid_len * sizeof(oid));
/* Provided bindings */
unsigned int j;
oid oid[MAX_OID_LEN];
size_t oid_len, onamelen;
- u_char *val;
+ uint8_t *val;
size_t val_len;
WriteMethod *wm = NULL;
struct variable cvp;