misc: fix api in ipfix_classify_table_add/details 68/29168/4
authorAlexander Chernavin <achernavin@netgate.com>
Wed, 30 Sep 2020 14:36:10 +0000 (10:36 -0400)
committerOle Tr�an <otroan@employees.org>
Tue, 8 Dec 2020 09:01:59 +0000 (09:01 +0000)
In ipfix_classify_table_add_del and ipfix_classify_table_details the
ip_version field has vl_api_address_family_t type. However, there is
no encode/decode for the field in the IPFIX API. Moreover, the IPFIX
code expects the field to contain raw 4 or 6 to indicate the IP
version.

With this change, encode/decode the ip_version field in the IPFIX
API. Also, stop converting transport_protocol between host and network
byte order because it's u8.

Type: fix
Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
Change-Id: I4051756b8077b4367dd779cb555a34f74f6d7a9d

src/vnet/ipfix-export/flow_api.c
src/vnet/ipfix-export/ipfix_export.api

index 226db26..f4b3fc8 100644 (file)
@@ -264,8 +264,8 @@ static void
     return;
 
   classify_table_index = ntohl (mp->table_id);
-  ip_version = ntohl (mp->ip_version);
-  transport_protocol = ntohl (mp->transport_protocol);
+  ip_version = (mp->ip_version == ADDRESS_IP4) ? 4 : 6;
+  transport_protocol = mp->transport_protocol;
   is_add = mp->is_add;
 
   if (fcm->src_port == 0)
@@ -340,8 +340,8 @@ send_ipfix_classify_table_details (u32 table_index,
   mp->_vl_msg_id = ntohs (VL_API_IPFIX_CLASSIFY_TABLE_DETAILS);
   mp->context = context;
   mp->table_id = htonl (table->classify_table_index);
-  mp->ip_version = htonl (table->ip_version);
-  mp->transport_protocol = htonl (table->transport_protocol);
+  mp->ip_version = (table->ip_version == 4) ? ADDRESS_IP4 : ADDRESS_IP6;
+  mp->transport_protocol = table->transport_protocol;
 
   vl_api_send_msg (reg, (u8 *) mp);
 }
index efd967d..147d790 100644 (file)
@@ -13,7 +13,7 @@
  * limitations under the License.
  */
 
-option version = "2.0.1";
+option version = "2.0.2";
 
 import "vnet/ip/ip_types.api";