9
0
Fork 0

net: dhcp: reset env variable before do a dhcp request

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
This commit is contained in:
Jean-Christophe PLAGNIOL-VILLARD 2012-03-30 11:40:20 +08:00
parent 16a07dc526
commit af387f080f
1 changed files with 16 additions and 0 deletions

View File

@ -513,11 +513,27 @@ static void dhcp_handler(void *ctx, char *packet, unsigned int len)
}
}
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)
continue;
setenv(opt->barebox_var_name,"");
}
}
static int do_dhcp(int argc, char *argv[])
{
int ret, opt;
char *vendor_id = (char*)getenv("dhcp_vendor_id");
dhcp_reset_env();
while((opt = getopt(argc, argv, "v:")) > 0) {
switch(opt) {
case 'v':