summaryrefslogtreecommitdiffstats
path: root/src/plugins/acl
diff options
context:
space:
mode:
authorNeale Ranns <neale@graphiant.com>2021-07-15 08:11:38 +0000
committerDamjan Marion <dmarion@me.com>2021-07-15 14:50:50 +0000
commit5be3d4cc59ea955cff35ef962fd908e1147eea99 (patch)
tree7d181452e25db812d488c0ffd3a18e581c717967 /src/plugins/acl
parent05698730e42346c54b7405c6c1a498a0467261ab (diff)
acl: Fix the CLI to accept IPv6 prefixes
Type: fix DBGvpp# set acl-plugin acl src 1::1/128 dst 2::/64 DBGvpp# sh acl-plugin acl acl-index 0 count 1 tag {cli} 0: ipv4 permit src 1.1.1.1/32 dst 1.1.1.2/32 proto 0 sport 0-65535 dport 0-65535 acl-index 1 count 1 tag {cli} 0: ipv6 permit src 1::1/128 dst 2::/64 proto 0 sport 0-65535 dport 0-65535 Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: Ibb8e20dd4ec2792f423a61eefe7398175e45a577
Diffstat (limited to 'src/plugins/acl')
-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))
{