if (mp->is_add)
{
- abf_policy_update (ntohl (mp->policy.policy_id),
- ntohl (mp->policy.acl_index), paths);
+ rv = abf_policy_update (ntohl (mp->policy.policy_id),
+ ntohl (mp->policy.acl_index), paths);
}
else
{
- abf_policy_delete (ntohl (mp->policy.policy_id), paths);
+ rv = abf_policy_delete (ntohl (mp->policy.policy_id), paths);
}
done:
vec_free (paths);
}
-void
+int
abf_policy_update (u32 policy_id,
u32 acl_index, const fib_route_path_t * rpaths)
{
ap = abf_policy_get (api);
old_pl = ap->ap_pl;
+ if (ap->ap_acl != acl_index)
+ {
+ /* Should change this error code to something more descriptive */
+ return (VNET_API_ERROR_INVALID_VALUE);
+ }
if (FIB_NODE_INDEX_INVALID != old_pl)
{
fib_walk_sync (abf_policy_fib_node_type, api, &ctx);
}
+ return (0);
}
static void
/*
* no such policy
*/
- return (-1);
+ return (VNET_API_ERROR_INVALID_VALUE);
}
else
{
u32 acl_index, policy_id;
fib_route_path_t *rpaths = NULL, rpath;
u32 is_del;
+ int rv = 0;
is_del = 0;
acl_index = INDEX_INVALID;
return 0;
}
- abf_policy_update (policy_id, acl_index, rpaths);
+ rv = abf_policy_update (policy_id, acl_index, rpaths);
+ /* Should change this error code to something more descriptive */
+ if (rv == VNET_API_ERROR_INVALID_VALUE)
+ {
+ vlib_cli_output (vm,
+ "ACL index must match existing ACL index in policy");
+ return 0;
+ }
}
else
{
* @param policy_id User defined Policy ID
* @param acl_index The ACL the policy with match on
* @param rpaths The set of paths to add to the forwarding set
+ * @return error code
*/
-extern void abf_policy_update (u32 policy_id,
- u32 acl_index,
- const fib_route_path_t * rpaths);
+extern int abf_policy_update (u32 policy_id,
+ u32 acl_index, const fib_route_path_t * rpaths);
/**
* Delete paths from an ABF Policy. If no more paths exist, the policy