ietf-openproxy
[Top] [All Lists]

Re: Fw: Divide and Conquer

2003-09-11 09:20:28

On Wed, 10 Sep 2003, Alex Rousskov wrote:

Furthermore, in order to move to a conclusion faster, I think we
should start with what you propose last: a good set of specific
examples that rules language can handle. I will try to contribute
some real-world ACL examples soon.

Here is a real-world rule example just posted on one of the mailing
lists for network admins. I think the rules are using F5 (f5.com)
language, but I am not sure. Pasted as-is:

 if ((exists http_cookie JSESSIONID) and http_cookie starts_with "1") {
    use slice1-pool
 } else ((exists http_cookie JSESSIONID) and http_cookie starts_with "2") {
    use slice2-pool
 } else {
    use all-pool
 }

Load balancing is not a 100% OPES application, but here is how the
above could be implemented in P, approximately:

  cookie := Http.message.headers.findCookie("JSESSIONID");

  if (cookie and cookie.value.starts_with("1")) {
    service := Services.find("slice1-pool");
  } else
  if (cookie and cookie.value.starts_with("2")) {
    service := Services.find("slice2-pool");
  } else {
    service := Services.find("all-pool");
  }

  Services.applyOne(service);

Depending on the interpreter, the above P code could be more efficient
that the above F5 code because the cookie header will be looked up
only once, even if its value does not start with "1".

Also note that if graceful handling of absent/down services is
required, the above P code can handle such error in one place (the
last line where the service variable is used) rather than three places
in the original F5 code.

HTH,

Alex.

P.S. Can anybody point me to F5 rule language specification?

<Prev in Thread] Current Thread [Next in Thread>