Compare commits

...

No commits in common. 'c9' and 'c8' have entirely different histories.
c9 ... c8

@ -1 +1 @@
73d7dce4312b006983b11367e4a43d4ec52cf888 SOURCES/OpenIPMI-2.0.32.tar.gz
5b9494e61d8fbcee05d6cea3c688f7f69fded4e7 SOURCES/OpenIPMI-2.0.31.tar.gz

2
.gitignore vendored

@ -1 +1 @@
SOURCES/OpenIPMI-2.0.32.tar.gz
SOURCES/OpenIPMI-2.0.31.tar.gz

@ -1,73 +0,0 @@
diff --git a/lanserv/lanserv_ipmi.c b/lanserv/lanserv_ipmi.c
index ccd60015..e707454e 100644
--- a/lanserv/lanserv_ipmi.c
+++ b/lanserv/lanserv_ipmi.c
@@ -882,6 +882,12 @@ handle_temp_session(lanserv_data_t *lan, msg_t *msg)
}
auth = msg->data[0] & 0xf;
+ if (auth >= MAX_IPMI_AUTHS) {
+ lan->sysinfo->log(lan->sysinfo, NEW_SESSION_FAILED, msg,
+ "Activate session failed: Invalid auth: 0x%x", auth);
+ return;
+ }
+
user = &(lan->users[user_idx]);
if (! (user->valid)) {
lan->sysinfo->log(lan->sysinfo, NEW_SESSION_FAILED, msg,
@@ -3016,17 +3022,33 @@ ipmi_handle_lan_msg(lanserv_data_t *lan,
{
msg_t msg;
+ memset(&msg, 0, sizeof(msg));
+
msg.src_addr = from_addr;
msg.src_len = from_len;
msg.oem_data = 0;
+ msg.channel = lan->channel.channel_num;
+ msg.orig_channel = &lan->channel;
+
+ /*
+ * Initialize the data so the log won't crash if it gets called, and
+ * so the log might have useful info.
+ */
+ msg.data = data;
+ msg.len = len;
+
if (len < 5) {
lan->sysinfo->log(lan->sysinfo, LAN_ERR, &msg,
"LAN msg failure: message too short");
return;
}
+ /* Length is at least marginally correct, skip the first part now. */
+ msg.data = data + 5;
+ msg.len = len - 5;
+
if (data[2] != 0xff) {
lan->sysinfo->log(lan->sysinfo, LAN_ERR, &msg,
"LAN msg failure: seq not ff");
@@ -3034,17 +3056,15 @@ ipmi_handle_lan_msg(lanserv_data_t *lan,
}
msg.authtype = data[4];
- msg.data = data+5;
- msg.len = len - 5;
- msg.channel = lan->channel.channel_num;
- msg.orig_channel = &lan->channel;
-
if (msg.authtype == IPMI_AUTHTYPE_RMCP_PLUS) {
ipmi_handle_rmcpp_msg(lan, &msg);
+ } else if (msg.authtype >= MAX_IPMI_AUTHS) {
+ lan->sysinfo->log(lan->sysinfo, LAN_ERR, &msg,
+ "LAN msg failure: Invalid authtype: %d", data[4]);
+ return;
} else {
ipmi_handle_rmcp_msg(lan, &msg);
}
-
}
static void

@ -0,0 +1,12 @@
diff -urNp a/unix/posix_thread_os_hnd.c b/unix/posix_thread_os_hnd.c
--- a/unix/posix_thread_os_hnd.c 2021-08-02 15:36:49.536860558 +0200
+++ b/unix/posix_thread_os_hnd.c 2021-08-02 15:38:48.990041616 +0200
@@ -140,8 +140,6 @@ add_fd(os_handler_t *handler,
fd_data->data_ready = data_ready;
fd_data->handler = handler;
fd_data->freed = freed;
- sel_set_fd_write_handler(posix_sel, fd, SEL_FD_HANDLER_DISABLED);
- sel_set_fd_except_handler(posix_sel, fd, SEL_FD_HANDLER_DISABLED);
rv = sel_set_fd_handlers(posix_sel, fd, fd_data, fd_handler, NULL, NULL,
free_fd_data);
if (rv) {

@ -1,12 +0,0 @@
diff -up OpenIPMI-2.0.32/cmdlang/cmdlang.c~ OpenIPMI-2.0.32/cmdlang/cmdlang.c
--- OpenIPMI-2.0.32/cmdlang/cmdlang.c~ 2021-01-22 19:51:28.000000000 +0100
+++ OpenIPMI-2.0.32/cmdlang/cmdlang.c 2022-01-28 11:55:42.375470392 +0100
@@ -32,6 +32,8 @@
*/
+#include <config.h>
+
#include <errno.h>
#include <string.h>
#include <ctype.h>

@ -4,7 +4,6 @@
# ipmi: OpenIPMI Driver helper script
#
# Authors: Jan Safranek <jsafrane@redhat.com>
# Václav Doležal <vdolezal@redhat.com>
#
# Based on IPMI init script by:
# Matt Domsch <Matt_Domsch@dell.com>
@ -31,6 +30,11 @@ INTF_NUM=0
IPMI_SMB_MODULE_NAME="ipmi_smb"
IPMI_SI_MODULE_NAME="ipmi_si"
kernel=`uname -r | cut -d. -f1-2`
if [ "${kernel}" == "2.4" ]; then
IPMI_SMB_MODULE_NAME="ipmi_smb_intf"
IPMI_SI_MODULE_NAME="ipmi_si_drv"
fi
MODULES_INTERFACES=""
[ "${DEV_IPMI}" = "yes" ] && MODULES_INTERFACES="${MODULES_INTERFACES} ipmi_devintf"
@ -51,6 +55,17 @@ RETVAL=0
LOCKFILE=/var/lock/subsys/ipmi
DEV_IPMI_TIMEOUT=150
UDEV_EXISTS=0
if [ -e /sbin/udev -o -e /sbin/udevd ]; then
UDEV_EXISTS=1
fi
#############################################################################
# NOTES:
# * /dev/ipmi0 is unconditionally deleted here on ipmi_devintf unload,
# because SLES9 and RHEL4 kernels don't send a message for udev to delete
# it for us.
#
#############################################################################
modules_loaded_verbose()
@ -58,7 +73,7 @@ modules_loaded_verbose()
OnePlusLoaded=0
OnePlusUnloaded=0
for m in $@; do
if /sbin/lsmod | grep -q $m ; then
if /sbin/lsmod | grep $m >/dev/null 2>&1 ; then
echo "$m module loaded."
OnePlusLoaded=1
else
@ -73,7 +88,7 @@ modules_loaded()
OnePlusLoaded=0
OnePlusUnloaded=0
for m in $@; do
if /sbin/lsmod | grep -q $m ; then
if /sbin/lsmod | grep $m >/dev/null 2>&1 ; then
OnePlusLoaded=1
else
OnePlusUnloaded=1
@ -139,6 +154,13 @@ start_watchdog_common()
RETVAL=$((RETVAL | 2)) &&
echo "Watchdog startup failed: cannot load ipmi_watchdog module" &&
return
if [ ${UDEV_EXISTS} -eq 0 -a ! -e /dev/watchdog ]; then
mknod -m 0600 /dev/watchdog c 10 130
[ $? -ne 0 ] &&
RETVAL=$((RETVAL | 8)) &&
echo "Watchdog startup failed: cannot create /dev/watchdog" &&
return
fi
}
start_watchdog_quiet()
@ -164,6 +186,10 @@ stop_watchdog()
if [ ${OnePlusLoaded} -ne 0 ]; then
RETVAL=$((RETVAL | 32))
echo "Watchog shutdown failed: cannot unload ipmi_watchdog module"
else
if [ "${IPMI_WATCHDOG}" = "yes" ]; then
[ ${UDEV_EXISTS} -eq 0 ] && rm -f /dev/watchdog
fi
fi
}
@ -173,6 +199,10 @@ stop_watchdog_quiet()
modules_loaded ipmi_watchdog
if [ ${OnePlusLoaded} -ne 0 ]; then
RETVAL=$((RETVAL | 32))
else
if [ "${IPMI_WATCHDOG}" = "yes" ]; then
[ ${UDEV_EXISTS} -eq 0 ] && rm -f /dev/watchdog
fi
fi
}
@ -181,9 +211,9 @@ start_powercontrol_common()
local poweroff_opts=""
load_hw_modules
if [ "${IPMI_POWERCYCLE}" == "yes" ]; then
modinfo ipmi_poweroff 2>/dev/null | grep -q poweroff_control && \
modinfo ipmi_poweroff 2>/dev/null | grep poweroff_control > /dev/null 2>&1 && \
poweroff_opts="poweroff_control=2"
modinfo ipmi_poweroff 2>/dev/null | grep -q poweroff_powercycle && \
modinfo ipmi_poweroff 2>/dev/null | grep poweroff_powercycle > /dev/null 2>&1 && \
poweroff_opts="poweroff_powercycle=1"
fi
modprobe ipmi_poweroff "${poweroff_opts}" > /dev/null 2>&1
@ -235,6 +265,9 @@ unload_all_ipmi_modules()
for m in ${MODULES}; do
modprobe -q -r ${m} > /dev/null 2>&1
done
# delete interface node ONLY if ipmi_devintf is unloaded
[ `lsmod | grep -c "ipmi_devintf"` -eq 0 ] &&
rm -f "/dev/ipmi${INTF_NUM}"
}
unload_ipmi_modules_leave_features()
@ -242,7 +275,10 @@ unload_ipmi_modules_leave_features()
for m in ${MODULES_INTERFACES}; do
modprobe -q -r ${m} > /dev/null 2>&1
done
lsmod | grep -Eq "ipmi_(poweroff|watchdog)"
# delete interface node ONLY if ipmi_devintf is unloaded
[ `lsmod | grep -c "ipmi_devintf"` -eq 0 ] &&
rm -f "/dev/ipmi${INTF_NUM}"
lsmod | egrep -q "ipmi_(poweroff|watchdog)" > /dev/null 2>&1
if [ "$?" -ne "0" ]; then
stop_watchdog_quiet
stop_powercontrol_quiet
@ -266,7 +302,14 @@ load_ipmi_modules ()
modprobe ipmi_devintf > /dev/null 2>&1
modules_loaded ipmi_devintf
RETVAL=$((RETVAL & ~2))
[ ${OnePlusLoaded} -eq 0 ] && RETVAL=$((RETVAL | 2))
if [ ${OnePlusLoaded} -eq 1 ]; then
if [ ${UDEV_EXISTS} -eq 0 ]; then
DEVMAJOR=`cat /proc/devices | awk '/ipmidev/{print $1}'`
rm -f /dev/ipmi${INTF_NUM}
mknod -m 0600 /dev/ipmi${INTF_NUM} c ${DEVMAJOR} 0 || RETVAL=$((RETVAL | 4))
fi
# udev can take several seconds to create /dev/ipmi0,
# but it happens asynchronously, so delay here
locdelay=${DEV_IPMI_TIMEOUT}
@ -274,8 +317,6 @@ load_ipmi_modules ()
locdelay=$((locdelay - 1))
sleep 0.1
done
else
RETVAL=$((RETVAL | 2))
fi
fi

@ -0,0 +1,870 @@
diff --git a/cmdlang/Makefile.am b/cmdlang/Makefile.am
index 9326e3ea..192623f3 100644
--- a/cmdlang/Makefile.am
+++ b/cmdlang/Makefile.am
@@ -2,8 +2,6 @@
LIB_VERSION = 0.0.5
LD_VERSION = 0:5:0
-noinst_HEADERS = cmdlang.h
-
AM_CFLAGS = -Wall -Wsign-compare -I$(top_builddir)/include \
-I$(top_srcdir)/include \
-DIPMI_CHECK_LOCKS $(GLIB_CFLAGS) \
diff --git a/cmdlang/cmd_conn.c b/cmdlang/cmd_conn.c
index cdd700b6..338e9c77 100644
--- a/cmdlang/cmd_conn.c
+++ b/cmdlang/cmd_conn.c
@@ -38,7 +38,6 @@
#include <stdio.h>
#include <OpenIPMI/ipmiif.h>
#include <OpenIPMI/ipmi_cmdlang.h>
-#include "cmdlang.h"
static void
con_list_handler(ipmi_domain_t *domain, int conn, void *cb_data)
diff --git a/cmdlang/cmd_control.c b/cmdlang/cmd_control.c
index feefe73c..06cf1c27 100644
--- a/cmdlang/cmd_control.c
+++ b/cmdlang/cmd_control.c
@@ -41,7 +41,6 @@
/* Internal includes, do not use in your programs */
#include <OpenIPMI/internal/ipmi_malloc.h>
-#include "cmdlang.h"
static void
control_list_handler(ipmi_entity_t *entity, ipmi_control_t *control,
diff --git a/cmdlang/cmd_domain.c b/cmdlang/cmd_domain.c
index dec5765d..0ca0b25d 100644
--- a/cmdlang/cmd_domain.c
+++ b/cmdlang/cmd_domain.c
@@ -45,7 +45,6 @@
/* Internal includes, do not use in your programs */
#include <OpenIPMI/internal/ipmi_malloc.h>
-#include "cmdlang.h"
/* Don't pollute the namespace iwth ipmi_fru_t. */
void ipmi_cmdlang_dump_fru_info(ipmi_cmd_info_t *cmd_info, ipmi_fru_t *fru);
diff --git a/cmdlang/cmd_entity.c b/cmdlang/cmd_entity.c
index e88854ac..a5ad1475 100644
--- a/cmdlang/cmd_entity.c
+++ b/cmdlang/cmd_entity.c
@@ -42,7 +42,6 @@
/* Internal includes, do not use in your programs */
#include <OpenIPMI/internal/ipmi_malloc.h>
-#include "cmdlang.h"
/* Don't pollute the namespace iwth ipmi_fru_t. */
void ipmi_cmdlang_dump_fru_info(ipmi_cmd_info_t *cmd_info, ipmi_fru_t *fru);
diff --git a/cmdlang/cmd_fru.c b/cmdlang/cmd_fru.c
index 5cc2a1ac..cea4b70c 100644
--- a/cmdlang/cmd_fru.c
+++ b/cmdlang/cmd_fru.c
@@ -43,7 +43,6 @@
/* Internal includes, do not use in your programs */
#include <OpenIPMI/internal/ipmi_malloc.h>
-#include "cmdlang.h"
/* Don't pollute the namespace iwth ipmi_fru_t. */
void ipmi_cmdlang_dump_fru_info(ipmi_cmd_info_t *cmd_info, ipmi_fru_t *fru);
diff --git a/cmdlang/cmd_lanparm.c b/cmdlang/cmd_lanparm.c
index b6e86701..7afd7dd2 100644
--- a/cmdlang/cmd_lanparm.c
+++ b/cmdlang/cmd_lanparm.c
@@ -44,7 +44,6 @@
/* Internal includes, do not use in your programs */
#include <OpenIPMI/internal/ipmi_malloc.h>
#include <OpenIPMI/internal/locked_list.h>
-#include "cmdlang.h"
static locked_list_t *lancs;
diff --git a/cmdlang/cmd_mc.c b/cmdlang/cmd_mc.c
index 645506e7..0a3f6440 100644
--- a/cmdlang/cmd_mc.c
+++ b/cmdlang/cmd_mc.c
@@ -47,7 +47,6 @@
/* Internal includes, do not use in your programs */
#include <OpenIPMI/internal/ipmi_malloc.h>
-#include "cmdlang.h"
static void
mc_list_handler(ipmi_domain_t *domain, ipmi_mc_t *mc, void *cb_data)
diff --git a/cmdlang/cmd_pef.c b/cmdlang/cmd_pef.c
index c8503299..47ab2bd1 100644
--- a/cmdlang/cmd_pef.c
+++ b/cmdlang/cmd_pef.c
@@ -44,7 +44,6 @@
/* Internal includes, do not use in your programs */
#include <OpenIPMI/internal/ipmi_malloc.h>
#include <OpenIPMI/internal/locked_list.h>
-#include "cmdlang.h"
static locked_list_t *pefs;
diff --git a/cmdlang/cmd_pet.c b/cmdlang/cmd_pet.c
index 5730159e..77d3f90d 100644
--- a/cmdlang/cmd_pet.c
+++ b/cmdlang/cmd_pet.c
@@ -40,7 +40,6 @@
#include <OpenIPMI/ipmi_pet.h>
#include <OpenIPMI/ipmi_mc.h>
#include <OpenIPMI/ipmi_cmdlang.h>
-#include "cmdlang.h"
static void
diff --git a/cmdlang/cmd_sel.c b/cmdlang/cmd_sel.c
index 660f58a7..545b12f2 100644
--- a/cmdlang/cmd_sel.c
+++ b/cmdlang/cmd_sel.c
@@ -42,7 +42,6 @@
/* Internal includes, do not use in your programs */
#include <OpenIPMI/internal/ipmi_malloc.h>
-#include "cmdlang.h"
static int
discrete_event_handler(ipmi_sensor_t *sensor,
diff --git a/cmdlang/cmd_sensor.c b/cmdlang/cmd_sensor.c
index a4abc77c..99b8a634 100644
--- a/cmdlang/cmd_sensor.c
+++ b/cmdlang/cmd_sensor.c
@@ -41,7 +41,6 @@
/* Internal includes, do not use in your programs */
#include <OpenIPMI/internal/ipmi_malloc.h>
-#include "cmdlang.h"
static void
sensor_list_handler(ipmi_entity_t *entity, ipmi_sensor_t *sensor,
diff --git a/cmdlang/cmd_solparm.c b/cmdlang/cmd_solparm.c
index f584f8f3..df32c3f7 100644
--- a/cmdlang/cmd_solparm.c
+++ b/cmdlang/cmd_solparm.c
@@ -44,7 +44,6 @@
/* Internal includes, do not use in your programs */
#include <OpenIPMI/internal/ipmi_malloc.h>
#include <OpenIPMI/internal/locked_list.h>
-#include "cmdlang.h"
static locked_list_t *solcs;
diff --git a/cmdlang/cmdlang.c b/cmdlang/cmdlang.c
index b690e24c..416fce7f 100644
--- a/cmdlang/cmdlang.c
+++ b/cmdlang/cmdlang.c
@@ -54,7 +54,6 @@
#include <OpenIPMI/internal/ipmi_locks.h>
#include <OpenIPMI/internal/ipmi_malloc.h>
#include <OpenIPMI/internal/winsock_compat.h>
-#include "cmdlang.h"
/*
* This is the value passed to a command handler.
@@ -2480,6 +2479,8 @@ event_done(ipmi_cmdlang_t *cmdlang)
ipmi_mem_free(cmdlang->errstr);
} else if (ipmi_cmdlang_event_rpt) {
ipmi_cmdlang_event_rpt(event);
+ } else if (ipmi_cmdlang_report_event) {
+ ipmi_cmdlang_report_event(event);
}
if (cmdlang->objstr)
diff --git a/cmdlang/cmdlang.h b/cmdlang/cmdlang.h
deleted file mode 100644
index 0758cb5d..00000000
--- a/cmdlang/cmdlang.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * cmdlang.h
- *
- * A command interpreter for OpenIPMI
- *
- * Author: MontaVista Software, Inc.
- * Corey Minyard <minyard@mvista.com>
- * source@mvista.com
- *
- * Copyright 2020 MontaVista Software Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef CMDLANG_H
-#define CMDLANG_H
-
-/* Used to log errors inside the cmdlang. */
-void ipmi_cmdlang_global_err(char *objstr,
- char *location,
- char *errstr,
- int errval);
-
-#endif /* CMDLANG_H */
diff --git a/include/OpenIPMI/Makefile.am b/include/OpenIPMI/Makefile.am
index 8e86afc8..644cc84a 100644
--- a/include/OpenIPMI/Makefile.am
+++ b/include/OpenIPMI/Makefile.am
@@ -8,7 +8,7 @@ pkginclude_HEADERS = \
ipmi_conn.h ipmi_lan.h ipmi_pet.h ipmi_ui.h \
ipmi_debug.h ipmi_lanparm.h ipmi_picmg.h ipmi_string.h \
ipmi_sol.h ipmi_solparm.h ipmi_tcl.h deprecator.h \
- dllvisibility.h
+ dllvisibility.h weaksyms.h
SUBDIRS = internal
diff --git a/include/OpenIPMI/ipmi_cmdlang.h b/include/OpenIPMI/ipmi_cmdlang.h
index 80e5cb8a..682279e9 100644
--- a/include/OpenIPMI/ipmi_cmdlang.h
+++ b/include/OpenIPMI/ipmi_cmdlang.h
@@ -35,6 +35,7 @@
#define OPENIPMI_CMDLANG_H
#include <OpenIPMI/dllvisibility.h>
+#include <OpenIPMI/weaksyms.h>
#include <OpenIPMI/selector.h>
#include <OpenIPMI/ipmi_bits.h>
#include <OpenIPMI/ipmi_types.h>
@@ -44,6 +45,14 @@
extern "C" {
#endif
+#ifdef BUILDING_IPMI_CMDLANG_DLL
+ #define IPMI_CMDLANG_WEAK(ret, sym, decl) IPMI_WEAK_DLL(ret, sym, decl)
+ #define IPMI_CMDLANG_WEAK_DEFAULT(ret, sym, decl) IPMI_WEAK_DLL_DEFAULT(ret, sym, decl)
+#else
+ #define IPMI_CMDLANG_WEAK(ret, sym, decl) IPMI_WEAK_USER(ret, sym, decl)
+ #define IPMI_CMDLANG_WEAK_DEFAULT(ret, sym, decl) IPMI_WEAK_USER(ret, sym, decl)
+#endif
+
#if defined _WIN32 || defined __CYGWIN__
#ifdef BUILDING_IPMI_CMDLANG_DLL
#ifdef __GNUC__
@@ -427,10 +436,15 @@ extern void (*ipmi_cmdlang_err_rpt)(char *objstr,
char *location,
char *errstr,
int errval);
+IPMI_CMDLANG_WEAK_DEFAULT(void, ipmi_cmdlang_global_err, (char *objstr,
+ char *location,
+ char *errstr,
+ int errval));
/* Supplied by the user to report events. */
IPMI_CMDLANG_DLL_PUBLIC
extern void (*ipmi_cmdlang_event_rpt)(ipmi_cmdlang_event_t *event);
+IPMI_CMDLANG_WEAK(void, ipmi_cmdlang_report_event, (ipmi_cmdlang_event_t *event));
/* In callbacks, you must use these to lock the cmd_info structure. */
IPMI_CMDLANG_DLL_PUBLIC
diff --git a/include/OpenIPMI/ipmi_posix.h b/include/OpenIPMI/ipmi_posix.h
index f3000eca..0d7e82ee 100644
--- a/include/OpenIPMI/ipmi_posix.h
+++ b/include/OpenIPMI/ipmi_posix.h
@@ -43,6 +43,19 @@
extern "C" {
#endif
+/* These are the defined OS handlers for POSIX with and without
+ threading. If you use these (and thus link with the OpenIPMIposix
+ or OpenIPMIpthread libraries) you must provide posix_vlog(). It is
+ not provided by the library. */
+/* DEPRECATED - This should no longer be used, you should use the
+ OS-handler function to set your log handler. If you do not supply
+ your own os_vlog handler, logs will go to stderr. If you supply a
+ posix_vlog handler and don't call set_log_handler in the OS handler,
+ posix_vlog() will still be used. */
+IPMI_SEL_WEAK(void, posix_vlog, (char *format,
+ enum ipmi_log_type_e log_type,
+ va_list ap));
+
/* Non-threaded os handler operations */
/**********************************************************************
diff --git a/include/OpenIPMI/selector.h b/include/OpenIPMI/selector.h
index ca1f7f9c..d803d9f4 100644
--- a/include/OpenIPMI/selector.h
+++ b/include/OpenIPMI/selector.h
@@ -46,6 +46,14 @@
typedef int sigset_t;
#endif
+#include <OpenIPMI/weaksyms.h>
+
+#if defined BUILDING_IPMI_SELECTOR_DLL
+ #define IPMI_SEL_WEAK(ret, sym, decl) IPMI_WEAK_DLL(ret, sym, decl)
+#else
+ #define IPMI_SEL_WEAK(ret, sym, decl) IPMI_WEAK_USER(ret, sym, decl)
+#endif
+
#if defined _WIN32 || defined __CYGWIN__
#ifdef BUILDING_IPMI_SELECTOR_DLL
#ifdef __GNUC__
diff --git a/include/OpenIPMI/weaksyms.h b/include/OpenIPMI/weaksyms.h
new file mode 100644
index 00000000..07004243
--- /dev/null
+++ b/include/OpenIPMI/weaksyms.h
@@ -0,0 +1,80 @@
+/*
+ * weaksyms.h
+ *
+ * MontaVista IPMI weak symbol defines
+ *
+ * Author: MontaVista Software, Inc.
+ * Corey Minyard <minyard@mvista.com>
+ * source@mvista.com
+ *
+ * Copyright 2003,2004,2005 MontaVista Software Inc.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses. You may choose to be licensed under the terms of the GNU
+ * Lesser General Public License (GPL) Version 2 or the modified BSD
+ * license below. The following disclamer applies to both licenses:
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+` * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * GNU Lesser General Public Licence
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Modified BSD Licence
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ */
+
+#ifndef __WEAKSYMS_H
+#define __WEAKSYMS_H
+
+#include <stddef.h>
+
+#if defined _WIN32 || defined __CYGWIN__
+ // Calling back to user code not supported, set the weak symbol to NULL always.
+ #define IPMI_WEAK_DLL(ret, sym, decl) static ret (*sym)decl = NULL
+ // Weak symbol with a default value, do not set to zero
+ #define IPMI_WEAK_DLL_DEFAULT(ret, sym, decl) ret sym decl
+ #define IPMI_WEAK_USER(ret, sym, decl) // Nothing, omit the prototype
+#else
+ #ifdef __GNUC__
+ #define IPMI_WEAK_DLL(ret, sym, decl) __attribute__ ((weak)) ret sym decl
+ #define IPMI_WEAK_DLL_DEFAULT(ret, sym, decl) IPMI_WEAK_DLL(ret, sym, decl)
+ #define IPMI_WEAK_USER(ret, sym, decl) ret sym decl
+ #else
+ // Weak symbol not supported as we can not generate #pragma nor _Pragma from cpp
+ #define IPMI_WEAK_DLL(ret, sym, decl) static ret (*sym)decl = NULL
+ #define IPMI_WEAK_DLL_DEFAULT(ret, sym, decl) ret sym decl
+ #define IPMI_WEAK_USER(ret, sym, decl) // Nothing, omit the prototype
+ #endif
+#endif
+
+#endif /* __WEAKSYMS_H */
diff --git a/lanserv/Makefile.am b/lanserv/Makefile.am
index 371ec52d..e4409423 100644
--- a/lanserv/Makefile.am
+++ b/lanserv/Makefile.am
@@ -30,7 +30,7 @@ bin_PROGRAMS = ipmi_sim $(IPMILAN_PROG)
noinst_PROGRAMS = ipmi_checksum
-noinst_HEADERS = emu.h bmc.h ipmi_sim.h sol.h
+noinst_HEADERS = emu.h bmc.h ipmi_sim.h sol.h callback.h
libIPMIlanserv_la_SOURCES = lanserv_ipmi.c lanserv_asf.c priv_table.c \
lanserv_oem_force.c lanserv_config.c config.c serv.c serial_ipmi.c \
diff --git a/lanserv/OpenIPMI/Makefile.am b/lanserv/OpenIPMI/Makefile.am
index 80fb44ea..f9fbf2cf 100644
--- a/lanserv/OpenIPMI/Makefile.am
+++ b/lanserv/OpenIPMI/Makefile.am
@@ -1,3 +1,3 @@
pkginclude_HEADERS = lanserv.h serserv.h serv.h extcmd.h persist.h msg.h \
- mcserv.h ipmbserv.h lanserv_dllvisibility.h
+ mcserv.h ipmbserv.h lanserv_dllvisibility.h lanserv_weaksyms.h
diff --git a/lanserv/OpenIPMI/lanserv.h b/lanserv/OpenIPMI/lanserv.h
index 57ed757e..867f2741 100644
--- a/lanserv/OpenIPMI/lanserv.h
+++ b/lanserv/OpenIPMI/lanserv.h
@@ -57,6 +57,7 @@
#define __LANSERV_H
#include <OpenIPMI/lanserv_dllvisibility.h>
+#include <OpenIPMI/lanserv_weaksyms.h>
#include <stdint.h>
#include <stdio.h>
@@ -236,6 +237,8 @@ typedef struct ipmi_tick_handler_s {
struct ipmi_tick_handler_s *next;
} ipmi_tick_handler_t;
+IPMI_LANSERV_WEAK(void, ipmi_register_tick_handler, (ipmi_tick_handler_t *handler));
+
typedef struct oem_handlers_s
{
void *oem_data;
diff --git a/lanserv/OpenIPMI/lanserv_weaksyms.h b/lanserv/OpenIPMI/lanserv_weaksyms.h
new file mode 100644
index 00000000..e68d6bd2
--- /dev/null
+++ b/lanserv/OpenIPMI/lanserv_weaksyms.h
@@ -0,0 +1,67 @@
+/*
+ * lanserv.h
+ *
+ * MontaVista IPMI LAN server include file
+ *
+ * Author: MontaVista Software, Inc.
+ * Corey Minyard <minyard@mvista.com>
+ * source@mvista.com
+ *
+ * Copyright 2003,2004,2005 MontaVista Software Inc.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses. You may choose to be licensed under the terms of the GNU
+ * Lesser General Public License (GPL) Version 2 or the modified BSD
+ * license below. The following disclamer applies to both licenses:
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+` * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * GNU Lesser General Public Licence
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Modified BSD Licence
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ */
+
+#ifndef __LANSERV_WEAKSYMS_H
+#define __LANSERV_WEAKSYMS_H
+
+#include <OpenIPMI/weaksyms.h>
+
+#if defined BUILDING_IPMI_LANSERV_DLL
+ #define IPMI_LANSERV_WEAK(ret, sym, decl) IPMI_WEAK_DLL(ret, sym, decl)
+#else
+ #define IPMI_LANSERV_WEAK(ret, sym, decl) IPMI_WEAK_USER(ret, sym, decl)
+#endif
+
+#endif /* __LANSERV_WEAKSYMS_H */
diff --git a/lanserv/OpenIPMI/mcserv.h b/lanserv/OpenIPMI/mcserv.h
index c2a04648..de8d1440 100644
--- a/lanserv/OpenIPMI/mcserv.h
+++ b/lanserv/OpenIPMI/mcserv.h
@@ -84,6 +84,19 @@ void ipmi_mc_set_chassis_control_func(lmc_data_t *mc,
void *cb_data),
void *cb_data);
+IPMI_LANSERV_WEAK(int, ipmi_mc_alloc_unconfigured, (sys_data_t *sys, unsigned char ipmb,
+ lmc_data_t **rmc));
+
+IPMI_LANSERV_WEAK(unsigned char, ipmi_mc_get_ipmb, (lmc_data_t *mc));
+IPMI_LANSERV_WEAK(channel_t **, ipmi_mc_get_channelset, (lmc_data_t *mc));
+IPMI_LANSERV_WEAK(ipmi_sol_t *, ipmi_mc_get_sol, (lmc_data_t *mc));
+IPMI_LANSERV_WEAK(startcmd_t *, ipmi_mc_get_startcmdinfo, (lmc_data_t *mc));
+IPMI_LANSERV_WEAK(user_t *, ipmi_mc_get_users, (lmc_data_t *mc));
+IPMI_LANSERV_WEAK(pef_data_t *, ipmi_mc_get_pef, (lmc_data_t *mc));
+
+IPMI_LANSERV_WEAK(void, ipmi_resend_atn, (channel_t *chan));
+IPMI_LANSERV_WEAK(msg_t *, ipmi_mc_get_next_recv_q, (channel_t *chan));
+
/*
* FRUs have a semaphore that can be use to grant exclusive access.
* The semaphore is attempted to get before read and write operations,
@@ -165,6 +178,8 @@ int check_msg_length(msg_t *msg,
unsigned int len,
unsigned char *rdata,
unsigned int *rdata_len);
+IPMI_LANSERV_WEAK(void, ipmi_set_chassis_control_prog,
+ (lmc_data_t *mc, const char *prog));
void ipmi_mc_set_dev_revision(lmc_data_t *mc, unsigned char dev_revision);
void ipmi_mc_set_fw_revision(lmc_data_t *mc, unsigned char fw_revision_major,
@@ -172,6 +187,10 @@ void ipmi_mc_set_fw_revision(lmc_data_t *mc, unsigned char fw_revision_major,
void ipmi_mc_set_aux_fw_revision(lmc_data_t *mc,
unsigned char aux_fw_revision[4]);
const char *get_lanserv_version(void);
+IPMI_LANSERV_WEAK(int, sol_read_config,
+ (char **tokptr, sys_data_t *sys, const char **err));
+
+IPMI_LANSERV_WEAK(int, ipmi_mc_users_changed, (lmc_data_t *mc));
/*
* Types and functions for registering handlers with the MC emulator.
diff --git a/lanserv/callback.h b/lanserv/callback.h
new file mode 100644
index 00000000..eb9f18fa
--- /dev/null
+++ b/lanserv/callback.h
@@ -0,0 +1,68 @@
+/*
+ * callback.h
+ *
+ * MontaVista IPMI LAN server include file
+ *
+ * Author: MontaVista Software, Inc.
+ * Corey Minyard <minyard@mvista.com>
+ * source@mvista.com
+ *
+ * Copyright 2003,2004,2005 MontaVista Software Inc.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses. You may choose to be licensed under the terms of the GNU
+ * Lesser General Public License (GPL) Version 2 or the modified BSD
+ * license below. The following disclamer applies to both licenses:
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+` * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * GNU Lesser General Public Licence
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Modified BSD Licence
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ */
+
+#ifndef __CALLBACK_H
+#define __CALLBACK_H
+
+/*
+ * Macros to get callbacks that exist either as function pointers in some structure
+ * or as functions in user code.
+ * Pointers take precedence, functions exist for backward compatibility.
+ */
+
+#define LANSERV_CB(obj, field, name) ( (obj)->field ? (obj)->field : (name) )
+#define LANSERV_CB_IPMI(obj, name) LANSERV_CB(obj, name, ipmi_ ## name)
+
+#endif /* __CALLBACK_H */
diff --git a/lanserv/config.c b/lanserv/config.c
index 453750eb..d59e93fe 100644
--- a/lanserv/config.c
+++ b/lanserv/config.c
@@ -65,6 +65,9 @@
#include <OpenIPMI/serserv.h>
#include <OpenIPMI/ipmbserv.h>
#include <OpenIPMI/persist.h>
+#include <OpenIPMI/mcserv.h>
+
+#include "callback.h"
void
read_persist_users(sys_data_t *sys)
@@ -80,11 +83,11 @@ read_persist_users(sys_data_t *sys)
if (!mc)
continue;
- p = read_persist("users.mc%2.2x", sys->mc_get_ipmb(mc));
+ p = read_persist("users.mc%2.2x", LANSERV_CB_IPMI(sys, mc_get_ipmb)(mc));
if (!p)
continue;
- users = sys->mc_get_users(mc);
+ users = LANSERV_CB_IPMI(sys, mc_get_users)(mc);
for (j = 0; j <= MAX_USERS; j++) {
void *data;
unsigned int len;
@@ -124,14 +127,14 @@ write_persist_users(sys_data_t *sys)
user_t *users;
persist_t *p;
- if (!mc || !sys->mc_users_changed(mc))
+ if (!mc || !LANSERV_CB_IPMI(sys, mc_users_changed)(mc))
continue;
- p = alloc_persist("users.mc%2.2x", sys->mc_get_ipmb(mc));
+ p = alloc_persist("users.mc%2.2x", LANSERV_CB_IPMI(sys, mc_get_ipmb)(mc));
if (!p)
return ENOMEM;
- users = sys->mc_get_users(mc);
+ users = LANSERV_CB_IPMI(sys, mc_get_users)(mc);
for (j = 0; j <= MAX_USERS; j++) {
add_persist_int(p, users[j].valid, "%d.valid", j);
add_persist_int(p, users[j].link_auth, "%d.link_auth", j);
@@ -834,12 +837,13 @@ read_config(sys_data_t *sys,
} else if (strcmp(tok, "serial") == 0) {
err = serserv_read_config(&tokptr, sys, &errstr);
} else if (strcmp(tok, "sol") == 0) {
- err = sys->sol_read_config(&tokptr, sys, &errstr);
+ err = LANSERV_CB(sys, sol_read_config, sol_read_config)
+ (&tokptr, sys, &errstr);
} else if (strcmp(tok, "chassis_control") == 0) {
char *prog;
err = get_delim_str(&tokptr, &prog, &errstr);
if (!err)
- sys->set_chassis_control_prog(sys->mc, prog);
+ LANSERV_CB_IPMI(sys, set_chassis_control_prog)(sys->mc, prog);
} else if (strcmp(tok, "name") == 0) {
err = get_delim_str(&tokptr, &sys->name, &errstr);
} else if (strcmp(tok, "startcmd") == 0) {
@@ -860,7 +864,7 @@ read_config(sys_data_t *sys,
err = get_uchar(&tokptr, &ipmb, &errstr);
if (!err) {
lmc_data_t *mc;
- err = sys->mc_alloc_unconfigured(sys, ipmb, &mc);
+ err = LANSERV_CB_IPMI(sys, mc_alloc_unconfigured)(sys, ipmb, &mc);
if (err == ENOMEM) {
errstr = "Out of memory";
err = -1;
@@ -869,11 +873,11 @@ read_config(sys_data_t *sys,
err = -1;
} else {
sys->mc = mc;
- sys->cusers = sys->mc_get_users(mc);
- sys->chan_set = sys->mc_get_channelset(mc);
- sys->cpef = sys->mc_get_pef(mc);
- sys->startcmd = sys->mc_get_startcmdinfo(mc);
- sys->sol = sys->mc_get_sol(mc);
+ sys->cusers = LANSERV_CB_IPMI(sys, mc_get_users)(mc);
+ sys->chan_set = LANSERV_CB_IPMI(sys, mc_get_channelset)(mc);
+ sys->cpef = LANSERV_CB_IPMI(sys, mc_get_pef)(mc);
+ sys->startcmd = LANSERV_CB_IPMI(sys, mc_get_startcmdinfo)(mc);
+ sys->sol = LANSERV_CB_IPMI(sys, mc_get_sol)(mc);
}
}
} else if (strcmp(tok, "console") == 0) {
diff --git a/lanserv/lanserv_ipmi.c b/lanserv/lanserv_ipmi.c
index ccd60015..c3c2cdbe 100644
--- a/lanserv/lanserv_ipmi.c
+++ b/lanserv/lanserv_ipmi.c
@@ -73,6 +73,9 @@
#include <OpenIPMI/persist.h>
#include <OpenIPMI/extcmd.h>
+#include <OpenIPMI/mcserv.h>
+
+#include "callback.h"
static int
is_authval_null(uint8_t *val)
@@ -512,7 +515,7 @@ lan_return_rsp(channel_t *chan, msg_t *msg, rsp_msg_t *rsp)
return_rsp(lan, msg, NULL, rsp);
- msg = lan->sysinfo->mc_get_next_recv_q(chan);
+ msg = LANSERV_CB_IPMI(lan->sysinfo, mc_get_next_recv_q)(chan);
if (!msg)
return;
while (msg) {
@@ -531,7 +534,7 @@ lan_return_rsp(channel_t *chan, msg_t *msg, rsp_msg_t *rsp)
chan->free(chan, msg);
- msg = lan->sysinfo->mc_get_next_recv_q(chan);
+ msg = LANSERV_CB_IPMI(lan->sysinfo, mc_get_next_recv_q)(chan);
}
if (chan->recv_in_q)
chan->recv_in_q(chan, 0);
@@ -729,7 +732,7 @@ handle_get_channel_cipher_suites(lanserv_data_t *lan, msg_t *msg)
if (chan == 0xe)
chan = lan->channel.channel_num;
- channels = lan->sysinfo->mc_get_channelset(lan->channel.mc);
+ channels = LANSERV_CB_IPMI(lan->sysinfo, mc_get_channelset)(lan->channel.mc);
channel = channels[chan];
if (!channel) {
return_err(lan, msg, NULL, IPMI_NOT_PRESENT_CC);
@@ -3202,7 +3205,7 @@ ipmi_lan_init(lanserv_data_t *lan)
lan->tick_handler.handler = ipmi_lan_tick;
lan->tick_handler.info = lan;
- lan->sysinfo->register_tick_handler(&lan->tick_handler);
+ LANSERV_CB_IPMI(lan->sysinfo, register_tick_handler)(&lan->tick_handler);
out:
return rv;
diff --git a/lanserv/marvell-bmc/marvell_mod.c b/lanserv/marvell-bmc/marvell_mod.c
index b5b15e05..41a07b5c 100644
--- a/lanserv/marvell-bmc/marvell_mod.c
+++ b/lanserv/marvell-bmc/marvell_mod.c
@@ -72,6 +72,7 @@
#include <OpenIPMI/lanserv.h>
#include <OpenIPMI/mcserv.h>
+#include "callback.h"
#include "wiw.h"
#define PVERSION "2.0.12"
@@ -3052,7 +3053,7 @@ ipmi_sim_module_init(sys_data_t *sys, const char *initstr_i)
}
}
- rv = sys->mc_alloc_unconfigured(sys, 0x20, &bmc_mc);
+ rv = LANSERV_CB_IPMI(sys, mc_alloc_unconfigured)(sys, 0x20, &bmc_mc);
if (rv) {
sys->log(sys, OS_ERROR, NULL,
"Unable to allocate an mc: %s", strerror(rv));
@@ -3099,7 +3100,7 @@ ipmi_sim_module_init(sys_data_t *sys, const char *initstr_i)
}
}
- rv = sys->mc_alloc_unconfigured(sys, board_ipmb[num], &mc);
+ rv = LANSERV_CB_IPMI(sys, mc_alloc_unconfigured)(sys, board_ipmb[num], &mc);
if (rv) {
sys->log(sys, OS_ERROR, NULL,
"Unable to allocate an mc: %s", strerror(rv));
@@ -3285,7 +3286,7 @@ ipmi_sim_module_post_init(sys_data_t *sys)
*/
unsigned char data[13];
memset(data, 0, sizeof(data));
- data[4] = sys->mc_get_ipmb(bmc_mc);
+ data[4] = LANSERV_CB_IPMI(sys, mc_get_ipmb)(bmc_mc);
data[5] = 0; /* LUN */
data[6] = 0x04; /* Event message revision for IPMI 1.5. */
data[7] = 0x1d; /* System boot initiated. */
diff --git a/lanserv/serial_ipmi.c b/lanserv/serial_ipmi.c
index 8ba8f7d0..b7255341 100644
--- a/lanserv/serial_ipmi.c
+++ b/lanserv/serial_ipmi.c
@@ -63,6 +63,7 @@
#include <OpenIPMI/ipmi_mc.h>
#include <OpenIPMI/ipmi_msgbits.h>
#include <OpenIPMI/serserv.h>
+#include <OpenIPMI/mcserv.h>
#define EVENT_BUFFER_GLOBAL_ENABLE (1 << 2)
#define EVENT_LOG_GLOBAL_ENABLE (1 << 3)
@@ -1008,6 +1009,8 @@ vm_connected(serserv_data_t *si)
si->connected = 1;
if (si->sysinfo->resend_atn)
si->sysinfo->resend_atn(&si->channel);
+ else if (ipmi_resend_atn)
+ ipmi_resend_atn(&si->channel);
}
static void
diff --git a/unix/posix_os_hnd.c b/unix/posix_os_hnd.c
index f84ba270..54910c4b 100644
--- a/unix/posix_os_hnd.c
+++ b/unix/posix_os_hnd.c
@@ -376,6 +376,8 @@ sposix_vlog(os_handler_t *handler,
if (log_handler)
log_handler(handler, format, log_type, ap);
+ else if (posix_vlog)
+ posix_vlog((char *) format, log_type, ap);
else
default_vlog(format, log_type, ap);
}
diff --git a/unix/posix_thread_os_hnd.c b/unix/posix_thread_os_hnd.c
index cb315c5e..3bec32f6 100644
--- a/unix/posix_thread_os_hnd.c
+++ b/unix/posix_thread_os_hnd.c
@@ -377,6 +377,8 @@ sposix_vlog(os_handler_t *handler,
if (log_handler)
log_handler(handler, format, log_type, ap);
+ else if (posix_vlog)
+ posix_vlog((char *) format, log_type, ap);
else
default_vlog(format, log_type, ap);
}

@ -3,8 +3,8 @@
Summary: IPMI (Intelligent Platform Management Interface) library and tools
Name: OpenIPMI
Version: 2.0.32
Release: 5%{?dist}
Version: 2.0.31
Release: 3%{?dist}
License: LGPLv2+ and GPLv2+ or BSD
URL: http://sourceforge.net/projects/openipmi/
Source: http://downloads.sourceforge.net/openipmi/%{name}-%{version}.tar.gz
@ -12,10 +12,9 @@ Source1: openipmi.sysconf
Source2: openipmi-helper
Source3: ipmi.service
Patch1: 0001-man.patch
Patch2: include-config-h-cmdlang.patch
Patch3: OpenIPMI-CVE-2024-42934.patch
Patch4: OpenIPMI-collectd.patch
Patch5: restore-api-compatibility.patch
BuildRequires: make
BuildRequires: gdbm-devel swig glib2-devel net-snmp-devel ncurses-devel
BuildRequires: openssl-devel python3-devel perl-devel perl-generators
BuildRequires: pkgconfig
@ -28,8 +27,6 @@ BuildRequires: systemd
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
# Prevent bogus provides of private libs from perl
%global __provides_exclude_from %{?__provides_exclude_from:%{__provides_exclude_from}|}^%{perl_vendorarch}/auto/.*\\.so$
%description
The Open IPMI project aims to develop an open code base to allow access to
@ -88,6 +85,8 @@ This package contains a network IPMI listener.
%autosetup -p1
%build
# Patch5 changes Makefile.am
%{__automake} --add-missing --copy --foreign
%configure \
CFLAGS="-fPIC %{optflags} -z now -fno-strict-aliasing" \
@ -118,8 +117,7 @@ install -d %{buildroot}%{_sysconfdir}/modprobe.d
rm %{buildroot}/%{_mandir}/man1/openipmigui.1 %{buildroot}%{_libdir}/*.la
# add missing documentation
echo ".so man1/openipmicmd.1" > %{buildroot}%{_mandir}/man1/ipmicmd.1
echo ".so man1/ipmicmd.1" > %{buildroot}%{_mandir}/man1/ipmicmd.1
echo ".so man1/openipmish.1" > %{buildroot}%{_mandir}/man1/ipmish.1
%post
@ -202,155 +200,44 @@ echo ".so man1/openipmish.1" > %{buildroot}%{_mandir}/man1/ipmish.1
%{_mandir}/man5/ipmi_sim_cmd.5*
%changelog
* Thu Oct 10 2024 Pavel Cahyna <pcahyna@redhat.com> - 2.0.32-5
- Update the patch for CVE-2024-42934 to add a missing upstream
commit from 2.0.36: 663e3cd3
* Thu Sep 26 2024 Pavel Cahyna <pcahyna@redhat.com> - 2.0.32-4
- Backport two commits from 2.0.36 to add checks in ipmi_sim
and ipmilan (CVE-2024-42934)
* Fri Jan 28 2022 Pavel Cahyna <pcahyna@redhat.com> - 2.0.32-3
- Add a patch to resolve one more issue found by rpmdiff/rpminspect:
fix getaddrinfo detection to avoid using gethostbyname.
* Wed Jan 26 2022 Pavel Cahyna <pcahyna@redhat.com> - 2.0.32-2
* Fri Aug 27 2021 Pavel Cahyna <pcahyna@redhat.com> - 2.0.31-3
- Resolve issues found by rpmdiff
- add explicit Requires: on subpackages to avoid the need to test
interoperability between the various combinations of old and new
subpackages
- add code to restore binary compatibility in libIPMIlanserv.so
and libOpenIPMIcmdlang.so broken in 2.0.31, while keeping
compatibility with 2.0.31 as well.
* Sun Jan 23 2022 Igor Raits <igor.raits@gmail.com> - 2.0.32-1
- Update to 2.0.32 (rhbz#1990072)
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 2.0.31-5
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Wed Jun 16 2021 Mohan Boddu <mboddu@redhat.com> - 2.0.31-4
- Rebuilt for RHEL 9 BETA for openssl 3.0
Related: rhbz#1971065
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 2.0.31-3
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Mon Jan 25 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.31-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Mon Jan 25 2021 Josef Ridky <jridky@redhat.com> - 2.0.31-1
- New upstream release 2.0.31 (#1905768)
* Thu Sep 17 2020 Josef Řídký <jridky@redhat.com> - 2.0.29-1
- New upstream release 2.0.29 (#1846675)
* Thu Aug 27 2020 Josef Řídký <jridky@redhat.com> - 2.0.28-7
- Rebuilt for new net-snmp release
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.28-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jun 23 2020 Jitka Plesnikova <jplesnik@redhat.com> - 2.0.28-5
- Perl 5.32 rebuild
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 2.0.28-4
- Rebuilt for Python 3.9
* Fri Aug 6 2021 Pavel Cahyna <pcahyna@redhat.com> - 2.0.31-2
- fix collectd-ipmi crash (#1990072)
* Mon Feb 03 2020 Vaclav Dolezal <vdolezal@redhat.com> - 2.0.28-3
- Cleanup of openipmi-helper script; removed no-udev branch (#1579773)
* Fri Jul 9 2021 Pavel Cahyna <pcahyna@redhat.com> - 2.0.31-1
- New upstream release 2.0.31 (#1923044)
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.28-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Wed Nov 18 2020 Josef Ridky <jridky@redhat.com> - 2.0.29-1
- New upstream release 2.0.29 (#1796588)
* Mon Dec 16 2019 Vaclav Dolezal <vdolezal@redhat.com> - 2.0.28-1
- New upstream release 2.0.28
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 2.0.27-5
- Rebuilt for Python 3.8.0rc1 (#1748018)
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 2.0.27-4
- Rebuilt for Python 3.8
* Thu Aug 01 2019 Vaclav Dolezal <vdolezal@redhat.com> - 2.0.27-3
- Prevent bogus Provides of libOpenIPMI.so.0 by OpenIPMI-perl (#1734407)
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.27-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Wed Jun 26 2019 Vaclav Dolezal <vdolezal@redhat.com> - 2.0.27-1
* Tue Oct 08 2019 Vaclav Dolezal <vdolezal@redhat.com> - 2.0.27-1
- New upstream release 2.0.27
* Fri May 31 2019 Jitka Plesnikova <jplesnik@redhat.com> - 2.0.25-10
- Perl 5.30 rebuild
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.25-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Wed Sep 05 2018 Josef Ridky <jridky@redhat.com> - 2.0.25-8
- Fix man page self referencing error (#1612159)
* Thu Aug 09 2018 Josef Ridky <jridky@redhat.com> - 2.0.25-4
- Rebuild for Net-SNMP
* Tue Jul 24 2018 Adam Williamson <awilliam@redhat.com> - 2.0.25-7
- Rebuild for new net-snmp
* Mon Jul 30 2018 Florian Weimer <fweimer@redhat.com> - 2.0.25-3
- Rebuild with fixed binutils
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.25-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed Jul 25 2018 Petr Kubat <pkubat@redhat.com> - 2.0.25-2
- Rebuilt for gdbm
* Tue Jul 03 2018 Petr Pisar <ppisar@redhat.com> - 2.0.25-5
- Perl 5.28 rebuild
* Fri Jun 29 2018 Jitka Plesnikova <jplesnik@redhat.com> - 2.0.25-4
- Perl 5.28 rebuild
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 2.0.25-3
- Rebuilt for Python 3.7
* Wed Apr 18 2018 Josef Ridky <jridky@redhat.com> - 2.0.25-2
- Python3 update
* Tue Apr 17 2018 Josef Ridky <jridky@redhat.com> - 2.0.25-1
* Fri Apr 20 2018 Josef Ridky <jridky@redhat.com> - 2.0.25-1
- New upstream release 2.0.25 (#1568194)
- Replace Python2 with Python3
- Drop OpenIPMI-python2 and set it as Obsolete
- Introduce new OpenIPMI-python3 package
* Tue Mar 06 2018 Josef Ridky <jridky@redhat.com> - 2.0.24-5
- use ldconfig macros
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.24-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Mon Jan 22 2018 Josef Ridky <jridky@redhat.com> -2.0.14-3
- remove old systemd dependencies
* Mon Jan 22 2018 Josef Ridky <jridky@redhat.com> -2.0.14-2
- restore removed requirements
* Thu Jan 18 2018 Tomasz Kłoczko <kloczek@fedoraproject.org> - 2.0.24-1
- remove pkgconfig from devel Requires
- remove libedit Requires (it is autogenerated as SONAME dependency)
- remove main package dependecy fron devell Requires (only libs is needed
- add use %%{?_isa} macro in Requires
* Wed Jan 17 2018 Josef Ridky <jridky@redhat.com> - 2.0.24-1
- New upstream release 2.0.24
- spec update (based on Tomasz Kłoczko's pull request)
- reduce the number of SONAME dependencies by use -Wl,--as-needed in LDFLAGS
- change COPYING COPYING.BSD COPYING.LIB files as %%license
- add %%{_sysconfdir}/ipmi directory to lanserv %%files list
- execute /sbin/ldconfig in %%post and %%postun section for lanserv sub-packages
- remove desktop-file-utils and GUI related packages from BuildRequires
- use roff links instead symlinks to gzipped man pages
- use %%autosetup in %%prep
- remove Group tags
* Thu Oct 19 2017 Josef Ridky <jridky@redhat.com> - 2.0.23-6
- Rebuilt for python2 package
* Sun Aug 20 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.0.23-5
- Add Provides for the old name without %%_isa
* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.0.23-4
- Python 2 binary package renamed to python2-openipmi
See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3
- use autosetup
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.23-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

Loading…
Cancel
Save