aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/mactime/mactime_test.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-06-08 12:33:13 -0400
committerFlorin Coras <florin.coras@gmail.com>2019-06-08 19:39:57 +0000
commit7681b1c469eda79003eef550fda460f48e5a08d7 (patch)
treea7bc4e892fd2b60efc2b39775487f51c524c10f0 /src/plugins/mactime/mactime_test.c
parent8875248f5e0602f4b4872ea12e542826df3df1f8 (diff)
mactime: add per-mac allow-with-quota feature
Specify a data limit during specified time ranges. Outside of the specified time ranges, data will be allowed. Clean up "show mactime" output. Type: feature Change-Id: Iddd6678e7ded1d0f9cb88d69c656de8d87d5694c Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/plugins/mactime/mactime_test.c')
-rw-r--r--src/plugins/mactime/mactime_test.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/plugins/mactime/mactime_test.c b/src/plugins/mactime/mactime_test.c
index 36ee063135d..4557e57dbff 100644
--- a/src/plugins/mactime/mactime_test.c
+++ b/src/plugins/mactime/mactime_test.c
@@ -158,6 +158,7 @@ api_mactime_add_del_range (vat_main_t * vam)
int mac_set = 0;
u8 is_add = 1;
u8 allow = 0;
+ u8 allow_quota = 0;
u8 drop = 0;
u8 no_udp_10001 = 0;
u64 data_quota = 0;
@@ -175,6 +176,9 @@ api_mactime_add_del_range (vat_main_t * vam)
else if (unformat (i, "allow-range %U",
unformat_clib_timebase_range_vector, &rp))
allow = 1;
+ else if (unformat (i, "allow-quota-range %U",
+ unformat_clib_timebase_range_vector, &rp))
+ allow_quota = 1;
else if (unformat (i, "drop-range %U",
unformat_clib_timebase_range_vector, &rp))
drop = 1;
@@ -206,11 +210,12 @@ api_mactime_add_del_range (vat_main_t * vam)
}
/* allow-range / drop-range parse errors cause this condition */
- if (is_add && allow == 0 && drop == 0)
+ if (is_add && allow == 0 && drop == 0 && allow_quota == 0)
{
vec_free (rp);
vec_free (device_name);
- errmsg ("neither allow nor drop set, parse error...\n");
+ errmsg ("parse error...\n");
+ return -99;
}
/* Unlikely, but check anyhow */
@@ -234,6 +239,7 @@ api_mactime_add_del_range (vat_main_t * vam)
mp->is_add = is_add;
mp->drop = drop;
mp->allow = allow;
+ mp->allow_quota = allow_quota;
mp->no_udp_10001 = no_udp_10001;
mp->data_quota = clib_host_to_net_u64 (data_quota);
memcpy (mp->mac_address, mac_address, sizeof (mp->mac_address));