oktetlabs / test-environment

OKTET Labs Test Environment
Other
5 stars 9 forks source link

lib/confapi: safely add instances with large values #18

Closed okt-galaktionov closed 1 year ago

okt-galaktionov commented 1 year ago

CFG_ADD messages include an 8-bit offset to the new instance's OID, starting from the beginning of the message. Since OIDs are placed after instance values, this practically limits the possible size of values that can be added to less than 256 bytes. This is lower than Configurator's internal limit of RCF_MAX_VAL (currently 1024 bytes).

This makes adding sufficiently large values impossible, which can be a problem when dealing with potentially large strings like process options, environmental variables, Open vSwitch flow rules, etc.

Fix this by making the offset 16-bit.

Testing done: tested by adding long Open vSwitch flow rules to Configurator; without this patch Configurator either goes into an infinite loop, fails with IPC-ECONNRESET or tries to process garbage values where part of the value is overwritten by OID