mc: guid: Implement encoding autodetection

With this commit the GUID encoding is now by default detected
automatically based on the validity of the version field,
and the timestamp (for time-based version 1 GUIDs).

The version is considered valid if it is 1 through 5.
The timestamp is considered valid if the year is past UNIX Epoch
and before the current year.

Resolves ipmitool/ipmitool#25

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
This commit is contained in:
Alexander Amelkin
2018-08-06 12:34:18 +03:00
parent 0b6abe8cd9
commit 40d52b5fa1
4 changed files with 313 additions and 102 deletions

View File

@@ -2023,11 +2023,35 @@ Display the Management Controller Globally Unique IDentifier.
.RS
.TP
\fIsmbios\fP
\fIauto\fP
.br
This is the default behavior for ipmitool for the sake of compatibility
with old versions and broken BMC implementations whose number is legion.
This is the default behavior for
.BR ipmitool (1).
Try to automatically detect the encoding based on the value of the
version field and (for version 1) the timestamp. The version is
considered valid if it is 1 through 5, and the timestamp is valid
if the year is past or equal to UNIX Epoch (1970) and is before or
equal to the current year.
If multiple encodings happen to have valid version fields, then
precedence takes the one with version 1 and a valid timestamp. If
neither one has that, then the precedence order is as follows:
\fIsmbios\fP, \fIipmi\fP, \fIrfc4122\fP.
If neither encoding yields a valid version field, then
.BR ipmitool (1)
defaults to \fIdump\fP mode.
If this option is in use, then
.BR ipmitool (1)
will also print out the detected encoding and warn
regarding IPMI specification violation if the encoding isn't \fIipmi\fP.
.TP
\fIsmbios\fP
.br
Decode GUID as if it was sent by BMC as prescribed by SMBIOS specification.
@@ -2035,6 +2059,13 @@ Decode GUID as if it was sent by BMC as prescribed by SMBIOS specification.
it this way. If your BMC's GUID is shown correctly using this option, you
may want to inform your BMC manufacturer that they have a bug.
.TP
\fIipmi\fP
.br
Decode GUID according to IPMI specification. It MUST show the correct GUID.
If it doesn't, try other options and inform your BMC manufacturer of the bug.
.TP
\fIrfc4122\fP or \fIrfc\fP
.br
@@ -2045,13 +2076,6 @@ Decode GUID as if it was sent by BMC as prescribed by RFC4122 specification.
If your BMC's GUID is shown correctly using this option, you
may want to inform your BMC manufacturer that they have a bug.
.TP
\fIipmi\fP
.br
Decode GUID according to IPMI specification. It MUST show the correct GUID.
If it doesn't, try other options above and inform your BMC manufacturer of the bug.
.TP
\fIdump\fP
.br