Nodelist 000- prefix now softcoded

This commit is contained in:
Michiel Broek 2004-07-11 11:49:51 +00:00
parent 075cfa6841
commit 139d927507
3 changed files with 28 additions and 13 deletions

View File

@ -67,6 +67,7 @@ static struct _keytab {
{(char *)"tcpip", getmdm, (char **)&nl_tcpip}, {(char *)"tcpip", getmdm, (char **)&nl_tcpip},
{(char *)"search", getarr, (char **)&nl_search}, {(char *)"search", getarr, (char **)&nl_search},
{(char *)"dialer", getarr, (char **)&nl_dialer}, {(char *)"dialer", getarr, (char **)&nl_dialer},
{(char *)"ipprefix", getarr, (char **)&nl_ipprefix},
{(char *)"domsuffix", getdom, (char **)&nl_domsuffix}, {(char *)"domsuffix", getdom, (char **)&nl_domsuffix},
{(char *)"service", getsrv, (char **)&nl_service}, {(char *)"service", getsrv, (char **)&nl_service},
{NULL, NULL, NULL} {NULL, NULL, NULL}
@ -339,6 +340,7 @@ void deinitnl(void)
tidy_nl_modem(&nl_tcpip); tidy_nl_modem(&nl_tcpip);
tidy_nl_array(&nl_search); tidy_nl_array(&nl_search);
tidy_nl_array(&nl_dialer); tidy_nl_array(&nl_dialer);
tidy_nl_array(&nl_ipprefix);
tidy_nl_domsuf(&nl_domsuffix); tidy_nl_domsuf(&nl_domsuffix);
tidy_nl_service(&nl_service); tidy_nl_service(&nl_service);
@ -371,6 +373,7 @@ int initnl(void)
nl_tcpip = NULL; nl_tcpip = NULL;
nl_search = NULL; nl_search = NULL;
nl_domsuffix = NULL; nl_domsuffix = NULL;
nl_ipprefix = NULL;
nl_dialer = NULL; nl_dialer = NULL;
nl_service = NULL; nl_service = NULL;
@ -543,7 +546,7 @@ node *getnlent(faddr *addr)
nodelist_modem **tmpm; nodelist_modem **tmpm;
nodelist_flag **tmpf; nodelist_flag **tmpf;
nodelist_service **tmps; nodelist_service **tmps;
nodelist_array **tmpa; nodelist_array **tmpa, **tmpaa;
nodelist_domsuf **tmpd; nodelist_domsuf **tmpd;
unsigned long tport = 0; unsigned long tport = 0;
@ -935,18 +938,21 @@ node *getnlent(faddr *addr)
memset(&tbuf, 0, sizeof(tbuf)); memset(&tbuf, 0, sizeof(tbuf));
} }
} else if (strcasecmp((*tmpa)->name, "field6") == 0) { } else if (strcasecmp((*tmpa)->name, "field6") == 0) {
if (nodebuf.phone && strncmp(nodebuf.phone, "000-", 4) == 0) { memset(&tbuf, 0, sizeof(tbuf));
Syslog('n', "getnlent: found 000- prefix"); for (tmpaa = &nl_ipprefix; *tmpaa; tmpaa=&((*tmpaa)->next)) {
sprintf(tbuf, "%s", nodebuf.phone+4); if (nodebuf.phone && strncmp(nodebuf.phone, (*tmpaa)->name, strlen((*tmpaa)->name)) == 0) {
for (i = 0; i < strlen(tbuf); i++) Syslog('n', "getnlent: found %s prefix", (*tmpaa)->name);
if (tbuf[i] == '-') sprintf(tbuf, "%s", nodebuf.phone+strlen((*tmpaa)->name));
tbuf[i] = '.'; for (i = 0; i < strlen(tbuf); i++)
Syslog('n', "getnlent: using field6 \"%s\"", tbuf); if (tbuf[i] == '-')
nodebuf.url = xstrcat(nodebuf.url, tbuf); tbuf[i] = '.';
break; Syslog('n', "getnlent: using field6 \"%s\"", tbuf);
} else { nodebuf.url = xstrcat(nodebuf.url, tbuf);
memset(&tbuf, 0, sizeof(tbuf)); break;
}
} }
if (strlen(tbuf))
break;
} else if (strcasecmp((*tmpa)->name, "field8") == 0) { } else if (strcasecmp((*tmpa)->name, "field8") == 0) {
/* /*
* Read nodelist line again in another buffer, the original * Read nodelist line again in another buffer, the original

View File

@ -145,6 +145,7 @@ tcpip IBN 0x00000004 0x00000004
# field6 - Search the phone field for 000- prefix, may be a IP # field6 - Search the phone field for 000- prefix, may be a IP
# or a FQDN with or without a :port suffix. # or a FQDN with or without a :port suffix.
# 000-192-168-1-40:1234 or 000-ntbox.mbse.ym:5678 are valid. # 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: # field8 - Search in the flags for a FQDN. Valid flags are like:
# IBN:domain.com Standard # IBN:domain.com Standard
# IFC:domain.com:port Standard # IFC:domain.com:port Standard
@ -159,8 +160,8 @@ tcpip IBN 0x00000004 0x00000004
# Order is important, defdomain must be the last if used. # Order is important, defdomain must be the last if used.
# #
search field3 search field3
search field6
search field8 search field8
search field6
search defdomain search defdomain
@ -177,3 +178,10 @@ domsuffix 5 net
domsuffix 6 net domsuffix 6 net
domsuffix 92 mbse.ym 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

View File

@ -110,6 +110,7 @@ nodelist_modem *nl_isdn;
nodelist_modem *nl_tcpip; nodelist_modem *nl_tcpip;
nodelist_array *nl_search; nodelist_array *nl_search;
nodelist_array *nl_dialer; nodelist_array *nl_dialer;
nodelist_array *nl_ipprefix;
nodelist_domsuf *nl_domsuffix; nodelist_domsuf *nl_domsuffix;
nodelist_service *nl_service; nodelist_service *nl_service;