/* * the dialstring is of the form '[/net/]proto!dest' */ int kdial(char *dest, char *local, char *dir, int *cfdp) { DS ds; int rv; char *err, *alterr; err = kmalloc(ERRMAX, KMALLOC_WAIT); alterr = kmalloc(ERRMAX, KMALLOC_WAIT); ds.local = local; ds.dir = dir; ds.cfdp = cfdp; _dial_string_parse(dest, &ds); if (ds.netdir) { rv = csdial(&ds); goto out; } ds.netdir = "/net"; rv = csdial(&ds); if (rv >= 0) goto out; err[0] = 0; strlcpy(err, current_errstr(), ERRMAX); if (strstr(err, "refused") != 0) { goto out; } ds.netdir = "/net.alt"; rv = csdial(&ds); if (rv >= 0) goto out; alterr[0] = 0; kerrstr(alterr, ERRMAX); if (strstr(alterr, "translate") || strstr(alterr, "does not exist")) kerrstr(err, ERRMAX); else kerrstr(alterr, ERRMAX); out: kfree(err); kfree(alterr); return rv; }
/* * the dialstring is of the form '[/net/]proto!dest' */ int kdial(char *dest, char *local, char *dir, int *cfdp) { DS ds; int rv; char err[ERRMAX], alterr[ERRMAX]; ds.local = local; ds.dir = dir; ds.cfdp = cfdp; _dial_string_parse(dest, &ds); if(ds.netdir) return csdial(&ds); ds.netdir = "/net"; rv = csdial(&ds); if(rv >= 0) return rv; err[0] = 0; kerrstr(err, sizeof err); if(strstr(err, "refused") != 0){ kerrstr(err, sizeof err); return rv; } ds.netdir = "/net.alt"; rv = csdial(&ds); if(rv >= 0) return rv; alterr[0] = 0; kerrstr(alterr, sizeof err); if(strstr(alterr, "translate") || strstr(alterr, "does not exist")) kerrstr(err, sizeof err); else kerrstr(alterr, sizeof alterr); return rv; }