Hi Sylvain,
instead of building more hacks on existing hacks, we should probably
consider to use our TLV parser instead of things like:
if (sw_config[0] != NM_ATT_SW_DESCR)
DEBUGP(DNM, "SW_DESCR attribute identifier not found!\n");
+
if (sw_config[1] != NM_ATT_FILE_ID)
DEBUGP(DNM, "FILE_ID attribute identifier not found!\n");
file_id_len = sw_config[2] * 256 + sw_config[3];
+ if (sw_config[4+file_id_len] != NM_ATT_FILE_VERSION)
+ DEBUGP(DNM, "FILE_VERSION attribute identifier not found!\n");
+ file_ver_len = sw_config[5+file_id_len] * 256 + sw_config[6+file_id_len];
all that we need is a second 'struct tlv_parsed' on the stack, as well as
a 'static const struct tlv_definition' for the nested attributes such as
SW_DESCR and FILE_ID, FILE_VERSION (or any others, if they exist).
If you have the time, I would appreciate a patch that solves the problem this
way, rather than manually calculating lengths and indexing into sw_config[],
etc.
The existing software activation code probably predates our tlv_parser and thus
wasn't written properly in the first place.
--
- Harald Welte <laforge(a)gnumonks.org>
http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
(ETSI EN 300 175-7 Ch. A6)