Compare commits

..

No commits in common. '983440fc29df161be57fd19434f9c53ce97690d4' and 'bba77edecd025ec1191538228d6987d5b9773218' have entirely different histories.

@ -1 +1 @@
0.25.3 0.25.2

@ -178,7 +178,7 @@ static int daemon_sysentry_deinit(s_sysentry *sysent)
return 0; return 0;
} }
static int daemon_node_cancall_line(const s_node *node, const s_override *ovrd) static bool daemon_node_cancall_line(const s_node *node, const s_override *ovrd)
{ {
bool good_phone = FALSE; bool good_phone = FALSE;
bool good_host = FALSE; bool good_host = FALSE;
@ -208,11 +208,6 @@ static int daemon_node_cancall_line(const s_node *node, const s_override *ovrd)
if( tcpip_isgood_host(ovrd->sIpaddr) ) if( tcpip_isgood_host(ovrd->sIpaddr) )
good_host = TRUE; good_host = TRUE;
} }
else if ( node && *node->host )
{
if( tcpip_isgood_host(node->host) )
good_host = TRUE;
}
/* /*
* Check work time * Check work time
@ -236,16 +231,6 @@ static int daemon_node_cancall_line(const s_node *node, const s_override *ovrd)
good_time = TRUE; good_time = TRUE;
} }
// Must be more complicated, i.e. call to IP even if modem is not good time
if ( good_host )
{
good_time = TRUE;
}
DEB((D_DAEMON, "daemon: node_cancall_line good_phone: %d, good_time:%d, good_host:%d",
good_phone, good_time, good_host));
if( good_time ) if( good_time )
{ {
if( good_host ) if( good_host )
@ -338,23 +323,9 @@ static bool daemon_node_cancall(s_sysentry *syst, bool ign_wtime, bool tcpip)
return FALSE; return FALSE;
} }
/* Make check for tcpip out */
if ( tcpip )
{
rc = daemon_node_cancall_line(&syst->node, NULL);
DEB((D_DAEMON, "daemon tcpip: node_cancall rc=%d", rc));
if ( rc == 2 )
{
syst->tcpip = TRUE;
return TRUE;
}
}
/* Make checks for all lines */ /* Make checks for all lines */
if( syst->overrides ) if( syst->overrides )
{ {
DEB((D_DAEMON, "daemon: node_cancall OVR-IN"));
if( syst->lineptr && syst->lineptr->hidden ) if( syst->lineptr && syst->lineptr->hidden )
{ {
line = syst->line + 1; line = syst->line + 1;
@ -392,18 +363,11 @@ static bool daemon_node_cancall(s_sysentry *syst, bool ign_wtime, bool tcpip)
} }
line++; line++;
} }
} }
else /* Node without overriden parameters */ else /* Node without overriden parameters */
{ {
syst->line = line = 0; syst->line = line = 0;
rc = daemon_node_cancall_line(&syst->node, NULL); return daemon_node_cancall_line(&syst->node, NULL);
DEB((D_DAEMON, "daemon: node_cancall rc=%d", rc));
if ( rc )
{
syst->tcpip = (rc == 2) ? TRUE : FALSE;
return TRUE;
}
} }
return FALSE; return FALSE;
@ -723,8 +687,6 @@ int daemon_rescan_sysqueue(s_sysqueue *q, s_daemon_queue dqs[])
#ifdef DEBUG #ifdef DEBUG
log_sysqueue(q); log_sysqueue(q);
DEB((D_DAEMON, "daemon rescan_sysqueue daemon queue: MODEM: %d, %d; TCPIP: %d, %d",
dqs[MODEM_QUEUE].circle, dqs[MODEM_QUEUE].current, dqs[TCPIP_QUEUE].circle, dqs[TCPIP_QUEUE].current));
#endif #endif
return 0; return 0;
@ -1048,16 +1010,16 @@ int daemon_run(const char *confname, const char *incname, bool quit)
timer_set(&timer_alive, DAEMON_ALIVE_TIMER); timer_set(&timer_alive, DAEMON_ALIVE_TIMER);
} }
if( max_tcpip > 0 ) if( max_modem > 0 )
{ {
DEB((D_INFO,"daemon: daemon_tcpip_queue")); DEB((D_INFO,"daemon: daemon_modem_queue"));
daemon_queue_do(&daemon_queues[TCPIP_QUEUE]); daemon_queue_do(&daemon_queues[MODEM_QUEUE]);
} }
if( max_modem > 0 ) if( max_tcpip > 0 )
{ {
DEB((D_INFO,"daemon: daemon_modem_queue")); DEB((D_INFO,"daemon: daemon_modem_queue"));
daemon_queue_do(&daemon_queues[MODEM_QUEUE]); daemon_queue_do(&daemon_queues[TCPIP_QUEUE]);
} }
(void)sleep(DAEMON_IDLE_SLEEP); (void)sleep(DAEMON_IDLE_SLEEP);

@ -54,13 +54,8 @@ static int daemon_call_branch(s_sysentry *syst, const char *lockdir, s_modemport
s_bforce_opts opts; s_bforce_opts opts;
// TODO: add hiddenline round-robin // TODO: add hiddenline round-robin
memset(&opts, '\0', sizeof(s_bforce_opts));
opts.hiddline = 0; opts.hiddline = 0;
if ( syst->tcpip ) opts.runmode = MODE_CALL_DEFAULT;
opts.runmode = MODE_CALL_IP;
else
opts.runmode = MODE_CALL_DEFAULT;
opts.ipproto = NULL; opts.ipproto = NULL;
opts.phone = NULL; opts.phone = NULL;
opts.force = 0; opts.force = 0;

@ -294,7 +294,7 @@ int nodelist_parsestring(s_node *node, char *str)
//TODO: Add more INA flags to array //TODO: Add more INA flags to array
nodelist_flagvalue(node->flags, "INA", node->host); nodelist_flagvalue(node->flags, "INA", node->host);
DEB((D_NODELIST, "nodelist: Parsed inet values IBN: %d, IFC: %d, ITN: %d, INA: %s", node->do_binkp, node->do_ifcico, node->do_telnet, node->host)); DEB((D_NODELIST, "nodelist: Parsed inet values IBN: %d, IFC: %d, ITN: %d, INA: %d", node->do_binkp, node->do_ifcico, node->do_telnet, node->host));
return 0; return 0;
} }

@ -543,7 +543,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
char s[300]; char s[300];
snprintf(s, 299, "bforce calling system %d:%d/%d.%d", addr.zone, addr.net, addr.node, addr.point ); snprintf(s, 299, "bforce calling system %d:%d/%d.%d", addr.zone, addr.net, addr.node, addr.point );
log(s); log(s);
DEB((D_EVENT, s));
// find suitable way of connection and try to make session // find suitable way of connection and try to make session
int rc = 0; int rc = 0;
@ -568,13 +568,12 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
} }
state.listed = state.node.listed; state.listed = state.node.listed;
DEB((D_EVENT, "Calling init, listed=%d", state.listed));
state.node.addr.domain[0] = '\0'; /* Discard domain for node address */ state.node.addr.domain[0] = '\0'; /* Discard domain for node address */
// 1. If call method specified in cmdline, do use it // 1. If call method specified in cmdline, do use it
// 2. If not, use nodelist data and overrides and call all available methods // 2. If not, use nodelist data and overrides and call all available methods
// If override contains Phone or IP flags, ignore nodelist connect methods (but save INA if not overrided) // If override contains Phone or IP flags, ignore nodelist connect methods (but save INA if not overrided)
DEB((D_EVENT, "Calling init, runmode=%d", opts->runmode));
// 1st - get all allowed call ways // 1st - get all allowed call ways
// 2nd - gather information reqired to call and remove unavailable ways (no info, node does not support) // 2nd - gather information reqired to call and remove unavailable ways (no info, node does not support)
@ -582,7 +581,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
if( opts->runmode == MODE_CALL_DEFAULT ) if( opts->runmode == MODE_CALL_DEFAULT )
{ {
call_mustuse = CALL_MODEM | CALL_TCPIP_ANY; call_mayuse = CALL_MODEM | CALL_TCPIP_ANY;
} }
else if( opts->runmode == MODE_CALL_STDIO ) else if( opts->runmode == MODE_CALL_STDIO )
{ {
@ -594,14 +593,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
} }
else if( opts->runmode == MODE_CALL_IP ) else if( opts->runmode == MODE_CALL_IP )
{ {
DEB((D_EVENT, "Calling init, MODE_CALL_IP")); if( strcasecmp(opts->ipproto, "binkp") == 0 )
if( !(opts->ipproto) ) // determine from nodelist/override
{
DEB((D_EVENT, "ipproto not set"));
call_mayuse = CALL_TCPIP_ANY;
call_mustuse = 0;
}
else if( strcasecmp(opts->ipproto, "binkp") == 0 )
{ {
call_mustuse = CALL_TCPIP_BINKP; call_mustuse = CALL_TCPIP_BINKP;
} }
@ -613,29 +605,31 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
{ {
call_mustuse = CALL_TCPIP_TELNET; call_mustuse = CALL_TCPIP_TELNET;
} }
else if( opts->ipproto == NULL ) // determine from nodelist/override
{
call_mayuse = CALL_TCPIP_ANY;
call_mustuse = 0;
}
else else
{ {
DEB((D_EVENT, "Unknown protocol %s", opts->ipproto));
log("Unknown protocol"); log("Unknown protocol");
return -1; return -1;
} }
} }
else else
{ {
DEB((D_EVENT, "Unknown runmode %d", opts->runmode)); log("Unknown protocol");
log("Unknown runmode");
return -1; return -1;
} }
call_mayuse |= call_mustuse; // it simplifies logics: all required is allowed call_mayuse |= call_mustuse; // it simplifies logics: all required is allowed
//char s[300]; //char s[300];
snprintf(s, 299, "initial: may use %d must use %d", call_mayuse, call_mustuse); //snprintf(s, 299, "initial: may use %d must use %d", call_mayuse, call_mustuse);
log(s); //log(s);
DEB((D_EVENT, s));
if( (call_mayuse & CALL_MODEM) ) if( call_mayuse & CALL_MODEM )
{ {
// 1. use phone from opts // 1. use phone from opts
// 2. use overrides // 2. use overrides
@ -699,9 +693,9 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
} }
} }
snprintf(s, 299, "after phone check: may use %d must use %d", call_mayuse, call_mustuse); // snprintf(s, 299, "after phone check: may use %d must use %d", call_mayuse, call_mustuse);
log(s); // log(s);
DEB((D_EVENT, s));
/* /*
* Apply overrides to the node information * Apply overrides to the node information
*/ */
@ -752,8 +746,6 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
state.override.sIpaddr, sizeof(state.node.host)); state.override.sIpaddr, sizeof(state.node.host));
} }
DEB((D_EVENT, "Calling init, IPHOST", state.node.host));
if( call_mayuse & CALL_TCPIP_ANY && !tcpip_isgood_host(state.node.host) ) { if( call_mayuse & CALL_TCPIP_ANY && !tcpip_isgood_host(state.node.host) ) {
char *fidodnszone = conf_string(cf_fidodnszone); char *fidodnszone = conf_string(cf_fidodnszone);
if (fidodnszone) { if (fidodnszone) {
@ -773,7 +765,6 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
{ {
call_mayuse &= ~CALL_TCPIP_ANY; call_mayuse &= ~CALL_TCPIP_ANY;
log("bad host, exclude IP"); log("bad host, exclude IP");
DEB((D_EVENT, "bad host %s, exclude IP", state.node.host));
if( call_mustuse & CALL_TCPIP_ANY ) if( call_mustuse & CALL_TCPIP_ANY )
{ {
errmsg = "don't know host name"; errmsg = "don't know host name";

Loading…
Cancel
Save