#ifndef lint
static char copyright[] =
-"$Id: conflex.c,v 1.51 1999/07/19 15:32:54 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: conflex.c,v 1.52 1999/08/01 14:26:48 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
return SPAWN;
if (!strcasecmp (atom + 1, "pace"))
return SPACE;
+ if (!strcasecmp (atom + 1, "tatic"))
+ return STATIC;
break;
case 't':
if (!strcasecmp (atom + 1, "imestamp"))
currently being processed is known - that is, if there's a host
declaration for it.
.RE
+.B static
+.PP
+.RS 0.25i
+The \fBstatic\fR expression returns true if the lease assigned to the
+client whose request is currently being processed is derived from a static
+address assignment.
+.RE
.SH DATA EXPRESSIONS
Several of the boolean expressions above depend on the results of
evaluating data expressions. A list of these expressions is provided
#ifndef lint
static char copyright[] =
-"$Id: parse.c,v 1.35 1999/07/31 21:35:12 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: parse.c,v 1.36 1999/08/01 14:26:49 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
}
break;
+ case STATIC:
+ token = next_token (&val, cfile);
+ if (!expression_allocate (expr, "parse_expression: STATIC"))
+ log_fatal ("can't allocate expression");
+ (*expr) -> op = expr_static;
+ break;
+
case KNOWN:
token = next_token (&val, cfile);
- if (!expression_allocate (expr, "parse_expression: EXISTS"))
+ if (!expression_allocate (expr, "parse_expression: KNOWN"))
log_fatal ("can't allocate expression");
(*expr) -> op = expr_known;
break;
#ifndef lint
static char copyright[] =
-"$Id: tree.c,v 1.45 1999/07/31 23:24:32 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
+"$Id: tree.c,v 1.46 1999/08/01 14:26:48 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
*result = packet -> known;
return 1;
+ case expr_static:
+ if (!lease || !(lease -> flags & STATIC_LEASE)) {
+#if defined (DEBUG_EXPRESSIONS)
+ log_debug ("bool: static = false");
+#endif
+ *result = 0;
+ return 1;
+ }
+#if defined (DEBUG_EXPRESSIONS)
+ log_debug ("bool: static = true");
+#endif
+ *result = 1;
+ return 1;
+
case expr_dns_update:
#if !defined (NSUPDATE)
return 0;
#else
/* we only want to do this on a DHCPREQUEST */
- if (packet -> packet_type != DHCPREQUEST)
+ if (!packet || packet -> packet_type != DHCPREQUEST)
+ return 0;
+ /* no update for static leases */
+ if (lease && (lease -> flags & STATIC_LEASE))
return 0;
memset (&rrtype, 0, sizeof expr1);
s0 = evaluate_data_expression (&rrtype, packet, lease,
case expr_or:
case expr_not:
case expr_match:
+ case expr_static:
case expr_known:
log_error ("Boolean opcode in evaluate_data_expression: %d",
expr -> op);
case expr_or:
case expr_not:
case expr_match:
+ case expr_static:
case expr_known:
log_error ("Boolean opcode in evaluate_numeric_expression: %d",
expr -> op);
expr -> op == expr_or ||
expr -> op == expr_dns_update ||
expr -> op == expr_not ||
- expr -> op == expr_known);
+ expr -> op == expr_known ||
+ expr -> op == expr_static);
}
int is_data_expression (expr)
switch (op) {
case expr_none:
case expr_match:
+ case expr_static:
case expr_check:
case expr_substring:
case expr_suffix:
/* XXX Why aren't these specific? */
case expr_none:
case expr_match:
+ case expr_static:
case expr_check:
case expr_substring:
case expr_suffix:
COMMIT = 411,
DNS_UPDATE = 412,
LEASE_TIME = 413,
+ STATIC = 414,
};
#define is_identifier(x) ((x) >= FIRST_TOKEN && \
expr_pick_first_value,
expr_lease_time,
expr_dns_update,
+ expr_static,
};
struct expression {