summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* user: Improve password length handlingG Dutton2019-09-031-17/+18
| | | | | | | No longer truncate passwords (16 < p <= 20) silently, instead attempt to set a 20-char password when such a password is given. Fail if an explicit length is exceeded, and any time the upper limit is exceeded.
* user: Alter "set password" usage informationG Dutton2019-09-031-1/+1
| | | | | This changes the usage string to match reality and note that [<16|20>] is an optional argument to set password.
* intf: Add missing function declarationsAlexander Amelkin2019-08-293-14/+0
| | | | | | | | | | ipmi_intf.h was missing a couple of declarations for the functions used by fru, sdr and hpmfwupg modules. Add those declarations to ipmi_intf.h and remove local declarations. This fixes a couple of compilation warnings. Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* event: Clean up event sending from a fileAlexander Amelkin2019-07-021-57/+16
| | | | | | | | | | | | | | | The ipmi_event_fromfile() function was massively repeating the code of ipmi_send_platform_event() and ipmi_event_msg_print(). This commit cleans up ipmi_event_fromfile() to simply call ipmi_send_platform_event() with all the prepared data read from the file. That function in its turn calls ipmi_event_msg_print(). This commit also replaces the dummy generator ID 2 that was printed to the user with a more relevant generator ID that will actually be sent by ipmi_send_platform_event(). Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* event: Clean up the event sending codeAlexander Amelkin2019-07-021-37/+38
| | | | | | Get rid of magic numbers, reduce code duplication Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* event: Fix event submission via SSIFAlexander Amelkin2019-07-022-18/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IPMI 2.0 specification is quite inconsistent about system interfaces. They have section 1.7.16 "System Interfaces" that clearly states that there are FOUR system interfaces (KCS, SMIC, BT and SSIF), but then they have section 1.7.31 saying that "It is mandatory to implement a system interface that is compatible with one of the **three** specified system interfaces" without specifying which three of the four interfaces are meant. Then in section 6 "IPMI Messaging interfaces" they again say that "As mentioned earlier, there are three System Interface implementations specified for the BMC: SMIC, KCS, and BT". Is all looks like during update from 1.5 to 2.0 they have updated section 1.7.16, but forgot to update Table 6-3, section 1.7.31 and section 6. Yet again, there is 'Get System Interface Capabilities' command that has a parameter 'System Interface Type' that can specify that SI is of SSIF type. All that have lead to a situation where some BMC manufacturers treated the specification as if it prohibited specifying media type 0xC (which is "System Interface") for system interfaces using SSIF (SMBus Sustem Interface), and so they specified an SMBUS media type for their system interface channels. As a result, ipmitool failed to properly send event data via such system interfaces as it treated them as non-system and didn't add the required Generator ID. To mitigate the inconsistency of IPMI specification and yet not ask BMC manufacturers to alter their code, thus increasing compatibility with legacy BMCs, this commit adds checking of current interface number. The system interface, according to Table 6-1 of IPMI Specification is required to have channel number 15 (0Fh). So with this commit the generator ID is added for any interfaces that are either marked as media type 0Ch 'System Interface' or have channel number 0Fh. Resolves ipmitool/ipmitool#111 Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* mc: Fix reporting of manufacturers > 64KAlexander Amelkin2019-06-181-7/+7
| | | | | | | | | | | | | | | If a manufacturer's IANA PEN (aka manufacturer ID) was above 65535, it wasn't reported properly. Luckily there are no such IDs so far, the biggest is 54077 as of 2019/06/18. There is, however, an ID 0xFFFFFE used by fake_ipmistack for debug purposes, and it was not reported correctly. This commit expands the value argument to string searching functions from 16-bit to 32-bit to allow for any possible IANA PEN. Fixes: 73d6af57827fc85e78c700ca1dff00b3dbc63948 Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* Use configurable path to IANA PEN registryAlexander Amelkin2019-06-181-6/+16
| | | | | | | | | | | | Add support for IANADIR and IANAUSERDIR variables to configure to allow for customizable locations of system and user-supplied IANA PEN registry. Also make path building code portable to Windows. Partially resolves ipmitool/ipmitool#11 Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* Load IANA PEN registry from a fileAlexander Amelkin2019-06-184-94/+355
| | | | | | | | | | | | | | | | | | | | Previously, the OEM names dictionary was compiled in and updating it required rebuilding of `ipmitool`, thus taking a long time for newly registered OEMs to get supported by the tool. Building also required a direct internet connection to succeed. With this commit, the OEM enterprise dictionary is now loaded from either ${HOME}/.local/usr/share/misc/enterprise-numbers or from /usr/share/misc/enterprise-numbers (in that precedence). Those files can be downloaded from iana.org at http://www.iana.org/assignments/enterprise-numbers Partially resolves ipmitool/ipmitool#11 Fixes: 9d41136c9b7c7d392f1a3f3adeb6d7fe3bd3135e Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* oem: name change from Newisys to Viking Enterprise Solutionsdan mcgee2019-06-111-8/+8
| | | | | | | | | | | Renamed the oem strings containing Newisys to Viking Enterprise Solutions. IANA 9237 Built and tested with AMI's IPMI stack LTS 12.01. Resolves ipmitool/ipmitool#124 Signed-off-by: dan mcgee <dan.mcgee@vikingenterprise.com> Signed-off-by: dan mcgee <dan.mcgee@sanmina.com>
* chassis: Add boot initiator mailbox supportAlexander Amelkin2019-06-101-37/+472
| | | | | | | | | | | | | | | Add `chassis bootmbox` command to set and get Boot Initiator Mailbox boot parameter (id 7) the easy way. The command allows for getting and setting the data both in hex and text modes, as well as properly decodes IANA Enterprise number for block 0. It can get/set the whole mailbox at once or operate on separate data blocks. This commit enhances the chassis_get_boot_param() function with extra arguments to re-use its code in handling of the added command. Documentation update will follow. Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* chassis: Use command-specific completion code parserAlexander Amelkin2019-06-101-5/+28
| | | | | | | | | | Get/set system boot option commands have some command-specific completion codes that are now reported as "Unknown (0080)", etc. Use the previously introduced specific_val2str() to convert those specific error codes to human-readable strings. Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* Add support for command-specific completion codesAlexander Amelkin2019-06-101-12/+57
| | | | | | | | | | | | | | Some commands may return command-specific completion codes. Now they are all reported as 'Unknown'. Add helper functions to support such command-specific codes. Command handlers will need to define their own valstr arrays with completion code descriptions and then use specific_val2str() instead of generic val2str() to convert the completion code into a string. Also reduce code duplication in helper.c Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* Add a helper args2buf() functionAlexander Amelkin2019-06-101-0/+32
| | | | | | | | The function converts a set of command line arguments representing byte values into a byte buffer and verifies each individual value to be a valid data byte. Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* create_pen_list: only print if values are setVernon Mauery2019-05-291-1/+3
| | | | | | | | | | | On a failed download of the PEN list, the create_pen_list script improperly printed an invalid entry of { , "" } causing the build to fail. The last line print must check that it has something to print or it will print the wrong thing. Partially resolves ipmitool/ipmitool#11 Signed-off-by: Vernon Mauery <vernon.mauery@intel.com>
* chassis: Refactor to reduce code duplicationAlexander Amelkin2019-05-281-15/+26
| | | | | | | Move boot information acknowledgement clearing code into a helper funcion, call it instead of copy-pasted code. Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* chassis: Refactor to reduce code duplicationAlexander Amelkin2019-05-281-100/+69
| | | | | | | | Get rid of repeated code that sets the set-in-progress parameter. Introduce chassis_bootparam_set_in_progress() function to do the job. Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* sdr: Fix segfault on invalid unit typesAlexander Amelkin2019-05-271-22/+50
| | | | | | | | | | | The program would crash if the BMC returned an out of range (>90) unit type for a full sensor record. This commit adds a range check and also add support for IPMI 2.0 additional unit types 91 and 92 ("fatal error" and "grams"). Resolves ipmitool/ipmitool#118 Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* vendor: Add YADRO TATLIN Storage Controller IDAlexander Amelkin2019-04-171-0/+1
| | | | Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
* Fix "ipmitool pef {status,info}" not printing final newlineVaclav Dolezal2019-04-011-0/+2
| | | | Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* 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>
* 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: 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-131-6/+3
| | | | | | | | | | | | 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>
* Move led color static array to source fileAlexander Amelkin2018-11-232-22/+48
| | | | | | | | | | 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>
* move static objects to source filePatrick Venture2018-11-235-0/+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-2311-121/+111
| | | | | | | | | 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-231-1/+1
| | | | | | | | | 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>
* fru: Fix processing of unspecified board mfg. dateAlexander Amelkin2018-11-161-1/+5
| | | | | | | | | | | | | 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-116-70/+28
| | | | | | | | | | 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-111-11/+27
| | | | | | | | | | | 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>