diff options
author | Nishanth Aravamudan <nacc@linux.vnet.ibm.com> | 2015-08-19 14:05:05 -0700 |
---|---|---|
committer | Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> | 2015-12-18 13:06:53 +1100 |
commit | 32d3249e252fe201eb81155cbf3b800ce5cf88e0 (patch) | |
tree | b5666989c2906d1a923d297f01208fb01ed8abbb /discover/platform-powerpc.c | |
parent | 45e9e7a53540e87e2129bb11fd853501131fb795 (diff) | |
download | talos-petitboot-32d3249e252fe201eb81155cbf3b800ce5cf88e0.tar.gz talos-petitboot-32d3249e252fe201eb81155cbf3b800ce5cf88e0.zip |
ui: add URL for static configurations to load a specified file
In certain configurations, e.g. automation, we want to use static
networking but load a particular file, automatically and parse it as a
pxelinux config file. Currently, we support something like this for DHCP
based booting, but not static. Add a URL field to the UI for static
configurations and reuse the logic from device_handler_process_url() to
load the specified file.
Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Diffstat (limited to 'discover/platform-powerpc.c')
-rw-r--r-- | discover/platform-powerpc.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c index 7370d7d..5abc4d7 100644 --- a/discover/platform-powerpc.c +++ b/discover/platform-powerpc.c @@ -310,7 +310,7 @@ static int parse_one_interface_config(struct config *config, } else if (!strcmp(tok, "static")) { ifconf->method = CONFIG_METHOD_STATIC; - /* ip/mask, [optional] gateway */ + /* ip/mask, [optional] gateway, [optional] url */ tok = strtok_r(NULL, ",", &saveptr); if (!tok) goto out_err; @@ -323,6 +323,12 @@ static int parse_one_interface_config(struct config *config, talloc_strdup(ifconf, tok); } + tok = strtok_r(NULL, ",", &saveptr); + if (tok) { + ifconf->static_config.url = + talloc_strdup(ifconf, tok); + } + } else { pb_log("Unknown network configuration method %s\n", tok); goto out_err; @@ -575,10 +581,12 @@ static char *iface_config_str(void *ctx, struct interface_config *config) str = talloc_asprintf_append(str, "dhcp"); } else if (config->method == CONFIG_METHOD_STATIC) { - str = talloc_asprintf_append(str, "static,%s%s%s", + str = talloc_asprintf_append(str, "static,%s%s%s%s%s", config->static_config.address, config->static_config.gateway ? "," : "", - config->static_config.gateway ?: ""); + config->static_config.gateway ?: "", + config->static_config.url ? "," : "", + config->static_config.url ?: ""); } return str; } |