summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* fru: Reduce duplicate codecodefactorAlexander Amelkin2019-03-071-136/+66
| | | | Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* Remove unused includeAlexander Amelkin2019-03-041-1/+0
| | | | | | | | | The endian.h header is not used for anything and was earlier added by mistake. It however hampers building on some systems where it doesn't exist. Resolves ipmitool/ipmitool#101 Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* Fix IPMI DCMI message typoGeorge Keishing2019-02-211-4/+4
| | | | Signed-off-by: George Keishing <gkeishin@in.ibm.com>
* open: swap free() calls for free_n()Patrick Venture2019-02-201-28/+7
| | | | | | | Swap calls to free() with calls to free_n() to leverage helper method and handle clearing pointers after freeing in one step. Signed-off-by: Patrick Venture <venture@google.com>
* open: checking received msg id against expectationPatrick Venture2019-02-201-35/+48
| | | | | | | | | | | | | | | | | Check the received IPMI response message id against the id expected given the IPMI request. They need to match. It is possible that request A times out, request B is sent, and then request A responds to the request B. The value for request B may be behind it in the queue. Note: This may only be possible if the file is kept open between multiple IPMI messages (a common occurrence). Resolves: #82 Signed-off-by: Patrick Venture <venture@google.com>
* open: fix whitespacePatrick Venture2019-02-201-179/+190
| | | | | | | Apply whitespace fixes via clang-format-6.0 to src/plugins/open/open.c to cleanup spaces and fixup line lengths, etc. Signed-off-by: Patrick Venture <venture@google.com>
* Refactor free_n() functionAlexander Amelkin2019-02-201-4/+7
| | | | | | | | Make the argument to free_n() compatible with any pointers, thus reducing the number of compilation warnings. End-user-impact: None Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* fru: swap free() calls for free_n()Patrick Venture2019-02-131-117/+49
| | | | | | | Swap calls to free() with calls to free_n() to leverage helper method and handle clearing pointers after freeing in one step. Signed-off-by: Patrick Venture <venture@google.com>
* fru: Fix write chunk reduction codePatrick Venture2019-02-131-1/+1
| | | | | | | | | Check against FRU_AREA_MAXIMUM_BLOCK_SZ instead of FRU_BLOCK_SZ when checking if the write chunk needs to be reduced. Apparently, that was the original intention, and then there was just a typo. In other places the same check is done properly. Signed-off-by: Patrick Venture <venture@google.com>
* fru: add macro FRU_AREA macrosPatrick Venture2019-02-131-6/+12
| | | | | | | Use two macros defining the FRU block sizes instead of hard-coded magic values. Signed-off-by: Patrick Venture <venture@google.com>
* fru: replace magic return codes with macrosPatrick Venture2019-02-131-4/+4
| | | | | | Use the return code macros instead of magic numbers. Signed-off-by: Patrick Venture <venture@google.com>
* fru header: add return error codes specific to fruPatrick Venture2019-02-131-0/+5
| | | | | | | Add two special return codes specific to the IPMI FRU commands. Signed-off-by: Patrick Venture <venture@google.com>
* fru: fix ipmi_fru_picmg_ext_edit as boolPatrick Venture2019-02-131-4/+6
| | | | | | | Fix ipmi_fru_picmg_ext_edit to use bools instead of an int treated as a boolean. Signed-off-by: Patrick Venture <venture@google.com>
* fru: use bool with ipmi_fru_oemkontron_editPatrick Venture2019-02-131-10/+12
| | | | | | | Convert ipmi_fru_oemkontron_edit to return a bool type instead of an int used as a bool. Signed-off-by: Patrick Venture <venture@google.com>
* fru: change ipmi_fru_query_new_value to return boolPatrick Venture2019-02-131-5/+5
| | | | | | | Change ipmi_fru_query_new_value to return the bool type instead of an int that's being used as a boolean value. Signed-off-by: Patrick Venture <venture@google.com>
* fru: mark ipmi_fru_query_new_value as staticPatrick Venture2019-02-131-1/+3
| | | | | | | Mark ipmi_fru_query_new_value as static as it's only used internally in this object. Signed-off-by: Patrick Venture <venture@google.com>
* fru: add fru_cc_rq2big helper method for code checksPatrick Venture2019-02-131-11/+10
| | | | | | | | Add fru_cc_rq2big helper method to reduce duplicate code checking for specific size-based IPMI response codes. Signed-off-by: Patrick Venture <venture@google.com>
* fru: cleanup ipmi_fru_upg_ekeyingPatrick Venture2019-02-131-28/+21
| | | | | | | Cleanup ipmi_fru_upg_ekeying such that it exits from one place that handles cleanup. Signed-off-by: Patrick Venture <venture@google.com>
* fru: use ipmi_cc defined maros for return codesPatrick Venture2019-02-131-8/+16
| | | | | | | Use the macros defined in ipmi_cc for IPMI return codes instead of magic numbers. Signed-off-by: Patrick Venture <venture@google.com>
* fru: drop extraneous parentheses on negative returnsPatrick Venture2019-02-131-63/+62
| | | | | | | Drop extraneous parentheses when returning a negative value. Signed-off-by: Patrick Venture <venture@google.com>
* fru: delete unused variable matchInstancePatrick Venture2019-02-131-3/+0
| | | | | | | Delete unused variable matchInstance. The variable is repeatedly assigned, but nothing reads it. Signed-off-by: Patrick Venture <venture@google.com>
* fru: cleanup ipmi_fru_oemkontron_getPatrick Venture2019-02-131-82/+81
| | | | | | | Cleanup style in method ipmi_fru_oemkontron_get as well as add inverted logic checks to reduce indentation. Signed-off-by: Patrick Venture <venture@google.com>
* fru: fixup array bounds checkingPatrick Venture2019-02-132-6/+5
| | | | | | | | | | | | Fixup the following array bounds checking bugs: [lib/ipmi_fru.c:1003]: (style) Array index 'i' is used before limits check. [lib/ipmi_fru.c:1127]: (style) Array index 'i' is used before limits check. [lib/ipmi_fru.c:1262]: (style) Array index 'i' is used before limits check. Signed-off-by: Patrick Venture <venture@google.com>
* hpm: Adhere to centralized exitingJosef Moellers2019-01-241-7/+10
| | | | | Replace `return`s with `goto`s to appropriate labels (with or without closing the file).
* hpm: Minor refactoringJosef Moellers2019-01-241-7/+3
| | | | | Remove an `if()` with a condition that is always true. Merge two calls to time() into one.
* hpm: Fix resource leakJosef Moellers2019-01-241-0/+1
| | | | | fclose(pImageFile) was missing before returning from HpmfwupgGetBufferFromFile()
* sol: Make interface timeout obey the -N optionAlexander Amelkin2018-12-281-3/+0
| | | | | | | | | For `sol activate` the timeout on lanplus interface was hard-coded to 1 second, overriding the value set with the `-N` option. Resolves ipmitool/ipmitool#87 Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* helper: add free_n method to handle clearing pointersPatrick Venture2018-12-241-0/+11
| | | | | | | | | | free_n() will free the memory and clear the pointer, which will reduce the probability a developer will forget to clear the pointer after freeing. Resolves: #79 Signed-off-by: Patrick Venture <venture@google.com>
* cygwin: imb: Fix build error (wchar_t)Jörg Krause2018-12-071-0/+3
| | | | | | | | | | For Win32/Cygwin, the imb plugin was failing to build with the following message: imbapi.h:140:9: error: unknown type name 'wchar_t' typedef wchar_t WCHAR; Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
* lanplus: Fix segfault for truncated dcmi responsepjdhpe2018-12-061-2/+2
| | | | | | | | | | | | | On occasion a dcmi power reading will return error C6, and a truncated response payload. As the decrypted payload is shorter than the expected length, lanplus_decrypt_aes_cbc_128() adjusts the payload_size downward by one byte. In ipmi_lan_poll_single() the calculation to determine if the payload size has increased erroniously sets extra_data_length to -1, with a subsequent segv when calling a memmove to shift response data. The fix is to check for a positive value in the extra_data_length. Resolves ipmitool/ipmitool#72
* lanplus: Cleanup. Refix 6dec83ff, fix be2c0c4bAlexander Amelkin2018-11-291-1/+1
| | | | | | | | | | | | | | | | | | This is a cleanup commit. Commit 6dec83ff removed assignment of `rsp` pointer in SOL-processing block of ipmi_lan_poll_single(), but left the check for the pointer validity in place. Although that has effectively fixed the bug of potentially accessing the null `rsp` pointer in the `else` block introduced with be2c0c4b, the resulting if/else looked suspicious and left and impression that a NULL pointer could still be accessed. This commit removes the check for `rsp` from the `if` as it is checked at the start of the function where `rsp` is initialized (and that is the only place where it is ever changed). Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* Move led color static array to source fileAlexander Amelkin2018-11-233-34/+49
| | | | | | | | | | Move led color static array from header to ipmi_picmg module and introduce `picmg_led_color_str()` function for use in ipmi_vita module. Partially resolves ipmitool/ipmitool#13 Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* drop unused static arraysPatrick Venture2018-11-234-54/+0
| | | | | | | | Originally marked unused, now dropped. Partially resolves ipmitool/ipmitool#13 Signed-off-by: Patrick Venture <venture@google.com>
* move static objects to source filePatrick Venture2018-11-2310-473/+607
| | | | | | | | | Move static objects declared in headers to the source files where they're used. Partially resolves ipmitool/ipmitool#13 Signed-off-by: Patrick Venture <venture@google.com>
* cleanup all unused-parameter warningsPatrick Venture2018-11-2322-173/+170
| | | | | | | | | Cleanup all unused-parameter warnings. Each warning was examined to verify it wasn't simply a case of a build macro difference. Partially resolves ipmitool/ipmitool#13 Signed-off-by: Patrick Venture <venture@google.com>
* use __UNUSED__ macro instead of gcc specific attributePatrick Venture2018-11-2310-25/+25
| | | | | | | | | Use __UNUSED__ macro defined in helper.h instead of the gcc-specific attribute unused macro. Partially resolves ipmitool/ipmitool#13 Signed-off-by: Patrick Venture <venture@google.com>
* implement __UNUSED__ macro for marking unusedPatrick Venture2018-11-231-0/+6
| | | | | | | | Implement __UNUSED__ macro for marking symbols unused safely. Partially resolves ipmitool/ipmitool#13 Signed-off-by: Patrick Venture <venture@google.com>
* Add .dirstamp to .gitignorePatrick Venture2018-11-231-0/+1
| | | | | | | Add the .dirstamp path to .gitignore. .dirstamp is automatically generated by some build systems. Signed-off-by: Patrick Venture <venture@google.com>
* fru: Fix processing of unspecified board mfg. dateAlexander Amelkin2018-11-162-2/+19
| | | | | | | | | | | | | FRU board mfg. date uses a different value for 'unspecified' timestamp than the general IPMI specification. This commit makes ekanalyzer and fru commands process unspecified FRU dates properly, displaying 'Unspecified' instead of 'Mon Jan 1 03:00:00 1996'. Resolves ipmitool/ipmitool#57 Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* [compiler-warnings-fixes] use correct fall through commentVernon Mauery2018-11-111-3/+3
| | | | | | | | | | | In some of the SDR calculating code, there were switch statements that had cases that would fall through deliberately into the next case. But the compiler didn't like the comment and would complain about the fall through anyway. This changes to a comment that the compiler recognizes. Partially resolves ipmitool/ipmitool#13 Signed-off-by: Vernon Mauery <vernon.mauery@intel.com>
* [compiler-warnings-fixes] ipmi_start_daemon: check return valuesVernon Mauery2018-11-111-4/+20
| | | | | | | | | | Some return values were being ignored in ipmi_start_daemon. This adds checks to the values and changes some hard-coded numbers into named values. Partially resolves ipmitool/ipmitool#13 Signed-off-by: Vernon Mauery <vernon.mauery@intel.com>
* [compiler-warnings-fixes] ipmi_sdr.c: remove unused function parametersVernon Mauery2018-11-118-85/+36
| | | | | | | | | | Several functions were passed a struct ipmi_intf* even though it was unused. This removes the unused parameters and changes calls and signatures. Partially resolves ipmitool/ipmitool#13 Signed-off-by: Vernon Mauery <vernon.mauery@intel.com>
* lan: Fix processing disabled VLANAlexander Amelkin2018-11-112-11/+34
| | | | | | | | | | | Before this fix `ipmitool` would complain that VLAN ID is out of range when trying to disable an already disabled VLAN on a lan channel. With this fix it will properly report that VLAN is already disabled. Resolves ipmitool/ipmitool#55 Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* Make ipmitool respect system locale settingsAlexander Amelkin2018-11-081-0/+5
| | | | | | | | | Dates, times and floating point numbers from now on will be displayed using system locale settings. Resolves ipmitoo/ipmitool#23 Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* Fix strftime() non-literal argument warningAlexander Amelkin2018-11-072-21/+49
| | | | | | | | | | | | | | | | There is a bug in gcc since 4.3.2 and still not fixed in 8.1.0. Even if __attribute__((format(strftime... is specified for a wrapper function around strftime, gcc still complains about strftime being called from the wrapper with a "non-literal" format argument. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39438 This commit adds 'ugly hacks' from that discussion to call strftime() from strftime-formatted wrappers and silence the warnings. Partially resolves ipmitool/ipmitool#23 Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* Refactor timestamp handlingAlexander Amelkin2018-11-0716-368/+486
| | | | | | | | | | | | Handle all date/time stamps uniformly, taking in account the host endianness. Respect the local time zone and the '-Z' option for all ipmitool commands. Unify the date and time formatting. Add correct handling of IPMI timestamps 'since system startup' and for 'unspecified' timestamps. Partially resolves ipmitool/ipmitool#23 Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* doc: Update manpage with new contact infoAlexander Amelkin2018-11-011-2/+9
|
* lanplus: RefactoringAlexander Amelkin2018-11-015-97/+151
| | | | | | | Some minor formatting corrections. Also introduced a new helper function to reduce nesting level. Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* lanplus: Fix -C option processingAlexander Amelkin2018-11-011-8/+6
| | | | | | | | Cipher suite ID is a byte as per IPMI spec. Use the appropriate function and consider target endianness (so write to a temporary variable). Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* lanplus: Auto-select 'best' cipher suite availableVernon Mauery2018-11-016-160/+296
| | | | | | | | | | | | | | | | | | | | | Based on current crypto alogrithms, one could rank cipher suites along these lines: 17 > 3 >> all the rest 17 and 3 are the only cipher suites that implement any sort of confidentiality alogorithm that is secure. In addition, any hmac-md5 or md5 integrity algorithm used in integrity is weak at best and dangerous for authentication. This could possibly be enabled in a simpler mechanism by simply checking for 17 and then choosing it before falling back to 3, but the way this is implemented, it makes it easy to change the list of acceptable algorithms from two to three or more items. Resolves ipmitool/ipmitool#29 Signed-off-by: Vernon Mauery <vernon.mauery@intel.com>