{
struct proto_shell_state *state;
struct proto_shell_handler *handler;
- const char *argv[5];
+ const char *argv[6];
char *config;
- int ret;
+ int ret, i = 0;
state = container_of(proto, struct proto_shell_state, proto);
handler = state->handler;
if (!config)
return -1;
- argv[0] = handler->script_name;
- argv[1] = handler->proto.name;
- argv[2] = "teardown";
- argv[3] = config;
- argv[4] = NULL;
-
- switch(cmd) {
- case PROTO_CMD_SETUP:
- argv[2] = "setup";
- /* fall through */
- case PROTO_CMD_TEARDOWN:
- ret = run_script(argv);
- break;
- }
+ argv[i++] = handler->script_name;
+ argv[i++] = handler->proto.name;
+ argv[i++] = cmd == PROTO_CMD_SETUP ? "setup" : "teardown";
+ argv[i++] = proto->iface->name;
+ argv[i++] = config;
+ if (proto->iface->main_dev.dev)
+ argv[i++] = proto->iface->main_dev.dev->ifname;
+ argv[i] = NULL;
+ ret = run_script(argv);
free(config);
return ret;
memcpy(state->config, attr, blob_pad_len(attr));
state->proto.free = proto_shell_free;
- state->proto.handler = proto_shell_handler;
+ state->proto.cb = proto_shell_handler;
state->handler = container_of(h, struct proto_shell_handler, proto);
return &state->proto;
proto->config_params = &handler->config;
proto->attach = proto_shell_attach;
+ tmp = get_field(obj, "no-device", json_type_boolean);
+ if (tmp && json_object_get_boolean(tmp))
+ handler->proto.flags |= PROTO_FLAG_NODEV;
+
config = get_field(obj, "config", json_type_array);
if (config)
handler->config_buf = proto_shell_parse_config(&handler->config, config);