5 Commits
Author SHA1 Message Date
zx bba77edecd mFix ipv6 2024-06-25 23:42:52 +03:00
zx 9aed37b92e IPv6 fixes for incoming inetd calls, minors from lint 2024-06-25 23:05:07 +03:00
zx 3526bc5ece Minor debug improvement 2024-06-24 23:23:24 +03:00
zx e6266e8eab Fixed another annoying binkp errors on aarch64 2024-06-22 21:59:22 +03:00
zx ea4e8c806f Fixes for binkp on aarch64 platform 2024-06-22 21:18:01 +03:00
11 changed files with 81 additions and 34 deletions
+7
View File
@@ -1011,9 +1011,16 @@ int daemon_run(const char *confname, const char *incname, bool quit)
}
if( max_modem > 0 )
{
DEB((D_INFO,"daemon: daemon_modem_queue"));
daemon_queue_do(&daemon_queues[MODEM_QUEUE]);
}
if( max_tcpip > 0 )
{
DEB((D_INFO,"daemon: daemon_modem_queue"));
daemon_queue_do(&daemon_queues[TCPIP_QUEUE]);
}
(void)sleep(DAEMON_IDLE_SLEEP);
break;
+10 -3
View File
@@ -54,7 +54,7 @@ static int daemon_call_branch(s_sysentry *syst, const char *lockdir, s_modemport
s_bforce_opts opts;
// TODO: add hiddenline round-robin
opts.hiddline=0;
opts.hiddline = 0;
opts.runmode = MODE_CALL_DEFAULT;
opts.ipproto = NULL;
opts.phone = NULL;
@@ -62,7 +62,7 @@ static int daemon_call_branch(s_sysentry *syst, const char *lockdir, s_modemport
opts.inetd = 0;
opts.connect = NULL;
opts.device = NULL;
DEB((D_DAEMON, "daemon_call: calling call_system from branch"));
// log("doing call_system");
return call_system(syst->node.addr, &opts);
}
@@ -88,7 +88,10 @@ int daemon_call(s_sysentry *syst)
* Check whether this node is allready locked
*/
if( out_bsy_check(syst->node.addr) )
{
DEB((D_DAEMON, "daemon_call: node locked by .bsy file"));
return 0;
}
/*
* Set state structure to make expressions works properly now
@@ -101,6 +104,7 @@ int daemon_call(s_sysentry *syst)
if( syst->tcpip == FALSE )
{
DEB((D_DAEMON, "daemon_call: tcpip false - prep modem line"));
if( (p_lockdir = conf_string(cf_uucp_lock_directory)) == NULL )
p_lockdir = BFORCE_LOCK_DIR;
@@ -110,6 +114,9 @@ int daemon_call(s_sysentry *syst)
return 1;
}
}
DEB((D_DAEMON, "call %s line %d via %s",
ftn_addrstr(abuf, syst->node.addr), syst->line,
syst->tcpip ? "TCP/IP" : modemport->name));
log("call %s line %d via %s",
ftn_addrstr(abuf, syst->node.addr), syst->line,
@@ -138,7 +145,7 @@ int daemon_call(s_sysentry *syst)
}
/* Now we are in child process */
DEB((D_DAEMON, "daemon_call: fork success - calling..."));
exit(daemon_call_branch(syst, p_lockdir, modemport));
}
-1
View File
@@ -54,7 +54,6 @@ static int tcpip_connect2(struct addrinfo *ai)
if ( fd == -1 )
{
DEB((D_INFO, "tcpip_connect2: socket error"));
continue;
}
else break;
+7 -1
View File
@@ -118,6 +118,9 @@ int tio_get(int fd, TIO *tio)
{
#ifdef HAVE_TERMIOS_H
return tcgetattr(fd, tio);
#else
DEB(("io_unix_tio: TERMIOS not supported!"));
return -1;
#endif
}
@@ -127,6 +130,9 @@ int tio_set(int fd, TIO *tio)
{
#ifdef HAVE_TERMIOS_H
return tcsetattr(fd, TCSANOW, tio);
#else
DEB(("io_unix_tio: TERMIOS not supported!"));
return -1;
#endif
}
@@ -177,7 +183,7 @@ int tio_get_speed(TIO *tio)
return speedtab[i].nspeed;
}
return-1;
return -1;
}
int tio_set_flow_control(int fd, TIO *tio, int flow)
+7 -1
View File
@@ -106,11 +106,15 @@ int log_open(const char *logname, const char *ext, const char *tty)
if( logname )
{
DEB((D_INFO,"log_open: Opening log file %s", logname));
strnxcpy(log_name, logname, sizeof(log_name));
// May be NULL, so check both
if( tty && *tty )
strnxcpy(log_ttyname, tty, sizeof(log_ttyname));
// May be NULL, so check both
if( ext && *ext )
{
strnxcpy(log_extension, ext, sizeof(log_extension));
@@ -142,7 +146,9 @@ int log_close(void)
if( log_fp )
{
rc = fclose(log_fp); log_fp = NULL;
rc = fclose(log_fp);
DEB((D_INFO,"Closing log file."));
log_fp = NULL;
}
return rc;
+4 -1
View File
@@ -243,7 +243,7 @@ int nodelist_parsestring(s_node *node, char *str)
strnxcpy(node->phone, argv[NODELIST_POSPHONE], sizeof(node->phone));
strnxcpy(node->flags, argv[NODELIST_POSFLAGS], sizeof(node->flags));
node->speed = atoi(argv[NODELIST_POSSPEED]);
DEB((D_NODELIST, "nodelist: Parsed common values SYS: %s, ZYZ: %s, LOC: %s, PHONE: %s", node->name, node->sysop, node->location, node->phone));
/*
* Replace all '_' by space character
*/
@@ -291,8 +291,11 @@ int nodelist_parsestring(s_node *node, char *str)
node->do_ifcico = nodelist_checkflag(node->flags, "IFC") == 0;
node->do_telnet = nodelist_checkflag(node->flags, "ITN") == 0;
//TODO: Add more INA flags to array
nodelist_flagvalue(node->flags, "INA", 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;
}
+8 -8
View File
@@ -124,7 +124,7 @@ int binkp_loop(s_binkp_state *bstate) {
bstate->continuesend = false;
}
if (have_to_write==0 && (!no_more_to_send || bstate->extracmd[0]!=-1)) {
if (have_to_write==0 && (!no_more_to_send || bstate->extracmd[0]!=(char)-1)) {
m = binkp_getforsend(bstate, writebuf+BINKP_HEADER, &block_type, &block_length);
if(m==1 || m==3) {
//DEB((D_24554, "got block for sending %d %hu", block_type, block_length));
@@ -340,7 +340,7 @@ int binkp_getforsend(s_binkp_state *bstate, char *buf, int *block_type, unsigned
{
int my_sf, wr_pos;
int n; // read file
if (bstate->extracmd[0]!=-1) {
if (bstate->extracmd[0]!=(char)-1) {
DEB((D_24554, "Send cmd to remote %d %s", bstate->extracmd[0], bstate->extracmd+1));
buf[0] = bstate->extracmd[0];
strcpy(buf+1, bstate->extracmd+1);
@@ -668,12 +668,12 @@ case BPMSG_ADR: /* List of addresses */
if (bstate->address_established) {
PROTO_ERROR("remote tries to change address");
}
if( bstate->extracmd[0] !=-1 ) return 0; // suspend !!!
if( bstate->extracmd[0] != (char)-1 ) return 0; // suspend !!!
binkp_process_ADR(buf+1);
if( !state.n_remoteaddr ) {
log("error: remote did not supplied any addresses");
if( bstate->extracmd[0] !=-1 ) return 0; // suspend
if( bstate->extracmd[0] != (char)-1 ) return 0; // suspend
bstate->extracmd[0] = BPMSG_BSY;
strcpy(bstate->extracmd+1, "No addresses was presented");
bstate->extraislast = true;
@@ -788,7 +788,7 @@ case BPMSG_FILE: /* File information */
DEB((D_24554, "no, skipping; TODO: accept it"));
if( bstate->extracmd[0] != -1 ) return 0;
bstate->extracmd[0] = BPMSG_SKIP;
sprintf(bstate->extracmd+1, "%s %ld %ld %ld", recvfi.fn, recvfi.sz, recvfi.tm);
sprintf(bstate->extracmd+1, "%s %ld %ld %ld", recvfi.fn, recvfi.sz, recvfi.tm, recvfi.offs);
bstate->extraislast = false;
return 1;
}
@@ -844,7 +844,7 @@ case BPMSG_OK: /* Password was acknowleged (data ignored) */
}
if (session_addrs_lock(state.remoteaddrs, state.n_remoteaddr)) {
log("error: unable to lock");
if (bstate->extracmd[0]!=-1) return 0;
if (bstate->extracmd[0]!= (char)-1) return 0;
bstate->extracmd[0] = BPMSG_BSY;
strcpy(bstate->extracmd+1, "All addresses are busy");
bstate->extraislast = true;
@@ -954,7 +954,7 @@ case BPMSG_GET: /* Get a file from offset */
}
DEB((D_24554, "M_GET file %s size %d time %d offset %d", getfi.fn, getfi.sz, getfi.tm, getfi.offs));
if (bstate->extracmd[0] != -1) return 0;
if (bstate->extracmd[0] != (char)-1) return 0;
if (bstate->pi->send) if (p_compfinfo(bstate->pi->send, getfi.fn, getfi.sz, getfi.tm)==0) {
DEB((D_24554, "M_GET for currently transmitted file"));
@@ -1044,7 +1044,7 @@ case BINKP_BLK_DATA:
return 1;
}
if (bstate->extracmd[0] != -1) return 0;
if (bstate->extracmd[0] != (char)-1) return 0;
long int n;
n = p_rx_writefile(buf, block_length, bstate->pi);
+21 -11
View File
@@ -22,8 +22,16 @@
int answ_system(e_session type, char *connstr, int inetd)
{
TIO oldtio;
struct sockaddr_in client;
union {
struct sockaddr a;
struct sockaddr_in in;
struct sockaddr_in6 in6;
} client;
//struct sockaddr_storage client;
int clientlen = sizeof(client);
char clienthost[NI_MAXHOST];
char clientport[NI_MAXSERV];
int clientres = 0;
int rc = 0;
char *p;
@@ -74,18 +82,20 @@ int answ_system(e_session type, char *connstr, int inetd)
log("Answering TCPIP call...");
if( connstr && *connstr )
state.connstr = (char*)xstrcpy(connstr);
else if( getpeername(0, (struct sockaddr*)&client, &clientlen) == -1 )
logerr("can't get client address");
else
{
#ifdef IPV6
>char addr_str[INET6_ADDRSTRLEN+1];
state.peername = (char*)xstrcpy(inet_ntop(AF_INET6, client.sin6_addr, addr_str, INET6_ADDRSTRLEN));
state.peerport = (long)ntohs(client.sin6_port);
#else
state.peername = (char*)xstrcpy(inet_ntoa(client.sin_addr));
state.peerport = (long)ntohs(client.sin_port);
#endif
if(getpeername(0, &client.a, &clientlen))
log("sess_answ: can't detrmine socket client");
clientres = getnameinfo( &client.a, clientlen,
clienthost, sizeof(clienthost), clientport,
sizeof(clientport), NI_NUMERICHOST | NI_NUMERICSERV);
if ( clientres == 0 )
{
state.peername = (char*)xstrcpy(clienthost);
state.peerport = (long)atol(clientport);
}
else
log("sess_answ: can't get client address: ", gai_strerror(clientres));
}
}
+7 -1
View File
@@ -771,7 +771,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
gotoexit(BFERR_PHONE_UNKNOWN);
}
}
DEB((D_EVENT,"sess_call: may use %d must use %d", call_mayuse, call_mustuse));
// snprintf(s, 299, "after IP check: may use %d must use %d", call_mayuse, call_mustuse);
// log(s);
@@ -810,26 +810,31 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
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 )
{
DEB((D_EVENT,"sess_call: calling binkp"));
rc = call_system_tcpip(CALL_TCPIP_BINKP);
}
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 )
{
DEB((D_EVENT,"sess_call: calling telnet"));
rc = call_system_tcpip(CALL_TCPIP_TELNET);
}
if( rc && call_mayuse & CALL_MODEM )
{
DEB((D_EVENT,"sess_call: calling MODEM"));
setproctitle("bforce calling %.32s, %.32s",
ftn_addrstr(abuf, state.node.addr), state.node.phone);
rc = -1;
@@ -850,6 +855,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts)
if( port_lock(p_lockdir, state.modemport) == 0 ) /* Successfuly locked port */
{
DEB((D_EVENT,"sess_call: call_system_modem running"));
rc = call_system_modem();
port_unlock(p_lockdir, state.modemport);
}
+3 -1
View File
@@ -189,7 +189,8 @@ static int ftn_addrparse_fido(s_faddr *addr, const char *s, bool wildcard)
{
strnxcpy(addr->domain, string_printable(p), sizeof(addr->domain));
}
DEB((D_INFO,"u_ftn: Parsed ftn address z:%d, net:%d, node:%d, point:%d",
addr->zone, addr->net, addr->node, addr->point));
return badaddr;
}
@@ -326,6 +327,7 @@ int ftn_addrparse(s_faddr *addr, const char *s, bool wildcard)
addr->node = DEFAULT_NODE;
addr->point = 0;
DEB((D_INFO, "u_ftn: parsing ftnaddr %s", s));
if( addr->inetform )
badaddr = ftn_addrparse_inet(addr, s, wildcard);
else
+1
View File
@@ -81,6 +81,7 @@ void *xrealloc(void *buf, size_t size)
else if( (tmp = (char*)(buf ? realloc(buf, size) : malloc(size))) == NULL )
{
log("failed to reallocate %ld bytes -> abort", size);
if( buf ) free(buf);
abort();
}