summaryrefslogtreecommitdiffstats
path: root/lib/agentx.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/agentx.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/agentx.c b/lib/agentx.c
index 45f14c2..70ee675 100644
--- a/lib/agentx.c
+++ b/lib/agentx.c
@@ -4,12 +4,14 @@
*/
#include <zebra.h>
+#include <fcntl.h>
#ifdef SNMP_AGENTX
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include <net-snmp/agent/snmp_vars.h>
+#include <net-snmp/library/large_fd_set.h>
#include "command.h"
#include "smux.h"
@@ -43,7 +45,7 @@ static void agentx_timeout(struct event *t)
static void agentx_read(struct event *t)
{
- fd_set fds;
+ netsnmp_large_fd_set lfds;
int flags, new_flags = 0;
int nonblock = false;
struct listnode *ln = EVENT_ARG(t);
@@ -68,9 +70,9 @@ static void agentx_read(struct event *t)
flog_err(EC_LIB_SYSTEM_CALL, "Failed to set snmp fd non blocking: %s(%d)",
strerror(errno), errno);
- FD_ZERO(&fds);
- FD_SET(EVENT_FD(t), &fds);
- snmp_read(&fds);
+ netsnmp_large_fd_set_init(&lfds, FD_SETSIZE);
+ netsnmp_large_fd_setfd(t->u.fd, &lfds);
+ snmp_read2(&lfds);
/* Reset the flag */
if (!nonblock) {
@@ -85,6 +87,7 @@ static void agentx_read(struct event *t)
netsnmp_check_outstanding_agent_requests();
agentx_events_update();
+ netsnmp_large_fd_set_cleanup(&lfds);
}
static void agentx_events_update(void)
@@ -92,15 +95,15 @@ static void agentx_events_update(void)
int maxfd = 0;
int block = 1;
struct timeval timeout = {.tv_sec = 0, .tv_usec = 0};
- fd_set fds;
+ netsnmp_large_fd_set lfds;
struct listnode *ln;
struct event **thr;
int fd, thr_fd;
event_cancel(&timeout_thr);
- FD_ZERO(&fds);
- snmp_select_info(&maxfd, &fds, &timeout, &block);
+ netsnmp_large_fd_set_init(&lfds, FD_SETSIZE);
+ snmp_select_info2(&maxfd, &lfds, &timeout, &block);
if (!block) {
event_add_timer_tv(agentx_tm, agentx_timeout, NULL, &timeout,
@@ -118,7 +121,7 @@ static void agentx_events_update(void)
/* caught up */
if (thr_fd == fd) {
struct listnode *nextln = listnextnode(ln);
- if (!FD_ISSET(fd, &fds)) {
+ if (!netsnmp_large_fd_is_set(fd, &lfds)) {
event_cancel(thr);
XFREE(MTYPE_TMP, thr);
list_delete_node(events, ln);
@@ -128,7 +131,7 @@ static void agentx_events_update(void)
thr_fd = thr ? EVENT_FD(*thr) : -1;
}
/* need listener, but haven't hit one where it would be */
- else if (FD_ISSET(fd, &fds)) {
+ else if (netsnmp_large_fd_is_set(fd, &lfds)) {
struct listnode *newln;
thr = XCALLOC(MTYPE_TMP, sizeof(struct event *));
@@ -147,6 +150,7 @@ static void agentx_events_update(void)
list_delete_node(events, ln);
ln = nextln;
}
+ netsnmp_large_fd_set_cleanup(&lfds);
}
/* AgentX node. */