summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/agentx.c19
-rw-r--r--lib/smux.h5
-rw-r--r--lib/srv6.c9
-rw-r--r--lib/workqueue.c7
-rw-r--r--lib/workqueue.h5
-rw-r--r--lib/zlog_targets.c4
6 files changed, 31 insertions, 18 deletions
diff --git a/lib/agentx.c b/lib/agentx.c
index 6c2923fcf8..5f62459805 100644
--- a/lib/agentx.c
+++ b/lib/agentx.c
@@ -32,13 +32,15 @@
#include "linklist.h"
#include "lib/version.h"
#include "lib_errors.h"
+#include "hook.h"
+#include "libfrr.h"
#include "xref.h"
XREF_SETUP();
DEFINE_HOOK(agentx_enabled, (), ());
-static int agentx_enabled = 0;
+static bool agentx_enabled = false;
static struct thread_master *agentx_tm;
static struct thread *timeout_thr = NULL;
@@ -226,7 +228,7 @@ DEFUN (agentx_enable,
init_snmp(FRR_SMUX_NAME);
events = list_new();
agentx_events_update();
- agentx_enabled = 1;
+ agentx_enabled = true;
hook_call(agentx_enabled);
}
@@ -245,7 +247,14 @@ DEFUN (no_agentx,
return CMD_WARNING_CONFIG_FAILED;
}
-int smux_enabled(void)
+static int smux_disable(void)
+{
+ agentx_enabled = false;
+
+ return 0;
+}
+
+bool smux_enabled(void)
{
return agentx_enabled;
}
@@ -264,6 +273,8 @@ void smux_init(struct thread_master *tm)
install_node(&agentx_node);
install_element(CONFIG_NODE, &agentx_enable_cmd);
install_element(CONFIG_NODE, &no_agentx_cmd);
+
+ hook_register(frr_early_fini, smux_disable);
}
void smux_agentx_enable(void)
@@ -272,7 +283,7 @@ void smux_agentx_enable(void)
init_snmp(FRR_SMUX_NAME);
events = list_new();
agentx_events_update();
- agentx_enabled = 1;
+ agentx_enabled = true;
}
}
diff --git a/lib/smux.h b/lib/smux.h
index 48c3374236..1d73406a28 100644
--- a/lib/smux.h
+++ b/lib/smux.h
@@ -109,7 +109,10 @@ struct index_oid {
#define SNMP_IP6ADDRESS(V) (*var_len = sizeof(struct in6_addr), (uint8_t *)&V)
-extern int smux_enabled(void);
+/*
+ * Check to see if snmp is enabled or not
+ */
+extern bool smux_enabled(void);
extern void smux_init(struct thread_master *tm);
extern void smux_agentx_enable(void);
diff --git a/lib/srv6.c b/lib/srv6.c
index 5cd82080f5..f4077a86d2 100644
--- a/lib/srv6.c
+++ b/lib/srv6.c
@@ -121,6 +121,13 @@ const char *seg6local_context2str(char *str, size_t size,
}
}
+static void srv6_locator_chunk_list_free(void *data)
+{
+ struct srv6_locator_chunk *chunk = data;
+
+ srv6_locator_chunk_free(&chunk);
+}
+
struct srv6_locator *srv6_locator_alloc(const char *name)
{
struct srv6_locator *locator = NULL;
@@ -128,7 +135,7 @@ struct srv6_locator *srv6_locator_alloc(const char *name)
locator = XCALLOC(MTYPE_SRV6_LOCATOR, sizeof(struct srv6_locator));
strlcpy(locator->name, name, sizeof(locator->name));
locator->chunks = list_new();
- locator->chunks->del = (void (*)(void *))srv6_locator_chunk_free;
+ locator->chunks->del = srv6_locator_chunk_list_free;
QOBJ_REG(locator, srv6_locator);
return locator;
diff --git a/lib/workqueue.c b/lib/workqueue.c
index c703de90b3..a5338ba78b 100644
--- a/lib/workqueue.c
+++ b/lib/workqueue.c
@@ -272,9 +272,6 @@ void work_queue_run(struct thread *thread)
/* dont run items which are past their allowed retries */
if (item->ran > wq->spec.max_retries) {
- /* run error handler, if any */
- if (wq->spec.errorfunc)
- wq->spec.errorfunc(wq, item);
work_queue_item_remove(wq, item);
continue;
}
@@ -317,10 +314,6 @@ void work_queue_run(struct thread *thread)
case WQ_RETRY_NOW:
/* a RETRY_NOW that gets here has exceeded max_tries, same as
* ERROR */
- case WQ_ERROR: {
- if (wq->spec.errorfunc)
- wq->spec.errorfunc(wq, item);
- }
/* fallthru */
case WQ_SUCCESS:
default: {
diff --git a/lib/workqueue.h b/lib/workqueue.h
index 27fb1383eb..7866032fc0 100644
--- a/lib/workqueue.h
+++ b/lib/workqueue.h
@@ -41,7 +41,6 @@ DECLARE_MTYPE(WORK_QUEUE);
/* action value, for use by item processor and item error handlers */
typedef enum {
WQ_SUCCESS = 0,
- WQ_ERROR, /* Error, run error handler if provided */
WQ_RETRY_NOW, /* retry immediately */
WQ_RETRY_LATER, /* retry later, cease processing work queue */
WQ_REQUEUE, /* requeue item, continue processing work queue */
@@ -80,10 +79,6 @@ struct work_queue {
*/
wq_item_status (*workfunc)(struct work_queue *, void *);
- /* error handling function, optional */
- void (*errorfunc)(struct work_queue *,
- struct work_queue_item *);
-
/* callback to delete user specific item data */
void (*del_item_data)(struct work_queue *, void *);
diff --git a/lib/zlog_targets.c b/lib/zlog_targets.c
index 31bd8e16eb..f7ea48bf9d 100644
--- a/lib/zlog_targets.c
+++ b/lib/zlog_targets.c
@@ -257,6 +257,7 @@ bool zlog_file_set_filename(struct zlog_cfg_file *zcf, const char *filename)
return zlog_file_cycle(zcf);
}
assert(0);
+ return false;
}
bool zlog_file_set_fd(struct zlog_cfg_file *zcf, int fd)
@@ -271,6 +272,7 @@ bool zlog_file_set_fd(struct zlog_cfg_file *zcf, int fd)
return zlog_file_cycle(zcf);
}
assert(0);
+ return false;
}
struct rcu_close_rotate {
@@ -544,6 +546,7 @@ int zlog_syslog_get_facility(void)
return syslog_facility;
}
assert(0);
+ return 0;
}
void zlog_syslog_set_prio_min(int prio_min)
@@ -581,4 +584,5 @@ int zlog_syslog_get_prio_min(void)
return syslog_prio_min;
}
assert(0);
+ return 0;
}