From d88bbf3c416e1030616c79ca0111d77d814d73b4 Mon Sep 17 00:00:00 2001 From: Alexander Amelkin Date: Wed, 7 Apr 2021 00:50:44 +0300 Subject: 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 --- src/plugins/bmc/bmc.c | 11 ++++++----- src/plugins/free/free.c | 12 ++++++------ src/plugins/lipmi/lipmi.c | 12 ++++++------ 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/plugins/bmc/bmc.c b/src/plugins/bmc/bmc.c index b88b077..eee6936 100644 --- a/src/plugins/bmc/bmc.c +++ b/src/plugins/bmc/bmc.c @@ -68,11 +68,12 @@ static struct ipmi_rs *ipmi_bmc_send_cmd_putmsg(struct ipmi_intf *intf, #define MESSAGE_BUFSIZE 1024 struct ipmi_intf ipmi_bmc_intf = { - name: "bmc", - desc: "IPMI v2.0 BMC interface", - open: ipmi_bmc_open, - close: ipmi_bmc_close, - sendrecv: ipmi_bmc_send_cmd}; + .name = "bmc", + .desc = "IPMI v2.0 BMC interface", + .open = ipmi_bmc_open, + .close = ipmi_bmc_close, + .sendrecv = ipmi_bmc_send_cmd +}; void ipmi_bmc_close(struct ipmi_intf *intf) diff --git a/src/plugins/free/free.c b/src/plugins/free/free.c index 96fc9ad..805a901 100644 --- a/src/plugins/free/free.c +++ b/src/plugins/free/free.c @@ -310,11 +310,11 @@ static struct ipmi_rs * ipmi_free_send_cmd(struct ipmi_intf * intf, struct ipmi_ } struct ipmi_intf ipmi_free_intf = { - name: "free", - desc: "FreeIPMI IPMI Interface", - open: ipmi_free_open, - close: ipmi_free_close, - sendrecv: ipmi_free_send_cmd, - target_addr: IPMI_BMC_SLAVE_ADDR, + .name = "free", + .desc = "FreeIPMI IPMI Interface", + .open = ipmi_free_open, + .close = ipmi_free_close, + .sendrecv = ipmi_free_send_cmd, + .target_addr = IPMI_BMC_SLAVE_ADDR, }; diff --git a/src/plugins/lipmi/lipmi.c b/src/plugins/lipmi/lipmi.c index fa7845d..f3db7ab 100644 --- a/src/plugins/lipmi/lipmi.c +++ b/src/plugins/lipmi/lipmi.c @@ -119,11 +119,11 @@ static struct ipmi_rs * ipmi_lipmi_send_cmd(struct ipmi_intf * intf, struct ipmi } struct ipmi_intf ipmi_lipmi_intf = { - name: "lipmi", - desc: "Solaris x86 LIPMI Interface", - open: ipmi_lipmi_open, - close: ipmi_lipmi_close, - sendrecv: ipmi_lipmi_send_cmd, - target_addr: IPMI_BMC_SLAVE_ADDR, + .name = "lipmi", + .desc = "Solaris x86 LIPMI Interface", + .open = ipmi_lipmi_open, + .close = ipmi_lipmi_close, + .sendrecv = ipmi_lipmi_send_cmd, + .target_addr = IPMI_BMC_SLAVE_ADDR, }; -- cgit v1.2.1 From fb176a1995936fd10d0c3fd76ef511243548898c Mon Sep 17 00:00:00 2001 From: Alexander Amelkin Date: Wed, 7 Apr 2021 00:53:34 +0300 Subject: Fix compiler warning Drop some unused variables detected by the compiler Signed-off-by: Alexander Amelkin --- src/plugins/free/free.c | 2 -- src/plugins/lanplus/lanplus.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/plugins/free/free.c b/src/plugins/free/free.c index 805a901..832f29b 100644 --- a/src/plugins/free/free.c +++ b/src/plugins/free/free.c @@ -63,8 +63,6 @@ extern int verbose; static int ipmi_free_open(struct ipmi_intf * intf) { - int kcs_ret = -1, ssif_ret = -1; - if (getuid() != 0) { fprintf(stderr, "Permission denied, must be root\n"); return -1; diff --git a/src/plugins/lanplus/lanplus.c b/src/plugins/lanplus/lanplus.c index 253f769..ed41380 100644 --- a/src/plugins/lanplus/lanplus.c +++ b/src/plugins/lanplus/lanplus.c @@ -741,8 +741,6 @@ ipmi_lan_poll_single(struct ipmi_intf * intf) return (struct ipmi_rs *)1; }; - uint8_t target_cmd = entry->req.msg.target_cmd; - lprintf(LOG_DEBUG+2, "IPMI Request Match found"); if (entry->bridging_level) { -- cgit v1.2.1 From 61bb233c5bdf3d756f7b284110c3ebb67fbb7517 Mon Sep 17 00:00:00 2001 From: Alexander Amelkin Date: Wed, 7 Apr 2021 00:58:49 +0300 Subject: 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 --- src/plugins/lanplus/lanplus_crypt.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/plugins/lanplus/lanplus_crypt.c b/src/plugins/lanplus/lanplus_crypt.c index 145c880..b4d677b 100644 --- a/src/plugins/lanplus/lanplus_crypt.c +++ b/src/plugins/lanplus/lanplus_crypt.c @@ -84,12 +84,16 @@ lanplus_rakp2_hmac_matches(const struct ipmi_session * session, return 1; /* 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) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5) -#ifdef HAVE_CRYPTO_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 = @@ -251,12 +255,16 @@ lanplus_rakp4_hmac_matches(const struct ipmi_session * session, return 1; /* 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) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5) -#ifdef HAVE_CRYPTO_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 = @@ -417,12 +425,16 @@ lanplus_generate_rakp3_authcode(uint8_t * output_buffer, } /* 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) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5) -#ifdef HAVE_CRYPTO_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 = 16 + /* Rc */ @@ -539,12 +551,16 @@ lanplus_generate_sik(struct ipmi_session * session, struct ipmi_intf * intf) return 0; /* 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) || (session->v2_data.auth_alg == IPMI_AUTH_RAKP_HMAC_MD5) -#ifdef HAVE_CRYPTO_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 = 16 + /* Rm */ -- cgit v1.2.1 From 6a3ded733306e12df8b2a8cc1c33dc03448fbee0 Mon Sep 17 00:00:00 2001 From: Alexander Amelkin Date: Sat, 17 Apr 2021 01:59:48 +0300 Subject: 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 --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 55ff479..3260373 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,7 @@ jobs: # as possible, hence these libraries. They aren't usually # needed for normal user builds: run: | + sudo apt update sudo apt install \ libsystemd-dev \ libreadline-dev \ -- cgit v1.2.1 From 6b1ce6c1ac34c567d594b24f03ddb43911284f1a Mon Sep 17 00:00:00 2001 From: Alexander Amelkin Date: Sat, 17 Apr 2021 02:09:49 +0300 Subject: 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 --- .github/workflows/ci.yml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3260373..fdbab0c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,5 @@ # vi: set et ts=2 sw=2 : -name: C/C++ CI +name: build on: push: @@ -8,10 +8,10 @@ on: branches: [ master ] jobs: - ubuntu: + linux: strategy: matrix: - os: [ ubuntu-16.04, ubuntu-18.04 ] + os: [ ubuntu-16.04, ubuntu-18.04, ubuntu-20.04 ] runs-on: ${{ matrix.os }} steps: - name: install dependencies @@ -24,12 +24,6 @@ jobs: libtool \ make \ 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 # This build job tries to verify as much of ipmitool code # as possible, hence these libraries. They aren't usually @@ -51,7 +45,6 @@ jobs: ./configure --enable-intf-dummy \ --enable-intf-dbus \ --enable-intf-usb \ - --enable-intf-bmc \ --enable-intf-free - name: make run: make @@ -61,7 +54,6 @@ jobs: run: make distcheck macos-catalina: - runs-on: macos-10.15 steps: -- cgit v1.2.1