From 342ebce798fe98ede64939a49bbc3770d8214649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 8 May 2016 22:59:02 +0200 Subject: Imported Upstream version 1.8.17 --- src/Makefile.am | 2 +- src/Makefile.in | 2 +- src/ipmievd.c | 3 +- src/ipmishell.c | 3 ++ src/plugins/Makefile.am | 2 +- src/plugins/Makefile.in | 2 +- src/plugins/bmc/Makefile.am | 2 +- src/plugins/bmc/Makefile.in | 2 +- src/plugins/dummy/Makefile.am | 4 +-- src/plugins/dummy/Makefile.in | 4 +-- src/plugins/dummy/dummy.c | 17 +++++++++++- src/plugins/dummy/dummy.h | 28 +++++++++++++++++++ src/plugins/free/Makefile.am | 2 +- src/plugins/free/Makefile.in | 2 +- src/plugins/imb/Makefile.am | 2 +- src/plugins/imb/Makefile.in | 2 +- src/plugins/imb/imb.c | 1 + src/plugins/imb/imbapi.c | 41 +++++++++++++++++++++------ src/plugins/imb/imbapi.h | 5 +--- src/plugins/ipmi_intf.c | 3 +- src/plugins/lan/Makefile.am | 2 +- src/plugins/lan/Makefile.in | 2 +- src/plugins/lan/lan.c | 2 +- src/plugins/lanplus/Makefile.am | 2 +- src/plugins/lanplus/Makefile.in | 2 +- src/plugins/lanplus/lanplus.c | 54 ++++++++++++++++++------------------ src/plugins/lipmi/Makefile.am | 2 +- src/plugins/lipmi/Makefile.in | 2 +- src/plugins/open/Makefile.am | 2 +- src/plugins/open/Makefile.in | 2 +- src/plugins/open/open.c | 1 + src/plugins/serial/Makefile.am | 2 +- src/plugins/serial/Makefile.in | 2 +- src/plugins/serial/serial_basic.c | 2 +- src/plugins/serial/serial_terminal.c | 2 +- src/plugins/usb/Makefile.am | 2 +- src/plugins/usb/Makefile.in | 2 +- 37 files changed, 143 insertions(+), 71 deletions(-) create mode 100644 src/plugins/dummy/dummy.h (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index ba388d3..cedf63d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -28,7 +28,7 @@ # LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, # EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include SUBDIRS = plugins MAINTAINERCLEANFILES = Makefile.in diff --git a/src/Makefile.in b/src/Makefile.in index 06b33a8..07e255d 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -387,7 +387,7 @@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include SUBDIRS = plugins MAINTAINERCLEANFILES = Makefile.in ipmitool_SOURCES = ipmitool.c ipmishell.c diff --git a/src/ipmievd.c b/src/ipmievd.c index cc1ca0f..caefd95 100644 --- a/src/ipmievd.c +++ b/src/ipmievd.c @@ -30,6 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ #define _XOPEN_SOURCE 700 +#define _BSD_SOURCE #include #include @@ -70,7 +71,7 @@ # else # include "plugins/open/open.h" # endif -# include +# include #endif /* IPMI_INTF_OPEN */ #include diff --git a/src/ipmishell.c b/src/ipmishell.c index 6cfcbe8..205cbf9 100644 --- a/src/ipmishell.c +++ b/src/ipmishell.c @@ -29,6 +29,9 @@ * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ +#define _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE >= 500 || \ + _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED || \ + /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L #include #include diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index a2c48ff..7ad8173 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -30,7 +30,7 @@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include SUBDIRS = @INTF_LAN@ @INTF_LANPLUS@ @INTF_OPEN@ @INTF_LIPMI@ @INTF_IMB@ @INTF_BMC@ @INTF_FREE@ @INTF_SERIAL@ @INTF_DUMMY@ @INTF_USB@ DIST_SUBDIRS = lan lanplus open lipmi imb bmc free serial dummy usb diff --git a/src/plugins/Makefile.in b/src/plugins/Makefile.in index f38697a..262ff90 100644 --- a/src/plugins/Makefile.in +++ b/src/plugins/Makefile.in @@ -381,7 +381,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include SUBDIRS = @INTF_LAN@ @INTF_LANPLUS@ @INTF_OPEN@ @INTF_LIPMI@ @INTF_IMB@ @INTF_BMC@ @INTF_FREE@ @INTF_SERIAL@ @INTF_DUMMY@ @INTF_USB@ DIST_SUBDIRS = lan lanplus open lipmi imb bmc free serial dummy usb noinst_LTLIBRARIES = libintf.la diff --git a/src/plugins/bmc/Makefile.am b/src/plugins/bmc/Makefile.am index 66080d6..f9374fe 100644 --- a/src/plugins/bmc/Makefile.am +++ b/src/plugins/bmc/Makefile.am @@ -30,7 +30,7 @@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_bmc.la noinst_LTLIBRARIES = @INTF_BMC_LIB@ diff --git a/src/plugins/bmc/Makefile.in b/src/plugins/bmc/Makefile.in index 6ed1ee7..3cb831b 100644 --- a/src/plugins/bmc/Makefile.in +++ b/src/plugins/bmc/Makefile.in @@ -338,7 +338,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_bmc.la noinst_LTLIBRARIES = @INTF_BMC_LIB@ libintf_bmc_la_LIBADD = $(top_builddir)/lib/libipmitool.la diff --git a/src/plugins/dummy/Makefile.am b/src/plugins/dummy/Makefile.am index 8a53bbe..bbc8048 100644 --- a/src/plugins/dummy/Makefile.am +++ b/src/plugins/dummy/Makefile.am @@ -1,8 +1,8 @@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_dummy.la noinst_LTLIBRARIES = @INTF_DUMMY_LIB@ libintf_dummy_la_LIBADD = $(top_builddir)/lib/libipmitool.la -libintf_dummy_la_SOURCES = dummy.c +libintf_dummy_la_SOURCES = dummy.c dummy.h diff --git a/src/plugins/dummy/Makefile.in b/src/plugins/dummy/Makefile.in index 86475ba..1850430 100644 --- a/src/plugins/dummy/Makefile.in +++ b/src/plugins/dummy/Makefile.in @@ -308,11 +308,11 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_dummy.la noinst_LTLIBRARIES = @INTF_DUMMY_LIB@ libintf_dummy_la_LIBADD = $(top_builddir)/lib/libipmitool.la -libintf_dummy_la_SOURCES = dummy.c +libintf_dummy_la_SOURCES = dummy.c dummy.h all: all-am .SUFFIXES: diff --git a/src/plugins/dummy/dummy.c b/src/plugins/dummy/dummy.c index 8bfc4cf..8600a84 100644 --- a/src/plugins/dummy/dummy.c +++ b/src/plugins/dummy/dummy.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -175,6 +176,14 @@ ipmi_dummyipmi_open(struct ipmi_intf *intf) struct sockaddr_un address; int len; int rc; + char *dummy_sock_path; + + dummy_sock_path = getenv("IPMI_DUMMY_SOCK"); + if (dummy_sock_path == NULL) { + lprintf(LOG_DEBUG, "No IPMI_DUMMY_SOCK set. Dummy mode ON."); + intf->opened = 1; + return intf->fd; + } if (intf->opened == 1) { return intf->fd; @@ -185,7 +194,7 @@ ipmi_dummyipmi_open(struct ipmi_intf *intf) return (-1); } address.sun_family = AF_UNIX; - strcpy(address.sun_path, DUMMY_SOCKET_PATH); + strcpy(address.sun_path, dummy_sock_path); len = sizeof(address); rc = connect(intf->fd, (struct sockaddr *)&address, len); if (rc != 0) { @@ -209,6 +218,12 @@ ipmi_dummyipmi_send_cmd(struct ipmi_intf *intf, struct ipmi_rq *req) static struct ipmi_rs rsp; struct dummy_rq req_dummy; struct dummy_rs rsp_dummy; + char *dummy_sock_path; + dummy_sock_path = getenv("IPMI_DUMMY_SOCK"); + if (dummy_sock_path == NULL) { + lprintf(LOG_DEBUG, "No IPMI_DUMMY_SOCK set. Dummy mode ON."); + return NULL; + } if (intf == NULL || intf->fd < 0 || intf->opened != 1) { lprintf(LOG_ERR, "dummy failed on intf check."); return NULL; diff --git a/src/plugins/dummy/dummy.h b/src/plugins/dummy/dummy.h new file mode 100644 index 0000000..bbe3aa3 --- /dev/null +++ b/src/plugins/dummy/dummy.h @@ -0,0 +1,28 @@ +#ifndef IPMI_DUMMYIPMI_H +# define IPMI_DUMMYIPMI_H + +struct dummy_rq { + struct { + uint8_t netfn; + uint8_t lun; + uint8_t cmd; + uint8_t target_cmd; + uint16_t data_len; + uint8_t *data; + } msg; +}; + +struct dummy_rs { + struct { + uint8_t netfn; + uint8_t cmd; + uint8_t seq; + uint8_t lun; + } msg; + + uint8_t ccode; + int data_len; + uint8_t *data; +}; + +#endif diff --git a/src/plugins/free/Makefile.am b/src/plugins/free/Makefile.am index 028281f..7a3a84e 100644 --- a/src/plugins/free/Makefile.am +++ b/src/plugins/free/Makefile.am @@ -1,6 +1,6 @@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_free.la noinst_LTLIBRARIES = @INTF_FREE_LIB@ diff --git a/src/plugins/free/Makefile.in b/src/plugins/free/Makefile.in index d8eb9e6..cc33b93 100644 --- a/src/plugins/free/Makefile.in +++ b/src/plugins/free/Makefile.in @@ -312,7 +312,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_free.la noinst_LTLIBRARIES = @INTF_FREE_LIB@ libintf_free_la_LIBADD = $(top_builddir)/lib/libipmitool.la diff --git a/src/plugins/imb/Makefile.am b/src/plugins/imb/Makefile.am index 91d5966..6f1b68c 100644 --- a/src/plugins/imb/Makefile.am +++ b/src/plugins/imb/Makefile.am @@ -30,7 +30,7 @@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_imb.la noinst_LTLIBRARIES = @INTF_IMB_LIB@ diff --git a/src/plugins/imb/Makefile.in b/src/plugins/imb/Makefile.in index d1ded78..1e40e15 100644 --- a/src/plugins/imb/Makefile.in +++ b/src/plugins/imb/Makefile.in @@ -338,7 +338,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_imb.la noinst_LTLIBRARIES = @INTF_IMB_LIB@ libintf_imb_la_LIBADD = $(top_builddir)/lib/libipmitool.la diff --git a/src/plugins/imb/imb.c b/src/plugins/imb/imb.c index 0044159..1514fa7 100644 --- a/src/plugins/imb/imb.c +++ b/src/plugins/imb/imb.c @@ -43,6 +43,7 @@ #include #include #include +#include #include "imbapi.h" diff --git a/src/plugins/imb/imbapi.c b/src/plugins/imb/imbapi.c index 899c47a..84eec2e 100644 --- a/src/plugins/imb/imbapi.c +++ b/src/plugins/imb/imbapi.c @@ -97,7 +97,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #endif #include "imbapi.h" -#include +#include #ifdef SCO_UW #define NO_MACRO_ARGS 1 @@ -105,9 +105,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define IMB_DEVICE "/dev/instru/mismic" #else #define IMB_DEVICE "/dev/imb" -#ifndef PAGESIZE -# define PAGESIZE EXEC_PAGESIZE #endif + +#if !defined(PAGESIZE) && defined(PAGE_SIZE) +# define PAGESIZE PAGE_SIZE +#endif + +#if !defined(_SC_PAGESIZE) && defined(_SC_PAGE_SIZE) +# define _SC_PAGESIZE _SC_PAGE_SIZE #endif /*Just to make the DEBUG code cleaner.*/ @@ -545,7 +550,7 @@ SendTimedI2cRequest ( if( status != TRUE ) { DWORD error; error = GetLastError(); - return ACCESN_ERROR; + return error; } if( respLength == 0 ) { return ACCESN_ERROR; @@ -1134,7 +1139,7 @@ SendTimedImbpRequest ( if( status != TRUE ) { DWORD error; error = GetLastError(); - return ACCESN_ERROR; + return error; } if( respLength == 0 ) { return ACCESN_ERROR; @@ -1211,7 +1216,7 @@ SendAsyncImbpRequest ( if( status != TRUE ) { DWORD error; error = GetLastError(); - return ACCESN_ERROR; + return error; } if( respLength != 2 ) { return ACCESN_ERROR; @@ -1985,6 +1990,16 @@ MapPhysicalMemory(int startAddress,int addressLength, int *virtualAddress ) off_t startpAddress = (off_t)startAddress; unsigned int diff; char *startvAddress; +#if defined(PAGESIZE) + long int pagesize = PAGESIZE; +#elif defined(_SC_PAGESIZE) + long int pagesize = sysconf(_SC_PAGESIZE); + if (pagesize < 1) { + perror("Invalid pagesize"); + } +#else +# error PAGESIZE unsupported +#endif if ((startAddress == 0) || (addressLength <= 0)) return ACCESN_ERROR; @@ -1999,7 +2014,7 @@ MapPhysicalMemory(int startAddress,int addressLength, int *virtualAddress ) } /* aliging the offset to a page boundary and adjusting the length */ - diff = (int)startpAddress % PAGESIZE; + diff = (int)startpAddress % pagesize; startpAddress -= diff; length += diff; @@ -2043,9 +2058,19 @@ ACCESN_STATUS UnmapPhysicalMemory( int virtualAddress, int Length ) { unsigned int diff = 0; +#if defined(PAGESIZE) + long int pagesize = PAGESIZE; +#elif defined(_SC_PAGESIZE) + long int pagesize = sysconf(_SC_PAGESIZE); + if (pagesize < 1) { + perror("Invalid pagesize"); + } +#else +# error PAGESIZE unsupported +#endif /* page align the virtual address and adjust length accordingly */ - diff = ((unsigned int) virtualAddress) % PAGESIZE; + diff = ((unsigned int) virtualAddress) % pagesize; virtualAddress -= diff; Length += diff; #ifndef NO_MACRO_ARGS diff --git a/src/plugins/imb/imbapi.h b/src/plugins/imb/imbapi.h index 74975c6..6ba4121 100644 --- a/src/plugins/imb/imbapi.h +++ b/src/plugins/imb/imbapi.h @@ -46,10 +46,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endif #ifndef WIN32 /* WIN32 defines this in stdio.h */ -#ifndef _WCHAR_T -#define _WCHAR_T -typedef long wchar_t; -#endif +#include #endif #define far #define near diff --git a/src/plugins/ipmi_intf.c b/src/plugins/ipmi_intf.c index 19ba5e3..6cf0553 100644 --- a/src/plugins/ipmi_intf.c +++ b/src/plugins/ipmi_intf.c @@ -31,6 +31,7 @@ */ #define _XOPEN_SOURCE 700 #define _GNU_SOURCE 1 +#define _DARWIN_C_SOURCE 1 #include #include @@ -451,7 +452,7 @@ ipmi_intf_socket_connect(struct ipmi_intf * intf) } /* OK, now try to connect with the scope id from this interface address */ - if (addr6->sin6_scope_id != 0) { + if (addr6->sin6_scope_id != 0 || !IN6_IS_ADDR_LINKLOCAL(&tmp6->sin6_addr)) { if (connect(intf->fd, rp->ai_addr, rp->ai_addrlen) != -1) { hints.ai_family = rp->ai_family; lprintf(LOG_DEBUG, "Successful connected on %s interface with scope id %d", ifa->ifa_name, tmp6->sin6_scope_id); diff --git a/src/plugins/lan/Makefile.am b/src/plugins/lan/Makefile.am index 70e320f..f276f38 100644 --- a/src/plugins/lan/Makefile.am +++ b/src/plugins/lan/Makefile.am @@ -30,7 +30,7 @@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_lan.la noinst_LTLIBRARIES = @INTF_LAN_LIB@ diff --git a/src/plugins/lan/Makefile.in b/src/plugins/lan/Makefile.in index 9d1ce80..2abda0d 100644 --- a/src/plugins/lan/Makefile.in +++ b/src/plugins/lan/Makefile.in @@ -338,7 +338,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_lan.la noinst_LTLIBRARIES = @INTF_LAN_LIB@ libintf_lan_la_LIBADD = $(top_builddir)/lib/libipmitool.la diff --git a/src/plugins/lan/lan.c b/src/plugins/lan/lan.c index 14730d3..40ba233 100644 --- a/src/plugins/lan/lan.c +++ b/src/plugins/lan/lan.c @@ -970,7 +970,7 @@ ipmi_lan_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req) // Example: We have to send command 23 and 2d. // If we send command,seq as 23,10 and if we dont get any response it will // retry 4 times with 23,10 and then come out here and indicate that there is no - // reponse from the remote controller and will send the next command for + // response from the remote controller and will send the next command for // ie 2d,11. And if the BMC is slow to respond and returns 23,10 then it // will match it in the list and will take response of command 23 as response // for command 2d and return success. So ideally when retries are done and diff --git a/src/plugins/lanplus/Makefile.am b/src/plugins/lanplus/Makefile.am index 428eb04..219440e 100644 --- a/src/plugins/lanplus/Makefile.am +++ b/src/plugins/lanplus/Makefile.am @@ -30,7 +30,7 @@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_lanplus.la noinst_LTLIBRARIES = @INTF_LANPLUS_LIB@ diff --git a/src/plugins/lanplus/Makefile.in b/src/plugins/lanplus/Makefile.in index eef233d..d24775b 100644 --- a/src/plugins/lanplus/Makefile.in +++ b/src/plugins/lanplus/Makefile.in @@ -339,7 +339,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_lanplus.la noinst_LTLIBRARIES = @INTF_LANPLUS_LIB@ libintf_lanplus_la_LIBADD = $(top_builddir)/lib/libipmitool.la diff --git a/src/plugins/lanplus/lanplus.c b/src/plugins/lanplus/lanplus.c index 8776212..2a89a14 100644 --- a/src/plugins/lanplus/lanplus.c +++ b/src/plugins/lanplus/lanplus.c @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -606,7 +607,7 @@ ipmiv2_lan_ping(struct ipmi_intf * intf) * Receive whatever comes back. Ignore received packets that don't correspond * to a request we've sent. * - * Returns: the ipmi_rs packet describing the/a reponse we expect. + * Returns: the ipmi_rs packet describing the/a response we expect. */ static struct ipmi_rs * ipmi_lan_poll_single(struct ipmi_intf * intf) @@ -651,7 +652,7 @@ ipmi_lan_poll_single(struct ipmi_intf * intf) * * 1) An IPMI 1.5 packet (the response to our GET CHANNEL * AUTHENTICATION CAPABILITIES request) - * 2) An RMCP+ message with an IPMI reponse payload + * 2) An RMCP+ message with an IPMI response payload * 3) AN RMCP+ open session response * 4) An RAKP-2 message (response to an RAKP 1 message) * 5) An RAKP-4 message (response to an RAKP 3 message) @@ -662,6 +663,21 @@ ipmi_lan_poll_single(struct ipmi_intf * intf) read_session_data(rsp, &offset, intf->session); + /* + * Skip packets that are not intended for this session + */ + if ((session->v2_data.session_state == LANPLUS_STATE_ACTIVE) && + (rsp->session.authtype == IPMI_SESSION_AUTHTYPE_RMCP_PLUS) && + (rsp->session.id != intf->session->v2_data.console_id)) + { + lprintf(LOG_INFO, "packet session id 0x%x does not " + "match active session 0x%0x", + rsp->session.id, intf->session->v2_data.console_id); + lprintf(LOG_ERR, "ERROR: Received an Unexpected message ID"); + /* read one more packet */ + return (struct ipmi_rs *)1; + } + if (lanplus_has_valid_auth_code(rsp, intf->session) == 0) { lprintf(LOG_ERR, "ERROR: Received message with invalid authcode!"); return NULL; @@ -681,7 +697,7 @@ ipmi_lan_poll_single(struct ipmi_intf * intf) } /* - * Handle IPMI responses (case #1 and #2) -- all IPMI reponses + * Handle IPMI responses (case #1 and #2) -- all IPMI responses */ if (rsp->session.payloadtype == IPMI_PAYLOAD_TYPE_IPMI) { struct ipmi_rq_entry * entry; @@ -863,7 +879,7 @@ ipmi_lan_poll_single(struct ipmi_intf * intf) * Receive whatever comes back. Ignore received packets that don't correspond * to a request we've sent. * - * Returns: the ipmi_rs packet describing the/a reponse we expect. + * Returns: the ipmi_rs packet describing the/a response we expect. */ static struct ipmi_rs * ipmi_lan_poll_recv(struct ipmi_intf * intf) @@ -881,7 +897,7 @@ ipmi_lan_poll_recv(struct ipmi_intf * intf) /* - * read_open_session_reponse + * read_open_session_response * * Initialize the ipmi_rs from the IPMI 2.x open session response data. * @@ -903,7 +919,7 @@ read_open_session_response(struct ipmi_rs * rsp, int offset) /* Message tag */ rsp->payload.open_session_response.message_tag = rsp->data[offset]; - /* RAKP reponse code */ + /* RAKP response code */ rsp->payload.open_session_response.rakp_return_code = rsp->data[offset + 1]; /* Maximum privilege level */ @@ -970,7 +986,7 @@ read_rakp2_message( /* Message tag */ rsp->payload.rakp2_message.message_tag = rsp->data[offset]; - /* RAKP reponse code */ + /* RAKP response code */ rsp->payload.rakp2_message.rakp_return_code = rsp->data[offset + 1]; /* Console session ID */ @@ -1051,7 +1067,7 @@ read_rakp4_message( /* Message tag */ rsp->payload.rakp4_message.message_tag = rsp->data[offset]; - /* RAKP reponse code */ + /* RAKP response code */ rsp->payload.rakp4_message.rakp_return_code = rsp->data[offset + 1]; /* Console session ID */ @@ -1162,19 +1178,6 @@ read_session_data_v2x( #endif - /* - * Verify that the session ID is what we think it should be - */ - if ((s->v2_data.session_state == LANPLUS_STATE_ACTIVE) && - (rsp->session.id != s->v2_data.console_id)) - { - lprintf(LOG_ERR, "packet session id 0x%x does not " - "match active session 0x%0x", - rsp->session.id, s->v2_data.console_id); - assert(0); - } - - /* Ignored, so far */ memcpy(&rsp->session.seq, rsp->data + *offset, 4); *offset += 4; @@ -1399,10 +1402,6 @@ void getIpmiPayloadWireRep( msg[len++] = IPMI_REMOTE_SWID; msg[len++] = curr_seq << 2; msg[len++] = 0x34; /* Send Message rqst */ - #if 0 /* From lan.c example */ - entry->req.msg.target_cmd = entry->req.msg.cmd; /* Save target command */ - entry->req.msg.cmd = 0x34; /* (fixup request entry) */ - #endif msg[len++] = (0x40|intf->target_channel); /* Track request*/ payload->payload_length += 7; @@ -2101,7 +2100,7 @@ ipmi_lanplus_send_payload( struct ipmi_v2_payload * payload) { struct ipmi_rs * rsp = NULL; - uint8_t * msg_data; + uint8_t * msg_data = NULL; int msg_length; struct ipmi_session * session = intf->session; struct ipmi_rq_entry * entry = NULL; @@ -2341,6 +2340,7 @@ ipmi_lanplus_send_payload( case IPMI_PAYLOAD_TYPE_RMCP_OPEN_REQUEST: case IPMI_PAYLOAD_TYPE_RAKP_1: case IPMI_PAYLOAD_TYPE_RAKP_3: + case IPMI_PAYLOAD_TYPE_SOL: free(msg_data); msg_data = NULL; break; @@ -3416,7 +3416,7 @@ ipmi_lanplus_open(struct ipmi_intf * intf) if (!ipmi_oem_active(intf, "i82571spt") && ipmi_get_auth_capabilities_cmd(intf, &auth_cap)) { lprintf(LOG_INFO, "Error issuing Get Channel " - "Authentication Capabilies request"); + "Authentication Capabilities request"); goto fail; } diff --git a/src/plugins/lipmi/Makefile.am b/src/plugins/lipmi/Makefile.am index 61c50f4..ca7aa0a 100644 --- a/src/plugins/lipmi/Makefile.am +++ b/src/plugins/lipmi/Makefile.am @@ -30,7 +30,7 @@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_lipmi.la noinst_LTLIBRARIES = @INTF_LIPMI_LIB@ diff --git a/src/plugins/lipmi/Makefile.in b/src/plugins/lipmi/Makefile.in index eb8000f..be4996d 100644 --- a/src/plugins/lipmi/Makefile.in +++ b/src/plugins/lipmi/Makefile.in @@ -338,7 +338,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_lipmi.la noinst_LTLIBRARIES = @INTF_LIPMI_LIB@ libintf_lipmi_la_LIBADD = $(top_builddir)/lib/libipmitool.la diff --git a/src/plugins/open/Makefile.am b/src/plugins/open/Makefile.am index 89ce711..edc4916 100644 --- a/src/plugins/open/Makefile.am +++ b/src/plugins/open/Makefile.am @@ -30,7 +30,7 @@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_open.la noinst_LTLIBRARIES = @INTF_OPEN_LIB@ diff --git a/src/plugins/open/Makefile.in b/src/plugins/open/Makefile.in index bb4be5e..c4b7714 100644 --- a/src/plugins/open/Makefile.in +++ b/src/plugins/open/Makefile.in @@ -338,7 +338,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_open.la noinst_LTLIBRARIES = @INTF_OPEN_LIB@ libintf_open_la_LIBADD = $(top_builddir)/lib/libipmitool.la diff --git a/src/plugins/open/open.c b/src/plugins/open/open.c index fc685de..df56172 100644 --- a/src/plugins/open/open.c +++ b/src/plugins/open/open.c @@ -44,6 +44,7 @@ #include #include +#include #include #include diff --git a/src/plugins/serial/Makefile.am b/src/plugins/serial/Makefile.am index 5bfbd0d..c1a3083 100644 --- a/src/plugins/serial/Makefile.am +++ b/src/plugins/serial/Makefile.am @@ -30,7 +30,7 @@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_serial.la noinst_LTLIBRARIES = @INTF_SERIAL_LIB@ diff --git a/src/plugins/serial/Makefile.in b/src/plugins/serial/Makefile.in index cae1857..aa03dd8 100644 --- a/src/plugins/serial/Makefile.in +++ b/src/plugins/serial/Makefile.in @@ -338,7 +338,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_serial.la noinst_LTLIBRARIES = @INTF_SERIAL_LIB@ libintf_serial_la_LIBADD = $(top_builddir)/lib/libipmitool.la diff --git a/src/plugins/serial/serial_basic.c b/src/plugins/serial/serial_basic.c index fe2ebff..e3322c1 100644 --- a/src/plugins/serial/serial_basic.c +++ b/src/plugins/serial/serial_basic.c @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/plugins/serial/serial_terminal.c b/src/plugins/serial/serial_terminal.c index dfcc202..cd33422 100644 --- a/src/plugins/serial/serial_terminal.c +++ b/src/plugins/serial/serial_terminal.c @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/plugins/usb/Makefile.am b/src/plugins/usb/Makefile.am index 2a431f7..ce68fb7 100644 --- a/src/plugins/usb/Makefile.am +++ b/src/plugins/usb/Makefile.am @@ -31,7 +31,7 @@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_usb.la noinst_LTLIBRARIES = @INTF_USB_LIB@ diff --git a/src/plugins/usb/Makefile.in b/src/plugins/usb/Makefile.in index 298e11d..c3cfc41 100644 --- a/src/plugins/usb/Makefile.in +++ b/src/plugins/usb/Makefile.in @@ -308,7 +308,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MAINTAINERCLEANFILES = Makefile.in -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include EXTRA_LTLIBRARIES = libintf_usb.la noinst_LTLIBRARIES = @INTF_USB_LIB@ libintf_usb_la_LIBADD = $(top_builddir)/lib/libipmitool.la -- cgit v1.2.3