aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/tcp
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/tcp')
-rw-r--r--src/vnet/tcp/builtin_client.c14
-rw-r--r--src/vnet/tcp/builtin_proxy.c16
-rw-r--r--src/vnet/tcp/builtin_server.c16
3 files changed, 26 insertions, 20 deletions
diff --git a/src/vnet/tcp/builtin_client.c b/src/vnet/tcp/builtin_client.c
index 44b1f70e9df..94e6b4ae5d8 100644
--- a/src/vnet/tcp/builtin_client.c
+++ b/src/vnet/tcp/builtin_client.c
@@ -563,12 +563,14 @@ test_tcp_clients_command_fn (vlib_main_t * vm,
else if (unformat (input, "private-segment-count %d",
&tm->private_segment_count))
;
- else if (unformat (input, "private-segment-size %dm", &tmp))
- tm->private_segment_size = tmp << 20;
- else if (unformat (input, "private-segment-size %dg", &tmp))
- tm->private_segment_size = tmp << 30;
- else if (unformat (input, "private-segment-size %d", &tmp))
- tm->private_segment_size = tmp;
+ else if (unformat (input, "private-segment-size %U",
+ unformat_memory_size, &tmp))
+ {
+ if (tmp >= 0x100000000ULL)
+ return clib_error_return
+ (0, "private segment size %lld (%llu) too large", tmp, tmp);
+ tm->private_segment_size = tmp;
+ }
else if (unformat (input, "preallocate-fifos"))
tm->prealloc_fifos = 1;
else if (unformat (input, "preallocate-sessions"))
diff --git a/src/vnet/tcp/builtin_proxy.c b/src/vnet/tcp/builtin_proxy.c
index d8cfb11d315..91377e76726 100644
--- a/src/vnet/tcp/builtin_proxy.c
+++ b/src/vnet/tcp/builtin_proxy.c
@@ -523,7 +523,7 @@ proxy_server_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
{
builtin_proxy_main_t *bpm = &builtin_proxy_main;
int rv;
- u32 tmp;
+ u64 tmp;
bpm->fifo_size = 64 << 10;
bpm->rcv_buffer_size = 1024;
@@ -542,12 +542,14 @@ proxy_server_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
else if (unformat (input, "private-segment-count %d",
&bpm->private_segment_count))
;
- else if (unformat (input, "private-segment-size %dm", &tmp))
- bpm->private_segment_size = tmp << 20;
- else if (unformat (input, "private-segment-size %dg", &tmp))
- bpm->private_segment_size = tmp << 30;
- else if (unformat (input, "private-segment-size %d", &tmp))
- bpm->private_segment_size = tmp;
+ else if (unformat (input, "private-segment-size %U",
+ unformat_memory_size, &tmp))
+ {
+ if (tmp >= 0x100000000ULL)
+ return clib_error_return
+ (0, "private segment size %lld (%llu) too large", tmp, tmp);
+ bpm->private_segment_size = tmp;
+ }
else
return clib_error_return (0, "unknown input `%U'",
format_unformat_error, input);
diff --git a/src/vnet/tcp/builtin_server.c b/src/vnet/tcp/builtin_server.c
index 295c189d869..93314529973 100644
--- a/src/vnet/tcp/builtin_server.c
+++ b/src/vnet/tcp/builtin_server.c
@@ -369,7 +369,7 @@ server_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
builtin_server_main_t *bsm = &builtin_server_main;
u8 server_uri_set = 0;
int rv;
- u32 tmp;
+ u64 tmp;
bsm->no_echo = 0;
bsm->fifo_size = 64 << 10;
@@ -392,12 +392,14 @@ server_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
else if (unformat (input, "private-segment-count %d",
&bsm->private_segment_count))
;
- else if (unformat (input, "private-segment-size %dm", &tmp))
- bsm->private_segment_size = tmp << 20;
- else if (unformat (input, "private-segment-size %dg", &tmp))
- bsm->private_segment_size = tmp << 30;
- else if (unformat (input, "private-segment-size %d", &tmp))
- bsm->private_segment_size = tmp;
+ else if (unformat (input, "private-segment-size %U",
+ unformat_memory_size, &tmp))
+ {
+ if (tmp >= 0x100000000ULL)
+ return clib_error_return
+ (0, "private segment size %lld (%llu) too large", tmp, tmp);
+ bsm->private_segment_size = tmp;
+ }
else if (unformat (input, "uri %s", &bsm->server_uri))
server_uri_set = 1;
else