9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] bug in authdial()
@ 2016-05-18  0:43 arisawa
  2016-05-18  9:14 ` cinap_lenrek
  2016-05-18 13:06 ` Charles Forsyth
  0 siblings, 2 replies; 31+ messages in thread
From: arisawa @ 2016-05-18  0:43 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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




^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2016-05-23 14:27 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-18  0:43 [9fans] bug in authdial() arisawa
2016-05-18  9:14 ` cinap_lenrek
2016-05-19 14:45   ` arisawa
2016-05-19 15:43     ` lucio
2016-05-19 15:48       ` Charles Forsyth
2016-05-20  4:58         ` arisawa
2016-05-20 22:04         ` Skip Tavakkolian
2016-05-20 22:25           ` Charles Forsyth
2016-05-21  4:46             ` arisawa
2016-05-21 17:04               ` erik quanstrom
2016-05-21 23:11                 ` Lyndon Nerenberg
2016-05-21 23:16                   ` erik quanstrom
2016-05-21 17:06             ` erik quanstrom
2016-05-21  3:24           ` arisawa
2016-05-23 14:27           ` arisawa
2016-05-20 22:07         ` Skip Tavakkolian
2016-05-21  2:25           ` Skip Tavakkolian
2016-05-21  7:00             ` arisawa
2016-05-21 16:51               ` erik quanstrom
2016-05-21 21:45                 ` Skip Tavakkolian
2016-05-21 21:48                   ` erik quanstrom
2016-05-21 22:16                     ` Skip Tavakkolian
2016-05-21 21:50                   ` erik quanstrom
2016-05-21 22:17                     ` Skip Tavakkolian
2016-05-21 22:34                       ` erik quanstrom
2016-05-21 23:03                         ` Skip Tavakkolian
2016-05-21 23:31                           ` erik quanstrom
2016-05-21 22:53                     ` David du Colombier
2016-05-18 13:06 ` Charles Forsyth
2016-05-18 17:03   ` Skip Tavakkolian
2016-05-19  4:07     ` arisawa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).