diff -Naur a/keepalived/vrrp/vrrp_ipset.c b/keepalived/vrrp/vrrp_ipset.c
--- a/keepalived/vrrp/vrrp_ipset.c 2020-03-30 11:16:29.420721279 -0500
+++ b/keepalived/vrrp/vrrp_ipset.c 2020-03-30 11:16:57.188181698 -0500
@@ -52,11 +52,11 @@
#include <dlfcn.h>
/* The addresses of the functions we want */
-struct ipset_session* (*ipset_session_init_addr)(ipset_outfn outfn);
+struct ipset_session* (*ipset_session_init_addr)(ipset_print_outfn outfn, const void *p);
int (*ipset_session_fini_addr)(struct ipset_session *session);
struct ipset_data* (*ipset_session_data_addr)(const struct ipset_session *session);
const char* (*ipset_session_error_addr)(const struct ipset_session *session);
-int (*ipset_envopt_parse_addr)(struct ipset_session *session, int env, const char *str);
+void (*ipset_envopt_set_addr)(struct ipset_session *session, int env);
const struct ipset_type* (*ipset_type_get_addr)(struct ipset_session *session, enum ipset_cmd cmd);
int (*ipset_data_set_addr)(struct ipset_data *data, enum ipset_opt opt, const void *value);
int (*ipset_cmd_addr)(struct ipset_session *session, enum ipset_cmd cmd, uint32_t lineno);
@@ -66,8 +66,7 @@
#define ipset_session_init (*ipset_session_init_addr)
#define ipset_session_fini (*ipset_session_fini_addr)
#define ipset_session_data (*ipset_session_data_addr)
-#define ipset_session_error (*ipset_session_error_addr)
-#define ipset_envopt_parse (*ipset_envopt_parse_addr)
+#define ipset_envopt_set (*ipset_envopt_set_addr)
#define ipset_type_get (*ipset_type_get_addr)
#define ipset_data_set (*ipset_data_set_addr)
/* Unfortunately ipset_cmd conflicts with struct ipset_cmd */
@@ -79,6 +78,21 @@
#define ipset_cmd1 ipset_cmd
#endif
+static int
+__attribute__ ((format(printf, 3, 4)))
+ipset_printf(__attribute ((__unused__)) struct ipset_session *session, void *p, const char *fmt, ...)
+{
+ va_list args;
+
+ log_message(LOG_INFO, "libipset message from %s", (const char *)p);
+
+ va_start(args, fmt);
+ vlog_message(LOG_INFO, fmt, args);
+ va_end(args);
+
+ return 0;
+}
+
static bool
do_ipset_cmd(struct ipset_session* session, enum ipset_cmd cmd, const char *setname,
const ip_address_t *addr, uint32_t timeout, const char* iface)
@@ -152,7 +166,7 @@
{
struct ipset_session *session;
- session = ipset_session_init(printf);
+ session = ipset_session_init(ipset_printf, "create_sets");
if (!session) {
log_message(LOG_INFO, "Cannot initialize ipset session.");
return false;
@@ -161,7 +175,7 @@
/* If we aren't reloading, don't worry if sets already exists. With the
* IPSET_ENV_EXIST option set, any existing entries in the set are removed. */
if (!reload)
- ipset_envopt_parse(session, IPSET_ENV_EXIST, NULL);
+ ipset_envopt_set(session, IPSET_ENV_EXIST);
if (block_ipv4) {
if (!reload || !has_ipset_setname(session, addr4))
@@ -242,8 +256,7 @@
if (!(ipset_session_init_addr = dlsym(libipset_handle, "ipset_session_init")) ||
!(ipset_session_fini_addr = dlsym(libipset_handle, "ipset_session_fini")) ||
!(ipset_session_data_addr = dlsym(libipset_handle,"ipset_session_data")) ||
- !(ipset_session_error_addr = dlsym(libipset_handle,"ipset_session_error")) ||
- !(ipset_envopt_parse_addr = dlsym(libipset_handle,"ipset_envopt_parse")) ||
+ !(ipset_envopt_set_addr = dlsym(libipset_handle,"ipset_envopt_set")) ||
!(ipset_type_get_addr = dlsym(libipset_handle,"ipset_type_get")) ||
!(ipset_data_set_addr = dlsym(libipset_handle,"ipset_data_set")) ||
!(ipset_cmd_addr = dlsym(libipset_handle,"ipset_cmd")) ||
@@ -275,7 +288,7 @@
return true;
#endif
- session = ipset_session_init(printf);
+ session = ipset_session_init(ipset_printf, "remove_ipsets");
if (!session) {
log_message(LOG_INFO, "Cannot initialize ipset session.");
return false;
@@ -301,7 +314,7 @@
struct ipset_session* ipset_session_start(void)
{
- return ipset_session_init(NULL);
+ return ipset_session_init(ipset_printf, "session_start");
}
void ipset_session_end(struct ipset_session* session)