diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2012-03-30 11:40:20 +0800 |
---|---|---|
committer | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2012-04-03 11:38:43 +0800 |
commit | af387f080f8f74931a9ca0b36192e624a2c2fbd1 (patch) | |
tree | 5148f928023adf4ff50321c47da49c72586868e3 /net | |
parent | 16a07dc526205d19277cc545f6226fe906d51d12 (diff) | |
download | barebox-af387f080f8f74931a9ca0b36192e624a2c2fbd1.tar.gz barebox-af387f080f8f74931a9ca0b36192e624a2c2fbd1.tar.xz |
net: dhcp: reset env variable before do a dhcp request
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/dhcp.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/net/dhcp.c b/net/dhcp.c index 750d87958c..9168221a9e 100644 --- a/net/dhcp.c +++ b/net/dhcp.c @@ -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': |