return;
}
-static void configure_interface_static(struct interface *interface,
+static void configure_interface_static(struct network *network,
+ struct interface *interface,
const struct interface_config *config)
{
int rc;
interface->name);
}
+ if (config->static_config.url) {
+ pb_log("config URL %s\n", config->static_config.url);
+ device_handler_process_url(network->handler,
+ config->static_config.url);
+ }
+
return;
}
configure_interface_dhcp(interface);
} else if (config->method == CONFIG_METHOD_STATIC) {
- configure_interface_static(interface, config);
+ configure_interface_static(network, interface, 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;
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;
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;
}
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;
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;
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;
#include "nc-config.h"
#include "nc-widgets.h"
-#define N_FIELDS 34
+#define N_FIELDS 37
extern struct help_text config_help_text;
struct nc_widget_label *gateway_l;
struct nc_widget_textbox *gateway_f;
struct nc_widget_label *gateway_help_l;
+ struct nc_widget_label *url_l;
+ struct nc_widget_textbox *url_f;
+ struct nc_widget_label *url_help_l;
struct nc_widget_label *dns_l;
struct nc_widget_textbox *dns_f;
struct nc_widget_label *dns_dhcp_help_l;
}
if (net_conf_type == NET_CONF_TYPE_STATIC) {
- char *ip, *mask, *gateway;
+ char *ip, *mask, *gateway, *url;
ip = widget_textbox_get_value(screen->widgets.ip_addr_f);
mask = widget_textbox_get_value(screen->widgets.ip_mask_f);
gateway = widget_textbox_get_value(screen->widgets.gateway_f);
+ url = widget_textbox_get_value(screen->widgets.url_f);
if (!ip || !*ip || !mask || !*mask) {
screen->scr.frame.status =
iface->static_config.address = talloc_asprintf(iface, "%s/%s",
ip, mask);
iface->static_config.gateway = talloc_strdup(iface, gateway);
+ iface->static_config.url = talloc_strdup(iface, url);
}
str = widget_textbox_get_value(screen->widgets.dns_f);
y++;
}
+ wl = widget_label_base(screen->widgets.url_l);
+ wf = widget_textbox_base(screen->widgets.url_f);
+ wh = widget_label_base(screen->widgets.url_help_l);
+ widget_set_visible(wl, show);
+ widget_set_visible(wf, show);
+ widget_set_visible(wh, show);
+
+ if (show) {
+ layout_pair(screen, y, screen->widgets.url_l, wf);
+ widget_move(wh, y, help_x);
+ y++;
+ }
+
wh = widget_label_base(screen->widgets.dns_help_l);
layout_pair(screen, y, screen->widgets.dns_l,
widget_textbox_base(screen->widgets.dns_f));
{
struct nc_widgetset *set = screen->widgetset;
struct interface_config *ifcfg;
- char *str, *ip, *mask, *gw;
+ char *str, *ip, *mask, *gw, *url;
enum net_conf_type type;
unsigned int i;
int add_len, clear_len, any_len, min_len = 20;
i, str, is_default);
}
- gw = ip = mask = NULL;
+ url = gw = ip = mask = NULL;
if (ifcfg && ifcfg->method == CONFIG_METHOD_STATIC) {
char *sep;
mask = sep + 1;
}
gw = ifcfg->static_config.gateway;
+ url = ifcfg->static_config.url;
}
screen->widgets.ip_addr_l = widget_new_label(set, 0, 0, _("IP/mask:"));
widget_textbox_set_fixed_size(screen->widgets.gateway_f);
widget_textbox_set_validator_ipv4(screen->widgets.gateway_f);
+ screen->widgets.url_l = widget_new_label(set, 0, 0, _("URL:"));
+ screen->widgets.url_f = widget_new_textbox(set, 0, 0, 32, url);
+ screen->widgets.url_help_l =
+ widget_new_label(set, 0, 0, _("(eg. tftp://)"));
+
str = talloc_strdup(screen, "");
for (i = 0; i < config->network.n_dns_servers; i++) {
str = talloc_asprintf_append(str, "%s%s",