kontron / python-ipmi

A pure python IPMI library
GNU Lesser General Public License v2.1
185 stars 74 forks source link

Feature flag to disable rmcp sdu length verification #141

Closed canteuni closed 1 year ago

canteuni commented 1 year ago

This PR aims to solve the following issue #140 .

It adds a sort of feature flag check_sdu_length in IpmiMsg constructor, which is enabled by default so the current behavior doesn't change.

When deactivated, this allows to ignore the verification len(pdu) = header_len + data_len. This will also return everything contained in the pdu[header_len:] array rather than just pdu[header_len:header_len + data_len] .

It only concerns legacy RMCP interface. I agree that the code should not be modified to complain with a buggy IPMI implementation, but I saw that ipmitool also ignore this verification when using legacy RMCP, so I thought this could be done here too.

The flag can be used when creating the IPMI interface :

interfaces.create_interface(
    interface="rmcp",
    check_sdu_length=False
)
coveralls commented 1 year ago

Coverage Status

Coverage: 67.021% (+0.03%) from 66.988% when pulling 9bf9087ca7eaa592da3560710fdd32922bd68720 on canteuni:ff_rmcp_payload_length into ba1d466a2a6126a680b0b4b197d595dc37438a5f on kontron:master.

hthiery commented 1 year ago

Looks good. Thank you!