aboutsummaryrefslogtreecommitdiff
path: root/tests/sys/netmap/ctrl-api-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/sys/netmap/ctrl-api-test.c')
-rw-r--r--tests/sys/netmap/ctrl-api-test.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/sys/netmap/ctrl-api-test.c b/tests/sys/netmap/ctrl-api-test.c
index 8c87760217c3..c143d14ae3ab 100644
--- a/tests/sys/netmap/ctrl-api-test.c
+++ b/tests/sys/netmap/ctrl-api-test.c
@@ -1012,9 +1012,10 @@ infinite_options(struct TestContext *ctx)
{
struct nmreq_option opt;
- printf("Testing infinite list of options on %s\n", ctx->ifname_ext);
+ printf("Testing infinite list of options on %s (invalid options)\n", ctx->ifname_ext);
- opt.nro_reqtype = 1234;
+ memset(&opt, 0, sizeof(opt));
+ opt.nro_reqtype = NETMAP_REQ_OPT_MAX + 1;
push_option(&opt, ctx);
opt.nro_next = (uintptr_t)&opt;
if (port_register_hwall(ctx) >= 0)
@@ -1023,6 +1024,23 @@ infinite_options(struct TestContext *ctx)
return (errno == EMSGSIZE ? 0 : -1);
}
+static int
+infinite_options2(struct TestContext *ctx)
+{
+ struct nmreq_option opt;
+
+ printf("Testing infinite list of options on %s (valid options)\n", ctx->ifname_ext);
+
+ memset(&opt, 0, sizeof(opt));
+ opt.nro_reqtype = NETMAP_REQ_OPT_OFFSETS;
+ push_option(&opt, ctx);
+ opt.nro_next = (uintptr_t)&opt;
+ if (port_register_hwall(ctx) >= 0)
+ return -1;
+ clear_options(ctx);
+ return (errno == EINVAL ? 0 : -1);
+}
+
#ifdef CONFIG_NETMAP_EXTMEM
int
change_param(const char *pname, unsigned long newv, unsigned long *poldv)
@@ -2049,6 +2067,7 @@ static struct mytest tests[] = {
decltest(vale_polling_enable_disable),
decltest(unsupported_option),
decltest(infinite_options),
+ decltest(infinite_options2),
#ifdef CONFIG_NETMAP_EXTMEM
decltest(extmem_option),
decltest(bad_extmem_option),