pgpool2.git / summary / log / commit / refs
commit bdeba5f620648d43c90814d8097c8d9cb4363b07
Author: Yugo Nagata <nagata@sraoss.co.jp>
Date: Fri Dec 26 09:22:59 2014 +0000
Rename parameter name from ifconfig_path to if_cmd_path
ifconfig_path isn't appropriate for the parameter name because
ifconfig command is obsolete and now ip command is used as default.
In addition, other command than ip might be used, for example
AWS API. So more gerenal name if_cmd_path is better.
doc/pgpool-en.html | 6 +++---
doc/pgpool-ja.html | 6 +++---
src/config/pool_config.c | 10 +++++-----
src/config/pool_config.l | 10 +++++-----
src/include/pool_config.h | 2 +-
src/sample/pgpool.conf.sample | 4 ++--
src/sample/pgpool.conf.sample-master-slave | 4 ++--
src/sample/pgpool.conf.sample-replication | 4 ++--
src/sample/pgpool.conf.sample-stream | 4 ++--
src/tools/pgmd5/pool_config.c | 10 +++++-----
src/utils/pool_process_reporting.c | 6 +++---
src/watchdog/watchdog.c | 10 +++++-----
src/watchdog/wd_if.c | 28 ++++++++++++++--------------
13 files changed, 52 insertions(+), 52 deletions(-)
diff --git a/doc/pgpool-en.html b/doc/pgpool-en.html
index a46d809f1..c0e50f62b 100644
--- a/doc/pgpool-en.html
+++ b/doc/pgpool-en.html
@@ -4380,7 +4380,7 @@ Configuration about virtual IP interface control
</p>
</dd>
-<dt><a name="IFCONFIG_PATH"></a>ifconfig_path <span class="version">V3.2 -</span></dt>
+<dt><a name="IF_CMD_PATH"></a>if_cmd_path <span class="version">V3.5 -</span></dt>
<dd>
<p>
This parameter specifies a path of a command to switch the IP address.
@@ -4396,7 +4396,7 @@ Configuration about virtual IP interface control
<p>
This parameter specifies a command to bring up the virtual IP.
Set the command and parameters such as
- "ifconfig eth0:0 inet $_IP_$ netmask 255.255.255.0".
+ "ip addr add $_IP_$/24 dev eth0 label eth0:0"
$_IP_$ is replaced by the IP address specified in <a href="#DELEGATE_IP">delegate_IP</a>.
</p>
<p>
@@ -4409,7 +4409,7 @@ Configuration about virtual IP interface control
<p>
This parameter specifies a command to bring down the virtual IP.
Set the command and parameters such as
- "ifconfig eth0:0 down".
+ "ip addr del $_IP_$/24 dev eth0"
</p>
<p>
You need to restart pgpool-II if you change this value.
diff --git a/doc/pgpool-ja.html b/doc/pgpool-ja.html
index 3f3a2dae6..c030bfa76 100644
--- a/doc/pgpool-ja.html
+++ b/doc/pgpool-ja.html
@@ -4510,7 +4510,7 @@ pgpool-II が生きていて PostgreSQL と繋がっている場合でも、
</p>
</dd>
-<dt><a name="IFCONFIG_PATH"></a>ifconfig_path <span class="version">V3.2 ~</span></dt>
+<dt><a name="IF_CMD_PATH"></a>if_cmd_path <span class="version">V3.5 ~</span></dt>
<dd>
<p>
IP アドレス切り替えに利用するコマンドのパスです。
@@ -4525,7 +4525,7 @@ pgpool-II が生きていて PostgreSQL と繋がっている場合でも、
<dd>
<p>
仮想 IP を起動するために実行するコマンドです。
- "ifconfig eth0:0 inet $_IP_$ netmask 255.255.255.0"
+ "ip addr add $_IP_$/24 dev eth0 label eth0:0"
のようにコマンドとパラメータを指定します。
$_IP_$ は <a href="#DELEGATE_IP">delegate_IP</a> で指定された IP アドレスに置換されます。
</p>
@@ -4538,7 +4538,7 @@ pgpool-II が生きていて PostgreSQL と繋がっている場合でも、
<dd>
<p>
仮想IPを停止するために実行するコマンドです。
- "ifconfig eth0:0 down"
+ "ip addr del $_IP_$/24 dev eth0"
のようにコマンドとパラメータを指定します。
</p>
<p>
diff --git a/src/config/pool_config.c b/src/config/pool_config.c
index b373655c8..c942c7b2e 100644
--- a/src/config/pool_config.c
+++ b/src/config/pool_config.c
@@ -1997,9 +1997,9 @@ int pool_init_config(void)
pool_config->wd_interval = 10;
pool_config->wd_authkey = "";
pool_config->ping_path = "/bin";
- pool_config->ifconfig_path = "/sbin";
- pool_config->if_up_cmd = "ifconfig eth0:0 inet $_IP_$ netmask 255.255.255.0";
- pool_config->if_down_cmd = "ifconfig eth0:0 down";
+ pool_config->if_cmd_path = "/sbin";
+ pool_config->if_up_cmd = "ip addr add $_IP_$/24 dev eth0 label eth0:0";
+ pool_config->if_down_cmd = "ip addr del $_IP_$/24 dev eth0";
pool_config->arping_path = "/usr/sbin";
pool_config->arping_cmd = "arping -U $_IP_$ -w 1";
pool_config->wd_life_point = 3;
@@ -4224,7 +4224,7 @@ int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context)
if(strlen(str))
pool_config->ping_path = str;
}
- else if (!strcmp(key, "ifconfig_path") && CHECK_CONTEXT(INIT_CONFIG, context))
+ else if (!strcmp(key, "if_cmd_path") && CHECK_CONTEXT(INIT_CONFIG, context))
{
char *str;
@@ -4241,7 +4241,7 @@ int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context)
return(-1);
}
if(strlen(str))
- pool_config->ifconfig_path = str;
+ pool_config->if_cmd_path = str;
}
else if (!strcmp(key, "if_up_cmd") && CHECK_CONTEXT(INIT_CONFIG, context))
{
diff --git a/src/config/pool_config.l b/src/config/pool_config.l
index fe3336cf9..7d63cbeda 100644
--- a/src/config/pool_config.l
+++ b/src/config/pool_config.l
@@ -258,9 +258,9 @@ int pool_init_config(void)
pool_config->wd_interval = 10;
pool_config->wd_authkey = "";
pool_config->ping_path = "/bin";
- pool_config->ifconfig_path = "/sbin";
- pool_config->if_up_cmd = "ifconfig eth0:0 inet $_IP_$ netmask 255.255.255.0";
- pool_config->if_down_cmd = "ifconfig eth0:0 down";
+ pool_config->if_cmd_path = "/sbin";
+ pool_config->if_up_cmd = "ip addr add $_IP_$/24 dev eth0 label eth0:0";
+ pool_config->if_down_cmd = "ip addr del $_IP_$/24 dev eth0";
pool_config->arping_path = "/usr/sbin";
pool_config->arping_cmd = "arping -U $_IP_$ -w 1";
pool_config->wd_life_point = 3;
@@ -2485,7 +2485,7 @@ int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context)
if(strlen(str))
pool_config->ping_path = str;
}
- else if (!strcmp(key, "ifconfig_path") && CHECK_CONTEXT(INIT_CONFIG, context))
+ else if (!strcmp(key, "if_cmd_path") && CHECK_CONTEXT(INIT_CONFIG, context))
{
char *str;
@@ -2502,7 +2502,7 @@ int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context)
return(-1);
}
if(strlen(str))
- pool_config->ifconfig_path = str;
+ pool_config->if_cmd_path = str;
}
else if (!strcmp(key, "if_up_cmd") && CHECK_CONTEXT(INIT_CONFIG, context))
{
diff --git a/src/include/pool_config.h b/src/include/pool_config.h
index 4cff9568b..94a77ce2e 100644
--- a/src/include/pool_config.h
+++ b/src/include/pool_config.h
@@ -266,7 +266,7 @@ typedef struct {
int wd_interval; /* lifecheck interval (sec) */
char *wd_authkey; /* Authentication key for watchdog communication */
char * ping_path; /* path to ping command */
- char * ifconfig_path; /* path to ifconfig command */
+ char * if_cmd_path; /* path to interface up/down command */
char * if_up_cmd; /* ifup command */
char * if_down_cmd; /* ifdown command */
char * arping_path; /* path to arping command */
diff --git a/src/sample/pgpool.conf.sample b/src/sample/pgpool.conf.sample
index 4917b50ee..0eaf98ab5 100644
--- a/src/sample/pgpool.conf.sample
+++ b/src/sample/pgpool.conf.sample
@@ -488,8 +488,8 @@ delegate_IP = ''
# delegate IP address
# If this is empty, virtual IP never bring up.
# (change requires restart)
-ifconfig_path = '/sbin'
- # ifconfig command path
+if_cmd_path = '/sbin'
+ # path to the directory where if_up/down_cmd exists
# (change requires restart)
if_up_cmd = 'ip addr add $_IP_$/24 dev eth0 label eth0:0'
# startup delegate IP command
diff --git a/src/sample/pgpool.conf.sample-master-slave b/src/sample/pgpool.conf.sample-master-slave
index 92ed2befe..9ec470af4 100644
--- a/src/sample/pgpool.conf.sample-master-slave
+++ b/src/sample/pgpool.conf.sample-master-slave
@@ -488,8 +488,8 @@ delegate_IP = ''
# delegate IP address
# If this is empty, virtual IP never bring up.
# (change requires restart)
-ifconfig_path = '/sbin'
- # ifconfig command path
+if_cmd_path = '/sbin'
+ # path to the directory where if_up/down_cmd exists
# (change requires restart)
if_up_cmd = 'ip addr add $_IP_$/24 dev eth0 label eth0:0'
# startup delegate IP command
diff --git a/src/sample/pgpool.conf.sample-replication b/src/sample/pgpool.conf.sample-replication
index ea206ca78..a687ad7c6 100644
--- a/src/sample/pgpool.conf.sample-replication
+++ b/src/sample/pgpool.conf.sample-replication
@@ -487,8 +487,8 @@ delegate_IP = ''
# delegate IP address
# If this is empty, virtual IP never bring up.
# (change requires restart)
-ifconfig_path = '/sbin'
- # ifconfig command path
+if_cmd_path = '/sbin'
+ # path to the directory where if_up/down_cmd exists
# (change requires restart)
if_up_cmd = 'ip addr add $_IP_$/24 dev eth0 label eth0:0'
# startup delegate IP command
diff --git a/src/sample/pgpool.conf.sample-stream b/src/sample/pgpool.conf.sample-stream
index e2126c5a2..b3304c46d 100644
--- a/src/sample/pgpool.conf.sample-stream
+++ b/src/sample/pgpool.conf.sample-stream
@@ -488,8 +488,8 @@ delegate_IP = ''
# delegate IP address
# If this is empty, virtual IP never bring up.
# (change requires restart)
-ifconfig_path = '/sbin'
- # ifconfig command path
+if_cmd_path = '/sbin'
+ # path to the directory where if_up/down_cmd exists
# (change requires restart)
if_up_cmd = 'ip addr add $_IP_$/24 dev eth0 label eth0:0'
# startup delegate IP command
diff --git a/src/tools/pgmd5/pool_config.c b/src/tools/pgmd5/pool_config.c
index dea7450b6..5de8ea2b9 100644
--- a/src/tools/pgmd5/pool_config.c
+++ b/src/tools/pgmd5/pool_config.c
@@ -1997,9 +1997,9 @@ int pool_init_config(void)
pool_config->wd_interval = 10;
pool_config->wd_authkey = "";
pool_config->ping_path = "/bin";
- pool_config->ifconfig_path = "/sbin";
- pool_config->if_up_cmd = "ifconfig eth0:0 inet $_IP_$ netmask 255.255.255.0";
- pool_config->if_down_cmd = "ifconfig eth0:0 down";
+ pool_config->if_cmd_path = "/sbin";
+ pool_config->if_up_cmd = "ip addr add $_IP_$/24 dev eth0 label eth0:0";
+ pool_config->if_down_cmd = "ip addr del $_IP_$/24 dev eth0";
pool_config->arping_path = "/usr/sbin";
pool_config->arping_cmd = "arping -U $_IP_$ -w 1";
pool_config->wd_life_point = 3;
@@ -4224,7 +4224,7 @@ int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context)
if(strlen(str))
pool_config->ping_path = str;
}
- else if (!strcmp(key, "ifconfig_path") && CHECK_CONTEXT(INIT_CONFIG, context))
+ else if (!strcmp(key, "if_cmd_path") && CHECK_CONTEXT(INIT_CONFIG, context))
{
char *str;
@@ -4241,7 +4241,7 @@ int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context)
return(-1);
}
if(strlen(str))
- pool_config->ifconfig_path = str;
+ pool_config->if_cmd_path = str;
}
else if (!strcmp(key, "if_up_cmd") && CHECK_CONTEXT(INIT_CONFIG, context))
{
diff --git a/src/utils/pool_process_reporting.c b/src/utils/pool_process_reporting.c
index 7b3058b92..49ee11d65 100644
--- a/src/utils/pool_process_reporting.c
+++ b/src/utils/pool_process_reporting.c
@@ -732,9 +732,9 @@ POOL_REPORT_CONFIG* get_config(int *nrows)
StrNCpy(status[i].desc, "path to ping command", POOLCONFIG_MAXDESCLEN);
i++;
- StrNCpy(status[i].name, "ifconfig_path", POOLCONFIG_MAXNAMELEN);
- snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%s", pool_config->ifconfig_path);
- StrNCpy(status[i].desc, "path to ifconfig command", POOLCONFIG_MAXDESCLEN);
+ StrNCpy(status[i].name, "if_cmd_path", POOLCONFIG_MAXNAMELEN);
+ snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%s", pool_config->if_cmd_path);
+ StrNCpy(status[i].desc, "path to interface up/down command", POOLCONFIG_MAXDESCLEN);
i++;
StrNCpy(status[i].name, "if_up_cmd", POOLCONFIG_MAXNAMELEN);
diff --git a/src/watchdog/watchdog.c b/src/watchdog/watchdog.c
index 19c47470a..7fb7d3488 100644
--- a/src/watchdog/watchdog.c
+++ b/src/watchdog/watchdog.c
@@ -350,22 +350,22 @@ wd_chk_setuid(void)
/* check setuid bit of ifup command */
wd_get_cmd(cmd, pool_config->if_up_cmd);
- snprintf(path, sizeof(path), "%s/%s", pool_config->ifconfig_path, cmd);
+ snprintf(path, sizeof(path), "%s/%s", pool_config->if_cmd_path, cmd);
if (! has_setuid_bit(path))
{
ereport(NOTICE,
- (errmsg("checking setuid bit of ifup command"),
+ (errmsg("checking setuid bit of if_up_cmd"),
errdetail("ifup[%s] doesn't have setuid bit", path)));
return 0;
}
/* check setuid bit of ifdown command */
wd_get_cmd(cmd, pool_config->if_down_cmd);
- snprintf(path, sizeof(path), "%s/%s", pool_config->ifconfig_path, cmd);
+ snprintf(path, sizeof(path), "%s/%s", pool_config->if_cmd_path, cmd);
if (! has_setuid_bit(path))
{
ereport(NOTICE,
- (errmsg("checking setuid bit of ifdown command"),
+ (errmsg("checking setuid bit of if_down_cmd"),
errdetail("ifdown[%s] doesn't have setuid bit", path)));
return 0;
}
@@ -421,4 +421,4 @@ exec_func(void *arg)
WdThreadInfo* thread_arg = (WdThreadInfo*) arg;
Assert(thread_arg != NULL);
return thread_arg->start_routine(thread_arg->arg);
-}
\ No newline at end of file
+}
diff --git a/src/watchdog/wd_if.c b/src/watchdog/wd_if.c
index bed3a9b43..c086b4301 100644
--- a/src/watchdog/wd_if.c
+++ b/src/watchdog/wd_if.c
@@ -38,7 +38,7 @@
#include "watchdog/watchdog.h"
#include "watchdog/wd_ext.h"
-static int exec_ifconfig(char * path,char * command);
+static int exec_if_cmd(char * path,char * command);
static char *string_replace(const char *string, const char *pattern, const char *replacement);
#define WD_TRY_PING_AT_IPUP 3
@@ -58,14 +58,14 @@ wd_IP_up(void)
WD_List->delegate_ip_flag = 1;
wd_get_cmd(cmd,pool_config->if_up_cmd);
- snprintf(path,sizeof(path),"%s/%s",pool_config->ifconfig_path,cmd);
- rtn = exec_ifconfig(path,pool_config->if_up_cmd);
+ snprintf(path,sizeof(path),"%s/%s",pool_config->if_cmd_path,cmd);
+ rtn = exec_if_cmd(path,pool_config->if_up_cmd);
if (rtn == WD_OK)
{
wd_get_cmd(cmd,pool_config->arping_cmd);
snprintf(path,sizeof(path),"%s/%s",pool_config->arping_path,cmd);
- rtn = exec_ifconfig(path,pool_config->arping_cmd);
+ rtn = exec_if_cmd(path,pool_config->arping_cmd);
}
if (rtn == WD_OK)
{
@@ -84,10 +84,10 @@ wd_IP_up(void)
if (rtn == WD_OK)
ereport(LOG,
- (errmsg("watchdog bringing up delegate IP, 'ifconfig up' succeeded")));
+ (errmsg("watchdog bringing up delegate IP, 'if_up_cmd' succeeded")));
else
ereport(WARNING,
- (errmsg("watchdog failed to bring up delegate IP, 'ifconfig up' failed")));
+ (errmsg("watchdog failed to bring up delegate IP, 'if_up_cmd' failed")));
}
else
{
@@ -115,8 +115,8 @@ wd_IP_down(void)
{
WD_List->delegate_ip_flag = 0;
wd_get_cmd(cmd,pool_config->if_down_cmd);
- snprintf(path, sizeof(path), "%s/%s", pool_config->ifconfig_path, cmd);
- rtn = exec_ifconfig(path,pool_config->if_down_cmd);
+ snprintf(path, sizeof(path), "%s/%s", pool_config->if_cmd_path, cmd);
+ rtn = exec_if_cmd(path,pool_config->if_down_cmd);
if (rtn == WD_OK)
{
@@ -134,13 +134,13 @@ wd_IP_down(void)
{
ereport(LOG,
(errmsg("watchdog bringing down delegate IP"),
- errdetail("ifconfig down succeeded")));
+ errdetail("if_down_cmd succeeded")));
}
else
{
WD_List->delegate_ip_flag = 1;
ereport(WARNING,
- (errmsg("watchdog bringing down delegate IP, ifconfig down failed")));
+ (errmsg("watchdog bringing down delegate IP, if_down_cmd failed")));
}
}
else
@@ -172,7 +172,7 @@ wd_get_cmd(char * buf, char * cmd)
}
static int
-exec_ifconfig(char * path,char * command)
+exec_if_cmd(char * path,char * command)
{
int pfd[2];
int status;
@@ -184,7 +184,7 @@ exec_ifconfig(char * path,char * command)
if (pipe(pfd) == -1)
{
ereport(WARNING,
- (errmsg("while executing ifconfig, pipe open failed with error \"%s\"",strerror(errno))));
+ (errmsg("while executing interface up/down command, pipe open failed with error \"%s\"",strerror(errno))));
return WD_NG;
}
@@ -254,7 +254,7 @@ exec_ifconfig(char * path,char * command)
if (WIFEXITED(status) == 0 || WEXITSTATUS(status) != 0)
{
ereport(DEBUG1,
- (errmsg("watchdog exec ifconfig failed"),
+ (errmsg("watchdog exec interface up/down command failed"),
errdetail("'%s' failed. exit status: %d",command, WEXITSTATUS(status))));
signal(SIGCHLD, SIG_IGN);
@@ -266,7 +266,7 @@ exec_ifconfig(char * path,char * command)
close(pfd[0]);
}
ereport(DEBUG1,
- (errmsg("watchdog exec ifconfig: '%s' succeeded", command)));
+ (errmsg("watchdog exec interface up/down command: '%s' succeeded", command)));
signal(SIGCHLD, SIG_IGN);
return WD_OK;
[parent: 2cbd669f76cc]