From 822114aaf5eea275398f79e668f14e0cf39d0f17 Mon Sep 17 00:00:00 2001 From: Weibing Zhang Date: Sun, 6 Nov 2016 13:14:13 -0800 Subject: tools: hv: remove unnecessary link flag The link flag pthread is not needed. Signed-off-by: Weibing Zhang Signed-off-by: K. Y. Srinivasan Signed-off-by: Greg Kroah-Hartman --- tools/hv/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tools/hv') diff --git a/tools/hv/Makefile b/tools/hv/Makefile index a8c4644022a6..0d1e61b81844 100644 --- a/tools/hv/Makefile +++ b/tools/hv/Makefile @@ -1,9 +1,8 @@ # Makefile for Hyper-V tools CC = $(CROSS_COMPILE)gcc -PTHREAD_LIBS = -lpthread WARNINGS = -Wall -Wextra -CFLAGS = $(WARNINGS) -g $(PTHREAD_LIBS) $(shell getconf LFS_CFLAGS) +CFLAGS = $(WARNINGS) -g $(shell getconf LFS_CFLAGS) CFLAGS += -D__EXPORTED_HEADERS__ -I../../include/uapi -I../../include -- cgit v1.2.3 From 1745ba41945db2c77d918e3bcad898f8259f7f5a Mon Sep 17 00:00:00 2001 From: Weibing Zhang Date: Sun, 6 Nov 2016 13:14:14 -0800 Subject: tools: hv: fix a compile warning in snprintf hv_kvp_daemon.c: In function .kvp_mac_to_if_name.: hv_kvp_daemon.c:705:2: warning: format not a string literal and no format arguments [-Wformat-security] snprintf(dev_id, sizeof(dev_id), kvp_net_dir); ^ hv_kvp_daemon.c:705:2: warning: format not a string literal and no format arguments [-Wformat-security] Signed-off-by: Weibing Zhang Signed-off-by: K. Y. Srinivasan Signed-off-by: Greg Kroah-Hartman --- tools/hv/hv_kvp_daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/hv') diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c index bc7adb84e679..bb0719b11475 100644 --- a/tools/hv/hv_kvp_daemon.c +++ b/tools/hv/hv_kvp_daemon.c @@ -702,7 +702,7 @@ static char *kvp_mac_to_if_name(char *mac) if (dir == NULL) return NULL; - snprintf(dev_id, sizeof(dev_id), kvp_net_dir); + snprintf(dev_id, sizeof(dev_id), "%s", kvp_net_dir); q = dev_id + strlen(kvp_net_dir); while ((entry = readdir(dir)) != NULL) { -- cgit v1.2.3 From 0c38cda64aecb4a821210bb2d3d04092c181c0ae Mon Sep 17 00:00:00 2001 From: Weibing Zhang Date: Sun, 6 Nov 2016 13:14:15 -0800 Subject: tools: hv: remove unnecessary header files and netlink related code Remove unnecessary header files and netlink related code as the daemons do not use netlink to communicate with the kernel now. Signed-off-by: Weibing Zhang Signed-off-by: K. Y. Srinivasan Signed-off-by: Greg Kroah-Hartman --- tools/hv/hv_fcopy_daemon.c | 7 ------- tools/hv/hv_kvp_daemon.c | 7 ------- 2 files changed, 14 deletions(-) (limited to 'tools/hv') diff --git a/tools/hv/hv_fcopy_daemon.c b/tools/hv/hv_fcopy_daemon.c index fdc9ca4c0356..26ae609a9448 100644 --- a/tools/hv/hv_fcopy_daemon.c +++ b/tools/hv/hv_fcopy_daemon.c @@ -18,21 +18,14 @@ #include -#include -#include -#include -#include #include #include #include -#include -#include #include #include #include #include #include -#include #include static int target_fd; diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c index bb0719b11475..d791dbf05d9b 100644 --- a/tools/hv/hv_kvp_daemon.c +++ b/tools/hv/hv_kvp_daemon.c @@ -22,8 +22,6 @@ */ -#include -#include #include #include #include @@ -34,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -99,10 +96,6 @@ static struct utsname uts_buf; #define MAX_FILE_NAME 100 #define ENTRIES_PER_BLOCK 50 -#ifndef SOL_NETLINK -#define SOL_NETLINK 270 -#endif - struct kvp_record { char key[HV_KVP_EXCHANGE_MAX_KEY_SIZE]; char value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE]; -- cgit v1.2.3 From 2eb72d4b790c0798d077cd69739350e10288dbf1 Mon Sep 17 00:00:00 2001 From: Alex Fluter Date: Sat, 3 Dec 2016 12:34:41 -0800 Subject: Tools: hv: kvp: configurable external scripts path error when running hypervkvpd: $ sudo ./hv_kvp_daemon -n sh: hv_get_dns_info: command not found sh: hv_get_dhcp_info: command not found sh: hv_get_dns_info: command not found sh: hv_get_dhcp_info: command not found The external scripts are not installed in system path, adding a configurable macro. Signed-off-by: Alex Fluter Signed-off-by: K. Y. Srinivasan Signed-off-by: Greg Kroah-Hartman --- tools/hv/hv_kvp_daemon.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'tools/hv') diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c index d791dbf05d9b..f1758fcbc37d 100644 --- a/tools/hv/hv_kvp_daemon.c +++ b/tools/hv/hv_kvp_daemon.c @@ -93,6 +93,10 @@ static struct utsname uts_buf; #define KVP_CONFIG_LOC "/var/lib/hyperv" +#ifndef KVP_SCRIPTS_PATH +#define KVP_SCRIPTS_PATH "/usr/libexec/hypervkvpd/" +#endif + #define MAX_FILE_NAME 100 #define ENTRIES_PER_BLOCK 50 @@ -818,7 +822,7 @@ static void kvp_get_ipconfig_info(char *if_name, * . */ - sprintf(cmd, "%s", "hv_get_dns_info"); + sprintf(cmd, KVP_SCRIPTS_PATH "%s", "hv_get_dns_info"); /* * Execute the command to gather DNS info. @@ -835,7 +839,7 @@ static void kvp_get_ipconfig_info(char *if_name, * Enabled: DHCP enabled. */ - sprintf(cmd, "%s %s", "hv_get_dhcp_info", if_name); + sprintf(cmd, KVP_SCRIPTS_PATH "%s %s", "hv_get_dhcp_info", if_name); file = popen(cmd, "r"); if (file == NULL) @@ -1341,7 +1345,8 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val) * invoke the external script to do its magic. */ - snprintf(cmd, sizeof(cmd), "%s %s", "hv_set_ifconfig", if_file); + snprintf(cmd, sizeof(cmd), KVP_SCRIPTS_PATH "%s %s", + "hv_set_ifconfig", if_file); if (system(cmd)) { syslog(LOG_ERR, "Failed to execute cmd '%s'; error: %d %s", cmd, errno, strerror(errno)); -- cgit v1.2.3