|
|
|
|
@@ -52,6 +52,7 @@ typedef struct __config_file_st{
|
|
|
|
|
char ip[IPSIZE];
|
|
|
|
|
int pingnum; //OPTIONAL!! How many times for once ping check? Default is 2.
|
|
|
|
|
int pinglap; //OPTIONAL!! How many seconds does ping wait for reply package? Default is 1.
|
|
|
|
|
int crazyping;
|
|
|
|
|
}CONFIG_FILE_ST;
|
|
|
|
|
|
|
|
|
|
typedef struct inc_name_node{
|
|
|
|
|
@@ -133,6 +134,7 @@ char myconf[][64] = {
|
|
|
|
|
"ping", // 13
|
|
|
|
|
"pingnum", // 14
|
|
|
|
|
"pinglap", // 15
|
|
|
|
|
"crazyping", // 16
|
|
|
|
|
""
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@@ -153,6 +155,7 @@ static const configoption_t options[] = {
|
|
|
|
|
{myconf[13], ARG_STR, cb_str, NULL, CTX_ALL},
|
|
|
|
|
{myconf[14], ARG_INT, cb_int, NULL, CTX_ALL},
|
|
|
|
|
{myconf[15], ARG_INT, cb_int, NULL, CTX_ALL},
|
|
|
|
|
{myconf[16], ARG_INT, cb_int, NULL, CTX_ALL},
|
|
|
|
|
LAST_OPTION
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@@ -1189,6 +1192,10 @@ DOTCONF_CB(cb_int)
|
|
|
|
|
if(strcmp(cmd ->name, myconf[15]) == 0){
|
|
|
|
|
conf.pinglap = cmd->data.value;
|
|
|
|
|
}
|
|
|
|
|
if(strcmp(cmd ->name, myconf[16]) == 0){
|
|
|
|
|
conf.crazyping = cmd->data.value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
@@ -1413,7 +1420,7 @@ int get_netcard_status(NETCARD_INFO_ST *listp)
|
|
|
|
|
return NIC_UNRUNNING;
|
|
|
|
|
|
|
|
|
|
//20100510
|
|
|
|
|
if(elapsed_ping_time == total_ping_time){
|
|
|
|
|
if(conf.crazyping || (elapsed_ping_time == total_ping_time)){
|
|
|
|
|
if(ping_gw(listp->info.charname) != 0)
|
|
|
|
|
return NIC_UNLINKABLE;
|
|
|
|
|
}
|
|
|
|
|
@@ -1475,14 +1482,14 @@ int do_alarm(NETCARD_INFO_ST *listp, int nic_status, D5000_NIC_ALARM *Malarm)
|
|
|
|
|
int main(int argc, char ** argv)
|
|
|
|
|
{
|
|
|
|
|
int id = -1;
|
|
|
|
|
if((id = semget(0x1d5200, 1, 0666)) == -1)
|
|
|
|
|
if((id = semget(0x1d5200, 1, 0666)) != -1)
|
|
|
|
|
semctl(id,0,IPC_RMID,0);
|
|
|
|
|
id = -1;
|
|
|
|
|
if((id = shmget(0x1d5010,sizeof(SHM) + 16 , 0666)) == -1)
|
|
|
|
|
semctl(id,0,IPC_RMID,0);
|
|
|
|
|
if((id = shmget(0x1d5010,sizeof(SHM) + 16 , 0666)) != -1)
|
|
|
|
|
shmctl(id,IPC_RMID,0);
|
|
|
|
|
id = -1;
|
|
|
|
|
if((id = shmget(0x1d6010, 128, 0666)) == -1)
|
|
|
|
|
semctl(id,0,IPC_RMID,0);
|
|
|
|
|
if((id = shmget(0x1d6010, 128, 0666)) != -1)
|
|
|
|
|
shmctl(id,IPC_RMID,0);
|
|
|
|
|
|
|
|
|
|
int ret = 0, proc_stat = 0;
|
|
|
|
|
unsigned int i = 0;
|
|
|
|
|
@@ -1725,7 +1732,8 @@ int main(int argc, char ** argv)
|
|
|
|
|
total_ping_time = 1000 / conf.monitor_interval;
|
|
|
|
|
if(total_ping_time == 0)
|
|
|
|
|
total_ping_time = 1;
|
|
|
|
|
elapsed_ping_time = 1;
|
|
|
|
|
//elapsed_ping_time = 1;
|
|
|
|
|
elapsed_ping_time = total_ping_time;
|
|
|
|
|
|
|
|
|
|
while(1){
|
|
|
|
|
i = 0;
|
|
|
|
|
|