summaryrefslogtreecommitdiffstats
path: root/src/plugins/acl/acl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/acl/acl.c')
-rw-r--r--src/plugins/acl/acl.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/plugins/acl/acl.c b/src/plugins/acl/acl.c
index dcca2a2c9ba..e8b5877ab21 100644
--- a/src/plugins/acl/acl.c
+++ b/src/plugins/acl/acl.c
@@ -2837,8 +2837,7 @@ acl_set_aclplugin_acl_fn (vlib_main_t * vm,
u32 port2 = 0;
u32 action = 0;
u32 tcpflags, tcpmask;
- u32 src_prefix_length = 0, dst_prefix_length = 0;
- ip46_address_t src, dst;
+ ip_prefix_t src, dst;
u8 *tag = 0;
if (!unformat_user (input, unformat_line_input, line_input))
@@ -2870,25 +2869,15 @@ acl_set_aclplugin_acl_fn (vlib_main_t * vm,
vec_validate_acl_rules (rules, rule_idx);
rules[rule_idx].is_permit = action;
}
- else if (unformat (line_input, "src %U/%d",
- unformat_ip46_address, &src, IP46_TYPE_ANY,
- &src_prefix_length))
+ else if (unformat (line_input, "src %U", unformat_ip_prefix, &src))
{
vec_validate_acl_rules (rules, rule_idx);
- ip_address_encode (&src, IP46_TYPE_ANY,
- &rules[rule_idx].src_prefix.address);
- rules[rule_idx].src_prefix.address.af = ADDRESS_IP4;
- rules[rule_idx].src_prefix.len = src_prefix_length;
+ ip_prefix_encode2 (&src, &rules[rule_idx].src_prefix);
}
- else if (unformat (line_input, "dst %U/%d",
- unformat_ip46_address, &dst, IP46_TYPE_ANY,
- &dst_prefix_length))
+ else if (unformat (line_input, "dst %U", unformat_ip_prefix, &dst))
{
vec_validate_acl_rules (rules, rule_idx);
- ip_address_encode (&dst, IP46_TYPE_ANY,
- &rules[rule_idx].dst_prefix.address);
- rules[rule_idx].dst_prefix.address.af = ADDRESS_IP4;
- rules[rule_idx].dst_prefix.len = dst_prefix_length;
+ ip_prefix_encode2 (&dst, &rules[rule_idx].dst_prefix);
}
else if (unformat (line_input, "sport %d-%d", &port1, &port2))
{