Ejemplo n.º 1
0
static void dhcp_reset_env(void)
{
	struct dhcp_opt *opt;
	int i;

	for (i = 0; i < ARRAY_SIZE(dhcp_options); i++) {
		opt = &dhcp_options[i];
		if (!opt->barebox_var_name || opt->copy_only_if_valid)
			continue;

		setenv(opt->barebox_var_name,"");
		if (opt->barebox_dhcp_global)
			dhcp_set_barebox_global(opt->barebox_dhcp_global,"");
	}
}
Ejemplo n.º 2
0
static void dhcp_reset_env(void)
{
	struct dhcp_opt *opt;
	int i;

	for (i = 0; i < ARRAY_SIZE(dhcp_options); i++) {
		opt = &dhcp_options[i];
		if (!opt->barebox_var_name || opt->copy_only_if_valid)
			continue;

		if (IS_ENABLED(CONFIG_ENVIRONMENT_VARIABLES))
			setenv(opt->barebox_var_name, "");
		if (opt->barebox_dhcp_global && IS_ENABLED(CONFIG_GLOBALVAR))
			dhcp_set_barebox_global(opt->barebox_dhcp_global, "");
	}
}
Ejemplo n.º 3
0
/*
 * Copy parameters of interest from BOOTP_REPLY/DHCP_OFFER packet
 */
static void bootp_copy_net_params(struct bootp *bp)
{
	IPaddr_t tmp_ip;

	tmp_ip = net_read_ip(&bp->bp_yiaddr);
	net_set_ip(tmp_ip);

	tmp_ip = net_read_ip(&bp->bp_siaddr);
	if (tmp_ip != 0)
		net_set_serverip(tmp_ip);

	if (strlen(bp->bp_file) > 0) {
		setenv("bootfile", bp->bp_file);
		dhcp_set_barebox_global("bootfile", bp->bp_file);
	}

	debug("bootfile: %s\n", bp->bp_file);
}
Ejemplo n.º 4
0
static void env_str_handle(struct dhcp_opt *opt, unsigned char *popt, int optlen)
{
	char str[256];
	char *tmp = str;

	if (opt->data)
		tmp = opt->data;

	memcpy(tmp, popt, optlen);
	tmp[optlen] = 0;

	if (opt->copy_only_if_valid && !strlen(tmp))
		return;
	if (opt->barebox_var_name && IS_ENABLED(CONFIG_ENVIRONMENT_VARIABLES))
		setenv(opt->barebox_var_name, tmp);
	if (opt->barebox_dhcp_global && IS_ENABLED(CONFIG_GLOBALVAR))
		dhcp_set_barebox_global(opt->barebox_dhcp_global, tmp);

}
Ejemplo n.º 5
0
static void env_str_handle(struct dhcp_opt *opt, unsigned char *popt, int optlen)
{
	char str[256];
	char *tmp = str;

	if (opt->data)
		tmp = opt->data;

	memcpy(tmp, popt, optlen);
	tmp[optlen] = 0;

	if (opt->copy_only_if_valid && !strlen(tmp))
		return;

	if (opt->barebox_var_name)
		setenv(opt->barebox_var_name, tmp);
	if (opt->barebox_dhcp_global)
		dhcp_set_barebox_global(opt->barebox_dhcp_global, tmp);

}
Ejemplo n.º 6
0
/*
 * Copy parameters of interest from BOOTP_REPLY/DHCP_OFFER packet
 */
static void bootp_copy_net_params(struct bootp *bp)
{
	IPaddr_t tmp_ip;

	tmp_ip = net_read_ip(&bp->bp_yiaddr);
	net_set_ip(tmp_ip);

	tmp_ip = net_read_ip(&bp->bp_siaddr);
	if (tmp_ip != 0)
		net_set_serverip(tmp_ip);

	if (strlen(bp->bp_file) > 0) {
		if (IS_ENABLED(CONFIG_ENVIRONMENT_VARIABLES))
			setenv("bootfile", bp->bp_file);
		if (IS_ENABLED(CONFIG_GLOBALVAR))
			dhcp_set_barebox_global("bootfile", bp->bp_file);
	}

	debug("bootfile: %s\n", bp->bp_file);
}