Fixed outgoing proto detection and order - as Direct, BinkP, Ifcico, Telnet, Modem first allowed to connect. You may change this order individually by override flags

zx
Alexey Khromov 4 days ago
parent 983440fc29
commit 73a3376a3d

@ -568,7 +568,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
}
state.listed = state.node.listed;
DEB((D_EVENT, "Calling init, listed=%d", state.listed));
//DEB((D_EVENT, "Calling init, listed=%d", state.listed));
state.node.addr.domain[0] = '\0'; /* Discard domain for node address */
// 1. If call method specified in cmdline, do use it
@ -630,9 +630,9 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
call_mayuse |= call_mustuse; // it simplifies logics: all required is allowed
//char s[300];
snprintf(s, 299, "initial: may use %d must use %d", call_mayuse, call_mustuse);
log(s);
DEB((D_EVENT, s));
//snprintf(s, 299, "initial: may use %d must use %d", call_mayuse, call_mustuse);
//log(s);
//DEB((D_EVENT, s));
if( (call_mayuse & CALL_MODEM) )
@ -656,7 +656,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
{
log("bad phone, excluding modem");
call_mayuse &= ~CALL_MODEM;
if( call_mustuse & CALL_MODEM )
if( !(call_mustuse & CALL_MODEM) )
{
errmsg = "don't know phone number";
gotoexit(BFERR_PHONE_UNKNOWN);
@ -690,7 +690,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
{
call_mayuse &= ~CALL_MODEM;
log("bad worktime, excluding modem");
if( call_mustuse & CALL_MODEM )
if( !(call_mustuse & CALL_MODEM) )
{
errmsg = "not works now, try later";
gotoexit(BFERR_NOTWORKING);
@ -699,9 +699,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);
log(s);
DEB((D_EVENT, s));
//snprintf(s, 299, "after phone check: may use %d must use %d", call_mayuse, call_mustuse);
//log(s);
//DEB((D_EVENT, s));
/*
* Apply overrides to the node information
*/
@ -720,7 +720,8 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
if( !(call_mustuse & CALL_TCPIP_BINKP) && (call_mayuse & CALL_TCPIP_BINKP) )
{
if( nodelist_checkflag(state.node.flags, "BINKP") != 0 && nodelist_checkflag(state.node.flags, "IBN") != 0 )
//if( nodelist_checkflag(state.node.flags, "BINKP") != 0 && nodelist_checkflag(state.node.flags, "IBN") != 0 )
if( state.node.do_binkp == 0 )
{
call_mayuse &= ~CALL_TCPIP_BINKP;
}
@ -728,7 +729,8 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
if( !(call_mustuse & CALL_TCPIP_IFCICO) && (call_mayuse & CALL_TCPIP_IFCICO) )
{
if( nodelist_checkflag(state.node.flags, "IFC") != 0 && nodelist_checkflag(state.node.flags, "IFC") != 0 )
//if( nodelist_checkflag(state.node.flags, "IFC") != 0 && nodelist_checkflag(state.node.flags, "IFC") != 0 )
if( state.node.do_ifcico == 0 )
{
call_mayuse &= ~CALL_TCPIP_IFCICO;
}
@ -736,7 +738,8 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
if( !(call_mustuse & CALL_TCPIP_TELNET) && (call_mayuse & CALL_TCPIP_TELNET) )
{
if( nodelist_checkflag(state.node.flags, "TELN") != 0 && nodelist_checkflag(state.node.flags, "TLN") != 0 )
//if( nodelist_checkflag(state.node.flags, "TELN") != 0 && nodelist_checkflag(state.node.flags, "TLN") != 0 )
if( state.node.do_telnet == 0 )
{
call_mayuse &= ~CALL_TCPIP_TELNET;
}
@ -752,9 +755,12 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
state.override.sIpaddr, sizeof(state.node.host));
}
DEB((D_EVENT, "Calling init, IPHOST", state.node.host));
//DEB((D_EVENT, "Calling init, IPHOST", state.node.host));
if( call_mayuse & CALL_TCPIP_ANY && !tcpip_isgood_host(state.node.host) ) {
// We have at least one protocol and not valid address - try to
// find INA with through Fidonet DNS
if( (call_mayuse & CALL_TCPIP_ANY) && !tcpip_isgood_host(state.node.host) )
{
char *fidodnszone = conf_string(cf_fidodnszone);
if (fidodnszone) {
if (addr.point) {
@ -769,14 +775,17 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
}
}
if( call_mayuse & CALL_TCPIP_ANY && !tcpip_isgood_host(state.node.host) )
// We have no valid tcpip protocols OR not valid address
if( !(call_mayuse & CALL_TCPIP_ANY) || !tcpip_isgood_host(state.node.host) )
{
call_mayuse &= ~CALL_TCPIP_ANY;
log("bad host, exclude IP");
DEB((D_EVENT, "bad host %s, exclude IP", state.node.host));
if( call_mustuse & CALL_TCPIP_ANY )
DEB((D_EVENT, "bad host or proto -> exclude IP, mayuse=%d", call_mayuse));
// If we had ONLY tcpip command - go out with error
if( !(call_mustuse & CALL_TCPIP_ANY) )
{
errmsg = "don't know host name";
errmsg = "Aborting, don't know host name";
gotoexit(BFERR_PHONE_UNKNOWN);
}
}
@ -817,31 +826,31 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
// try allowed methods and break if rc == 0
rc = -1;
if( rc && call_mayuse & CALL_STDIO )
if( rc && (call_mayuse & CALL_STDIO) )
{
DEB((D_EVENT,"sess_call: calling stdio"));
rc = call_system_quiet(opts->connect, opts->inetd);
}
if( rc && call_mayuse & CALL_TCPIP_BINKP )
if( rc && (call_mayuse & CALL_TCPIP_BINKP) )
{
DEB((D_EVENT,"sess_call: calling binkp"));
rc = call_system_tcpip(CALL_TCPIP_BINKP);
}
if( rc && call_mayuse & CALL_TCPIP_IFCICO )
if( rc && (call_mayuse & CALL_TCPIP_IFCICO) )
{
DEB((D_EVENT,"sess_call: calling ifcico"));
rc = call_system_tcpip(CALL_TCPIP_IFCICO);
}
if( rc && call_mayuse & CALL_TCPIP_TELNET )
if( rc && (call_mayuse & CALL_TCPIP_TELNET) )
{
DEB((D_EVENT,"sess_call: calling telnet"));
rc = call_system_tcpip(CALL_TCPIP_TELNET);
}
if( rc && call_mayuse & CALL_MODEM )
if( rc && (call_mayuse & CALL_MODEM) )
{
DEB((D_EVENT,"sess_call: calling MODEM"));
setproctitle("bforce calling %.32s, %.32s",

Loading…
Cancel
Save