Hello,
authdial() is slow. so I have inspected the code:
/sys/src/libauthsrv/authdial.c
I suspect netroot causes the problem.
int
authdial(char *netroot, char *dom)
{
[snip]
if(dom == nil)
/* look for one relative to my machine */
return dial(netmkaddr("$auth", netroot, "ticket"), 0, 0, 0);
/* look up an auth server in an authentication domain */
p = csgetvalue(netroot, "authdom", dom, "auth", &t);
/* if that didn't work, just try the IP domain */
if(p == nil)
p = csgetvalue(netroot, "dom", dom, "auth", &t);
[snip]
for(nt = t; nt != nil; nt = nt->entry) {
if(strcmp(nt->attr, "auth") == 0) {
p = netmkaddr(nt->val, netroot, "ticket");
rv = dial(p, 0, 0, 0);
if(rv >= 0)
break;
}
}
[snip]
}
man authsrv(2) says:
the default of netroot in authdial(char *netroot, char *ad) is “/net”
and consistent with the synopsis of csgetvalue(char *netroot, char *attr, char
*val,….).
on the other hand the synopsis of netmkaddr is
char* netmkaddr(char *addr, char *defnet, char *defservice)
the defnet takes values nil, “tcp”, “il”, etc.
as the result, netroot in the first argument of authdial() works only if it is
nil, which makes authdial()
very slow.
I think that should be fixed for example:
- p = netmkaddr(nt->val, netroot, "ticket");
rv = dial(p, 0, 0, 0);
if(rv >= 0)
break;
+ p = netmkaddr(nt->val, “tcp", "ticket");
rv = dial(p, 0, 0, 0);
if(rv >= 0)
break;
+ p = netmkaddr(nt->val, “il", "ticket");
+ rv = dial(p, 0, 0, 0);
+ if(rv >= 0)
+ break;
NOTE that
return dial(netmkaddr("$auth", netroot, "ticket"), 0, 0, 0);
should be also fixed.
Kenji Arisawa