Updates to "unlang"

Alan DeKok aland at deployingradius.com
Fri Dec 11 14:55:12 CET 2015


  There have been some long-needed changes to the "unlang" interpreter / compiler.  For people who've looked at the code, it hadn't really changed since 2000 or so.  Largely because it's core to the server, and confusing as heck.

  Now that we have a large number of test cases, I've been going through and fixing the code.  It passes all of the tests, and more have been added.

  The new compiler is in modcall.c.  The interpreter has been moved to interpreter.c.  The split means it's easier to understand each piece in isolation.

  One benefit is that the mess of "if / then / else" statements has been changed to be table driven.  Each keyword "foo" now as a dedicated compilation function compile_foo(), and a dedicate interpreter function modcall_foo().  This makes adding new keywords almost trivial.

  So the question is... what else would you like to see in "unlang"?

  I don't want to make it a general-purpose language, but some additional features may be useful.

  e.g. it would be possible for modules to dynamically register new unlang keywords / syntax:

	if (foo) {
		module-thing argument {
			... ??? ...
		}

	}

  Ideas?  Comments?

  Alan DeKok.




More information about the Freeradius-Devel mailing list