IPnom Home • Manuals • FreeBSD

 FreeBSD Man Pages

Man Sections:Commands (1)System Calls (2)Library Functions (3)Device Drivers (4)File Formats (5)Miscellaneous (7)System Utilities (8)
Keyword Live Search (10 results max):
 Type in part of a command in the search box.
 
Index:
  a.out(5)
  acct(5)
  adduser.conf(5)
  aliases(5)
  amd.conf(5)
  auth.conf(5)
  big5(5)
  bluetooth.hosts(5)
  bluetooth.protocols(5)
  bootparams(5)
  bootptab(5)
  config(5)
  core(5)
  crontab(5)
  ctm(5)
  cvs(5)
  devd.conf(5)
  devfs(5)
  device.hints(5)
  dhclient.conf(5)
  dhclient.leases(5)
  dhcp-eval(5)
  dhcp-options(5)
  dir(5)
  dirent(5)
  disktab(5)
  editrc(5)
  elf(5)
  ethers(5)
  euc(5)
  eui64(5)
  exports(5)
  fbtab(5)
  fdescfs(5)
  finger.conf(5)
  forward(5)
  fs(5)
  fstab(5)
  ftpchroot(5)
  gb18030(5)
  gb2312(5)
  gbk(5)
  gettytab(5)
  groff_font(5)
  groff_out(5)
  groff_tmac(5)
  group(5)
  hcsecd.conf(5)
  hesiod.conf(5)
  hosts(5)
  hosts.equiv(5)
  hosts.lpd(5)
  hosts_access(5)
  hosts_options(5)
  inetd.conf(5)
  info(5)
  inode(5)
  intro(5)
  ipf(5)
  ipnat(5)
  ipnat.conf(5)
  ipsend(5)
  isdnd.acct(5)
  isdnd.rates(5)
  isdnd.rc(5)
  kbdmap(5)
  keycap(5)
  keymap(5)
  krb5.conf(5)
  lastlog(5)
  libarchive-formats(5)
  libmap.conf(5)
  link(5)
  linprocfs(5)
  loader.conf(5)
  login.access(5)
  login.conf(5)
  mac.conf(5)
  magic(5)
  mailer.conf(5)
  make.conf(5)
  malloc.conf(5)
  master.passwd(5)
  moduli(5)
  motd(5)
  msdos(5)
  msdosfs(5)
  mskanji(5)
  named.conf(5)
  netconfig(5)
  netgroup(5)
  netid(5)
  networks(5)
  newsyslog.conf(5)
  nologin(5)
  nsmb.conf(5)
  nsswitch.conf(5)
  ntp.conf(5)
  ntp.keys(5)
  opieaccess(5)
  opiekeys(5)
  passwd(5)
  pbm(5)
  pccard.conf(5)
  periodic.conf(5)
  pf.conf(5)
  pf.os(5)
  phones(5)
  printcap(5)
  procfs(5)
  protocols(5)
  publickey(5)
  pw.conf(5)
  quota.group(5)
  quota.user(5)
  radius.conf(5)
  rc.conf(5)
  rcsfile(5)
  remote(5)
  resolv.conf(5)
  resolver(5)
  rhosts(5)
  rndc.conf(5)
  rpc(5)
  rrenumd.conf(5)
  rtadvd.conf(5)
  services(5)
  shells(5)
  ssh_config(5)
  sshd_config(5)
  stab(5)
  style.Makefile(5)
  sysctl.conf(5)
  syslog.conf(5)
  tacplus.conf(5)
  tar(5)
  term(5)
  termcap(5)
  terminfo(5)
  texinfo(5)
  tmac(5)
  ttys(5)
  tzfile(5)
  usbd.conf(5)
  utf2(5)
  utf8(5)
  utmp(5)
  uuencode(5)
  uuencode.format(5)
  vgrindefs(5)
  wtmp(5)

dhcp-eval(5)

NAME

       dhcp-eval - ISC DHCP conditional evaluation


DESCRIPTION

       The Internet Systems Consortium DHCP client and server both provide the
       ability to perform conditional behavior depending on  the  contents  of
       packets	they receive.	The syntax for specifying this conditional be-
       haviour is documented here.


REFERENCE: CONDITIONAL BEHAVIOUR

       Conditional behaviour is specified using the if statement and the  else
       or elsif statements.   A conditional statement can appear anywhere that
       a regular statement (e.g., an option statement)	can  appear,  and  can
       enclose	one or more such statements.   A typical conditional statement
       in a server might be:

       if option dhcp-user-class = "accounting" {
	 max-lease-time 17600;
	 option domain-name "accounting.example.org";
	 option domain-name-servers ns1.accounting.example.org,
			   ns2.accounting.example.org;
       } elsif option dhcp-user-class = "sales" {
	 max-lease-time 17600;
	 option domain-name "sales.example.org";
	 option domain-name-servers ns1.sales.example.org,
			   ns2.sales.example.org;
       } elsif option dhcp-user-class = "engineering" {
	 max-lease-time 17600;
	 option domain-name "engineering.example.org";
	 option domain-name-servers ns1.engineering.example.org,
			   ns2.engineering.example.org;
       } else {
	 max-lease-time 600;
	 option domain-name "misc.example.org";
	 option domain-name-servers ns1.misc.example.org,
			   ns2.misc.example.org;
       }

       On the client side, an example of conditional evaluation might be:

       # example.org filters DNS at its firewall, so we have to use their DNS
       # servers when we connect to their network.   If we are not at
       # example.org, prefer our own DNS server.
       if not option domain-name = "example.org" {
	 prepend domain-name-servers 127.0.0.1;
       }

       The if statement and the elsif continuation statement both take boolean
       expressions  as their arguments.   That is, they take expressions that,
       when evaluated, produce a boolean result.   If the expression evaluates
       to true, then the statements enclosed in braces following the if state-
       ment are executed, and  all  subsequent	elsif  and  else  clauses  are
       skipped.    Otherwise,  each  subsequent  elsif	clause's expression is
       checked, until an elsif clause is encountered whose test  evaluates  to
       true.	If  such a clause is found, the statements in braces following
       The  following is the current list of boolean expressions that are sup-
       ported by the DHCP distribution.

       data-expression-1 = data-expression-2

	 The = operator compares the values of two data expressions, returning
	 true  if  they  are  the same, false if they are not.	 If either the
	 left-hand side or the right-hand side are null, the  result  is  also
	 null.

       boolean-expression-1 and boolean-expression-2

	 The  and  operator evaluates to true if the boolean expression on the
	 left-hand side and the boolean expression on the right-hand side both
	 evaluate  to  true.  Otherwise, it evaluates to false.  If either the
	 expression on the left-hand side or the expression on the  right-hand
	 side are null, the result is null.

       boolean-expression-1 or boolean-expression-2

	 The or operator evaluates to true if either the boolean expression on
	 the left-hand side or the boolean expression on the  right-hand  side
	 evaluate  to  true.  Otherwise, it evaluates to false.  If either the
	 expression on the left-hand side or the expression on the  right-hand
	 side are null, the result is null.

       not boolean-expression

	 The not operator evaluates to true if boolean-expression evaluates to
	 false, and returns false if  boolean-expression  evaluates  to  true.
	 If boolean-expression evaluates to null, the result is also null.

       exists option-name

	 The  exists expression returns true if the specified option exists in
	 the incoming DHCP packet being processed.
       known

	 The known expression returns true if the client whose request is cur-
	 rently being processed is known - that is, if there's a host declara-
	 tion for it.
       static

	 The static expression returns true  if  the  lease  assigned  to  the
	 client  whose	request is currently being processed is derived from a
	 static address assignment.


DATA EXPRESSIONS

       Several of the boolean expressions above depend on the results of eval-
       uating  data  expressions.    A	list  of these expressions is provided
       here.

       substring (data-expr, offset, length)

	 The substring operator evaluates the data expression and returns  the
	 substring  of	the result of that evaluation that starts offset bytes
	 from the beginning, continuing for length bytes.  Offset  and	length
	 are  both numeric expressions.  If data-expr, offset or length evalu-
	 The suffix operator evaluates data-expr and returns the  last	length
	 bytes	of  the result of that evaluation. Length is a numeric expres-
	 sion.	If data-expr or length evaluate to null, then  the  result  is
	 also  null.   If suffix evaluates to a number greater than the length
	 of the evaluated data, then the evaluated data is returned.

       option option-name

	 The option operator returns the contents of the specified  option  in
	 the packet to which the server is responding.

       config-option option-name

	 The config-option operator returns the value for the specified option
	 that the DHCP client or server has been configured to send.

       hardware

	 The hardware operator returns a data string whose  first  element  is
	 the  type  of network interface indicated in packet being considered,
	 and whose subsequent elements are client's link-layer	address.    If
	 there is no packet, or if the RFC2131 hlen field is invalid, then the
	 result is null.   Hardware types  include  ethernet  (1),  token-ring
	 (6),  and  fddi  (8).	 Hardware types are specified by the IETF, and
	 details on how the type numbers are defined can be found  in  RFC2131
	 (in the ISC DHCP distribution, this is included in the doc/ subdirec-
	 tory).

       packet (offset, length)

	 The packet operator returns the specified portion of the packet being
	 considered,  or null in contexts where no packet is being considered.
	 Offset and length are applied to the contents packet as in  the  sub-
	 string operator.

       string

	 A  string, enclosed in quotes, may be specified as a data expression,
	 and returns the text between the  quotes,  encoded  in  ASCII.    The
	 backslash  ('\') character is treated specially, as in C programming:
	 where nnn is any positive octal number less than 0400.  Any hexadeci-
	 mal value can be specified with '', where nn is any positive hexadec-
	 imal number less than 0xff.

       colon-separated hexadecimal list

	 A list of hexadecimal octet values, separated by colons, may be spec-
	 ified as a data expression.

       concat (data-expr1, ..., data-exprN)
	 The expressions are evaluated, and the results of each evaluation are
	 concatenated in the sequence that the subexpressions are listed.   If
	 any  subexpression evaluates to null, the result of the concatenation
	 is null.

       reverse (numeric-expr1, data-expr2)
	 The two expressions are evaluated, and then the result of  evaluating
	 the  data  expression	is  reversed in place, using hunks of the size
	 In  any context where the client whose request is being processed has
	 been assigned an IP address, this data  expression  returns  that  IP
	 address.

       binary-to-ascii (numeric-expr1, numeric-expr2, data-expr1, data-expr2)
	 Converts  the result of evaluating data-expr2 into a text string con-
	 taining one number for each element of the result of evaluating data-
	 expr2.    Each  number  is  separated from the other by the result of
	 evaluating data-expr1.   The result of evaluating numeric-expr1 spec-
	 ifies	the  base (2 through 16) into which the numbers should be con-
	 verted.   The result of evaluating numeric-expr2 specifies the  width
	 in bits of each number, which may be either 8, 16 or 32.

	 As an example of the preceding three types of expressions, to produce
	 the name of a PTR record for the  IP  address	being  assigned  to  a
	 client, one could write the following expression:

	       concat (binary-to-ascii (10, 8, ".",
					reverse (1, leased-address)),
		       ".in-addr.arpa.");

       encode-int (numeric-expr, width)
	 Numeric-expr  is evaluated and encoded as a data string of the speci-
	 fied width, in network byte order (most significant byte first).   If
	 the  numeric  expression  evaluates  to the null value, the result is
	 also null.

	 pick-first-value (data-expr1 [ ... exprn ] )
	    The pick-first-value function takes any number of data expressions
	    as	its  arguments.    Each expression is evaluated, starting with
	    the first in the list, until an expression is found that does  not
	    evaluate  to a null value.	 That expression is returned, and none
	    of the subsequent expressions are evaluated.   If all  expressions
	    evaluate to a null value, the null value is returned.

	 host-decl-name
	    The  host-decl-name function returns the name of the host declara-
	    tion that matched the client whose request is currently being pro-
	    cessed,  if  any.	 If no host declaration matched, the result is
	    the null value.


NUMERIC EXPRESSIONS

       Numeric expressions are expressions that evaluate to an	integer.    In
       general,  the  maximum size of such an integer should not be assumed to
       be representable in fewer than 32 bits, but the precision of such inte-
       gers may be more than 32 bits.

       extract-int (data-expr, width)

	 The  extract-int  operator  extracts an integer value in network byte
	 order from the result of evaluating the  specified  data  expression.
	 Width is the width in bits of the integer to extract.	Currently, the
	 only supported widths are 8, 16 and 32.   If the  evaluation  of  the
	 data expression doesn't provide sufficient bits to extract an integer
	 of the specified size, the null value is returned.

       lease-time

       client-state

	 The current state of the client instance being processed.    This  is
	 only  useful  in  DHCP  client configuration files.   Possible values
	 are:

	 +<I>o Booting - DHCP client is in the INIT state, and does not  yet  have
	   an  IP  address.    The next message transmitted will be a DHCPDIS-
	   COVER, which will be broadcast.

	 +<I>o Reboot - DHCP client is in the INIT-REBOOT state.   It  has	an  IP
	   address,  but  is not yet using it.	 The next message to be trans-
	   mitted will be a DHCPREQUEST, which	will  be  broadcast.	If  no
	   response  is heard, the client will bind to its address and move to
	   the BOUND state.

	 +<I>o Select - DHCP client is in the SELECTING state - it has received at
	   least  one  DHCPOFFER  message,  but  is  waiting  to see if it may
	   receive other DHCPOFFER messages from other servers.   No  messages
	   are sent in the SELECTING state.

	 +<I>o Request  - DHCP client is in the REQUESTING state - it has received
	   at least one DHCPOFFER message, and has chosen which  one  it  will
	   request.    The  next message to be sent will be a DHCPREQUEST mes-
	   sage, which will be broadcast.

	 +<I>o Bound - DHCP client is in the BOUND state - it has an  IP  address.
	   No messages are transmitted in this state.

	 +<I>o Renew  -  DHCP  client  is  in  the	RENEWING  state - it has an IP
	   address, and is trying to contact the server  to  renew  it.    The
	   next  message  to be sent will be a DHCPREQUEST message, which will
	   be unicast directly to the server.

	 +<I>o Rebind - DHCP client is in the REBINDING  state  -  it  has	an  IP
	   address,  and  is  trying  to contact any server to renew it.   The
	   next message to be sent will be a DHCPREQUEST, which will be broad-
	   cast.


REFERENCE: LOGGING

       Logging statements may be used to send information to the standard log-
       ging channels.  A  logging  statement  includes	an  optional  priority
       (fatal, error, info, or debug), and a data expression.

       log (priority, data-expr)

       Logging	statements  take only a single data expression argument, so if
       you want to output multiple data values, you will need to use the  con-
       cat operator to concatenate them.


REFERENCE: DYNAMIC DNS UPDATES

       The  DHCP  client and server have the ability to dynamically update the
       Domain Name System.  Within the configuration files, you can define how
       you  want  the Domain Name System to be updated.  These updates are RFC
       2136 compliant so any DNS server supporting RFC 2136 should be able  to
       accept updates from the DHCP server.

       distribution.

       Dynamic DNS (DDNS)  updates  are  performed  by	using  the  dns-update
       expression.   The  dns-update  expression  is a boolean expression that
       takes four parameters.  If the update succeeds, the result is true.  If
       it  fails,  the	result is false.  The four parameters that the are the
       resource record type (RR), the left hand side of the RR, the right hand
       side  of  the RR and the ttl that should be applied to the record.  The
       simplest example of the use of the function can be found in the	refer-
       ence  section  of  the dhcpd.conf file, where events are described.  In
       this example several statements are being used to make the arguments to
       the dns-updateR.

       In  the example, the first argument to the first Bdns-update expression
       is a data expression that evaluates to the A RR type.  The second argu-
       ment  is  constructed by concatenating the DHCP host-name option with a
       text string containing  the  local  domain,  in	this  case  "ssd.exam-
       ple.net".   The third argument is constructed by converting the address
       the client has been assigned from a 32-bit number into an ascii	string
       with each byte separated by a ".".  The fourth argument, the TTL, spec-
       ifies the amount of time remaining in the lease (note that  this  isn't
       really  correct, since the DNS server will pass this TTL out whenever a
       request comes in, even if that is only a few seconds before  the  lease
       expires).

       If  the	first  dns-update statement succeeds, it is followed up with a
       second update to install a PTR RR.  The installation of a PTR record is
       similar	to  installing	an  A RR except that the left hand side of the
       record is the leased address, reversed, with  ".in-addr.arpa"  concate-
       nated.	The  right hand side is the fully qualified domain name of the
       client to which the address is being leased.


SEE ALSO

       dhcpd.conf(5),	dhcpd.leases(5),    dhclient.conf(5),	 dhcp-eval(5),
       dhcpd(8), dhclient(8), RFC2132, RFC2131.


AUTHOR

       The  Internet  Systems  Consortium DHCP Distribution was written by Ted
       Lemon under a contract with Vixie Labs.	Funding for this  project  was
       provided through Internet Systems Consortium.  Information about Inter-
       net Systems Consortium can be found at http://www.isc.org.

								  dhcp-eval(5)

SPONSORED LINKS




Man(1) output converted with man2html , sed , awk