summaryrefslogtreecommitdiffstats
path: root/extras/vom
diff options
context:
space:
mode:
authorJakub Grajciar <jgrajcia@cisco.com>2020-03-27 06:55:06 +0100
committerOle Trøan <otroan@employees.org>2020-03-27 12:46:42 +0000
commit2f8cd914514fe54f91974c6d465d4769dfac8de8 (patch)
tree0800301d4e2ba8d1cf9bf695798b88684bee39f7 /extras/vom
parent64d9da3ba3b07d23782ef1a947fb5a71b9f4de56 (diff)
acl: API cleanup
Use consistent API types. Type: fix Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: I09fa6c1b6917936351bd376b56c414ce24488095 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Diffstat (limited to 'extras/vom')
-rw-r--r--extras/vom/vom/acl_l2_list.cpp5
-rw-r--r--extras/vom/vom/acl_l3_list.cpp9
-rw-r--r--extras/vom/vom/acl_list_cmds.cpp18
3 files changed, 14 insertions, 18 deletions
diff --git a/extras/vom/vom/acl_l2_list.cpp b/extras/vom/vom/acl_l2_list.cpp
index e55efcf8cd1..8684c2c4d3a 100644
--- a/extras/vom/vom/acl_l2_list.cpp
+++ b/extras/vom/vom/acl_l2_list.cpp
@@ -15,6 +15,7 @@
#include "vom/acl_l2_list.hpp"
#include "vom/acl_list_cmds.hpp"
+#include "vom/api_types.hpp"
#include "vom/logger.hpp"
#include "vom/singular_db_funcs.hpp"
@@ -195,9 +196,7 @@ l2_list::event_handler::handle_populate(const client_db::key_t& key)
l2_list acl(hdl, std::string(reinterpret_cast<const char*>(payload.tag)));
for (unsigned int ii = 0; ii < payload.count; ii++) {
- const route::prefix_t pfx(payload.r[ii].is_ipv6,
- payload.r[ii].src_ip_addr,
- payload.r[ii].src_ip_prefix_len);
+ const route::prefix_t pfx = from_api(payload.r[ii].src_prefix);
l2_rule rule(ii,
action_t::from_int(payload.r[ii].is_permit),
pfx,
diff --git a/extras/vom/vom/acl_l3_list.cpp b/extras/vom/vom/acl_l3_list.cpp
index ee9b956f541..cfa9cfee948 100644
--- a/extras/vom/vom/acl_l3_list.cpp
+++ b/extras/vom/vom/acl_l3_list.cpp
@@ -15,6 +15,7 @@
#include "vom/acl_l3_list.hpp"
#include "vom/acl_list_cmds.hpp"
+#include "vom/api_types.hpp"
#include "vom/logger.hpp"
#include "vom/singular_db_funcs.hpp"
@@ -195,12 +196,8 @@ l3_list::event_handler::handle_populate(const client_db::key_t& key)
l3_list acl(hdl, std::string(reinterpret_cast<const char*>(payload.tag)));
for (unsigned int ii = 0; ii < payload.count; ii++) {
- const route::prefix_t src(payload.r[ii].is_ipv6,
- payload.r[ii].src_ip_addr,
- payload.r[ii].src_ip_prefix_len);
- const route::prefix_t dst(payload.r[ii].is_ipv6,
- payload.r[ii].dst_ip_addr,
- payload.r[ii].dst_ip_prefix_len);
+ const route::prefix_t src = from_api(payload.r[ii].src_prefix);
+ const route::prefix_t dst = from_api(payload.r[ii].dst_prefix);
l3_rule rule(ii, action_t::from_int(payload.r[ii].is_permit), src, dst);
rule.set_proto(payload.r[ii].proto);
diff --git a/extras/vom/vom/acl_list_cmds.cpp b/extras/vom/vom/acl_list_cmds.cpp
index cb02edba98b..a589e1f2542 100644
--- a/extras/vom/vom/acl_list_cmds.cpp
+++ b/extras/vom/vom/acl_list_cmds.cpp
@@ -14,6 +14,7 @@
*/
#include "vom/acl_list_cmds.hpp"
+#include "vom/api_types.hpp"
namespace VOM {
namespace ACL {
@@ -24,9 +25,10 @@ namespace list_cmds {
static void
to_vpp(const l2_rule& rule, vapi_type_macip_acl_rule& payload)
{
- payload.is_permit = rule.action().value();
- rule.src_ip().to_vpp(
- &payload.is_ipv6, payload.src_ip_addr, &payload.src_ip_prefix_len);
+ payload.is_permit = (vapi_enum_acl_action)rule.action().value();
+ rule.src_ip().to_vpp((uint8_t*)&payload.src_prefix.address.af,
+ (uint8_t*)&payload.src_prefix.address.un,
+ &payload.src_prefix.len);
rule.mac().to_bytes(payload.src_mac, 6);
rule.mac_mask().to_bytes(payload.src_mac_mask, 6);
}
@@ -34,13 +36,11 @@ to_vpp(const l2_rule& rule, vapi_type_macip_acl_rule& payload)
static void
to_vpp(const l3_rule& rule, vapi_type_acl_rule& payload)
{
- payload.is_permit = rule.action().value();
- rule.src().to_vpp(
- &payload.is_ipv6, payload.src_ip_addr, &payload.src_ip_prefix_len);
- rule.dst().to_vpp(
- &payload.is_ipv6, payload.dst_ip_addr, &payload.dst_ip_prefix_len);
+ payload.is_permit = (vapi_enum_acl_action)rule.action().value();
+ payload.src_prefix = to_api(rule.src());
+ payload.dst_prefix = to_api(rule.dst());
- payload.proto = rule.proto();
+ payload.proto = (vapi_enum_ip_proto)rule.proto();
payload.srcport_or_icmptype_first = rule.srcport_or_icmptype_first();
payload.srcport_or_icmptype_last = rule.srcport_or_icmptype_last();
payload.dstport_or_icmpcode_first = rule.dstport_or_icmpcode_first();