CESNET / ipfixcol

IPFIXcol is an implementation of an IPFIX (RFC 7011) collector
Other
64 stars 37 forks source link

Fixed invalid element and enterprise ID translations in fields_get_field... #10

Closed rickhofstede closed 9 years ago

rickhofstede commented 9 years ago

... (ipfix_message.c)

Fixed an issue, introduced in 48231d71ad9ce5bec92e67993521fd23179f7d67, that caused the lookup of enterprise-specific fields within a template to always fail:

In the case where fields_get_field is called with netw = true, the element ID to look for is converted to network byte order (line 384), while the element IDs in the template records are converted to host byte order (line 409). As such, the element IDs will never match.

mikeek commented 9 years ago

If I get it right, your solution will only work for elements that have enterprise number. Otherwise field ID will not be converted from network byte order. Please check the latest commit 1f763508829900d5421cae3e0977e309a6716265 where this problem should be fixed.

Anyway thanks for your bugfix with detailed description.

rickhofstede commented 9 years ago

Actually, I tested the code on both fields, with and without enterprise ID. Your code is cleaner for sure, so we should stick to that structure. However, you've introduced another byte order conversion bug. I've already prepared a fix. Please pull this request to get it fixed.