From e040ad4ad0dbec022158c000590ee7eb5b412a66 Mon Sep 17 00:00:00 2001 From: sasha Date: Fri, 1 Aug 2008 15:17:17 +0000 Subject: - [DEV-195] added support of source ip address git-svn-id: svn://svn.zabbix.com/trunk@5863 97f52cf1-0a1b-0410-bd0e-c28be96e8082 --- misc/conf/zabbix_agentd.conf | 3 +++ misc/conf/zabbix_proxy.conf | 3 +++ misc/conf/zabbix_server.conf | 3 +++ src/zabbix_proxy/servercomms.c | 2 +- src/zabbix_proxy/servercomms.h | 1 + 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/misc/conf/zabbix_agentd.conf b/misc/conf/zabbix_agentd.conf index 74347b46..bbb9a28d 100644 --- a/misc/conf/zabbix_agentd.conf +++ b/misc/conf/zabbix_agentd.conf @@ -27,6 +27,9 @@ Hostname=localhost #ListenIP=127.0.0.1 +# Source IP address for outgouing connections +#SourceIP= + # Number of pre-forked instances of zabbix_agentd. # Default value is 5 # This parameter must be between 1 and 16 diff --git a/misc/conf/zabbix_proxy.conf b/misc/conf/zabbix_proxy.conf index e9eefb06..420a2cf1 100644 --- a/misc/conf/zabbix_proxy.conf +++ b/misc/conf/zabbix_proxy.conf @@ -50,6 +50,9 @@ Hostname=proxy # must be between 1024 and 32767 #ListenPort=10051 +# Source IP address for outgouing connections +#SourceIP= + # Listen interface for trapper. Trapper will listen all network interfaces # if this parameter is missing. #ListenIP=127.0.0.1 diff --git a/misc/conf/zabbix_server.conf b/misc/conf/zabbix_server.conf index 171378f9..dfc17860 100644 --- a/misc/conf/zabbix_server.conf +++ b/misc/conf/zabbix_server.conf @@ -44,6 +44,9 @@ #ListenPort=10051 +# Source IP address for outgouing connections +#SourceIP= + # Listen interface for trapper. Trapper will listen all network interfaces # if this parameter is missing. diff --git a/src/zabbix_proxy/servercomms.c b/src/zabbix_proxy/servercomms.c index e0651bfa..ce98f405 100644 --- a/src/zabbix_proxy/servercomms.c +++ b/src/zabbix_proxy/servercomms.c @@ -36,7 +36,7 @@ int connect_to_server(zbx_sock_t *sock, int timeout) CONFIG_SERVER_PORT, timeout); - if (FAIL == (res = zbx_tcp_connect(sock, CONFIG_SERVER, CONFIG_SERVER_PORT, timeout))) + if (FAIL == (res = zbx_tcp_connect(sock, CONFIG_SOURCE_IP, CONFIG_SERVER, CONFIG_SERVER_PORT, timeout))) zabbix_log(LOG_LEVEL_ERR, "Unable connect to the server [%s]:%d [%s]", CONFIG_SERVER, CONFIG_SERVER_PORT, diff --git a/src/zabbix_proxy/servercomms.h b/src/zabbix_proxy/servercomms.h index 10974fb5..cb959b13 100644 --- a/src/zabbix_proxy/servercomms.h +++ b/src/zabbix_proxy/servercomms.h @@ -20,6 +20,7 @@ #ifndef ZABBIX_SERVERCOMMS_H #define ZABBIX_SERVERCOMMS_H +extern char *CONFIG_SOURCE_IP; extern char *CONFIG_SERVER; extern int CONFIG_SERVER_PORT; extern char *CONFIG_HOSTNAME; -- cgit