Message ID | 20180509053705.3143-6-sam@mendozajonas.com |
---|---|
State | Changes Requested |
Headers | show |
Series | IPv6 Support | expand |
Hi Sam, > 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. I'm not 100% convinced we need this to be explicitly set. For specifying petitboot's own network settings, could we not detect this at interface-configuration time, based on the format of the addresses in the petitboot,network parameter? When doing DHCP, we could start both v4 and v6 discovery. And for detecting the v4/v6-iness of external URLs, that could just depend on the format of the URLS (if they're explicit IPs, either v4 or v6) or type of answer records we get back from DNS? Cheers, Jeremy
On Mon, 2018-05-14 at 09:56 +0800, Jeremy Kerr wrote: > Hi Sam, > > > 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. > > I'm not 100% convinced we need this to be explicitly set. > > For specifying petitboot's own network settings, could we not detect > this at interface-configuration time, based on the format of the > addresses in the petitboot,network parameter? When doing DHCP, we could > start both v4 and v6 discovery. On reflection this completely makes sense! One scenario that comes to mind is if some users might want to restrict which format is used if both are available, but I'm not sure how common of a request that would be (eg. both are available but only one routes to somewhere useful - that could have an effect on async loads potentially). In general though nothing really stops us from doing both simultaneously - perhaps just some extra logic to check if the IPv6 addresses we have are link-local only. > > And for detecting the v4/v6-iness of external URLs, that could just > depend on the format of the URLS (if they're explicit IPs, either v4 or > v6) or type of answer records we get back from DNS? Indeed we already do this in device_from_addr(). Cheers, Sam > > Cheers, > > > Jeremy
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;
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@mendozajonas.com> --- discover/platform-powerpc.c | 15 +++++++++++++++ discover/platform.c | 1 + 2 files changed, 16 insertions(+)