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 --- lib/pb-protocol/pb-protocol.c | 6 ++++++ lib/types/types.h | 1 + 2 files changed, 7 insertions(+) (limited to 'lib') 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; }; }; -- cgit v1.2.1