dhcp-eval.5

来自「open source dhcp server client etc...」· 5 代码 · 共 478 行 · 第 1/2 页

5
478
字号
.\"	dhcp-eval.5.\".\" Copyright (c) 1996-2001 Internet Software Consortium..\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\".\" 1. Redistributions of source code must retain the above copyright.\"    notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\"    notice, this list of conditions and the following disclaimer in the.\"    documentation and/or other materials provided with the distribution..\" 3. Neither the name of The Internet Software Consortium nor the names.\"    of its contributors may be used to endorse or promote products derived.\"    from this software without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE.\" DISCLAIMED.  IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR.\" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\" This software has been written for the Internet Software Consortium.\" by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc..\" To learn more about the Internet Software Consortium, see.\" ``http://www.isc.org/''.  To learn more about Vixie Enterprises,.\" see ``http://www.vix.com''.   To learn more about Nominum, Inc., see.\" ``http://www.nominum.com''..TH dhcp-eval 5.SH NAMEdhcp-eval - ISC DHCP conditional evaluation.SH DESCRIPTIONThe Internet Software Consortium DHCP client and server both providethe ability to perform conditional behavior depending on the contentsof packets they receive.   The syntax for specifying this conditionalbehaviour is documented here..SH REFERENCE: CONDITIONAL BEHAVIOURConditional behaviour is specified using the if statement and the elseor elsif statements.   A conditional statement can appear anywherethat a regular statement (e.g., an option statement) can appear, andcan enclose one or more such statements.   A typical conditionalstatement in a server might be:.PP.nfif 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;}.fi.PPOn the client side, an example of conditional evaluation might be:.PP.nf# 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;}.fi  .PPThe.B ifstatement and the.B elsifcontinuation statement both take boolean expressions as theirarguments.   That is, they take expressions that, when evaluated,produce a boolean result.   If the expression evaluates to true, thenthe statements enclosed in braces following the .B ifstatement are executed, and all subsequent.B elsifand.B elseclauses are skipped.   Otherwise, each subsequent .B elsifclause's expression is checked, until an elsif clause is encounteredwhose test evaluates to true.   If such a clause is found, thestatements in braces following it are executed, and then anysubsequent.B elsifand.B elseclauses are skipped.   If all the .B ifand.B elsifclauses are checked but noneof their expressions evaluate true, then if there is an.B elseclause, the statements enclosed in braces following the.B elseare evaluated.   Boolean expressions that evaluate to null aretreated as false in conditionals..SH BOOLEAN EXPRESSIONSThe following is the current list of boolean expressions that aresupported by the DHCP distribution..PP.I data-expression-1 \fB=\fI data-expression-2\fR.RS 0.25i.PPThe \fB=\fR operator compares the values of two data expressions,returning true if they are the same, false if they are not.   Ifeither the left-hand side or the right-hand side are null, theresult is also null..RE.PP.I boolean-expression-1 \fBand\fI boolean-expression-2\fR.PP.RS 0.25iThe \fBand\fR operator evaluates to true if the boolean expression onthe left-hand side and the boolean expression on the right-hand sideboth evaluate to true.  Otherwise, it evaluates to false.  If eitherthe expression on the left-hand side or the expression on theright-hand side are null, the result is null..RE.PP.I boolean-expression-1 \fBor\fI boolean-expression-2\fR.PP.RS 0.25iThe \fBor\fR operator evaluates to true if either the booleanexpression on the left-hand side or the boolean expression on theright-hand side evaluate to true.  Otherwise, it evaluates to false.If either the expression on the left-hand side or the expression onthe right-hand side are null, the result is null..RE.PP.B not \fIboolean-expression.PP.RS 0.25iThe \fBnot\fR operator evaluates to true if \fIboolean-expression\fRevaluates to false, and returns false if \fIboolean-expression\fR evaluatesto true.   If \fIboolean-expression\fR evaluates to null, the resultis also null..RE.PP.B exists \fIoption-name\fR.PP.RS 0.25iThe \fBexists\fR expression returns true if the specified optionexists in the incoming DHCP packet being processed..RE.B known.PP.RS 0.25iThe \fBknown\fR expression returns true if the client whose request iscurrently being processed is known - that is, if there's a hostdeclaration for it..RE.B static.PP.RS 0.25iThe \fBstatic\fR expression returns true if the lease assigned to theclient whose request is currently being processed is derived from a staticaddress assignment..RE.SH DATA EXPRESSIONSSeveral of the boolean expressions above depend on the results ofevaluating data expressions.   A list of these expressions is providedhere..PP.B substring (\fIdata-expr\fB, \fIoffset\fB, \fIlength\fB)\fR.PP.RS 0.25iThe \fBsubstring\fR operator evaluates the data expression and returnsthe substring of the result of that evaluation that starts\fIoffset\fR bytes from the beginning, continuing for \fIlength\fRbytes.  \fIOffset\fR and \fIlength\fR are both numeric expressions.If \fIdata-expr\fR, \fIoffset\fR or \fIlength\fR evaluate to null,then the result is also null.  If \fIoffset\fR is greater than orequal to the length of the evaluated data, then a zero-length datastring is returned.  If \fIlength\fI is greater then the remaininglength of the evaluated data after \fIoffset\fR, then a data stringcontaining all data from \fIoffset\fR to the end of the evaluated datais returned..RE.PP.B suffix (\fIdata-expr\fB, \fIlength\fB)\fR.PP.RS 0.25iThe \fBsuffix\fR operator evaluates \fIdata-expr\fR and returns thelast \fIlength\fR bytes of the result of that evaluation. \fILength\fRis a numeric expression.  If \fIdata-expr\fR or \fIlength\fR evaluateto null, then the result is also null.  If \fIsuffix\fR evaluates to anumber greater than the length of the evaluated data, then theevaluated data is returned..RE.PP.B option \fIoption-name\fR.PP.RS 0.25iThe \fBoption\fR operator returns the contents of the specified option inthe packet to which the server is responding..RE.PP.B hardware.PP.RS 0.25iThe \fBhardware\fR operator returns a data string whose first elementis the type of network interface indicated in packet being considered,and whose subsequent elements are client's link-layer address.   Ifthere is no packet, or if the RFC2131 \fIhlen\fR field is invalid,then the result is null.   Hardware types include ethernet (1),token-ring (6), and fddi (8).   Hardware types are specified by theIETF, and details on how the type numbers are defined can be found inRFC2131 (in the ISC DHCP distribution, this is included in the doc/subdirectory)..RE.PP.B packet (\fIoffset\fB, \fIlength\fB)\fR.PP.RS 0.25iThe \fBpacket\fR operator returns the specified portion of the packetbeing considered, or null in contexts where no packet is being

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?