Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 324431
b: refs/heads/master
c: c050372
h: refs/heads/master
i:
  324429: bf4bcaa
  324427: e893c26
  324423: c8594be
  324415: 05842a7
v: v3
  • Loading branch information
K. Y. Srinivasan authored and Greg Kroah-Hartman committed Sep 10, 2012
1 parent 2050418 commit a9d41bf
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2aea3c712826824dbbbaa7b9c0b70936819304b4
refs/heads/master: c050372591bed4488a32e8bf271ae471af5098eb
31 changes: 31 additions & 0 deletions trunk/tools/hv/hv_kvp_daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,9 @@ static void kvp_get_ipconfig_info(char *if_name,
struct hv_kvp_ipaddr_value *buffer)
{
char cmd[512];
char dhcp_info[128];
char *p;
FILE *file;

/*
* Get the address of default gateway (ipv4).
Expand Down Expand Up @@ -572,6 +575,34 @@ static void kvp_get_ipconfig_info(char *if_name,
*/
kvp_process_ipconfig_file(cmd, (char *)buffer->dns_addr,
(MAX_IP_ADDR_SIZE * 2), INET_ADDRSTRLEN, 0);

/*
* Gather the DHCP state.
* We will gather this state by invoking an external script.
* The parameter to the script is the interface name.
* Here is the expected output:
*
* Enabled: DHCP enabled.
*/

sprintf(cmd, "%s %s", "hv_get_dhcp_info", if_name);

file = popen(cmd, "r");
if (file == NULL)
return;

p = fgets(dhcp_info, sizeof(dhcp_info), file);
if (p == NULL) {
pclose(file);
return;
}

if (!strncmp(p, "Enabled", 7))
buffer->dhcp_enabled = 1;
else
buffer->dhcp_enabled = 0;

pclose(file);
}


Expand Down

0 comments on commit a9d41bf

Please sign in to comment.