summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tools/ocbr/ocbr.c17
-rw-r--r--src/tools/ocbr/ocbr_client.c2
-rw-r--r--src/tools/ocbr/ocbr_server.c2
3 files changed, 16 insertions, 5 deletions
diff --git a/src/tools/ocbr/ocbr.c b/src/tools/ocbr/ocbr.c
index 2c22cc3c..e2bd84af 100644
--- a/src/tools/ocbr/ocbr.c
+++ b/src/tools/ocbr/ocbr.c
@@ -46,7 +46,7 @@
#include <time.h>
#include <stdbool.h>
-#define BUF_SIZE 1500
+#define BUF_SIZE 524288L
#include "ocbr_client.c"
@@ -71,11 +71,12 @@ static void usage(void)
" -n, --server_apn Specify the name of the server.\n"
" -d, --duration Duration for sending (s)\n"
" -f, --flood Send SDUs as fast as possible\n"
- " -s, --size SDU size (B)\n"
+ " -s, --size SDU size (B, max %ld B)\n"
" -r, --rate Rate (b/s)\n"
" --sleep Sleep in between sending SDUs\n"
"\n\n"
- " --help Display this help text and exit\n");
+ " --help Display this help text and exit\n",
+ BUF_SIZE);
}
int main(int argc, char ** argv)
@@ -152,6 +153,16 @@ int main(int argc, char ** argv)
return 0;
}
+ if (size > BUF_SIZE) {
+ printf("Maximum size: %ld.\n", BUF_SIZE);
+ return 0;
+ }
+
+ if (size < 0) {
+ printf("Size overflow.\n");
+ return 0;
+ }
+
ret = client_main(s_apn, duration, size, rate, flood, sleep);
}
diff --git a/src/tools/ocbr/ocbr_client.c b/src/tools/ocbr/ocbr_client.c
index bf527317..026ab001 100644
--- a/src/tools/ocbr/ocbr_client.c
+++ b/src/tools/ocbr/ocbr_client.c
@@ -79,7 +79,7 @@ int client_main(char * server,
struct sigaction sig_act;
int fd = 0;
- char buf[size];
+ char buf[BUF_SIZE];
long seqnr = 0;
long gap = size * 8.0 * (BILLION / (double) rate);
diff --git a/src/tools/ocbr/ocbr_server.c b/src/tools/ocbr/ocbr_server.c
index 3004d77c..4f080eff 100644
--- a/src/tools/ocbr/ocbr_server.c
+++ b/src/tools/ocbr/ocbr_server.c
@@ -100,7 +100,7 @@ static void handle_flow(int fd)
alive = iv_start;
ts_add(&iv_start, &intv, &iv_end);
- fccntl(fd, FLOWSFLAGS, FLOWFRNOBLOCK | FLOWFRDWR);
+ fccntl(fd, FLOWSFLAGS, FLOWFRNOBLOCK | FLOWFRDWR | FLOWFRNOPART);
while (!stop) {
clock_gettime(CLOCK_REALTIME, &now);