fib: skip byte swap on n_paths in mroute details 09/28909/2
authorMatthew Smith <mgsmith@netgate.com>
Thu, 17 Sep 2020 21:33:10 +0000 (16:33 -0500)
committerNeale Ranns <nranns@cisco.com>
Fri, 18 Sep 2020 17:54:12 +0000 (17:54 +0000)
Type: fix

While preparing to send a ip_mroute_details API message, the number
of paths for a multicast route is stored in an int in
send_ip_mroute_details(). Before the value in the int is copied into
the field n_paths in the API message, the byte order is swapped.
This results in n_paths getting set to 0.

Change the int to a u8 and omit the byte swap so API clients can
receive data on multicast route paths.

Change-Id: Ie6dcb0f7b135c5b5deeeb2e44147560dbbb12507
Signed-off-by: Matthew Smith <mgsmith@netgate.com>
src/vnet/ip/ip_api.c

index d264806..2f02fa0 100644 (file)
@@ -330,7 +330,7 @@ send_ip_mroute_details (vpe_api_main_t * am,
   vl_api_ip_mroute_details_t *mp;
   const mfib_prefix_t *pfx;
   vl_api_mfib_path_t *fp;
-  int path_count;
+  u8 path_count;
 
   rpaths = NULL;
   pfx = mfib_entry_get_prefix (mfib_entry_index);
@@ -348,7 +348,7 @@ send_ip_mroute_details (vpe_api_main_t * am,
   mp->route.table_id =
     htonl (mfib_table_get_table_id
           (mfib_entry_get_fib_index (mfib_entry_index), pfx->fp_proto));
-  mp->route.n_paths = htonl (path_count);
+  mp->route.n_paths = path_count;
   fp = mp->route.paths;
   vec_foreach (rpath, rpaths)
   {