Skip to content

The fru edit command may need to consider if that section is not present #364

Open
andrew8325 opened this issue Sep 21, 2022 · 0 comments
Open
Assignees

Comments

@andrew8325
Copy link

Describe the bug
Hi, recently I found when using command ipmitool fru edit <fruid> field <section> <index> <string> to modify the fru Chassis/Board/Product section, the fru edit command may also update the MultiRecord area offset even if the MultiRecord is not present (offset is 00).

IPMITOOL Version

$ ipmitool -V
ipmitool version 1.8.19.1.g4519b4b

To Reproduce
Steps to reproduce the behavior:

  1. Modify the FRU field by ipmitool
root:~$ ipmitool fru edit 0 field p 1 ABC
String size are not equal, resizing fru to fit new string
Read All FRU area
Fru Size       : 512 bytes
Copy to new FRU
Section Length: 72
Padding Length: 1
NumByte Change: 2
Start SecChnge: c1
End SecChnge  : 36
Start Section : 1
End Sec wo Pad: c1
End Section   : 81
New Padding Length: -1
change_size_by_8: 1
New Padding Length: 7
change_size_by_8: 1
header.offset.board: 7
Change multi offset from 0 to 1
Moving Remaining Bytes (Multi-Rec , etc..), from 200 to 208
Updating Field : ' ' with 'ABC' ... (Length from '193' to '195')
Copying remaining of sections: 60 
Calculate New Checksum: ffffffc5
Writing new FRU.
Done.
  1. The MultiRecord offset in those the common header would be modified to 1 according to log Change multi offset from 0 to 1

Expected behavior
If the MultiRecord is not present, the offset of this section should remain 00.

Additional context

andrew8325 pushed a commit to andrew8325/ipmitool that referenced this issue Sep 26, 2022
Originally, ipmitool will assume the FRU section offset will follow a specific order, but this is not true (or not be defined in IPMI FRU SPEC). So change the FRU edit method, now it will:
  - Calculate the section offset one by one according to their offset
  - Ignore the FRU section offset if its offset is 00 (area does not exist)
  - If the new FRU become smaller, reset the redundant data to 0
Fixes ipmitool#364
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants