From 32d3249e252fe201eb81155cbf3b800ce5cf88e0 Mon Sep 17 00:00:00 2001 From: Nishanth Aravamudan Date: Wed, 19 Aug 2015 14:05:05 -0700 Subject: 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 Signed-off-by: Samuel Mendoza-Jonas --- discover/platform-powerpc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'discover/platform-powerpc.c') 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; } -- cgit v1.2.1