acl-plugin: the second and subsequent ACEs incorrect endianness when custom-dump... 25/7225/2
authorAndrew Yourtchenko <ayourtch@gmail.com>
Tue, 20 Jun 2017 11:54:57 +0000 (13:54 +0200)
committerOle Trøan <otroan@employees.org>
Wed, 21 Jun 2017 20:31:54 +0000 (20:31 +0000)
Add the missing function to convert the entire array of rules in the respective _endian functions,
rather than just the first rule.

Change-Id: Ic057f27ff7ec20150595efca1a48b74e5850f52b
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
src/plugins/acl/manual_fns.h

index a2620fb..c37d14b 100644 (file)
     vl_print (handle, (char *)s);               \
     vec_free (s);
 
+static inline void
+vl_api_acl_rule_t_array_endian(vl_api_acl_rule_t *rules, u32 count)
+{
+  u32 i;
+  for(i=0; i<count; i++) {
+    vl_api_acl_rule_t_endian (&rules[i]);
+  }
+}
+
+static inline void
+vl_api_macip_acl_rule_t_array_endian(vl_api_macip_acl_rule_t *rules, u32 count)
+{
+  u32 i;
+  for(i=0; i<count; i++) {
+    vl_api_macip_acl_rule_t_endian (&rules[i]);
+  }
+}
+
 static inline void
 vl_api_acl_details_t_endian (vl_api_acl_details_t * a)
 {
@@ -33,7 +51,7 @@ vl_api_acl_details_t_endian (vl_api_acl_details_t * a)
   a->acl_index = clib_net_to_host_u32 (a->acl_index);
   /* a->tag[0..63] = a->tag[0..63] (no-op) */
   a->count = clib_net_to_host_u32 (a->count);
-  vl_api_acl_rule_t_endian (a->r);
+  vl_api_acl_rule_t_array_endian (a->r, a->count);
 }
 
 static inline void
@@ -44,7 +62,7 @@ vl_api_macip_acl_details_t_endian (vl_api_macip_acl_details_t * a)
   a->acl_index = clib_net_to_host_u32 (a->acl_index);
   /* a->tag[0..63] = a->tag[0..63] (no-op) */
   a->count = clib_net_to_host_u32 (a->count);
-  vl_api_macip_acl_rule_t_endian (a->r);
+  vl_api_macip_acl_rule_t_array_endian (a->r, a->count);
 }
 
 
@@ -57,7 +75,7 @@ vl_api_acl_add_replace_t_endian (vl_api_acl_add_replace_t * a)
   a->acl_index = clib_net_to_host_u32 (a->acl_index);
   /* a->tag[0..63] = a->tag[0..63] (no-op) */
   a->count = clib_net_to_host_u32 (a->count);
-  vl_api_acl_rule_t_endian (a->r);
+  vl_api_acl_rule_t_array_endian (a->r, a->count);
 }
 
 static inline void
@@ -68,7 +86,7 @@ vl_api_macip_acl_add_t_endian (vl_api_macip_acl_add_t * a)
   a->context = clib_net_to_host_u32 (a->context);
   /* a->tag[0..63] = a->tag[0..63] (no-op) */
   a->count = clib_net_to_host_u32 (a->count);
-  vl_api_macip_acl_rule_t_endian (a->r);
+  vl_api_macip_acl_rule_t_array_endian (a->r, a->count);
 }
 
 static inline u8 *