--- dhcp-0.10/dhcp6.h.prefix_bz196429 2006-07-19 01:30:48.000000000 -0400 +++ dhcp-0.10/dhcp6.h 2006-07-19 01:30:48.000000000 -0400 @@ -301,6 +301,7 @@ */ #define DH6OPT_IA_PD CONF_DH6OPT_IA_PD #define DH6OPT_IAPREFIX CONF_DH6OPT_IAPREFIX +#define DH6OPT_REQUEST_PREFIX 28 struct dhcp6opt { u_int16_t dh6opt_type; @@ -340,8 +341,7 @@ struct in6_addr addr; u_int32_t preferlifetime; u_int32_t validlifetime; - u_int8_t plen; -/* +/* u_int8_t plen; struct dhcp6_status_info status; */ } __attribute__ ((__packed__)); --- dhcp-0.10/dhcp6c.c.prefix_bz196429 2006-07-19 01:30:48.000000000 -0400 +++ dhcp-0.10/dhcp6c.c 2006-07-19 01:30:48.000000000 -0400 @@ -955,8 +955,14 @@ if (dhcp6_copy_list(&optinfo.addr_list, &request_list)) goto end; } + /* support for server assigned prefix */ + if ( ! ifp->use_ra_prefix ) + optinfo.flags |= DHCIFF_REQUEST_PREFIX; break; case DHCP6S_REQUEST: + /* support for server assigned prefix */ + if ( ! ifp->use_ra_prefix ) + optinfo.flags |= DHCIFF_REQUEST_PREFIX; if (!(ifp->send_flags & DHCIFF_INFO_ONLY)) { memcpy(&optinfo.iaidinfo, &client6_iaidaddr.client6_info.iaidinfo, sizeof(optinfo.iaidinfo)); --- dhcp-0.10/dhcp6s.conf.5.prefix_bz196429 2006-07-19 01:30:48.000000000 -0400 +++ dhcp-0.10/dhcp6s.conf.5 2006-07-19 01:37:33.000000000 -0400 @@ -1,330 +1,340 @@ -.\" $Id: dhcp6s.conf.5,v 1.3 2003/05/28 22:56:23 shirleyma Exp $ -.\" -.\" Copyright (C) International Business Machines Corp., 2003 -.\" All rights reserved. -.\" -.\" 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 project 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 PROJECT 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 PROJECT 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. -.\" -.TH dhcp6s.conf 5 "17 March 2003" "dhcp6s.conf" "Linux System Manager's Manual" - -.SH NAME -dhcp6s.conf \- configuration file of the DHCPv6 server daemon, dhcp6s - -.SH DESCRIPTION +.\" $Id: dhcp6s.conf.5,v 1.3 2003/05/28 22:56:23 shirleyma Exp $ +.\" +.\" Copyright (C) International Business Machines Corp., 2003 +.\" All rights reserved. +.\" +.\" 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 project 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 PROJECT 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 PROJECT 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. +.\" +.TH dhcp6s.conf 5 "17 March 2003" "dhcp6s.conf" "Linux System Manager's Manual" + +.SH NAME +dhcp6s.conf \- configuration file of the DHCPv6 server daemon, dhcp6s + +.SH DESCRIPTION .B dhcp6s.conf -contains the configuration information of addresses, prefixes, or -various network configuration parameters for each of the interfaces. -The network configuration parameters can be described globally for all of -the interfaces. The default address preferred life time is 36000 seconds; -the default address valid life time is 72000 seconds if they are not defined -in any declaration. The specific declaration order is interface, link, host; -within link the more specific declaration is pool. - - The interface definitions are described in the following form: -.PP -.nf -.B \tinterface\ <interface\ name> -.B \t{ -.B \t\t[declarations]; -.B \t}; -.fi - where each of the declarations could be of type link, group, or host. -Each declaration and the statements within each of these declarations -must be terminated by a semicolon. Additional details of the declarations -are specified below. - -.PP -.BI DECLARATIONS -.PP -.nf -.B interface\ <interface\ name> -.B { -.B \t[declarations]; -.B }; -.fi -An interface declaration is used to inform the DHCPv6 server that the links and -hosts declared within it are connected to the same network segment. Common -network parameters for this network segment can be defined within the interface -declaration. - -.nf -.B link\ <link\ name> -.B { -.B \t[declarations]; -.B }; -.fi -A link declaration is used to provide the DHCPv6 server the IPv6 assgined -address ranges, prefixes, and hosts. Common network parameters for this link -can be defined within the link declaration. - -.nf -.B group -.B { -.B \t[declarations]; -.B }; -.fi -A group declaration is used to group a list of declarations together to define -the common network parameters. These network parameters are valid within this -declaration only. Declarations can be one of the following types: interface, link, -pool, or host. - -.nf -.B pool -.B { -.B \t[declarations]; -.B }; -.fi -The pool declaration is used to declare an address pool from which IPv6 -address can be allocated, with its own permit to control client access -and its own declaration in which you can declare pool-specific network parameters. - -.nf -.B host\ <host\ name> -.B { -.B \t[duid\ <DUID\n>]; -.B \t[iaidinfo\ {}]; -.B \t[address\ {}]; -.B \t[prefix\ <prefix>/<prefix\ length>]; -.B \t[declarations]; -.B }; -.fi -This declaration allows administrators to describe the addresses, prefixes, and -network configuration parameters for this host. As for this declaration, the -DHCP Unique Identifier (DUID), Identity Association Identifier (IAID), and -addresses must be specified. The host declaration is used to do Static -Address Assginment for a particular DHCPv6 client. - -.nf -.B address -.B { -.B \t[<ipv6 address>/<prefix length>]; -.B \t[prefer-life-time\ <preferred\ lifetime>]; -.B \t[valid-life-time\ <valid\ lifetime>]; -.B }; -.fi -This statement allows administrators to specify the address for the -host. Preferred Lifetime and Valid Lifetime also can be set in this -statement. This statement is valid only in host {} declarations. - -.nf -.B prefix\ <prefix>/<prefix\ length>; -.fi -This statement allows administrators to specify the prefix. -This parameter is needed when configuring dhcp6s as the Delegation Router for -the Prefix Delegation. dhcp6s assigns the specified prefixes -to the requesting routers. - -.nf -.B relay\ <relay>/<prefix\ length>; -.fi -This statement specifies the prefix that the relay agent will put in the link -address field of the RELAY-FORW message to indicate the link the client is -attached to. If the link-address matches this prefix, this link declaration -will be used. This statement is only valid in the link declaration. - -.nf -.B iaidinfo -.B { -.B \t[iaid\ <IAID\ number>]; -.B \t[renew-time\ <renew\ time>]; -.B \t[rebind-time\ <rebind\ time>]; -.B }; -.fi -This statement allows administrators to describe the information for -this IAID. This statement is only valid in host {} declarations. -iaid is required; renew-time and rebind time are optional in this statement. - -.nf -.B range\ <ipv6\ address>\ to\ <ipv6\ address>/<prefix\ length>; -.fi -This statement allows adminstrators to use "range" and "to" keywords and -prefix length to specify an address range. -For each range not more than one of the unassigned addresses will be -assgined to the requested client. - -.nf -.B duid\ <DUID\>; -.fi -DUID is a DHCP Unique Identifier for a DHCP participant. Using this option, -the administrator can specify the DUID of this DHCPv6 client. -The duid statement is valid only in host {} declarations. - -.nf -.BI iaid\ <IAID\ number>; -.fi -IAID is a Identity Association Identifier. IA is a collection of addresses -assigned to a client. Using this option, the administrator can specify the IAID -in iaidinfo for a host declaration. - -.nf -.BI renew-time\ <renew\ time>; -.fi -This statement allows administrators to specify the RenewTime (T1). -The recommended value for RenewTime is .5 times the shortest preferred -lifetime of the address in the IA, if the value is not defined. - -.nf -.BI rebind-time\ <rebind\ time>; -.fi -This statement allows administrators to specify the RebindTime (T2). -The recommended value for RenewTime is .8 times the shortest preferred -lifetime of the address in the IA, if the value is not defined. - -.nf -.BI prefer-life-time\ <preferred\ lifetime>; -.fi -This statement allows administrators to specify the Preferred Life Time for -each address. - -.nf -.BI valid-life-time\ <valid\ lifetime>; -.fi -This statement allows administrators to specify the Valid Life Time for -each address. - -.nf -.BI option\ dns_server\ <ipv6\ addresses\ or\ domain\ name\ list>; -.fi -This statement allows administrators to specify the DNS servers. - -.B send\ <OPTION>; -.fi -This declaration enables dhcp6s to include the specified option in sending -DHCPv6 messages. - -.nf -\fIsend\ unicast;\fR -.fi -This declaration enables dhcp6s to send a Server Unicast option. Usually -DHCPv6 clients must use multicast addresses to contact the DHCPv6 server and -agents. This declaration specifies that dhcp6s will accept unicast messages -from DHCPv6 clients if they include a Server Unicast option. - -.nf -\fIsend\ server-preference\ <server\ preference\ value>;\fR -.fi -This declaration enables dhcp6s to include a Preference option for sending -DHCPv6 messages. DHCPv6 clients will pick up the DHCPv6 server which has -highest preference value. The highest preference value is 255. - -.nf -\fIsend\ temp-address;\fR -.fi -This declaration assigns a temporary address to the requesting client. - -.nf -\fIsend\ information-only;\fR -.fi -This option enables dhcp6s to give only configuration information rather than -assigning client addresses. This could be, for example, DNS server address -configuration information. - -.nf -.B allow\ <OPTION>; -.fi -This declaration allows the DHCPv6 client to specify an option in receiving -DHCPv6 messages. - -.nf -\fIallow rapid\-commit;\fR -.fi -This option enables dhcp6s to allow the Rapid-Commit option from the DHCPv6 -client and the Solicit-Reply message exchanges. - -.nf -\fIallow\ unicast;\fR -.fi -This option enables dhcp6s to allow the Server Unicast option for the DHCPv6 -client. Usually DHCPv6 clients must use multicast addresses to contact DHCPv6 -server and agents. With this declaration, dhcp6s accepts unicast -messages from DHCPv6 clients if they include a Server Unicast option. - -.SH EXAMPLES -.PP -This is a sample of the dhcp6s.conf file. -.nf -.B option dns\_server 2003::6:1 ibm.com; -.B prefer\-life\-time 10000; -.B valid\-life\-time 20000; -.B renew\-time 5000; -.B rebind\-time 8000; -.B interface eth1 { -.B \tlink AAA { -.B \t\tallow unicast; -.B \t\tsend unicast; -.B \t\tallow rapid-commit; -.B \t\tsend server-preference 5; -.B \t\trenew-time 1000; -.B \t\trebind-time 2400; -.B \t\tprefer-life-time 2000; -.B \t\tvalid-life-time 3000; -.B \t\trange 3ffe:ffff:100::10 to 3ffe:ffff:100::110/64; -.B \t\tprefix 3ffe:ffef:104::/64; -.B \t\tpool { -.B \t\t\tprefer\-life\-time 3600; -.B \t\t\tvalid\-life\-time 7200; -.B \t\t\trange fec0:ffff::10 to fec0:ffff::110/64; -.B \t\t\tprefix fec0:fffe::/48; -.B \t\t}; -.B \t}; -.B \thost host0 { -.B \t\tduid 00:00:00:00:a0:a0; -.B \t\tiaidinfo { -.B \t\t\tiaid 101010; -.B \t\t\trenew-time 1000; -.B \t\t\trebind-time 2000; -.B \t\t}; -.B \t\taddress { -.B \t\t\t3ffe:ffff:102::120/64; -.B \t\t\tprefer-life-time 2000; -.B \t\t\tvalid-life-time 3000; -.B \t\t}; -.B \t}; -.B \tgroup { -.B \t\tprefer\-life\-time 5000; -.B \t\tvalid\-life\-time 6000; -.B \t\thost host1 { -.B \t\t\tduid 00:00:00:00:a1:a1; -.B \t\t\tiaidinfo { -.B \t\t\t\tiaid 101011; -.B \t\t\t\trenew-time 1000; -.B \t\t\t\trebind-time 2000; -.B \t\t\t}; -.B \t\t}; -.B \t\thost host2 { -.B \t\t\tduid 00:00:00:00:a2:a2; -.B \t\t\tsend information-only; -.B \t\t}; -.B \t}; -.B }; -.fi - -.SH SEE ALSO -Dynamic Host Configuration Protocol for IPv6 (DHCPv6), IPv6 Prefix Options -for DHCPv6, dhcp6s(5) - -.SH AUTHORS -.LP -Kazuo Hiekata <hiekata@yamato.ibm.com> +contains the configuration information of addresses, prefixes, or +various network configuration parameters for each of the interfaces. +The network configuration parameters can be described globally for all of +the interfaces. The default address preferred life time is 36000 seconds; +the default address valid life time is 72000 seconds if they are not defined +in any declaration. The specific declaration order is interface, link, host; +within link the more specific declaration is pool. + + The interface definitions are described in the following form: +.PP +.nf +.B \tinterface\ <interface\ name> +.B \t{ +.B \t\t[declarations]; +.B \t}; +.fi + where each of the declarations could be of type link, group, or host. +Each declaration and the statements within each of these declarations +must be terminated by a semicolon. Additional details of the declarations +are specified below. + +.PP +.BI DECLARATIONS +.PP +.nf +.B interface\ <interface\ name> +.B { +.B \t[declarations]; +.B }; +.fi +An interface declaration is used to inform the DHCPv6 server that the links and +hosts declared within it are connected to the same network segment. Common +network parameters for this network segment can be defined within the interface +declaration. + +.nf +.B link\ <link\ name> +.B { +.B \t[declarations]; +.B }; +.fi +A link declaration is used to provide the DHCPv6 server the IPv6 assgined +address ranges, prefixes, and hosts. Common network parameters for this link +can be defined within the link declaration. + +.nf +.B group +.B { +.B \t[declarations]; +.B }; +.fi +A group declaration is used to group a list of declarations together to define +the common network parameters. These network parameters are valid within this +declaration only. Declarations can be one of the following types: interface, link, +pool, or host. + +.nf +.B pool +.B { +.B \t[declarations]; +.B }; +.fi +The pool declaration is used to declare an address pool from which IPv6 +address can be allocated, with its own permit to control client access +and its own declaration in which you can declare pool-specific network parameters. + +.nf +.B host\ <host\ name> +.B { +.B \t[duid\ <DUID\n>]; +.B \t[iaidinfo\ {}]; +.B \t[address\ {}]; +.B \t[prefix\ <prefix>/<prefix\ length>]; +.B \t[declarations]; +.B }; +.fi +This declaration allows administrators to describe the addresses, prefixes, and +network configuration parameters for this host. As for this declaration, the +DHCP Unique Identifier (DUID), Identity Association Identifier (IAID), and +addresses must be specified. The host declaration is used to do Static +Address Assginment for a particular DHCPv6 client. + +.nf +.B address +.B { +.B \t[<ipv6 address>/<prefix length>]; +.B \t[prefer-life-time\ <preferred\ lifetime>]; +.B \t[valid-life-time\ <valid\ lifetime>]; +.B }; +.fi +This statement allows administrators to specify the address for the +host. Preferred Lifetime and Valid Lifetime also can be set in this +statement. This statement is valid only in host {} declarations. + +.nf +.B prefix\ <prefix>/<prefix\ length>; +.fi +This statement allows administrators to specify the prefix. +This parameter is needed when configuring dhcp6s as the Delegation Router for +the Prefix Delegation. dhcp6s assigns the specified prefixes +to the requesting routers. + +.nf +.B relay\ <relay>/<prefix\ length>; +.fi +This statement specifies the prefix that the relay agent will put in the link +address field of the RELAY-FORW message to indicate the link the client is +attached to. If the link-address matches this prefix, this link declaration +will be used. This statement is only valid in the link declaration. + +.nf +.B iaidinfo +.B { +.B \t[iaid\ <IAID\ number>]; +.B \t[renew-time\ <renew\ time>]; +.B \t[rebind-time\ <rebind\ time>]; +.B }; +.fi +This statement allows administrators to describe the information for +this IAID. This statement is only valid in host {} declarations. +iaid is required; renew-time and rebind time are optional in this statement. + +.nf +.B range\ <ipv6\ address>\ to\ <ipv6\ address>/<prefix\ length>; +.fi +This statement allows adminstrators to use "range" and "to" keywords and +prefix length to specify an address range. +For each range not more than one of the unassigned addresses will be +assgined to the requested client. + +.nf +.B duid\ <DUID\>; +.fi +DUID is a DHCP Unique Identifier for a DHCP participant. Using this option, +the administrator can specify the DUID of this DHCPv6 client. +The duid statement is valid only in host {} declarations. + +.nf +.BI iaid\ <IAID\ number>; +.fi +IAID is a Identity Association Identifier. IA is a collection of addresses +assigned to a client. Using this option, the administrator can specify the IAID +in iaidinfo for a host declaration. + +.nf +.BI renew-time\ <renew\ time>; +.fi +This statement allows administrators to specify the RenewTime (T1). +The recommended value for RenewTime is .5 times the shortest preferred +lifetime of the address in the IA, if the value is not defined. + +.nf +.BI rebind-time\ <rebind\ time>; +.fi +This statement allows administrators to specify the RebindTime (T2). +The recommended value for RenewTime is .8 times the shortest preferred +lifetime of the address in the IA, if the value is not defined. + +.nf +.BI prefer-life-time\ <preferred\ lifetime>; +.fi +This statement allows administrators to specify the Preferred Life Time for +each address. + +.nf +.BI valid-life-time\ <valid\ lifetime>; +.fi +This statement allows administrators to specify the Valid Life Time for +each address. + +.nf +.BI option\ dns_server\ <ipv6\ addresses\ or\ domain\ name\ list>; +.fi +This statement allows administrators to specify the DNS servers. + +.B send\ <OPTION>; +.fi +This declaration enables dhcp6s to include the specified option in sending +DHCPv6 messages. + +.nf +\fIsend\ unicast;\fR +.fi +This declaration enables dhcp6s to send a Server Unicast option. Usually +DHCPv6 clients must use multicast addresses to contact the DHCPv6 server and +agents. This declaration specifies that dhcp6s will accept unicast messages +from DHCPv6 clients if they include a Server Unicast option. + +.nf +\fIsend\ server-preference\ <server\ preference\ value>;\fR +.fi +This declaration enables dhcp6s to include a Preference option for sending +DHCPv6 messages. DHCPv6 clients will pick up the DHCPv6 server which has +highest preference value. The highest preference value is 255. + +.nf +\fIsend\ temp-address;\fR +.fi +This declaration assigns a temporary address to the requesting client. + +.nf +\fIsend\ information-only;\fR +.fi +This option enables dhcp6s to give only configuration information rather than +assigning client addresses. This could be, for example, DNS server address +configuration information. + +.nf +.B allow\ <OPTION>; +.fi +This declaration allows the DHCPv6 client to specify an option in receiving +DHCPv6 messages. + +.nf +\fIallow rapid\-commit;\fR +.fi +This option enables dhcp6s to allow the Rapid-Commit option from the DHCPv6 +client and the Solicit-Reply message exchanges. + +.nf +\fIallow\ unicast;\fR +.fi +This option enables dhcp6s to allow the Server Unicast option for the DHCPv6 +client. Usually DHCPv6 clients must use multicast addresses to contact DHCPv6 +server and agents. With this declaration, dhcp6s accepts unicast +messages from DHCPv6 clients if they include a Server Unicast option. + + +.nf +\fIuse-ra-prefix;\fR +.fi +This declaration tells the server not to send clients the address prefix configured +in address or range statements. With this option, client address prefixes can +be set only by router advertisements, and the prefix configured in address or +range statements will be ignored. This is a Red Hat extension; previously, the +only way to set client address prefixes was by router advertisement. + +.SH EXAMPLES +.PP +This is a sample of the dhcp6s.conf file. +.nf +.B option dns\_server 2003::6:1 ibm.com; +.B prefer\-life\-time 10000; +.B valid\-life\-time 20000; +.B renew\-time 5000; +.B rebind\-time 8000; +.B interface eth1 { +.B \tlink AAA { +.B \t\tallow unicast; +.B \t\tsend unicast; +.B \t\tallow rapid-commit; +.B \t\tsend server-preference 5; +.B \t\trenew-time 1000; +.B \t\trebind-time 2400; +.B \t\tprefer-life-time 2000; +.B \t\tvalid-life-time 3000; +.B \t\trange 3ffe:ffff:100::10 to 3ffe:ffff:100::110/64; +.B \t\tprefix 3ffe:ffef:104::/64; +.B \t\tpool { +.B \t\t\tprefer\-life\-time 3600; +.B \t\t\tvalid\-life\-time 7200; +.B \t\t\trange fec0:ffff::10 to fec0:ffff::110/64; +.B \t\t\tprefix fec0:fffe::/48; +.B \t\t}; +.B \t}; +.B \thost host0 { +.B \t\tduid 00:00:00:00:a0:a0; +.B \t\tiaidinfo { +.B \t\t\tiaid 101010; +.B \t\t\trenew-time 1000; +.B \t\t\trebind-time 2000; +.B \t\t}; +.B \t\taddress { +.B \t\t\t3ffe:ffff:102::120/64; +.B \t\t\tprefer-life-time 2000; +.B \t\t\tvalid-life-time 3000; +.B \t\t}; +.B \t}; +.B \tgroup { +.B \t\tprefer\-life\-time 5000; +.B \t\tvalid\-life\-time 6000; +.B \t\thost host1 { +.B \t\t\tduid 00:00:00:00:a1:a1; +.B \t\t\tiaidinfo { +.B \t\t\t\tiaid 101011; +.B \t\t\t\trenew-time 1000; +.B \t\t\t\trebind-time 2000; +.B \t\t\t}; +.B \t\t}; +.B \t\thost host2 { +.B \t\t\tduid 00:00:00:00:a2:a2; +.B \t\t\tsend information-only; +.B \t\t}; +.B \t}; +.B }; +.fi + +.SH SEE ALSO +Dynamic Host Configuration Protocol for IPv6 (DHCPv6), IPv6 Prefix Options +for DHCPv6, dhcp6s(5) + +.SH AUTHORS +.LP +Kazuo Hiekata <hiekata@yamato.ibm.com> --- dhcp-0.10/client6_token.l.prefix_bz196429 2006-07-19 01:30:48.000000000 -0400 +++ dhcp-0.10/client6_token.l 2006-07-19 01:30:48.000000000 -0400 @@ -158,6 +158,7 @@ /* generic options */ <S_CNF>information-only { DECHO; return (INFO_ONLY); } <S_CNF>temp-address { DECHO; return (TEMP_ADDR); } +<S_CNF>use-ra-prefix { DECHO; return (USE_RA_PREFIX); } /* duration */ <S_CNF>infinity { DECHO; return (INFINITY); } --- dhcp-0.10/dhcp6s.c.prefix_bz196429 2006-07-19 01:30:48.000000000 -0400 +++ dhcp-0.10/dhcp6s.c 2006-07-19 01:30:48.000000000 -0400 @@ -1024,7 +1024,27 @@ memset(dh6, 0, sizeof(*dh6)); dh6->dh6_msgtypexid = origmsg->dh6_msgtypexid; dh6->dh6_msgtype = (u_int8_t)type; + + if ( optinfo->flags & DHCIFF_REQUEST_PREFIX ) + { + if ( ! ( (subnet && (subnet->linkscope.use_ra_prefix)) + ||(host && (host->hostscope.use_ra_prefix)) + ) + ) + { + struct interface *ifnetwork; + int no_use_ra_prefix = 1; + for (ifnetwork = globalgroup->iflist; ifnetwork; ifnetwork = ifnetwork->next) + { + if ( ( ifp->ifname && ( strcmp( &(ifnetwork->name[0]), ifp->ifname ) == 0 ) ) + &&(ifnetwork->ifscope.use_ra_prefix) + ) no_use_ra_prefix = 0; + } + if ( no_use_ra_prefix ) + roptinfo->flags |= DHCIFF_RESPOND_PREFIX; + } + } /* set options in the reply message */ if ((optlen = dhcp6_set_options((struct dhcp6opt *)(dh6 + 1), (struct dhcp6opt *)(replybuf + --- dhcp-0.10/config.h.prefix_bz196429 2006-07-19 01:30:48.000000000 -0400 +++ dhcp-0.10/config.h 2006-07-19 01:30:48.000000000 -0400 @@ -96,18 +96,21 @@ #define DHCIFF_TEMP_ADDRS 0x4 #define DHCIFF_PREFIX_DELEGATION 0x8 #define DHCIFF_UNICAST 0x10 - +#define DHCIFF_REQUEST_PREFIX 0x20 +#define DHCIFF_RESPOND_PREFIX 0x40 struct in6_addr linklocal; int server_pref; /* server preference (server only) */ + int use_ra_prefix; + struct dhcp6_list reqopt_list; /* request specific addresses list from client */ struct dhcp6_list addr_list; struct dhcp6_list prefix_list; struct dhcp6_option_list option_list; struct dhcp6_serverinfo *current_server; - struct dhcp6_serverinfo *servers; + struct dhcp6_serverinfo *servers; }; struct dhcp6_event { @@ -176,6 +179,8 @@ struct dhcp6_list reqopt_list; struct dhcp6_option_list option_list; + + int use_ra_prefix; }; struct prefix_ifconf { @@ -282,7 +287,7 @@ DECL_ADDRESS, DECL_LINKLOCAL, DECL_PREFIX_INFO, DECL_PREFIX_REQ, DECL_PREFIX_DELEGATION_INTERFACE, DHCPOPT_PREFIX_DELEGATION, IFPARAM_SLA_ID, IFPARAM_SLA_LEN, DHCPOPT_RAPID_COMMIT, - DHCPOPT_DNS, ADDRESS_LIST_ENT }; + DHCPOPT_DNS, ADDRESS_LIST_ENT, DECL_USE_RA_PREFIX }; typedef enum {DHCP6_MODE_SERVER, DHCP6_MODE_CLIENT, DHCP6_MODE_RELAY } dhcp6_mode_t; --- dhcp-0.10/client6_parse.y.prefix_bz196429 2006-07-19 01:30:48.000000000 -0400 +++ dhcp-0.10/client6_parse.y 2006-07-19 01:44:35.000000000 -0400 @@ -93,8 +93,8 @@ %token INTERFACE IFNAME IPV6ADDR %token REQUEST SEND %token RAPID_COMMIT PREFIX_DELEGATION DNS_SERVERS -%token INFO_ONLY TEMP_ADDR -%token ADDRESS PREFIX IAID RENEW_TIME REBIND_TIME V_TIME P_TIME PREFIX_DELEGATION_INTERFACE +%token INFO_ONLY TEMP_ADDR USE_RA_PREFIX +%token ADDRESS PREFIX IAID RENEW_TIME REBIND_TIME V_TIME P_TIME PREFIX_DELEGATION_INTERFACE %token NUMBER SLASH EOS BCL ECL STRING INFINITY %token COMMA OPTION @@ -243,7 +243,17 @@ MAKE_CFLIST(l, DECL_PREFIX_DELEGATION_INTERFACE, pp, NULL ); $$ = l; - } + } + + | USE_RA_PREFIX EOS + { + struct cf_list *l; + + MAKE_CFLIST(l, DECL_USE_RA_PREFIX, NULL, NULL); + /* no value */ + $$ = l; + } + ; dhcpoption: @@ -270,7 +280,7 @@ MAKE_CFLIST(l, DHCPOPT_DNS, NULL, NULL); /* currently no value */ $$ = l; - } + } ; addrdecl: --- dhcp-0.10/dhcp6c.conf.5.prefix_bz196429 2006-07-19 01:30:48.000000000 -0400 +++ dhcp-0.10/dhcp6c.conf.5 2006-07-19 01:37:22.000000000 -0400 @@ -1,176 +1,176 @@ -.\" $Id: dhcp6c.conf.5,v 1.2 2003/03/28 20:16:36 shirleyma Exp $ -.\" -.\" Copyright (C) International Business Machines Corp., 2003 -.\" All rights reserved. -.\" -.\" 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 project 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 PROJECT 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 PROJECT 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. -.\" -.TH dhcp6c.conf 5 "17 March 2003" "dhcp6c.conf" "Linux System Manager's Manual" - -.SH NAME -dhcp6c.conf \- configuration file of the DHCPv6 client daemon, dhcp6c - -.SH DESCRIPTION -.B dhcp6c.conf -is a configuration file for dhcp6c (DHCPv6 client). - -dhcp6c is configured by the configuration information (such as rapid-commit, -requesting temp-address, or prefix-delegation) in this file. -dhcp6c.conf is an ASCII text file and lines that start with # are comments. - -.PP -.BI STATEMENTS -.PP -.nf -.B interface\ <interface\ name> -.B { -.B \t[declarations] -.B }; -.fi -Write configurations for this interface in this statement. -In [declarations], options can be specified. - -.PP -.BI DECLARATIONS -.PP -.nf -.B send\ [dhcpoptions]; -.fi -With this declaration, dhcp6c sends specified options. -Currently rapid\-commit is defined. - -.nf -\fIsend rapid\-commit;\fR -.fi -This declaration enables dhcp6c to request the dhcp6s server to perform a -Rapid Commit. - -.nf -.B request\ [dhcpoptions]; -.fi -This declaration enables dhcp6c to request specified options. -Currently temp\-address, domain\-name\-servers, and prefix\-delegation -are defined. - -.nf -\fIrequest domain\-name\-servers;\fR -.fi -The DHCPv6 mechanism provides a way to obtain configuration information -such as a list of available DNS servers or NTP servers. This declaration -enables dhcp6c to request a DNS server address from the DHCPv6 server. - -.nf -\fIrequest prefix\-delegation;\fR -.fi -This declaration enables dhcp6c to request a Prefix Delegation to the -DHCPv6 server. dhcp6c gets a prefix assignment from the DHCPv6 server. - -.nf -\fIrequest temp\-address;\fR -.fi -This declaration enables dhcp6c to request temporary addresses. -dhcp6c requests Non-temporary Addresses as default. This option makes -dhcp6c request Temporary Addresses. - -.nf -.B information-only; -.fi -This declaration enables dhcp6c to request host configuration information -from the DHCPv6 server. If dhcp6c doesn't need to be assigned any addresses, -this option should be specified. - -.nf -.B address\ { -.B \t[<ipv6\ address>/<prefix\ length>]; -.B \t[prefer-life-time\ <preferred\-lifetime>]; -.B \t[valid-life-time\ <valid\-lifetime>]; -.B }; -.fi -This declaration defines the dhcp6c client preferred IPv6 address, -the preferred lifetime of the address, and the valid lifetime for this -interface. - -.nf -.B prefix\ { -.B \t[<ipv6\ prefix>/<prefix\ length>]; -.B \t[prefer-life-time\ <preferred\-lifetime>]; -.B \t[valid-life-time\ <valid\-lifetime>]; -.B }; -.fi -This declaration defines the dhcp6c client acting as a requesting -router for the preferred prefix, the prefix length, and the prefix's -preferred lifetime, and valid lifetime for this interface. - -.nf -.B prefer-life-time\ <preferred\-lifetime>; -.fi -This declaration sets the preferred lifetime (in seconds) of the address -or prefix. This declaration is valid only in address or prefix declarations. - -.nf -.B valid-life-time\ <valid\-lifetime>; -.fi -This declaration sets the valid lifetime (in seconds) of the address or -prefix. -This declaration is valid only in address or prefix declarations. - -.nf -.B renew-time\ <renew-time>; -.fi -This declaration specifies the Renew Time (in seconds) for this Identity -Association (IA). Renew Time is a T1 value in an IA option. dhcp6c sets the -Renew Time in IA options to the specified value. - -.nf -.B rebind-time\ <rebind-time>; -.fi -This declaration specifies the Rebind Time (in seconds) for this IA. Rebind -Time is T2 value in an IA option. dhcp6c sets the Rebind Time in IA options -to the specified value. - -.PP -.BI DHCPOPTIONS -.PP -.nf -.B rapid\-commit -.fi -If this option is used in a "send [dhcpoptions];" declaration, -dhcp6c sends DHCPv6 messages with a Rapid Commit option. - -.nf -.B domain\-name\-servers -.fi -If this option is used in a "request [dhcpoptions];" declaration, -dhcp6c requests the DNS server address via the DHCPv6 mechanism. - -.nf -.B prefix\-delegation -.fi -If this option is used in a "request [dhcpoptions];" declaration, -dhcp6c requests a Prefix Delegation to the DHCPv6 servers. - +.\" $Id: dhcp6c.conf.5,v 1.2 2003/03/28 20:16:36 shirleyma Exp $ +.\" +.\" Copyright (C) International Business Machines Corp., 2003 +.\" All rights reserved. +.\" +.\" 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 project 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 PROJECT 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 PROJECT 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. +.\" +.TH dhcp6c.conf 5 "17 March 2003" "dhcp6c.conf" "Linux System Manager's Manual" + +.SH NAME +dhcp6c.conf \- configuration file of the DHCPv6 client daemon, dhcp6c + +.SH DESCRIPTION +.B dhcp6c.conf +is a configuration file for dhcp6c (DHCPv6 client). + +dhcp6c is configured by the configuration information (such as rapid-commit, +requesting temp-address, or prefix-delegation) in this file. +dhcp6c.conf is an ASCII text file and lines that start with # are comments. + +.PP +.BI STATEMENTS +.PP +.nf +.B interface\ <interface\ name> +.B { +.B \t[declarations] +.B }; +.fi +Write configurations for this interface in this statement. +In [declarations], options can be specified. + +.PP +.BI DECLARATIONS +.PP +.nf +.B send\ [dhcpoptions]; +.fi +With this declaration, dhcp6c sends specified options. +Currently rapid\-commit is defined. + +.nf +\fIsend rapid\-commit;\fR +.fi +This declaration enables dhcp6c to request the dhcp6s server to perform a +Rapid Commit. + +.nf +.B request\ [dhcpoptions]; +.fi +This declaration enables dhcp6c to request specified options. +Currently temp\-address, domain\-name\-servers, and prefix\-delegation +are defined. + +.nf +\fIrequest domain\-name\-servers;\fR +.fi +The DHCPv6 mechanism provides a way to obtain configuration information +such as a list of available DNS servers or NTP servers. This declaration +enables dhcp6c to request a DNS server address from the DHCPv6 server. + +.nf +\fIrequest prefix\-delegation;\fR +.fi +This declaration enables dhcp6c to request a Prefix Delegation to the +DHCPv6 server. dhcp6c gets a prefix assignment from the DHCPv6 server. + +.nf +\fIrequest temp\-address;\fR +.fi +This declaration enables dhcp6c to request temporary addresses. +dhcp6c requests Non-temporary Addresses as default. This option makes +dhcp6c request Temporary Addresses. + +.nf +.B information-only; +.fi +This declaration enables dhcp6c to request host configuration information +from the DHCPv6 server. If dhcp6c doesn't need to be assigned any addresses, +this option should be specified. + +.nf +.B address\ { +.B \t[<ipv6\ address>/<prefix\ length>]; +.B \t[prefer-life-time\ <preferred\-lifetime>]; +.B \t[valid-life-time\ <valid\-lifetime>]; +.B }; +.fi +This declaration defines the dhcp6c client preferred IPv6 address, +the preferred lifetime of the address, and the valid lifetime for this +interface. + +.nf +.B prefix\ { +.B \t[<ipv6\ prefix>/<prefix\ length>]; +.B \t[prefer-life-time\ <preferred\-lifetime>]; +.B \t[valid-life-time\ <valid\-lifetime>]; +.B }; +.fi +This declaration defines the dhcp6c client acting as a requesting +router for the preferred prefix, the prefix length, and the prefix's +preferred lifetime, and valid lifetime for this interface. + +.nf +.B prefer-life-time\ <preferred\-lifetime>; +.fi +This declaration sets the preferred lifetime (in seconds) of the address +or prefix. This declaration is valid only in address or prefix declarations. + +.nf +.B valid-life-time\ <valid\-lifetime>; +.fi +This declaration sets the valid lifetime (in seconds) of the address or +prefix. +This declaration is valid only in address or prefix declarations. + +.nf +.B renew-time\ <renew-time>; +.fi +This declaration specifies the Renew Time (in seconds) for this Identity +Association (IA). Renew Time is a T1 value in an IA option. dhcp6c sets the +Renew Time in IA options to the specified value. + +.nf +.B rebind-time\ <rebind-time>; +.fi +This declaration specifies the Rebind Time (in seconds) for this IA. Rebind +Time is T2 value in an IA option. dhcp6c sets the Rebind Time in IA options +to the specified value. + +.PP +.BI DHCPOPTIONS +.PP +.nf +.B rapid\-commit +.fi +If this option is used in a "send [dhcpoptions];" declaration, +dhcp6c sends DHCPv6 messages with a Rapid Commit option. + +.nf +.B domain\-name\-servers +.fi +If this option is used in a "request [dhcpoptions];" declaration, +dhcp6c requests the DNS server address via the DHCPv6 mechanism. + +.nf +.B prefix\-delegation +.fi +If this option is used in a "request [dhcpoptions];" declaration, +dhcp6c requests a Prefix Delegation to the DHCPv6 servers. + .nf .B prefix\-delegation\-interface <interface name> Specifies the name of the interface definition in radvd.conf @@ -178,32 +178,41 @@ dhcp6c will write a radvd.conf prefix declaration for the interface on which it receives the prefix delegation lease. -.SH EXAMPLES -.PP -This is a sample of the dhcp6c.conf file. -.nf -.B interface eth0 { -.B \tsend rapid-commit; -.B \trequest prefix-delegation; -.B \trequest domain-name-servers; -.B \trequest temp-address; -.B \tiaid 11111; -.B \taddress { -.B \t\t3ffe:10::10/64; -.B \t\tprefer-life-time 6000; -.B \t\tvalid-life-time 8000; -.B \t}; -.B \trenew-time 11000; -.B \trebind-time 21000; -.B }; -.fi - -.SH SEE ALSO -Dynamic Host Configuration Protocol for IPv6 (DHCPv6), IPv6 Prefix Options -for DHCPv6, dhcp6c(5) - -.SH AUTHORS -.LP -Kazuo Hiekata <hiekata@yamato.ibm.com> - - +.nf +\fIuse-ra-prefix;\fR +.fi +This declaration tells the client not to request the address prefix configured +in the server's address or range statements. With this option, client address +prefixes can be set only by router advertisements, and the prefix configured in +server address or range statements will be ignored. This is a Red Hat extension; +previously, the only way to set client address prefixes was by router advertisement. + +.SH EXAMPLES +.PP +This is a sample of the dhcp6c.conf file. +.nf +.B interface eth0 { +.B \tsend rapid-commit; +.B \trequest prefix-delegation; +.B \trequest domain-name-servers; +.B \trequest temp-address; +.B \tiaid 11111; +.B \taddress { +.B \t\t3ffe:10::10/64; +.B \t\tprefer-life-time 6000; +.B \t\tvalid-life-time 8000; +.B \t}; +.B \trenew-time 11000; +.B \trebind-time 21000; +.B }; +.fi + +.SH SEE ALSO +Dynamic Host Configuration Protocol for IPv6 (DHCPv6), IPv6 Prefix Options +for DHCPv6, dhcp6c(5) + +.SH AUTHORS +.LP +Kazuo Hiekata <hiekata@yamato.ibm.com> + + --- dhcp-0.10/server6_token.l.prefix_bz196429 2003-07-16 15:09:53.000000000 -0400 +++ dhcp-0.10/server6_token.l 2006-07-19 01:30:48.000000000 -0400 @@ -118,6 +118,7 @@ valid-life-time { return VALIDLIFETIME; } prefer-life-time { return PREFERLIFETIME; } server-preference { return PREFERENCE; } +use-ra-prefix { return USE_RA_PREFIX; } to { return TO; } infinity { return INFINITY; } --- dhcp-0.10/server6_conf.h.prefix_bz196429 2003-04-30 15:04:14.000000000 -0400 +++ dhcp-0.10/server6_conf.h 2006-07-19 01:30:48.000000000 -0400 @@ -50,6 +50,7 @@ u_int8_t send_flags; u_int8_t allow_flags; struct dns_list dnslist; + u_int8_t use_ra_prefix; }; struct scopelist { --- dhcp-0.10/server6_parse.y.prefix_bz196429 2006-07-19 01:30:48.000000000 -0400 +++ dhcp-0.10/server6_parse.y 2006-07-19 01:30:48.000000000 -0400 @@ -107,6 +107,7 @@ %token <str> IAID IAIDINFO %token <str> INFO_ONLY %token <str> TO +%token <str> USE_RA_PREFIX %token <str> BAD_TOKEN %type <str> name @@ -903,6 +904,15 @@ dprintf(LOG_ERR, "%s" "bad server preference number", FNAME); currentscope->scope->server_pref = $2; } + | USE_RA_PREFIX ';' + { + if (!currentscope) { + currentscope = push_double_list(currentscope, &globalgroup->scope); + if (currentscope == NULL) + ABORT; + } + currentscope->scope->use_ra_prefix = 1; + } ; number_or_infinity --- dhcp-0.10/common.c.prefix_bz196429 2006-07-19 01:30:48.000000000 -0400 +++ dhcp-0.10/common.c 2006-07-19 01:30:48.000000000 -0400 @@ -1046,6 +1046,11 @@ goto malformed; optinfo->flags |= DHCIFF_RAPID_COMMIT; break; + case DH6OPT_REQUEST_PREFIX: + if (optlen != 0) + goto malformed; + optinfo->flags |= DHCIFF_REQUEST_PREFIX; + break; case DH6OPT_UNICAST: if (optlen != sizeof(struct in6_addr) && dhcp6_mode != DHCP6_MODE_CLIENT) @@ -1222,7 +1227,6 @@ memcpy(&addr6.addr, (struct in6_addr *)cp, sizeof(struct in6_addr)); addr6.preferlifetime = ntohl(ai.preferlifetime); addr6.validlifetime = ntohl(ai.validlifetime); - addr6.plen = ai.plen; dprintf(LOG_DEBUG, " get IAADR address information: " "%s preferlifetime %d validlifetime %d", in6addr2str(&addr6.addr, 0), @@ -1235,6 +1239,12 @@ "(%d)", addr6.preferlifetime, addr6.validlifetime); goto malformed; } + if ( optlen & 1 ) + { + addr6.plen = *(p + sizeof(ai)); + optlen -= 1; + p++; + } if (optlen == sizeof(ai) - sizeof(u_int32_t)) { addr6.status_code = DH6OPT_STCODE_UNDEFINE; break; @@ -1380,6 +1390,9 @@ if (optinfo->flags & DHCIFF_RAPID_COMMIT) COPY_OPTION(DH6OPT_RAPID_COMMIT, 0, "", p); + if (optinfo->flags & DHCIFF_REQUEST_PREFIX) + COPY_OPTION(DH6OPT_REQUEST_PREFIX, 0, "", p); + if ((dhcp6_mode == DHCP6_MODE_SERVER) && (optinfo->flags & DHCIFF_UNICAST)) { if (!IN6_IS_ADDR_UNSPECIFIED(&optinfo->server_addr)) { COPY_OPTION(DH6OPT_UNICAST, sizeof(optinfo->server_addr), @@ -1432,27 +1445,40 @@ if (!TAILQ_EMPTY(&optinfo->addr_list)) { for (dp = TAILQ_FIRST(&optinfo->addr_list); dp; dp = TAILQ_NEXT(dp, link)) { - int iaddr_len = 0; + int iaddr_len = + (dp->val_dhcp6addr.plen && + ( optinfo->flags & DHCIFF_RESPOND_PREFIX ) + ) ? 1 : 0; memset(&ai, 0, sizeof(ai)); ai.dh6_ai_type = htons(DH6OPT_IADDR); if (dp->val_dhcp6addr.status_code != DH6OPT_STCODE_UNDEFINE) - iaddr_len = sizeof(ai) - sizeof(u_int32_t) + iaddr_len += sizeof(ai) - sizeof(u_int32_t) + sizeof(status); else - iaddr_len = sizeof(ai) - sizeof(u_int32_t); + iaddr_len += sizeof(ai) - sizeof(u_int32_t); ai.dh6_ai_len = htons(iaddr_len); ai.preferlifetime = htonl(dp->val_dhcp6addr.preferlifetime); ai.validlifetime = htonl(dp->val_dhcp6addr.validlifetime); - ai.plen = dp->val_dhcp6addr.plen; memcpy(&ai.addr, &dp->val_dhcp6addr.addr, sizeof(ai.addr)); memcpy(tp, &ai, sizeof(ai)); tp += sizeof(ai); + if( dp->val_dhcp6addr.plen && + ( optinfo->flags & DHCIFF_RESPOND_PREFIX ) + ) + { + *tp = dp->val_dhcp6addr.plen; + optlen += 1; + ++tp; + } dprintf(LOG_DEBUG, "set IADDR address option len %d: " - "%s preferlifetime %d validlifetime %d", + "%s preferlifetime %d validlifetime %d prefix:%d", iaddr_len, in6addr2str(&ai.addr, 0), ntohl(ai.preferlifetime), - ntohl(ai.validlifetime)); + ntohl(ai.validlifetime), + ( optinfo->flags & DHCIFF_RESPOND_PREFIX ) + ? dp->val_dhcp6addr.plen : 0 + ); /* set up address status code if any */ if (dp->val_dhcp6addr.status_code != DH6OPT_STCODE_UNDEFINE) { status.dh6_status_type = htons(DH6OPT_STATUS_CODE); @@ -1465,6 +1491,8 @@ dhcp6_stcodestr(ntohs(status.dh6_status_code))); optlen += sizeof(status); tp += sizeof(status); + dprintf(LOG_DEBUG, "set IADDR status len %d optlen: %d", + sizeof(status), optlen); /* XXX: copy status message if any */ } } --- dhcp-0.10/client6_addr.c.prefix_bz196429 2006-07-19 01:30:48.000000000 -0400 +++ dhcp-0.10/client6_addr.c 2006-07-19 01:30:48.000000000 -0400 @@ -110,8 +110,11 @@ /* add new address */ for (lv = TAILQ_FIRST(&optinfo->addr_list); lv; lv = lv_next) { lv_next = TAILQ_NEXT(lv, link); -/* - if (lv->val_dhcp6addr.type != IAPD) { + + if ( (lv->val_dhcp6addr.type != IAPD) + &&(lv->val_dhcp6addr.plen == 0) + ) + { lv->val_dhcp6addr.plen = dhcp6_get_prefixlen(&lv->val_dhcp6addr.addr, dhcp6_if); if (lv->val_dhcp6addr.plen == PREFIX_LEN_NOTINRA) { @@ -121,7 +124,7 @@ in6addr2str(&lv->val_dhcp6addr.addr, 0)); } } -*/ + if ((cl_lease = dhcp6_find_lease(&client6_iaidaddr, &lv->val_dhcp6addr)) != NULL) { dhcp6_update_lease(&lv->val_dhcp6addr, cl_lease); @@ -337,17 +340,21 @@ /* flag == ADDR_UPDATE */ for (lv = TAILQ_FIRST(&optinfo->addr_list); lv; lv = lv_next) { lv_next = TAILQ_NEXT(lv, link); -/* - if (lv->val_dhcp6addr.type != IAPD) { + + if ( (lv->val_dhcp6addr.type != IAPD) + &&(lv->val_dhcp6addr.plen == 0) + ) + { lv->val_dhcp6addr.plen = dhcp6_get_prefixlen(&lv->val_dhcp6addr.addr, dhcp6_if); if (lv->val_dhcp6addr.plen == PREFIX_LEN_NOTINRA) { dprintf(LOG_WARNING, "assigned address %s is not in any RAs" " prefix length using 64 bit instead", in6addr2str(&lv->val_dhcp6addr.addr, 0)); + } } -*/ + if ((cl = dhcp6_find_lease(&client6_iaidaddr, &lv->val_dhcp6addr)) != NULL) { /* update leases */ dhcp6_update_lease(&lv->val_dhcp6addr, cl); --- dhcp-0.10/config.c.prefix_bz196429 2006-07-19 01:30:48.000000000 -0400 +++ dhcp-0.10/config.c 2006-07-19 01:30:48.000000000 -0400 @@ -195,6 +195,9 @@ goto bad; } break; + case DECL_USE_RA_PREFIX: + ifc->use_ra_prefix = 1; + break; default: dprintf(LOG_ERR, "%s" "%s:%d " "invalid interface configuration", @@ -478,6 +481,8 @@ ifp->server_pref = ifc->server_pref; + ifp->use_ra_prefix = ifc->use_ra_prefix; + memcpy(&ifp->iaidinfo, &ifc->iaidinfo, sizeof(ifp->iaidinfo)); } } --- dhcp-0.10/server6_conf.c.prefix_bz196429 2004-03-15 17:03:52.000000000 -0500 +++ dhcp-0.10/server6_conf.c 2006-07-19 01:30:48.000000000 -0400 @@ -293,6 +293,8 @@ dhcp6_copy_list(¤t->dnslist.addrlist, &up->dnslist.addrlist); if (current->dnslist.domainlist == NULL) current->dnslist.domainlist = up->dnslist.domainlist; + if ( current->use_ra_prefix ) + up->use_ra_prefix = 1; return; }