discover: Handle incoming configuration messages
[petitboot] / discover / discover-server.c
index bd631f61bf86eac57c76dbfb8dfcb43476ad741a..3cf9facc07ff700d6d4e4d30b42c0a9271591344 100644 (file)
@@ -214,6 +214,7 @@ static int discover_server_process_message(void *arg)
        struct pb_protocol_message *message;
        struct boot_command *boot_command;
        struct client *client = arg;
+       struct config *config;
        int rc;
 
        message = pb_protocol_read_message(client, client->fd);
@@ -243,6 +244,19 @@ static int discover_server_process_message(void *arg)
                device_handler_cancel_default(client->server->device_handler);
                break;
 
+       case PB_PROTOCOL_ACTION_CONFIG:
+               config = talloc_zero(client, struct config);
+
+               rc = pb_protocol_deserialise_config(config, message);
+               if (rc) {
+                       pb_log("%s: no config?", __func__);
+                       return 0;
+               }
+
+               device_handler_update_config(client->server->device_handler,
+                               config);
+               break;
+
        default:
                pb_log("%s: invalid action %d\n", __func__, message->action);
                return 0;