From f2ad132b99781cf77350195561fd8078b5fdc751 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sat, 29 Jun 2002 12:56:11 +0000 Subject: [PATCH] Changed mbfido test routing tests --- ChangeLog | 3 ++ html/programs/mbfido.html | 11 ++--- mbfido/mbfido.c | 22 +++++++--- mbfido/tracker.c | 84 ++++++++++++++++++++++----------------- mbfido/tracker.h | 2 +- 5 files changed, 74 insertions(+), 48 deletions(-) diff --git a/ChangeLog b/ChangeLog index bfaac57e..8caea5d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -44,6 +44,9 @@ v0.35.02 22-Jun-2002 tag, mbfido would crash. Filefind netmail replies now set the private flag. Removed debugging messages displaying the incoming tic files. + The mbfid test command now needs a extra parameter, the final + destination to test. It doesn't use the internal fixed table + anymore. mbindex: Fixed a crash when a pointlist contained Point,5,reservered, diff --git a/html/programs/mbfido.html b/html/programs/mbfido.html index 25b87fb4..0421ef07 100644 --- a/html/programs/mbfido.html +++ b/html/programs/mbfido.html @@ -12,7 +12,7 @@
-
Last update 01-May-2002
+
Last update 29-Jun-2002

 

mbfido, the fidonet mail and files processor.

@@ -187,10 +187,11 @@ It is wise to do this sometimes, on my bbs I run this once a day. The command will create tag- and areas files in the doc directory for each group of mail and files.

-mbfido test -This is for testing of the mail routing. In the source "tracker.c" I have -included a list of nodes that will be tested. This is for development only, -but it might be handy for you to test your netmail routing. +mbfido test <node> +This is for testing of the mail routing. The node on the commandline must be in +the format f28.n280.z2 etc. The results are printed on the tty. If you have +debug logging on in menu 1.5.16 items 17 and 18, then all needed debug +information is written to the logfile. You can use this to debug your routing.

mbfido tic Process incoming files accompanied with .tic control files. Several actions can diff --git a/mbfido/mbfido.c b/mbfido/mbfido.c index 1afa7c9a..bda1100a 100644 --- a/mbfido/mbfido.c +++ b/mbfido/mbfido.c @@ -125,7 +125,7 @@ void Help(void) printf(" r roll Rollover statistic counters\n"); printf(" s scan Scan outgoing Fido mail\n"); printf(" ta tag Create taglists\n"); - printf(" te test Do some testing\n"); + printf(" te test Do routing test for node\n"); printf(" ti tic Process .tic files\n"); printf(" to toss Toss incoming Fido mail\n"); printf(" u uucp Process UUCP batchfile\n"); @@ -254,7 +254,7 @@ int main(int argc, char **argv) struct passwd *pw; struct tm *t; fa_list **envrecip, *envrecip_start = NULL; - faddr *taddr; + faddr *taddr = NULL; int envrecip_count = 0; FILE *ofp; @@ -362,9 +362,15 @@ int main(int argc, char **argv) do_tags = TRUE; else if (strncmp(tl(argv[i]), "ti", 2) == 0) do_tic = TRUE; - else if (strncmp(tl(argv[i]), "te", 2) == 0) + else if (strncmp(tl(argv[i]), "te", 2) == 0) { do_test = TRUE; - else if (strncmp(tl(argv[i]), "to", 2) == 0) + if ((i + 1) < argc) { + if ((taddr = parsefaddr(argv[i + 1])) == NULL) { + Help(); + } + i++; + } + } else if (strncmp(tl(argv[i]), "to", 2) == 0) do_toss = TRUE; else if (strncmp(tl(argv[i]), "u", 1) == 0) do_uucp = TRUE; @@ -526,8 +532,12 @@ int main(int argc, char **argv) } if (!do_uucp) newspost(); - if (do_test) - TestTracker(); + if (do_test) { + if (taddr == NULL) + Help(); + TestTracker(taddr); + tidy_faddr(taddr); + } if (do_tags) MakeTags(); if (do_stat) diff --git a/mbfido/tracker.c b/mbfido/tracker.c index fffb3d38..1ec74466 100644 --- a/mbfido/tracker.c +++ b/mbfido/tracker.c @@ -190,6 +190,7 @@ int GetRoute(char *ftn, fidoaddr *res) } best = bestaka_s(dest); Syslog('r', "Get route for: %s", ascfnode(dest, 0xff)); + Syslog('r', "Our best aka is: %s", ascfnode(best, 0xff)); /* * Check if the destination is ourself. @@ -221,6 +222,7 @@ int GetRoute(char *ftn, fidoaddr *res) * We are a point, so don't bother the rest of the tests, route * to our boss. */ + Syslog('r', "We are a point"); res->zone = best->zone; res->net = best->net; res->node = best->node; @@ -243,6 +245,7 @@ int GetRoute(char *ftn, fidoaddr *res) /* * First direct match */ + Syslog('r', "Checking for a direct link, 4d"); if (SearchNode(dir)) { for (i = 0; i < 20; i++) { if ((dir.zone == nodes.Aka[i].zone) && @@ -261,6 +264,7 @@ int GetRoute(char *ftn, fidoaddr *res) /* * Again, but now for points */ + Syslog('r', "Checking for a direct link, 3d"); dir.point = 0; if (SearchNode(dir)) { for (i = 0; i < 20; i++) { @@ -280,6 +284,7 @@ int GetRoute(char *ftn, fidoaddr *res) /* * Check if we know the uplink, but first check if the node is listed. */ + Syslog('r', "Checking for a known uplink"); dnlent = (node *)malloc(sizeof(node)); memcpy(dnlent, getnlent(dest), sizeof(node)); if (dnlent->addr.domain) @@ -314,6 +319,7 @@ int GetRoute(char *ftn, fidoaddr *res) me_hub = AreWeHub(dest); bnlent = getnlent(best); myregion = bnlent->region; + Syslog('r', "We are in region %d", myregion); /* * This is default routing for hosts: @@ -323,6 +329,7 @@ int GetRoute(char *ftn, fidoaddr *res) * 4. The rest goes to the hubs. */ if (me_host != -1) { + Syslog('r', "We are a host"); sprintf(res->domain, "%s", CFG.aka[me_host].domain); if (((myregion != dnlent->region) && (!(dnlent->pflag & NL_DUMMY))) || (CFG.aka[me_host].zone != dest->zone)) { @@ -377,6 +384,7 @@ int GetRoute(char *ftn, fidoaddr *res) * 2. Kick everything else to the host. */ if (me_hub != -1) { + Syslog('r', "We are a hub"); sprintf(res->domain, "%s", CFG.aka[me_hub].domain); if ((dnlent->upnode == CFG.aka[me_hub].node) && (dnlent->upnet == CFG.aka[me_hub].net) && @@ -410,6 +418,7 @@ int GetRoute(char *ftn, fidoaddr *res) * Routing for normal nodes, everything goes to the hub or host. */ if ((me_hub == -1) && (me_host == -1)) { + Syslog('r', "We are a normal node"); if (bnlent->pflag != NL_DUMMY) { res->zone = bnlent->addr.zone; res->net = bnlent->upnet; @@ -430,6 +439,7 @@ int GetRoute(char *ftn, fidoaddr *res) * If the above failed, we are probably a new node without * a nodelist entry. We will switch to plan B. */ + Syslog('r', "Plan B, we are a unlisted node"); if ((fil = fopen(nodes_fil, "r")) != NULL) { fread(&nodeshdr, sizeof(nodeshdr), 1, fil); nodes_pos = -1; @@ -470,49 +480,51 @@ int GetRoute(char *ftn, fidoaddr *res) void TestRoute(char *dest) { - fidoaddr result; - int rc; + fidoaddr result; + int rc; + char *res; - - rc = GetRoute(dest, &result); - if (rc == R_NOROUTE) - printf("Route %d %23s => no route\n", rc, dest); - else if (rc == R_UNLISTED) - printf("Route %d %23s => unlisted node\n", rc, dest); + rc = GetRoute(dest, &result); + switch (rc) { + case R_NOROUTE: res = xstrcpy((char *)"No Route"); + break; + case R_LOCAL: res = xstrcpy((char *)"Local address"); + break; + case R_DIRECT: res = xstrcpy((char *)"Direct link"); + break; + case R_ROUTE: res = xstrcpy((char *)"Routed"); + break; + case R_UNLISTED: res = xstrcpy((char *)"Unlisted node"); + break; + default: res = xstrcpy((char *)"Internal error"); + } + + printf("Route %s => %s, route result: %s\n", dest, aka2str(result), res); + free(res); + + if ((rc == R_NOROUTE) || (rc == R_UNLISTED) || (rc == R_LOCAL)) + return; + + if (SearchNode(result)) { + if (nodes.RouteVia.zone) + printf("Node is in the setup, route via is %s\n", aka2str(nodes.RouteVia)); else - printf("Route %d %23s => %s\n", rc, dest, aka2str(result)); + printf("Node is in the setup, no route via address\n"); + } else { + printf("Node is not in the setup\n"); + } } -void TestTracker(void) +void TestTracker(faddr *dest) { - colour(7, 0); - TestRoute((char *)"2:2801/16@fidonet"); - TestRoute((char *)"2:2801/16.1"); - TestRoute((char *)"2:2801/805.3"); - TestRoute((char *)"2:2801/899.1@fidonet"); - TestRoute((char *)"2:2801/890@fidonet"); - TestRoute((char *)"2:2801/1008"); - TestRoute((char *)"2:2801/21"); - TestRoute((char *)"2:2801/899@fidonet"); - TestRoute((char *)"2:2801/807"); - TestRoute((char *)"92:100/0@bibnet"); - TestRoute((char *)"92:100/5@bibnet"); - TestRoute((char *)"92:100/45"); - TestRoute((char *)"2:28/0"); - TestRoute((char *)"2:2801/1002@fidonet"); - TestRoute((char *)"2:2801/206"); - TestRoute((char *)"2:2/0@fidonet"); - TestRoute((char *)"2:2/3001"); - TestRoute((char *)"2:2801/28"); - TestRoute((char *)"2:2801/307.50"); - TestRoute((char *)"2:280/901"); - TestRoute((char *)"2:280/9"); - TestRoute((char *)"2:203/111"); - TestRoute((char *)"1:213/350"); - TestRoute((char *)"9:314/8@virnet"); - TestRoute((char *)"9:314/8.1@virnet"); + char *addr; + + colour(7, 0); + addr = ascfnode(dest, 0x2f); + Syslog('+', "Search route for %s", addr); + TestRoute(addr); } diff --git a/mbfido/tracker.h b/mbfido/tracker.h index 225d34cd..da352883 100644 --- a/mbfido/tracker.h +++ b/mbfido/tracker.h @@ -10,7 +10,7 @@ int TrackMail(fidoaddr, fidoaddr *); int GetRoute(char *, fidoaddr *); -void TestTracker(void); +void TestTracker(faddr *); #endif