diff options
author | K. Y. Srinivasan <kys@microsoft.com> | 2012-10-25 17:15:50 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-30 14:11:24 -0400 |
commit | 3321e738d6f0a82b2c19f9d5890f304dab1e5357 (patch) | |
tree | f86293d804947c65262b24db1ee9f473e9be2364 /tools/hv | |
parent | f426a36cecfea2cfd69c28ca5ba4f4bfae913f63 (diff) |
Tools: hv: Don't return loopback addresses
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/hv')
-rw-r--r-- | 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 6c7bcb9932cb..13c2a142331d 100644 --- a/tools/hv/hv_kvp_daemon.c +++ b/tools/hv/hv_kvp_daemon.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <sys/stat.h> | 43 | #include <sys/stat.h> |
44 | #include <fcntl.h> | 44 | #include <fcntl.h> |
45 | #include <dirent.h> | 45 | #include <dirent.h> |
46 | #include <net/if.h> | ||
46 | 47 | ||
47 | /* | 48 | /* |
48 | * KVP protocol: The user mode component first registers with the | 49 | * KVP protocol: The user mode component first registers with the |
@@ -882,7 +883,7 @@ static int kvp_process_ip_address(void *addrp, | |||
882 | addr_length = INET6_ADDRSTRLEN; | 883 | addr_length = INET6_ADDRSTRLEN; |
883 | } | 884 | } |
884 | 885 | ||
885 | if ((length - *offset) < addr_length + 1) | 886 | if ((length - *offset) < addr_length + 2) |
886 | return HV_E_FAIL; | 887 | return HV_E_FAIL; |
887 | if (str == NULL) { | 888 | if (str == NULL) { |
888 | strcpy(buffer, "inet_ntop failed\n"); | 889 | strcpy(buffer, "inet_ntop failed\n"); |
@@ -890,11 +891,13 @@ static int kvp_process_ip_address(void *addrp, | |||
890 | } | 891 | } |
891 | if (*offset == 0) | 892 | if (*offset == 0) |
892 | strcpy(buffer, tmp); | 893 | strcpy(buffer, tmp); |
893 | else | 894 | else { |
895 | strcat(buffer, ";"); | ||
894 | strcat(buffer, tmp); | 896 | strcat(buffer, tmp); |
895 | strcat(buffer, ";"); | 897 | } |
896 | 898 | ||
897 | *offset += strlen(str) + 1; | 899 | *offset += strlen(str) + 1; |
900 | |||
898 | return 0; | 901 | return 0; |
899 | } | 902 | } |
900 | 903 | ||
@@ -956,7 +959,9 @@ kvp_get_ip_info(int family, char *if_name, int op, | |||
956 | * supported address families; if not we gather info on | 959 | * supported address families; if not we gather info on |
957 | * the specified address family. | 960 | * the specified address family. |
958 | */ | 961 | */ |
959 | if ((family != 0) && (curp->ifa_addr->sa_family != family)) { | 962 | if ((((family != 0) && |
963 | (curp->ifa_addr->sa_family != family))) || | ||
964 | (curp->ifa_flags & IFF_LOOPBACK)) { | ||
960 | curp = curp->ifa_next; | 965 | curp = curp->ifa_next; |
961 | continue; | 966 | continue; |
962 | } | 967 | } |