for (i = 0; i < sysinfo->n_interfaces; i++) {
struct interface_info *if_info = sysinfo->interfaces[i];
len += 4 + if_info->hwaddr_size +
- 4 + optional_strlen(if_info->name);
+ 4 + optional_strlen(if_info->name) +
+ sizeof(if_info->link);
}
for (i = 0; i < sysinfo->n_blockdevs; i++) {
unsigned int i, len;
len = 4 /* config->autoboot_enabled */ +
- 4 /* config->autoboot_timeout_sec */;
+ 4 /* config->autoboot_timeout_sec */ +
+ 4 /* config->safe_mode */;
len += 4;
for (i = 0; i < config->network.n_interfaces; i++)
len += 4 + optional_strlen(config->network.dns_servers[i]);
len += 4;
- len += config->n_boot_priorities * 4;
+ len += config->n_boot_priorities * 8;
+
+ len += 4 + optional_strlen(config->boot_device);
return len;
}
pos += if_info->hwaddr_size;
pos += pb_protocol_serialise_string(pos, if_info->name);
+
+ *(bool *)pos = if_info->link;
+ pos += sizeof(bool);
}
*(uint32_t *)pos = __cpu_to_be32(sysinfo->n_blockdevs);
*(uint32_t *)pos = __cpu_to_be32(config->autoboot_timeout_sec);
pos += 4;
+ *(uint32_t *)pos = config->safe_mode;
+ pos += 4;
+
*(uint32_t *)pos = __cpu_to_be32(config->network.n_interfaces);
pos += 4;
for (i = 0; i < config->network.n_interfaces; i++) {
*(uint32_t *)pos = __cpu_to_be32(config->n_boot_priorities);
pos += 4;
for (i = 0; i < config->n_boot_priorities; i++) {
- *(uint32_t *)pos = __cpu_to_be32(config->boot_priorities[i].type);
+ *(uint32_t *)pos =
+ __cpu_to_be32(config->boot_priorities[i].type);
+ pos += 4;
+ *(uint32_t *)pos =
+ __cpu_to_be32(config->boot_priorities[i].priority);
pos += 4;
}
+ pos += pb_protocol_serialise_string(pos, config->boot_device);
+
assert(pos <= buf + buf_len);
(void)buf_len;
if (read_string(if_info, &pos, &len, &if_info->name))
goto out;
+ if_info->link = *(bool *)pos;
+ pos += sizeof(if_info->link);
+
sysinfo->interfaces[i] = if_info;
}
unsigned int len, i, tmp;
const char *pos;
int rc = -1;
+ char *str;
len = message->payload_len;
pos = message->payload;
if (read_u32(&pos, &len, &config->autoboot_timeout_sec))
goto out;
+ if (read_u32(&pos, &len, &tmp))
+ goto out;
+ config->safe_mode = !!tmp;
+
if (read_u32(&pos, &len, &config->network.n_interfaces))
goto out;
config->network.n_dns_servers);
for (i = 0; i < config->network.n_dns_servers; i++) {
- char *tmp;
- if (read_string(config->network.dns_servers, &pos, &len, &tmp))
+ if (read_string(config->network.dns_servers, &pos, &len, &str))
goto out;
- config->network.dns_servers[i] = tmp;
+ config->network.dns_servers[i] = str;
}
if (read_u32(&pos, &len, &config->n_boot_priorities))
config->n_boot_priorities);
for (i = 0; i < config->n_boot_priorities; i++) {
+ if (read_u32(&pos, &len, &tmp))
+ goto out;
+ config->boot_priorities[i].priority = (int)tmp;
if (read_u32(&pos, &len, &tmp))
goto out;
config->boot_priorities[i].type = tmp;
}
+ if (read_string(config, &pos, &len, &str))
+ goto out;
+
+ config->boot_device = str;
+
rc = 0;
out: