lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 21 Jun 2012 14:31:43 -0700
From:	"K. Y. Srinivasan" <kys@...rosoft.com>
To:	gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
	devel@...uxdriverproject.org, virtualization@...ts.osdl.org,
	ohering@...e.com, apw@...onical.com
Cc:	"K. Y. Srinivasan" <kys@...rosoft.com>
Subject: [PATCH 11/13] Tools: hv: Gather dhcp information

Collect information on dhcp setting for the specified interface.

Signed-off-by: K. Y. Srinivasan <kys@...rosoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@...rosoft.com>
---
 tools/hv/hv_kvp_daemon.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index 68a4cc1..dcf67fa 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -524,6 +524,10 @@ static void kvp_get_ipconfig_info(char *if_name,
 	char cmd[512];
 	char *dns_config = "/var/opt/hyperv/.kvp_dns_cfg";
 	char *gw_config = "/var/opt/hyperv/.kvp_gw_cfg";
+	char if_cfg_file[256];
+	FILE *file;
+	char *p;
+	char buf[256];
 
 	memset(cmd, 0, 512);
 	strcat(cmd, "cat /etc/resolv.conf 2>/tmp/null | ");
@@ -569,6 +573,35 @@ static void kvp_get_ipconfig_info(char *if_name,
 	kvp_process_ipconfig_file(gw_config, (char *)buffer->gate_way,
 				(MAX_GATEWAY_SIZE * 2), INET6_ADDRSTRLEN,
 				strlen(gw_config));
+
+	/*
+	 * Get the boot protocol for the interface.
+	 * We will get the info from:
+	 * /etc/sysconfig/network-scripts/ifcfg-ethx
+	 * If need to parse other files to get
+	 * this info, we need to add code to parse
+	 * other files.
+	 */
+	memset(if_cfg_file, 0, sizeof(if_cfg_file));
+	strcat(if_cfg_file, "/etc/sysconfig/network-scripts/ifcfg-");
+	strcat(if_cfg_file, if_name);
+
+	file = fopen(if_cfg_file, "r");
+	if (file == NULL)
+		/*
+		 * Add code to parse other files.
+		 */
+		return;
+
+	while ((p = fgets(buf, sizeof(buf), file)) != NULL) {
+		if (strncmp(p, "BOOTPROTO", 9))
+			continue;
+		if (strncmp(p, "BOOTPROTO=none", 14))
+			buffer->dhcp_enabled = 0;
+		else
+			buffer->dhcp_enabled = 1;
+	}
+
 }
 
 
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ