Menu ▾ ▴

#476 GUID field and timestamp error

version-1.8.18
open
nobody
UUID (1) GUID (1)
2
2017-08-10
2017-01-16
Fred
No

I have debugged the GUID generated by BMC, the GUID format can be parsed ok according IPMI spec, but maybe the format is wrong with "mc guid" and "pef info". The field "node" is printed to time according to IPMI spec table 20-10.

And also, the timestamp is wrong. UUID UTC base time is October 15, 1582. Unix base time is January 1, 1970. Besides, it is wrong that ipmitool just use "time_low" to generate time.

Attached the logs:

BMC System GUID debug:
time_low: 6e4dcc5e
time_mid: bfde
timeHigh_Ver: 1000
clockSeq_Res: 03e7
NodeID: bc0000000000

BMC Device GUID debug:
time_low: 6e504a1a
time_mid: bfde
timeHigh_Ver: 1000
clockSeq_Res: 03e7
NodeID: bc0000000000

root@bmcfw:/home/fred# ipmitool -I lanplus -H 10.204.29.169 -U admin -P admin raw 6 8
bc 00 00 00 00 00 e7 03 00 10 de bf 1a 4a 50 6e
root@bmcfw:/home/fred# ipmitool -I lanplus -H 10.204.29.169 -U admin -P admin raw 6 0x37
bc 00 00 00 00 00 e7 03 00 10 de bf 5e cc 4d 6e
root@bmcfw:/home/fred# ipmitool -I lanplus -H 10.204.29.169 -U admin -P admin mc guid
System GUID : 000000bc-0000-03e7-0010-debf5ecc4d6e
Timestamp : 01/01/1970 08:03:08
root@bmcfw:/home/fred# ipmitool -I lanplus -H 10.204.29.169 -U admin -P admin pef info
0x51 | 40 | 60 | bc000000-0000-e703-0010-debf5ecc4d6e | Alert,Power-off,Reset,Power-cycle,OEM-defined,Diagnostic-interrupt

Discussion

  • Zdenek Styblik

    Zdenek Styblik - 2017-01-21

    And also, the timestamp is wrong. UUID UTC base time is October 15, 1582. Unix base time is January 1, 1970. Besides, it is wrong that ipmitool just use "time_low" to generate time.

    Thank you for the report. This seems to be correct. Feel free to provide a patch.

    Z.

     
  • Fred

    Fred - 2017-08-10

    The print order of ipmitool System GUID does not follow IPMI2.0 spec and UUID format difined by https://tools.ietf.org/rfc/rfc4122, the following is the patch(based on ipmitool-1.8.18).

    diff -Naurp ipmitool-1.8.18/include/ipmitool/ipmi_mc.h ipmitool-1.8.18-CLS_DBG/include/ipmitool/ipmi_mc.h
    --- ipmitool-1.8.18/include/ipmitool/ipmi_mc.h  2016-05-30 03:46:53.000000000 +0800
    +++ ipmitool-1.8.18-CLS_DBG/include/ipmitool/ipmi_mc.h  2017-08-09 20:26:51.766750619 +0800
    @@ -95,12 +95,12 @@ struct ipm_devid_rsp {
     #pragma pack(1)
     #endif
     struct ipmi_guid_t {
    
    -       uint32_t  time_low;     /* timestamp low field */
    -       uint16_t  time_mid;     /* timestamp middle field */
    -       uint16_t  time_hi_and_version; /* timestamp high field and version number */
    -       uint8_t   clock_seq_hi_variant;/* clock sequence high field and variant */
    -       uint8_t   clock_seq_low; /* clock sequence low field */
            uint8_t   node[6];      /* node */
    +       uint8_t   clock_seq_low; /* clock sequence low field */
    +       uint8_t   clock_seq_hi_variant;/* clock sequence high field and variant */
    +       uint16_t  time_hi_and_version; /* timestamp high field and version number */
    +       uint16_t  time_mid;     /* timestamp middle field */
    +       uint32_t  time_low;     /* timestamp low field */
     } ATTRIBUTE_PACKING;
     #ifdef HAVE_PRAGMA_PACK
     #pragma pack(0)
    
    diff -Naurp ipmitool-1.8.18/lib/ipmi_mc.c ipmitool-1.8.18-CLS_DBG/lib/ipmi_mc.c
    --- ipmitool-1.8.18/lib/ipmi_mc.c       2016-05-30 03:46:53.000000000 +0800
    +++ ipmitool-1.8.18-CLS_DBG/lib/ipmi_mc.c       2017-08-09 20:29:47.640712594 +0800
    @@ -508,12 +508,13 @@ ipmi_mc_print_guid(struct ipmi_guid_t gu
            char tbuf[40];
            time_t s;
            memset(tbuf, 0, 40);
            /* Kipp - changed order of last field (node) to follow specification */
            printf("System GUID  : %08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x\n",
                   guid.time_low, guid.time_mid, guid.time_hi_and_version,
                   guid.clock_seq_hi_variant << 8 | guid.clock_seq_low,
    
    -              guid.node[0], guid.node[1], guid.node[2],
    -              guid.node[3], guid.node[4], guid.node[5]);
    +              guid.node[5], guid.node[4], guid.node[3],
    +              guid.node[2], guid.node[1], guid.node[0]);
    
            s = (time_t)guid.time_low; /* Kipp - removed the BSWAP_32, it was not needed here */
            strftime(tbuf, sizeof(tbuf), "%m/%d/%Y %H:%M:%S", localtime(&s));
    
    diff -Naurp ipmitool-1.8.18/lib/ipmi_pef.c ipmitool-1.8.18-CLS_DBG/lib/ipmi_pef.c
    --- ipmitool-1.8.18/lib/ipmi_pef.c      2016-07-31 14:52:40.000000000 +0800
    +++ ipmitool-1.8.18-CLS_DBG/lib/ipmi_pef.c      2017-08-09 20:15:29.337507611 +0800
    @@ -200,16 +200,16 @@ ipmi_pef_print_guid(uint8_t *guid)
            if (verbose) {
                    printf("%-*s : %02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
                                    KYWD_LENGTH, "System GUID",
    
    -                               guid[0], guid[1], guid[2], guid[3], guid[4],
    -                               guid[5], guid[6], guid[7], guid[8], guid[9],
    -                               guid[10],guid[11], guid[12], guid[13], guid[14],
    -                               guid[15]);
    +                               guid[15], guid[14], guid[13], guid[12], guid[11],
    +                               guid[10], guid[9], guid[8], guid[7], guid[6],
    +                               guid[5],guid[4], guid[3], guid[2], guid[1],
    +                               guid[0]);
            } else {
                    printf(" | %02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
    -                               guid[0], guid[1], guid[2], guid[3], guid[4],
    -                               guid[5], guid[6], guid[7], guid[8], guid[9],
    -                               guid[10], guid[11], guid[12], guid[13], guid[14],
    -                               guid[15]);
    +                               guid[15], guid[14], guid[13], guid[12], guid[11],
    +                               guid[10], guid[9], guid[8], guid[7], guid[6],
    +                               guid[5],guid[4], guid[3], guid[2], guid[1],
    +                               guid[0]);
            }
            return 0;
     }
    

    Result:

    ipmitool raw 0x6 0x8
    31 5e 37 76 b6 32 d7 b2 e0 3b c3 20 a6 f6 a0 d0
    ipmitool mc guid
    System GUID : d0a0f6a6-20c3-3be0-b2d7-32b676375e31
    Timestamp : 12/01/2080 00:30:30

     

    Last edit: Fred 2017-08-10

Log in to post a comment.