Fixed nodelist index for root zone nodes, added support for IBN:port

This commit is contained in:
zx
2024-07-04 23:05:23 +03:00
parent 46312ebc1b
commit 3f9d10e467
6 changed files with 168 additions and 7 deletions
+48 -3
View File
@@ -480,10 +480,15 @@ int call_system_tcpip(int callwith) // only TCPIP values
{
char abuf[BF_MAXADDRSTR+1];
int rc = BFERR_NOERROR;
char * pbuf;
char * target;
int resflg;
/*
* Set verbal line name to "tcpip" value
*/
memset(abuf, '\0', BF_MAXADDRSTR+1);
target = xmalloc(1024);
memset(target, '\0', 1024);
state.linename = xstrcpy("tcpip");
state.inet = TRUE;
@@ -502,14 +507,17 @@ int call_system_tcpip(int callwith) // only TCPIP values
case CALL_TCPIP_BINKP:
state.tcpmode = TCPMODE_BINKP;
state.session = SESSION_BINKP;
target = xstrcpy("IBN");
break;
case CALL_TCPIP_IFCICO:
state.tcpmode = TCPMODE_RAW;
state.session = SESSION_UNKNOWN;
target = xstrcpy("IFC");
break;
case CALL_TCPIP_TELNET:
state.tcpmode = TCPMODE_TELNET;
state.session = SESSION_UNKNOWN;
target = xstrcpy("ITN");
break;
defalt:
log("invalid protocol for TCP/IP module");
@@ -520,8 +528,45 @@ defalt:
ftn_addrstr(abuf, state.node.addr),
(state.node.name && *state.node.name ) ? state.node.name : "<none>",
(state.node.host && *state.node.host) ? state.node.host : "<none>");
memset(abuf, '\0', BF_MAXADDRSTR+1);
pbuf = xmalloc(1024);
resflg = nodelist_lookup_string(pbuf, 1024, state.node.addr);
if ( ! resflg )
{
if( (rc = tcpip_connect(state.node.host, state.tcpmode)) == 0
char *p = strcasestr(pbuf, target);
if ( p )
{
target = strrchr(p, ',');
if ( target ) target[0] = '\0';
target = strrchr(p, ':');
if ( target ) {
target++;
strcpy(abuf,target);
}
}
}
free(pbuf);
pbuf = xstrcpy(state.node.host);
if ( ! resflg )
{
if ( abuf[0] != '\0' )
{
// port not empty
DEB((D_EVENT, "Modifying host address %s with port %s", pbuf, abuf));
pbuf = xstrcat(pbuf, ":");
pbuf = xstrcat(pbuf, abuf);
}
}
if( (rc = tcpip_connect(pbuf, state.tcpmode)) == 0
&& (rc = tcpip_init() == 0) )
{
TTYSTATUS(1);
@@ -532,7 +577,7 @@ defalt:
{
rc = BFERR_CANT_CONNECT10;
}
free(pbuf);
return rc;
}
+1 -1
View File
@@ -127,7 +127,7 @@ static int nodelist_makeindex(s_nodelist *nlp, s_faddr addr)
switch(keyword) {
case KEYWORD_ZONE:
bni.zone = value;
bni.net = 0;
bni.net = value; // zxalexis
bni.node = 0;
bni.point = 0;
bni.hub = 0;