bool keep = false;
bool up;
+ if (state->sm == S_TEARDOWN || state->sm == S_SETUP_ABORT)
+ return UBUS_STATUS_PERMISSION_DENIED;
+
if (!tb[NOTIFY_LINK_UP])
return UBUS_STATUS_INVALID_ARGUMENT;
static char *argv[64];
static char *env[32];
+ if (state->sm == S_TEARDOWN || state->sm == S_SETUP_ABORT)
+ return UBUS_STATUS_PERMISSION_DENIED;
+
if (!tb[NOTIFY_COMMAND])
goto error;
const char *ifname_str = ifname_a ? blobmsg_data(ifname_a) : "";
char *ifname;
+ if (state->sm == S_TEARDOWN || state->sm == S_SETUP_ABORT)
+ return UBUS_STATUS_PERMISSION_DENIED;
+
if (!host)
return UBUS_STATUS_INVALID_ARGUMENT;
static int
proto_shell_setup_failed(struct proto_shell_state *state)
{
+ int ret = 0;
+
switch (state->sm) {
case S_IDLE:
state->proto.proto_event(&state->proto, IFPEV_LINK_LOST);
case S_SETUP:
proto_shell_handler(&state->proto, PROTO_CMD_TEARDOWN, false);
break;
+ case S_SETUP_ABORT:
+ case S_TEARDOWN:
default:
+ ret = UBUS_STATUS_PERMISSION_DENIED;
break;
}
- return 0;
+ return ret;
}
static int
{
struct proto_shell_state *state;
struct blob_attr *tb[__NOTIFY_LAST];
- uint32_t action;
state = container_of(proto, struct proto_shell_state, proto);
if (!tb[NOTIFY_ACTION])
return UBUS_STATUS_INVALID_ARGUMENT;
- action = blobmsg_get_u32(tb[NOTIFY_ACTION]);
-
- /* allow proto_shell_notify_error even in S_TEARDOWN or S_SETUP_ABORT states */
- if (action != 3 && (state->sm == S_TEARDOWN || state->sm == S_SETUP_ABORT))
- return UBUS_STATUS_PERMISSION_DENIED;
-
- switch(action) {
+ switch(blobmsg_get_u32(tb[NOTIFY_ACTION])) {
case 0:
return proto_shell_update_link(state, attr, tb);
case 1: