summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNishanth Aravamudan <nacc@linux.vnet.ibm.com>2015-08-19 14:05:05 -0700
committerSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>2015-12-18 13:06:53 +1100
commit32d3249e252fe201eb81155cbf3b800ce5cf88e0 (patch)
treeb5666989c2906d1a923d297f01208fb01ed8abbb /lib
parent45e9e7a53540e87e2129bb11fd853501131fb795 (diff)
downloadtalos-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 'lib')
-rw-r--r--lib/pb-protocol/pb-protocol.c6
-rw-r--r--lib/types/types.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c
index ab5ea8a..9d07a58 100644
--- a/lib/pb-protocol/pb-protocol.c
+++ b/lib/pb-protocol/pb-protocol.c
@@ -260,6 +260,7 @@ static int pb_protocol_interface_config_len(struct interface_config *conf)
if (conf->method == CONFIG_METHOD_STATIC) {
len += 4 + optional_strlen(conf->static_config.address);
len += 4 + optional_strlen(conf->static_config.gateway);
+ len += 4 + optional_strlen(conf->static_config.url);
}
return len;
@@ -454,6 +455,8 @@ static int pb_protocol_serialise_config_interface(char *buf,
conf->static_config.address);
pos += pb_protocol_serialise_string(pos,
conf->static_config.gateway);
+ pos += pb_protocol_serialise_string(pos,
+ conf->static_config.url);
}
return pos - buf;
@@ -900,6 +903,9 @@ static int pb_protocol_deserialise_config_interface(const char **buf,
if (read_string(iface, buf, len, &iface->static_config.gateway))
return -1;
+
+ if (read_string(iface, buf, len, &iface->static_config.url))
+ return -1;
}
return 0;
diff --git a/lib/types/types.h b/lib/types/types.h
index 702b6f5..c2de8a5 100644
--- a/lib/types/types.h
+++ b/lib/types/types.h
@@ -115,6 +115,7 @@ struct interface_config {
struct {
char *address;
char *gateway;
+ char *url;
} static_config;
};
};
OpenPOWER on IntegriCloud