Compare commits

...

5 Commits

Author SHA1 Message Date
cac593b83d ci: Add support for Ubuntu 20.04
- Add ubuntu-20.04 target
- Disable building of Solaris-specific `bmc` interface on Ubuntu
- Rename `ubuntu` matrix to `linux`

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2021-04-17 02:44:37 +03:00
8554e19e68 ci: Fix Ubuntu builds
GitHub machines sometimes aren't immediately updated after
Ubuntu repos update. That leads to failed CI builds due
to inability to install some packages.

Add a call to `apt update` to update the package database
before installing anything.

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2021-04-17 02:10:48 +03:00
e6632dcf43 Fix compiler warning
Move #ifdef from the inside to the outside of assert()'s
to get rid of this compiler warning:

warning: embedding a directive within macro arguments has undefined
behavior [-Wembedded-directive]

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2021-04-17 01:59:03 +03:00
692a357808 Fix compiler warning
Drop some unused variables detected by the compiler

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2021-04-17 01:59:03 +03:00
87fc969e45 Fix compiler warning
Refactor plugin ipmi_intf structure initialization for some
plugins to stop the compiler complaining like this:

warning: use of GNU old-style field designator
extension [-Wgnu-designator]

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2021-04-17 01:59:03 +03:00
6 changed files with 46 additions and 40 deletions

View File

@ -1,5 +1,5 @@
# vi: set et ts=2 sw=2 : # vi: set et ts=2 sw=2 :
name: C/C++ CI name: build
on: on:
push: push:
@ -8,10 +8,10 @@ on:
branches: [ master ] branches: [ master ]
jobs: jobs:
ubuntu: linux:
strategy: strategy:
matrix: matrix:
os: [ ubuntu-16.04, ubuntu-18.04 ] os: [ ubuntu-16.04, ubuntu-18.04, ubuntu-20.04 ]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: install dependencies - name: install dependencies
@ -24,17 +24,12 @@ jobs:
libtool \ libtool \
make \ make \
wget wget
# TODO: Add ubuntu-20.04 to the matrix.os list and fix the build
# - name: install extra dependencies
# # In Ubuntu 20.04 some crucial development headers/libraries
# # have been moved from libc6-dev to musl-dev
# if: matrix.os == 'ubuntu-20.04'
# run: sudo apt install musl-dev
- name: install extra libraries - name: install extra libraries
# This build job tries to verify as much of ipmitool code # This build job tries to verify as much of ipmitool code
# as possible, hence these libraries. They aren't usually # as possible, hence these libraries. They aren't usually
# needed for normal user builds: # needed for normal user builds:
run: | run: |
sudo apt update
sudo apt install \ sudo apt install \
libsystemd-dev \ libsystemd-dev \
libreadline-dev \ libreadline-dev \
@ -50,7 +45,6 @@ jobs:
./configure --enable-intf-dummy \ ./configure --enable-intf-dummy \
--enable-intf-dbus \ --enable-intf-dbus \
--enable-intf-usb \ --enable-intf-usb \
--enable-intf-bmc \
--enable-intf-free --enable-intf-free
- name: make - name: make
run: make run: make
@ -60,7 +54,6 @@ jobs:
run: make distcheck run: make distcheck
macos-catalina: macos-catalina:
runs-on: macos-10.15 runs-on: macos-10.15
steps: steps:

View File

@ -68,11 +68,12 @@ static struct ipmi_rs *ipmi_bmc_send_cmd_putmsg(struct ipmi_intf *intf,
#define MESSAGE_BUFSIZE 1024 #define MESSAGE_BUFSIZE 1024
struct ipmi_intf ipmi_bmc_intf = { struct ipmi_intf ipmi_bmc_intf = {
name: "bmc", .name = "bmc",
desc: "IPMI v2.0 BMC interface", .desc = "IPMI v2.0 BMC interface",
open: ipmi_bmc_open, .open = ipmi_bmc_open,
close: ipmi_bmc_close, .close = ipmi_bmc_close,
sendrecv: ipmi_bmc_send_cmd}; .sendrecv = ipmi_bmc_send_cmd
};
void void
ipmi_bmc_close(struct ipmi_intf *intf) ipmi_bmc_close(struct ipmi_intf *intf)

View File

@ -63,8 +63,6 @@ extern int verbose;
static int ipmi_free_open(struct ipmi_intf * intf) static int ipmi_free_open(struct ipmi_intf * intf)
{ {
int kcs_ret = -1, ssif_ret = -1;
if (getuid() != 0) { if (getuid() != 0) {
fprintf(stderr, "Permission denied, must be root\n"); fprintf(stderr, "Permission denied, must be root\n");
return -1; return -1;
@ -310,11 +308,11 @@ static struct ipmi_rs * ipmi_free_send_cmd(struct ipmi_intf * intf, struct ipmi_
} }
struct ipmi_intf ipmi_free_intf = { struct ipmi_intf ipmi_free_intf = {
name: "free", .name = "free",
desc: "FreeIPMI IPMI Interface", .desc = "FreeIPMI IPMI Interface",
open: ipmi_free_open, .open = ipmi_free_open,
close: ipmi_free_close, .close = ipmi_free_close,
sendrecv: ipmi_free_send_cmd, .sendrecv = ipmi_free_send_cmd,
target_addr: IPMI_BMC_SLAVE_ADDR, .target_addr = IPMI_BMC_SLAVE_ADDR,
}; };

View File

@ -741,8 +741,6 @@ ipmi_lan_poll_single(struct ipmi_intf * intf)
return (struct ipmi_rs *)1; return (struct ipmi_rs *)1;
}; };
uint8_t target_cmd = entry->req.msg.target_cmd;
lprintf(LOG_DEBUG+2, "IPMI Request Match found"); lprintf(LOG_DEBUG+2, "IPMI Request Match found");
if (entry->bridging_level) { if (entry->bridging_level) {

View File

@ -84,12 +84,16 @@ lanplus_rakp2_hmac_matches(const struct ipmi_session * session,
return 1; return 1;
/* We don't yet support other algorithms */ /* We don't yet support other algorithms */
#ifdef HAVE_CRYPTO_SHA256 // assert() is a macro, must not put #ifdef inside it
assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1) assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1)
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5)
#ifdef HAVE_CRYPTO_SHA256
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA256) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA256)
#endif /* HAVE_CRYPTO_SHA256 */
); );
#else
assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1)
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5)
);
#endif /* HAVE_CRYPTO_SHA256 */
bufferLength = bufferLength =
@ -251,12 +255,16 @@ lanplus_rakp4_hmac_matches(const struct ipmi_session * session,
return 1; return 1;
/* We don't yet support other algorithms */ /* We don't yet support other algorithms */
#ifdef HAVE_CRYPTO_SHA256 // assert() is a macro, must not put #ifdef inside it
assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1) assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1)
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5)
#ifdef HAVE_CRYPTO_SHA256
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA256) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA256)
#endif /* HAVE_CRYPTO_SHA256 */
); );
#else
assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1)
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5)
);
#endif /* HAVE_CRYPTO_SHA256 */
} }
bufferLength = bufferLength =
@ -417,12 +425,16 @@ lanplus_generate_rakp3_authcode(uint8_t * output_buffer,
} }
/* We don't yet support other algorithms */ /* We don't yet support other algorithms */
#ifdef HAVE_CRYPTO_SHA256 // assert() is a macro, must not put #ifdef inside it
assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1) assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1)
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5)
#ifdef HAVE_CRYPTO_SHA256
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA256) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA256)
#endif /* HAVE_CRYPTO_SHA256 */
); );
#else
assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1)
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5)
);
#endif /* HAVE_CRYPTO_SHA256 */
input_buffer_length = input_buffer_length =
16 + /* Rc */ 16 + /* Rc */
@ -539,12 +551,16 @@ lanplus_generate_sik(struct ipmi_session * session, struct ipmi_intf * intf)
return 0; return 0;
/* We don't yet support other algorithms */ /* We don't yet support other algorithms */
#ifdef HAVE_CRYPTO_SHA256 // assert() is a macro, must not put #ifdef inside it
assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1) assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1)
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5)
#ifdef HAVE_CRYPTO_SHA256
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA256) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA256)
#endif /* HAVE_CRYPTO_SHA256 */
); );
#else
assert((session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_SHA1)
|| (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5)
);
#endif /* HAVE_CRYPTO_SHA256 */
input_buffer_length = input_buffer_length =
16 + /* Rm */ 16 + /* Rm */

View File

@ -119,11 +119,11 @@ static struct ipmi_rs * ipmi_lipmi_send_cmd(struct ipmi_intf * intf, struct ipmi
} }
struct ipmi_intf ipmi_lipmi_intf = { struct ipmi_intf ipmi_lipmi_intf = {
name: "lipmi", .name = "lipmi",
desc: "Solaris x86 LIPMI Interface", .desc = "Solaris x86 LIPMI Interface",
open: ipmi_lipmi_open, .open = ipmi_lipmi_open,
close: ipmi_lipmi_close, .close = ipmi_lipmi_close,
sendrecv: ipmi_lipmi_send_cmd, .sendrecv = ipmi_lipmi_send_cmd,
target_addr: IPMI_BMC_SLAVE_ADDR, .target_addr = IPMI_BMC_SLAVE_ADDR,
}; };