From 139d927507a3ba86307e89b8607830232e648582 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sun, 11 Jul 2004 11:49:51 +0000 Subject: [PATCH] Nodelist 000- prefix now softcoded --- lib/nodelist.c | 30 ++++++++++++++++++------------ lib/nodelist.conf | 10 +++++++++- lib/nodelist.h | 1 + 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/lib/nodelist.c b/lib/nodelist.c index 20da7e18..567dc01d 100644 --- a/lib/nodelist.c +++ b/lib/nodelist.c @@ -67,6 +67,7 @@ static struct _keytab { {(char *)"tcpip", getmdm, (char **)&nl_tcpip}, {(char *)"search", getarr, (char **)&nl_search}, {(char *)"dialer", getarr, (char **)&nl_dialer}, + {(char *)"ipprefix", getarr, (char **)&nl_ipprefix}, {(char *)"domsuffix", getdom, (char **)&nl_domsuffix}, {(char *)"service", getsrv, (char **)&nl_service}, {NULL, NULL, NULL} @@ -339,6 +340,7 @@ void deinitnl(void) tidy_nl_modem(&nl_tcpip); tidy_nl_array(&nl_search); tidy_nl_array(&nl_dialer); + tidy_nl_array(&nl_ipprefix); tidy_nl_domsuf(&nl_domsuffix); tidy_nl_service(&nl_service); @@ -371,6 +373,7 @@ int initnl(void) nl_tcpip = NULL; nl_search = NULL; nl_domsuffix = NULL; + nl_ipprefix = NULL; nl_dialer = NULL; nl_service = NULL; @@ -543,7 +546,7 @@ node *getnlent(faddr *addr) nodelist_modem **tmpm; nodelist_flag **tmpf; nodelist_service **tmps; - nodelist_array **tmpa; + nodelist_array **tmpa, **tmpaa; nodelist_domsuf **tmpd; unsigned long tport = 0; @@ -935,18 +938,21 @@ node *getnlent(faddr *addr) memset(&tbuf, 0, sizeof(tbuf)); } } else if (strcasecmp((*tmpa)->name, "field6") == 0) { - if (nodebuf.phone && strncmp(nodebuf.phone, "000-", 4) == 0) { - Syslog('n', "getnlent: found 000- prefix"); - sprintf(tbuf, "%s", nodebuf.phone+4); - for (i = 0; i < strlen(tbuf); i++) - if (tbuf[i] == '-') - tbuf[i] = '.'; - Syslog('n', "getnlent: using field6 \"%s\"", tbuf); - nodebuf.url = xstrcat(nodebuf.url, tbuf); - break; - } else { - memset(&tbuf, 0, sizeof(tbuf)); + memset(&tbuf, 0, sizeof(tbuf)); + for (tmpaa = &nl_ipprefix; *tmpaa; tmpaa=&((*tmpaa)->next)) { + if (nodebuf.phone && strncmp(nodebuf.phone, (*tmpaa)->name, strlen((*tmpaa)->name)) == 0) { + Syslog('n', "getnlent: found %s prefix", (*tmpaa)->name); + sprintf(tbuf, "%s", nodebuf.phone+strlen((*tmpaa)->name)); + for (i = 0; i < strlen(tbuf); i++) + if (tbuf[i] == '-') + tbuf[i] = '.'; + Syslog('n', "getnlent: using field6 \"%s\"", tbuf); + nodebuf.url = xstrcat(nodebuf.url, tbuf); + break; + } } + if (strlen(tbuf)) + break; } else if (strcasecmp((*tmpa)->name, "field8") == 0) { /* * Read nodelist line again in another buffer, the original diff --git a/lib/nodelist.conf b/lib/nodelist.conf index 05386c99..0488a181 100644 --- a/lib/nodelist.conf +++ b/lib/nodelist.conf @@ -145,6 +145,7 @@ tcpip IBN 0x00000004 0x00000004 # field6 - Search the phone field for 000- prefix, may be a IP # or a FQDN with or without a :port suffix. # 000-192-168-1-40:1234 or 000-ntbox.mbse.ym:5678 are valid. +# The keyword ipprefix below define the possible prefix names. # field8 - Search in the flags for a FQDN. Valid flags are like: # IBN:domain.com Standard # IFC:domain.com:port Standard @@ -159,8 +160,8 @@ tcpip IBN 0x00000004 0x00000004 # Order is important, defdomain must be the last if used. # search field3 -search field6 search field8 +search field6 search defdomain @@ -177,3 +178,10 @@ domsuffix 5 net domsuffix 6 net domsuffix 92 mbse.ym + +# The IP prefixes for nodelist field 6 like 000- +# +ipprefix 000- # Standard +ipprefix DNS- # Used in skynet +ipprefix IPN- # Used in skynet + diff --git a/lib/nodelist.h b/lib/nodelist.h index 826dd33c..fafa4b99 100644 --- a/lib/nodelist.h +++ b/lib/nodelist.h @@ -110,6 +110,7 @@ nodelist_modem *nl_isdn; nodelist_modem *nl_tcpip; nodelist_array *nl_search; nodelist_array *nl_dialer; +nodelist_array *nl_ipprefix; nodelist_domsuf *nl_domsuffix; nodelist_service *nl_service;