Skip to content
Snippets Groups Projects
Commit 6cd756bd authored by Anjan Chanda's avatar Anjan Chanda
Browse files

controller_command_parse - return error when mandatory argument not passed

parent 958bf12d
No related branches found
No related tags found
3 merge requests!295wifi_opclass: add wifi_radio_opclass_update_channel,!294Revert "fix typo query_channel_pref enum",!293Draft: Janusz cntlr apis
Pipeline #131455 failed
......@@ -975,8 +975,18 @@ int controller_command_parse(const char *command, void *args, struct blob_attr *
memset(tb, 0, cmd->num_attrs * sizeof(*tb));
msg = (struct blob_attr *)args;
if (!msg || !blob_len(msg))
if (!msg || !blob_len(msg)) {
for (int i = 0; i < cmd->num_attrs; i++) {
if (cmd->attrs[i].optional == 0) {
fprintf(stderr, "%s: mandatory arg '%s' not provided\n",
__func__, cmd->attrs[i].pol.name);
//blob_buf_free(&bi);
return -1;
}
}
return 0;
}
#if 0 //TODO: for json string as input instead of blob_attr
printf("cmd: name = %s, num-pol = %zd args = %s\n", cmd->command, cmd->num_attrs, args);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment