[PATCH 5/7] discover/platform-powerpc: Add NVRAM parameter for IPv6
Samuel Mendoza-Jonas
sam at mendozajonas.com
Wed May 9 15:37:03 AEST 2018
Add a new NVRAM parameter to signal which address scheme should be used.
This is kept separate from petitboot,network to maintain some backwards
compatibility for IPv4 configurations.
Signed-off-by: Samuel Mendoza-Jonas <sam at mendozajonas.com>
---
discover/platform-powerpc.c | 15 +++++++++++++++
discover/platform.c | 1 +
2 files changed, 16 insertions(+)
diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c
index df8c7d6..ba7c470 100644
--- a/discover/platform-powerpc.c
+++ b/discover/platform-powerpc.c
@@ -53,6 +53,7 @@ struct platform_powerpc {
static const char *known_params[] = {
"auto-boot?",
"petitboot,network",
+ "petitboot,network_type",
"petitboot,timeout",
"petitboot,bootdevs",
"petitboot,language",
@@ -387,6 +388,16 @@ static void populate_network_config(struct platform_powerpc *platform,
const char *cval;
int i;
+ cval = get_param(platform, "petitboot,network_type");
+ if (!cval || !strlen(cval) || strncmp(cval, "ipv4", strlen("ipv4")) == 0)
+ config->network.addr_type = ADDR_IPV4;
+ else if (strncmp(cval, "ipv6", strlen("ipv6")) == 0)
+ config->network.addr_type = ADDR_IPV6;
+ else {
+ pb_debug("malformed petitboot,network_type param");
+ config->network.addr_type = ADDR_IPV4;
+ }
+
cval = get_param(platform, "petitboot,network");
if (!cval || !strlen(cval))
return;
@@ -630,6 +641,10 @@ static void update_network_config(struct platform_powerpc *platform,
config->network.interfaces[0]->override)
return;
+ update_string_config(platform, "petitboot,network_type",
+ config->network.addr_type == ADDR_IPV6 ?
+ "ipv6" : "ipv4");
+
val = talloc_strdup(platform, "");
for (i = 0; i < config->network.n_interfaces; i++) {
diff --git a/discover/platform.c b/discover/platform.c
index cc6306f..30a6ffd 100644
--- a/discover/platform.c
+++ b/discover/platform.c
@@ -126,6 +126,7 @@ void config_set_defaults(struct config *config)
config->network.n_interfaces = 0;
config->network.dns_servers = NULL;
config->network.n_dns_servers = 0;
+ config->network.addr_type = ADDR_IPV4;
config->http_proxy = NULL;
config->https_proxy = NULL;
config->safe_mode = false;
--
2.17.0
More information about the Petitboot
mailing list