* [PATCH 0/2] Tools: hv: kvp_daemon
@ 2012-10-13 17:08 K. Y. Srinivasan
2012-10-13 17:08 ` [PATCH 1/2] tools: hv: Return the full kernel version K. Y. Srinivasan
0 siblings, 1 reply; 3+ messages in thread
From: K. Y. Srinivasan @ 2012-10-13 17:08 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, olaf, apw, jasowang; +Cc: K. Y. Srinivasan
This patch-set makes KVP implementation track the implementation
on Windows guests with regards to how IP addresses are returned.
Additionally, we also returns more information for the
OSBuild key.
K. Y. Srinivasan (2):
tools: hv: Return the full kernel version
Tools: hv: Don't return loopback addresses
tools/hv/hv_kvp_daemon.c | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
--
1.7.4.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] tools: hv: Return the full kernel version
2012-10-13 17:08 [PATCH 0/2] Tools: hv: kvp_daemon K. Y. Srinivasan
@ 2012-10-13 17:08 ` K. Y. Srinivasan
2012-10-13 17:08 ` [PATCH 2/2] Tools: hv: Don't return loopback addresses K. Y. Srinivasan
0 siblings, 1 reply; 3+ messages in thread
From: K. Y. Srinivasan @ 2012-10-13 17:08 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, olaf, apw, jasowang; +Cc: K. Y. Srinivasan
Currently, we are returning the same string for both OSBuildNumber
and OSVersion keys. Return the full uts string for the OSBuild
key since Windows does not impose any restrictions on this.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Reported-by: Claudio Latini <claudio.latini@live.com>
---
tools/hv/hv_kvp_daemon.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index 5959aff..6c7bcb9 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -88,6 +88,7 @@ static char *os_major = "";
static char *os_minor = "";
static char *processor_arch;
static char *os_build;
+static char *os_version;
static char *lic_version = "Unknown version";
static struct utsname uts_buf;
@@ -453,7 +454,9 @@ void kvp_get_os_info(void)
char *p, buf[512];
uname(&uts_buf);
- os_build = uts_buf.release;
+ os_version = uts_buf.release;
+ os_build = strdup(uts_buf.release);
+
os_name = uts_buf.sysname;
processor_arch = uts_buf.machine;
@@ -462,7 +465,7 @@ void kvp_get_os_info(void)
* string to be of the form: x.y.z
* Strip additional information we may have.
*/
- p = strchr(os_build, '-');
+ p = strchr(os_version, '-');
if (p)
*p = '\0';
@@ -1649,7 +1652,7 @@ int main(void)
strcpy(key_name, "OSMinorVersion");
break;
case OSVersion:
- strcpy(key_value, os_build);
+ strcpy(key_value, os_version);
strcpy(key_name, "OSVersion");
break;
case ProcessorArchitecture:
--
1.7.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] Tools: hv: Don't return loopback addresses
2012-10-13 17:08 ` [PATCH 1/2] tools: hv: Return the full kernel version K. Y. Srinivasan
@ 2012-10-13 17:08 ` K. Y. Srinivasan
0 siblings, 0 replies; 3+ messages in thread
From: K. Y. Srinivasan @ 2012-10-13 17:08 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, olaf, apw, jasowang; +Cc: K. Y. Srinivasan
Don't return loopback addresses and further don't terminate
the IP address strings with a semicolon. This is the current
behavior of Windows guests.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Reported-by: Claudio Latini <claudio.latini@live.com>
---
tools/hv/hv_kvp_daemon.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index 6c7bcb9..13c2a14 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -43,6 +43,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <dirent.h>
+#include <net/if.h>
/*
* KVP protocol: The user mode component first registers with the
@@ -882,7 +883,7 @@ static int kvp_process_ip_address(void *addrp,
addr_length = INET6_ADDRSTRLEN;
}
- if ((length - *offset) < addr_length + 1)
+ if ((length - *offset) < addr_length + 2)
return HV_E_FAIL;
if (str == NULL) {
strcpy(buffer, "inet_ntop failed\n");
@@ -890,11 +891,13 @@ static int kvp_process_ip_address(void *addrp,
}
if (*offset == 0)
strcpy(buffer, tmp);
- else
+ else {
+ strcat(buffer, ";");
strcat(buffer, tmp);
- strcat(buffer, ";");
+ }
*offset += strlen(str) + 1;
+
return 0;
}
@@ -956,7 +959,9 @@ kvp_get_ip_info(int family, char *if_name, int op,
* supported address families; if not we gather info on
* the specified address family.
*/
- if ((family != 0) && (curp->ifa_addr->sa_family != family)) {
+ if ((((family != 0) &&
+ (curp->ifa_addr->sa_family != family))) ||
+ (curp->ifa_flags & IFF_LOOPBACK)) {
curp = curp->ifa_next;
continue;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-10-13 16:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-13 17:08 [PATCH 0/2] Tools: hv: kvp_daemon K. Y. Srinivasan
2012-10-13 17:08 ` [PATCH 1/2] tools: hv: Return the full kernel version K. Y. Srinivasan
2012-10-13 17:08 ` [PATCH 2/2] Tools: hv: Don't return loopback addresses K. Y. Srinivasan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox