Skip to content
Snippets Groups Projects
Commit 15b230af authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Rework NetMail routing logic to handle point destinations better

With this commmit, the logic is now:

If the NetMail destination is a point and there's no linked-node for it
   and the boss node for this point is not one of our AKAs
   then route to the boss node (no linked-node match needed)
   if the boss node matches a linked-node with a route configuration
   then route to that configured route destination (2-levels of routing
   and thus 2 "Routing NetMail" msgs will be logged in this scenario)

If the NetMail destination is a point and there is a linked-node for it
   then the netmail will not be routed
		unless that linked node has a route configuration

NetMail destined for non-points are treated the same as before this
commit.

No change in the routing of echomail for points.

I think this change fixes issue #520 which can be traced back to commit
45ced2a3 for poindexter FORTRAN (REALITY), 2 years ago almost to the
day, where that change added point->boss routing, but only if the boss
had a matching linked-node configuration (for both echomail and
netmail).

This commit also re-thinks commit ffe69b43 (for Alterego) which
would not route a point netmail if any our local AKAs matched the
destination address, igorining the point value. I think what was
intended here (I coudln't locate the original enhancmenet request or
issue), was to not route if a local AKA was the *boss* of the point.
And with this commit, that's now how it now works.

As before, "test results appreciated".
parent ccfad124
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #3806 passed
...@@ -1274,18 +1274,12 @@ bool area_is_valid(uint areanum) ...@@ -1274,18 +1274,12 @@ bool area_is_valid(uint areanum)
return areanum < cfg.areas; return areanum < cfg.areas;
} }
// if full is true, compare full address, otherwise, exclude point in comparison uint find_sysfaddr(faddr_t addr)
uint find_sysfaddr(faddr_t addr, bool full)
{ {
unsigned u; unsigned u;
for(u=0; u < scfg.total_faddrs; u++) { for(u=0; u < scfg.total_faddrs; u++) {
if(full && memcmp(&scfg.faddr[u], &addr, sizeof(addr)) == 0) if(memcmp(&scfg.faddr[u], &addr, sizeof(addr)) == 0)
break;
if(!full
&& scfg.faddr[u].zone == addr.zone
&& scfg.faddr[u].net == addr.net
&& scfg.faddr[u].node == addr.node)
break; break;
} }
...@@ -5421,7 +5415,7 @@ void pack_netmail(void) ...@@ -5421,7 +5415,7 @@ void pack_netmail(void)
addr.point = hdr.destpoint; addr.point = hdr.destpoint;
printf("NetMail msg %s from %s (%s) to %s (%s): " printf("NetMail msg %s from %s (%s) to %s (%s): "
,getfname(path), hdr.from, fmsghdr_srcaddr_str(&hdr), hdr.to, smb_faddrtoa(&addr,NULL)); ,getfname(path), hdr.from, fmsghdr_srcaddr_str(&hdr), hdr.to, smb_faddrtoa(&addr,NULL));
if(sysfaddr_is_valid(find_sysfaddr(addr, true))) { /* In-bound, so ignore */ if(sysfaddr_is_valid(find_sysfaddr(addr))) { /* In-bound, so ignore */
printf("in-bound\n"); printf("in-bound\n");
fclose(fidomsg); fclose(fidomsg);
continue; continue;
...@@ -5474,24 +5468,26 @@ void pack_netmail(void) ...@@ -5474,24 +5468,26 @@ void pack_netmail(void)
return; return;
} }
nodecfg=findnodecfg(&cfg, addr, /* exact: */false); if(addr.point != 0) {
if(!sysfaddr_is_valid(find_sysfaddr(addr, false))) { nodecfg = findnodecfg(&cfg, addr, /* exact: */true);
if(nodecfg!=NULL && nodecfg->route.zone && nodecfg->status==MAIL_STATUS_NORMAL if(nodecfg == NULL) {
&& !(hdr.attr&(FIDO_CRASH|FIDO_HOLD))) {
addr=nodecfg->route; /* Routed */
lprintf(LOG_INFO, "Routing NetMail (%s) to %s",getfname(path),smb_faddrtoa(&addr,NULL));
nodecfg=findnodecfg(&cfg, addr, /* exact: */false);
}
if(nodecfg == NULL && addr.point != 0) {
fidoaddr_t boss = addr; fidoaddr_t boss = addr;
boss.point = 0; boss.point = 0;
if((nodecfg = findnodecfg(&cfg, boss, /* exact: */true)) != NULL) { if(!sysfaddr_is_valid(find_sysfaddr(boss))) {
addr = boss; addr = boss;
lprintf(LOG_INFO, "Routing NetMail (%s) to boss-node %s" lprintf(LOG_INFO, "Routing NetMail (%s) to boss-node %s"
,getfname(path), smb_faddrtoa(&addr, NULL)); ,getfname(path), smb_faddrtoa(&addr, NULL));
} }
} }
} }
if(nodecfg == NULL)
nodecfg = findnodecfg(&cfg, addr, /* exact: */false);
if(nodecfg!=NULL && nodecfg->route.zone && nodecfg->status==MAIL_STATUS_NORMAL
&& !(hdr.attr&(FIDO_CRASH|FIDO_HOLD))) {
addr=nodecfg->route; /* Routed */
lprintf(LOG_INFO, "Routing NetMail (%s) to %s",getfname(path),smb_faddrtoa(&addr,NULL));
nodecfg=findnodecfg(&cfg, addr, /* exact: */false);
}
if(!bso_lock_node(addr)) if(!bso_lock_node(addr))
continue; continue;
...@@ -5634,7 +5630,7 @@ void find_stray_packets(void) ...@@ -5634,7 +5630,7 @@ void find_stray_packets(void)
delfile(packet, __LINE__); delfile(packet, __LINE__);
continue; continue;
} }
uint sysfaddr = find_sysfaddr(pkt_orig, true); uint sysfaddr = find_sysfaddr(pkt_orig);
lprintf(LOG_WARNING,"Stray Outbound Packet (type %s) found, from %s address %s to %s: %s" lprintf(LOG_WARNING,"Stray Outbound Packet (type %s) found, from %s address %s to %s: %s"
,pktTypeStringList[pkt_type], sysfaddr_is_valid(sysfaddr) ? "local" : "FOREIGN" ,pktTypeStringList[pkt_type], sysfaddr_is_valid(sysfaddr) ? "local" : "FOREIGN"
,smb_faddrtoa(&pkt_orig, NULL), smb_faddrtoa(&pkt_dest, str), packet); ,smb_faddrtoa(&pkt_orig, NULL), smb_faddrtoa(&pkt_dest, str), packet);
...@@ -6286,7 +6282,7 @@ int main(int argc, char **argv) ...@@ -6286,7 +6282,7 @@ int main(int argc, char **argv)
} }
for(uint u = 0; u < cfg.nodecfgs; u++) { for(uint u = 0; u < cfg.nodecfgs; u++) {
if(sysfaddr_is_valid(find_sysfaddr(cfg.nodecfg[u].addr, true))) { if(sysfaddr_is_valid(find_sysfaddr(cfg.nodecfg[u].addr))) {
lprintf(LOG_ERR, "Configuration ERROR: Linked node #%u is your own address: %s" lprintf(LOG_ERR, "Configuration ERROR: Linked node #%u is your own address: %s"
,u + 1, faddrtoa(&cfg.nodecfg[u].addr)); ,u + 1, faddrtoa(&cfg.nodecfg[u].addr));
bail(1); bail(1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment