Björn Spruck
2015-12-02 15:47:52 UTC
Hi,
There seems to be some problem with the fru edit function. to be more
exactly its the update of the header which seems to be wrong. if I edit
a valid fru
ipmitool -H xxxx -U yyyy -P yyy -T 0x20 -B 0 -t 0x78 -b 7 fru edit 0
field b 0 "Uni Mainz"
the header is not correctly updated.
before edit:
0000 0000: 01 00 00 01 *04* *08* 00 F2 01 03 19 7D 94 9D C2 41
........ ...}...A
0000 0010: 41 C2 42 42 C2 43 43 C2 44 44 C2 45 45 C1 00 0C A.BB.CC.
DD.EE...
0000 0020: 01 04 19 C2 65 65 C2 66 66 C2 67 67 C2 68 68 C2 ....ee.f
f.gg.hh.
0000 0030: 69 69 C2 6A 6A C2 6B 6B C1 00 00 00 00 00 00 23 ii.jj.kk
.......#
0000 0040: C0 82 06 47 71 5A 31 00 16 00 18 47 71 00 31 5A ...GqZ1.
...Gq.1Z
0000 0050: 16 00 18 FF FF FF FF FF FF FF FF FF FF FF FF FF ........
........
after edit:
0000 0000: 01 00 00 01 *05* *08* 00 F1 01 04 19 7D 94 9D C9 55
........ ...}...U
0000 0010: 6E 69 20 4D 61 69 6E 7A C2 42 42 C2 43 43 C2 44 ni Mainz
.BB.CC.D
0000 0020: 44 C2 45 45 C1 00 00 3B 01 04 19 C2 65 65 C2 66 D.EE...;
....ee.f
0000 0030: 66 C2 67 67 C2 68 68 C2 69 69 C2 6A 6A C2 6B 6B f.gg.hh.
ii.jj.kk
0000 0040: C1 00 00 00 00 00 00 23 C0 82 06 47 71 5A 31 00 .......#
...GqZ1.
0000 0050: 16 00 18 47 71 00 31 5A 16 00 18 FF FF FF FF FF ...Gq.1Z
........
You can notice that all data is moved 8 bytes and the offset for the
first record after the edited one is correctly modified. but the second
offset for the multirecord area) is not modified.
I guess around line 5050-5080 in ipmi_fru.c a line
header.offset.multi += change_size_by_8;
is missing (within some if statements...)
I would like to notice that the parser of the FRU is not detecting the
mismatch between header offsets and actual size of the records (overlap
between product info and multirecord area).
It would be nice to have the FRU information cross-checked before
writing, e.g. overlaps/offset and checksums verified. maybe a command
like fru check <file> for printing and check a dump would be nice to
have here.
Ciao,
Bjoern
There seems to be some problem with the fru edit function. to be more
exactly its the update of the header which seems to be wrong. if I edit
a valid fru
ipmitool -H xxxx -U yyyy -P yyy -T 0x20 -B 0 -t 0x78 -b 7 fru edit 0
field b 0 "Uni Mainz"
the header is not correctly updated.
before edit:
0000 0000: 01 00 00 01 *04* *08* 00 F2 01 03 19 7D 94 9D C2 41
........ ...}...A
0000 0010: 41 C2 42 42 C2 43 43 C2 44 44 C2 45 45 C1 00 0C A.BB.CC.
DD.EE...
0000 0020: 01 04 19 C2 65 65 C2 66 66 C2 67 67 C2 68 68 C2 ....ee.f
f.gg.hh.
0000 0030: 69 69 C2 6A 6A C2 6B 6B C1 00 00 00 00 00 00 23 ii.jj.kk
.......#
0000 0040: C0 82 06 47 71 5A 31 00 16 00 18 47 71 00 31 5A ...GqZ1.
...Gq.1Z
0000 0050: 16 00 18 FF FF FF FF FF FF FF FF FF FF FF FF FF ........
........
after edit:
0000 0000: 01 00 00 01 *05* *08* 00 F1 01 04 19 7D 94 9D C9 55
........ ...}...U
0000 0010: 6E 69 20 4D 61 69 6E 7A C2 42 42 C2 43 43 C2 44 ni Mainz
.BB.CC.D
0000 0020: 44 C2 45 45 C1 00 00 3B 01 04 19 C2 65 65 C2 66 D.EE...;
....ee.f
0000 0030: 66 C2 67 67 C2 68 68 C2 69 69 C2 6A 6A C2 6B 6B f.gg.hh.
ii.jj.kk
0000 0040: C1 00 00 00 00 00 00 23 C0 82 06 47 71 5A 31 00 .......#
...GqZ1.
0000 0050: 16 00 18 47 71 00 31 5A 16 00 18 FF FF FF FF FF ...Gq.1Z
........
You can notice that all data is moved 8 bytes and the offset for the
first record after the edited one is correctly modified. but the second
offset for the multirecord area) is not modified.
I guess around line 5050-5080 in ipmi_fru.c a line
header.offset.multi += change_size_by_8;
is missing (within some if statements...)
I would like to notice that the parser of the FRU is not detecting the
mismatch between header offsets and actual size of the records (overlap
between product info and multirecord area).
It would be nice to have the FRU information cross-checked before
writing, e.g. overlaps/offset and checksums verified. maybe a command
like fru check <file> for printing and check a dump would be nice to
have here.
Ciao,
Bjoern