rpms/dhcpv6/devel dhcpv6-0.10-prefix_bz196429.patch, NONE, 1.1 dhcpv6-0.10-libdhcp6client.patch, 1.6, 1.7 dhcpv6-0.10-salen.patch, 1.1, 1.2 dhcpv6.spec, 1.40, 1.41
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Wed Jul 19 06:46:06 UTC 2006
Author: jvdias
Update of /cvs/dist/rpms/dhcpv6/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv16563
Modified Files:
dhcpv6-0.10-libdhcp6client.patch dhcpv6-0.10-salen.patch
dhcpv6.spec
Added Files:
dhcpv6-0.10-prefix_bz196429.patch
Log Message:
fix bug 196429
dhcpv6-0.10-prefix_bz196429.patch:
client6_addr.c | 19 +
client6_parse.y | 18 +
client6_token.l | 1
common.c | 42 ++-
config.c | 5
config.h | 11
dhcp6.h | 4
dhcp6c.c | 6
dhcp6c.conf.5 | 413 +++++++++++++++++-----------------
dhcp6s.c | 20 +
dhcp6s.conf.5 | 668 ++++++++++++++++++++++++++++----------------------------
server6_conf.c | 2
server6_conf.h | 1
server6_parse.y | 10
server6_token.l | 1
15 files changed, 668 insertions(+), 553 deletions(-)
--- NEW FILE dhcpv6-0.10-prefix_bz196429.patch ---
--- 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 at 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 at 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 at 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 at 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;
}
dhcpv6-0.10-libdhcp6client.patch:
client6_addr.c | 61 +++++--
common.c | 37 +++-
dhc6_alloc.c | 67 ++++++++
dhc6_alloc.h | 17 ++
dhcp6.h | 17 +-
dhcp6c.c | 447 +++++++++++++++++++++++++++++++++++++++++++++++-------
dhcp6client.h | 22 ++
lease.c | 10 -
lease.h | 2
lease_token.l | 3
libdhcp_control.h | 104 ++++++++++++
11 files changed, 705 insertions(+), 82 deletions(-)
Index: dhcpv6-0.10-libdhcp6client.patch
===================================================================
RCS file: /cvs/dist/rpms/dhcpv6/devel/dhcpv6-0.10-libdhcp6client.patch,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- dhcpv6-0.10-libdhcp6client.patch 22 Jun 2006 17:23:31 -0000 1.6
+++ dhcpv6-0.10-libdhcp6client.patch 19 Jul 2006 06:46:03 -0000 1.7
@@ -1,6 +1,17 @@
-diff -urN dhcp-0.10.orig/libdhcp6client/client6_addr.c dhcp-0.10/libdhcp6client/client6_addr.c
---- dhcp-0.10.orig/libdhcp6client/client6_addr.c 2006-06-22 11:45:08.000000000 -0400
-+++ dhcp-0.10/libdhcp6client/client6_addr.c 2006-06-22 11:46:51.000000000 -0400
+--- dhcp-0.10/libdhcp6client/lease_token.l.libdhcp6client 2004-02-04 18:29:24.000000000 -0500
++++ dhcp-0.10/libdhcp6client/lease_token.l 2006-07-19 01:30:57.000000000 -0400
+@@ -241,6 +241,9 @@
+
+ fseek(file, 0, 0);
+ yyin = file;
++ yy_init=1;
++ yy_start=0;
++ yy_current_buffer=0;
+ yylex();
+ return;
+ }
+--- dhcp-0.10/libdhcp6client/client6_addr.c.libdhcp6client 2006-07-19 01:30:48.000000000 -0400
++++ dhcp-0.10/libdhcp6client/client6_addr.c 2006-07-19 01:30:57.000000000 -0400
@@ -56,6 +56,10 @@
#include "timer.h"
#include "lease.h"
@@ -12,7 +23,7 @@
static int dhcp6_update_lease __P((struct dhcp6_addr *, struct dhcp6_lease *));
static int dhcp6_add_lease __P((struct dhcp6_addr *));
struct dhcp6_lease *dhcp6_find_lease __P((struct dhcp6_iaidaddr *,
-@@ -217,7 +221,7 @@
+@@ -220,7 +224,7 @@
sp->iaidaddr = &client6_iaidaddr;
time(&sp->start_date);
sp->state = ACTIVE;
@@ -21,7 +32,7 @@
dprintf(LOG_ERR, "%s" "failed to write a new lease address %s to lease file",
FNAME, in6addr2str(&sp->lease_addr.addr, 0));
if (sp->timer)
-@@ -228,14 +232,24 @@
+@@ -231,14 +235,24 @@
if (sp->lease_addr.type == IAPD) {
dprintf(LOG_INFO, "request prefix is %s/%d",
in6addr2str(&sp->lease_addr.addr, 0), sp->lease_addr.plen);
@@ -53,7 +64,7 @@
TAILQ_INSERT_TAIL(&client6_iaidaddr.lease_list, sp, link);
/* for infinite lifetime don't do any timer */
if (sp->lease_addr.validlifetime == DHCP6_DURATITION_INFINITE ||
-@@ -282,7 +296,12 @@
+@@ -285,7 +299,12 @@
dprintf(LOG_DEBUG, "%s" "removing address %s", FNAME,
in6addr2str(&sp->lease_addr.addr, 0));
sp->state = INVALID;
@@ -67,7 +78,7 @@
dprintf(LOG_INFO, "%s"
"failed to write removed lease address %s to lease file",
FNAME, in6addr2str(&sp->lease_addr.addr, 0));
-@@ -294,10 +313,17 @@
+@@ -297,10 +316,17 @@
in6addr2str(&sp->lease_addr.addr, 0), sp->lease_addr.plen);
/* XXX: remove from the update prefix list */
@@ -87,7 +98,7 @@
/* remove expired timer for this lease. */
if (sp->timer)
dhcp6_remove_timer(sp->timer);
-@@ -446,7 +472,12 @@
+@@ -453,7 +479,12 @@
memcpy(&sp->lease_addr, addr, sizeof(sp->lease_addr));
sp->state = ACTIVE;
time(&sp->start_date);
@@ -101,7 +112,7 @@
dprintf(LOG_ERR, "%s"
"failed to write an updated lease address %s to lease file",
FNAME, in6addr2str(&sp->lease_addr.addr, 0));
-@@ -670,7 +701,7 @@
+@@ -677,7 +708,7 @@
return (-1);
}
@@ -110,7 +121,7 @@
in6addr2str(&ifaddr->addr, 0), ifp->ifname);
close(s);
return (0);
-@@ -700,7 +731,7 @@
+@@ -707,7 +738,7 @@
create_iaid(struct iaid_table *iaidtab, int num_device)
{
struct iaid_table *temp = iaidtab;
@@ -119,7 +130,7 @@
int i;
if ( getifaddrs( &ifap ) != 0 )
-@@ -709,7 +740,7 @@
+@@ -716,7 +747,7 @@
return -1;
}
@@ -128,258 +139,8 @@
(ifa != 0L) && ( i < MAX_DEVICE );
i++, ifa = ifa->ifa_next
)
-diff -urN dhcp-0.10.orig/libdhcp6client/common.c dhcp-0.10/libdhcp6client/common.c
---- dhcp-0.10.orig/libdhcp6client/common.c 2006-06-22 11:45:08.000000000 -0400
-+++ dhcp-0.10/libdhcp6client/common.c 2006-06-22 11:46:51.000000000 -0400
-@@ -79,11 +79,19 @@
- #include "timer.h"
- #include "lease.h"
-
-+#ifdef LIBDHCP
-+#include "libdhcp_control.h"
-+#endif
-+
- int foreground;
- int debug_thresh;
- struct dhcp6_if *dhcp6_if;
- struct dns_list dnslist;
-+#ifdef LIBDHCP
-+struct host_conf *host_conflist;
-+#else
- static struct host_conf *host_conflist;
-+#endif
- static int in6_matchflags __P((struct sockaddr *, char *, int));
- ssize_t gethwid __P((char *, int, const char *, u_int16_t *));
- static int get_assigned_ipv6addrs __P((char *, char *,
-@@ -645,7 +653,7 @@
- memset(&ifr, 0, sizeof(ifr));
- strncpy(ifr.ifr_name, ifnam, sizeof(ifr.ifr_name));
- ifr.ifr_addr = *(struct sockaddr *)addr;
--
-+ dprintf(LOG_DEBUG,"in6_matchflags: SIOCGIFFLAGS");
- if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) {
- warn("in6_matchflags: ioctl(SIOCGIFFLAGS, %s)",
- addr2str(addr));
-@@ -720,6 +728,9 @@
- struct dhcp6_duid_type1 *dp; /* we only support the type1 DUID */
- char tmpbuf[256]; /* DUID should be no more than 256 bytes */
-
-+#ifdef LIBDHCP
-+ if ( libdhcp_control && (libdhcp_control->capability & DHCP_USE_LEASE_DATABASE))
-+#endif
- if ((fp = fopen(idfile, "r")) == NULL && errno != ENOENT)
- dprintf(LOG_NOTICE, "%s" "failed to open DUID file: %s",
- FNAME, idfile);
-@@ -774,6 +785,9 @@
- }
-
- /* save the (new) ID to the file for next time */
-+#ifdef LIBDHCP
-+ if ( libdhcp_control && (libdhcp_control->capability & DHCP_USE_LEASE_DATABASE))
-+#endif
- if (!fp) {
- if ((fp = fopen(idfile, "w+")) == NULL) {
- dprintf(LOG_ERR, "%s"
-@@ -821,8 +835,13 @@
- return -1;
-
- strcpy(if_hwaddr.ifr_name, ifname);
-+ dprintf(LOG_DEBUG,"gethwid: ioctl SIOCGIFHWADDR");
- if (ioctl(skfd, SIOCGIFHWADDR, &if_hwaddr) < 0)
-+ {
-+ close(skfd);
- return -1;
-+ }
-+ close(skfd);
- /* only support Ethernet */
- switch (if_hwaddr.ifr_hwaddr.sa_family) {
- case ARPHRD_ETHER:
-@@ -938,7 +957,7 @@
- cp = (char *)(p + 1);
- np = (struct dhcp6opt *)(cp + optlen);
-
-- dprintf(LOG_DEBUG, "%s" "get DHCP option %s, len %d",
-+ dprintf(LOG_INFO, "%s" "get DHCP option %s, len %d",
- FNAME, dhcp6optstr(opt), optlen);
-
- /* option length field overrun */
-@@ -1078,7 +1097,7 @@
- ntohl(*(u_int32_t *)(cp + sizeof(u_int32_t)));
- optinfo->iaidinfo.rebindtime =
- ntohl(*(u_int32_t *)(cp + 2 * sizeof(u_int32_t)));
-- dprintf(LOG_DEBUG, "get option iaid is %u, renewtime %u, "
-+ dprintf(LOG_INFO, "get option iaid is %u, renewtime %u, "
- "rebindtime %u", optinfo->iaidinfo.iaid,
- optinfo->iaidinfo.renewtime, optinfo->iaidinfo.rebindtime);
- if (get_assigned_ipv6addrs(cp + 3 * sizeof(u_int32_t),
-@@ -1182,7 +1201,7 @@
- opt = ntohs(opth.dh6opt_type);
- cp = p + sizeof(opth);
- np = cp + optlen;
-- dprintf(LOG_DEBUG, " IA address option: %s, "
-+ dprintf(LOG_INFO, " IA address option: %s, "
- "len %d", dhcp6optstr(opt), optlen);
-
- if (np > ep) {
-@@ -1212,7 +1231,7 @@
- }
- break;
- case DH6OPT_IADDR:
-- if (optlen < sizeof(ai) - sizeof(u_int32_t))
-+ if (optlen < sizeof(ai)- sizeof(u_int32_t))
- goto malformed;
- memcpy(&ai, p, sizeof(ai));
- /* copy the information into internal format */
-@@ -1221,7 +1240,7 @@
- addr6.preferlifetime = ntohl(ai.preferlifetime);
- addr6.validlifetime = ntohl(ai.validlifetime);
- addr6.plen = ai.plen;
-- dprintf(LOG_DEBUG, " get IAADR address information: "
-+ dprintf(LOG_INFO, " get IAADR address information: "
- "%s preferlifetime %d validlifetime %d",
- in6addr2str(&addr6.addr, 0),
- addr6.preferlifetime, addr6.validlifetime);
-@@ -1998,8 +2017,16 @@
- va_list ap;
- char logbuf[LINE_MAX];
-
-+#if LIBDHCP
-+ va_start(ap, fmt);
-+ if ( libdhcp_control && libdhcp_control->eh )
-+ libdhcp_control->eh(libdhcp_control, level, fmt, ap);
-+ va_end(ap);
-+ return;
-+#endif
- va_start(ap, fmt);
- vsnprintf(logbuf, sizeof(logbuf), fmt, ap);
-+ va_end(ap);
-
- if (foreground && debug_thresh >= level) {
- time_t now;
-diff -urN dhcp-0.10.orig/libdhcp6client/dhc6_alloc.c dhcp-0.10/libdhcp6client/dhc6_alloc.c
---- dhcp-0.10.orig/libdhcp6client/dhc6_alloc.c 1969-12-31 19:00:00.000000000 -0500
-+++ dhcp-0.10/libdhcp6client/dhc6_alloc.c 2006-06-22 11:46:51.000000000 -0400
-@@ -0,0 +1,67 @@
-+#include <malloc.h>
-+#include <search.h>
-+extern void tdestroy (void *root, void (*free_node)(void *nodep));
-+void *ifp_ptr;
-+
-+static void *ptr_tree=0L;
-+
-+static int ptr_comparator( const void *p1, const void *p2 )
-+{
-+ return
-+ ( (p1 == p2)
-+ ? 0
-+ :( (p1 > p2)
-+ ? 1
-+ : -1
-+ )
-+ );
-+}
-+
-+void *dhc6_alloc( size_t s )
-+{
-+ void *ptr = malloc( s );
-+ if ( ptr != 0 )
-+ tsearch(ptr, &(ptr_tree), ptr_comparator);
-+ return ptr;
-+}
-+
-+void *dhc6_realloc( void *ptr, size_t s )
-+{
-+ void *ptr2 = realloc(ptr, s);
-+ if ( ptr2 != 0 )
-+ {
-+ if ( ptr != 0 )
-+ tdelete(ptr,&(ptr_tree), ptr_comparator);
-+ tsearch(ptr2, &(ptr_tree), ptr_comparator);
-+ }
-+ return ptr2;
-+}
-+
-+void *dhc6_calloc( size_t n, size_t s )
-+{
-+ void *ptr = calloc( n, s );
-+ if ( ptr != 0 )
-+ tsearch(ptr, &(ptr_tree), ptr_comparator);
-+ return ptr;
-+}
-+
-+char *dhc6_strdup( char *str )
-+{
-+ char *ptr = strdup( str );
-+ if ( ptr != 0 )
-+ tsearch(ptr, &(ptr_tree), ptr_comparator);
-+ return ptr;
-+}
-+
-+void dhc6_free( void *ptr )
-+{
-+ free(ptr);
-+ tdelete(ptr, &(ptr_tree), ptr_comparator);
-+}
-+
-+void dhc6_free_all_pointers(void)
-+{
-+ if( ptr_tree != 0L )
-+ tdestroy(ptr_tree, free);
-+ ptr_tree = 0L;
-+}
-diff -urN dhcp-0.10.orig/libdhcp6client/dhc6_alloc.h dhcp-0.10/libdhcp6client/dhc6_alloc.h
---- dhcp-0.10.orig/libdhcp6client/dhc6_alloc.h 1969-12-31 19:00:00.000000000 -0500
-+++ dhcp-0.10/libdhcp6client/dhc6_alloc.h 2006-06-22 11:46:51.000000000 -0400
-@@ -0,0 +1,17 @@
-+
-+extern void *dhc6_alloc( size_t );
-+extern void *dhc6_realloc(void *, size_t);
-+extern void *dhc6_calloc(size_t, size_t);
-+extern char *dhc6_strdup(char *str);
-+extern void dhc6_free( void *);
-+extern void dhc6_free_all_pointers(void);
-+#undef malloc
-+#define malloc( size ) dhc6_alloc( size )
-+#undef realloc
-+#define realloc(ptr, size) dhc6_realloc(ptr, size)
-+#undef calloc
-+#define calloc(n, size) dhc6_calloc(n, size)
-+#undef free
-+#define free( ptr ) dhc6_free( ptr )
-+#undef strdup
-+#define strdup( str ) dhc6_strdup( str )
-diff -urN dhcp-0.10.orig/libdhcp6client/dhcp6.h dhcp-0.10/libdhcp6client/dhcp6.h
---- dhcp-0.10.orig/libdhcp6client/dhcp6.h 2006-06-22 11:45:08.000000000 -0400
-+++ dhcp-0.10/libdhcp6client/dhcp6.h 2006-06-22 11:46:51.000000000 -0400
-@@ -116,9 +116,24 @@
-
- typedef enum { IANA, IATA, IAPD} iatype_t;
-
--typedef enum { ACTIVE, RENEW,
-+#ifdef LIBDHCP
-+typedef enum { DHCP6_ACTIVE=1, DHCP6_RENEW,
-+ DHCP6_REBIND, DHCP6_EXPIRED,
-+ DHCP6_INVALID } state_t;
-+
-+#define ACTIVE DHCP6_ACTIVE
-+#define RENEW DHCP6_RENEW
-+#define REBIND DHCP6_REBIND
-+#define EXPIRED DHCP6_EXPIRED
-+#define INVALID DHCP6_INVALID
-+#include <libdhcp_control.h>
-+extern LIBDHCP_Control *libdhcp_control;
-+#include <dhc6_alloc.h>
-+#else
-+typedef enum { ACTIVE=1, RENEW,
- REBIND, EXPIRED,
- INVALID } state_t;
-+#endif
- /* Internal data structure */
-
- struct duid {
-diff -urN dhcp-0.10.orig/libdhcp6client/dhcp6c.c dhcp-0.10/libdhcp6client/dhcp6c.c
---- dhcp-0.10.orig/libdhcp6client/dhcp6c.c 2006-06-22 11:45:08.000000000 -0400
-+++ dhcp-0.10/libdhcp6client/dhcp6c.c 2006-06-22 11:47:19.000000000 -0400
+--- dhcp-0.10/libdhcp6client/dhcp6c.c.libdhcp6client 2006-07-19 01:30:48.000000000 -0400
++++ dhcp-0.10/libdhcp6client/dhcp6c.c 2006-07-19 01:30:57.000000000 -0400
@@ -73,6 +73,9 @@
#include "common.h"
#include "timer.h"
@@ -403,7 +164,7 @@
extern char *raproc_file;
extern char *ifproc_file;
-@@ -154,20 +157,35 @@
+@@ -155,20 +158,35 @@
#define DUID_FILE "/var/lib/dhcpv6/dhcp6c_duid"
static int pid;
@@ -441,7 +202,7 @@
pid = getpid();
srandom(time(NULL) & pid);
-@@ -283,16 +301,22 @@
+@@ -284,16 +302,22 @@
err(1, "daemon");
openlog(progname, LOG_NDELAY|LOG_PID, LOG_DAEMON);
}
@@ -466,7 +227,7 @@
if ((cfparse(conffile)) != 0) {
dprintf(LOG_ERR, "%s" "failed to parse configuration file",
FNAME);
-@@ -301,7 +325,55 @@
+@@ -302,7 +326,55 @@
client6_init(device);
client6_ifinit(device);
client6_mainloop();
@@ -523,7 +284,7 @@
}
static void
-@@ -320,13 +392,17 @@
+@@ -321,13 +393,17 @@
char *device;
{
struct addrinfo hints, *res;
@@ -541,7 +302,7 @@
ifidx = if_nametoindex(device);
if (ifidx == 0) {
-@@ -345,7 +421,7 @@
+@@ -346,7 +422,7 @@
if (inet_ntop(AF_INET6, &lladdr, linklocal, sizeof(linklocal)) < 0) {
exit(1);
}
@@ -550,60 +311,58 @@
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_INET6;
-@@ -379,14 +455,42 @@
- FNAME, strerror(errno));
- exit(1);
+@@ -382,12 +458,40 @@
}
--#endif
-+#endif
+ #endif
((struct sockaddr_in6 *)(res->ai_addr))->sin6_scope_id = ifidx;
-- dprintf(LOG_DEBUG, "res addr is %s/%d", addr2str(res->ai_addr), res->ai_addrlen);
+- dprintf(LOG_DEBUG, "res addr is %s/%d", addr2str(res->ai_addr, res->ai_addrlen), res->ai_addrlen);
- if (bind(insock, res->ai_addr, res->ai_addrlen) < 0) {
- dprintf(LOG_ERR, "%s" "bind(inbound): %s",
- FNAME, strerror(errno));
- exit(1);
-+ dprintf(LOG_INFO, "inbound addr is %s/%d", addr2str(res->ai_addr), res->ai_addrlen);
-+
-+ /*
+- }
++ dprintf(LOG_INFO, "inbound addr is %s/%d", addr2str(res->ai_addr, res->ai_addrlen ), res->ai_addrlen);
++
++ /*
+ * If the interface has JUST been brought up, the kernel may not
-+ * have enough time to allow the bind to the linklocal address -
-+ * it will then return EADDRNOTAVAIL. The bind will succeed if
++ * have enough time to allow the bind to the linklocal address -
++ * it will then return EADDRNOTAVAIL. The bind will succeed if
+ * we try again:
-+ */
-+ retry = now = time(0);
-+ bound = 0;
-+ do
-+ {
-+ if (bind(insock, res->ai_addr, res->ai_addrlen) < 0)
-+ {
-+ bound = -errno;
-+ retry = time(0);
-+ if( ( bound != -EADDRNOTAVAIL ) || ( (retry - now) > 5 ))
-+ break;
-+ struct timespec tv = { 0, 200000000 };
-+ nanosleep(&tv,0);
-+ }else
-+ {
-+ bound = 1;
-+ break;
-+ }
-+ }while( (retry - now) < 5 );
-+
-+ if( bound < 0 )
-+ {
-+ dprintf(LOG_ERR, "%s" "bind(inbound): %s",
-+ FNAME, strerror(-bound));
-+ exit(bound);
- }
-+
++ */
++ retry = now = time(0);
++ bound = 0;
++ do
++ {
++ if (bind(insock, res->ai_addr, res->ai_addrlen) < 0)
++ {
++ bound = -errno;
++ retry = time(0);
++ if( ( bound != -EADDRNOTAVAIL ) || ( (retry - now) > 5 ))
++ break;
++ struct timespec tv = { 0, 200000000 };
++ nanosleep(&tv,0);
++ }else
++ {
++ bound = 1;
++ break;
++ }
++ } while( (retry - now) < 5 );
++
++ if( bound < 0 )
++ {
++ dprintf(LOG_ERR, "%s" "bind(inbound): %s",
++ FNAME, strerror(-bound));
++ exit(bound);
++ }
++
freeaddrinfo(res);
hints.ai_flags = 0;
-@@ -410,18 +514,13 @@
+@@ -411,18 +515,13 @@
exit(1);
}
((struct sockaddr_in6 *)(res->ai_addr))->sin6_scope_id = ifidx;
-+ dprintf(LOG_INFO, "outbound addr is %s/%d", addr2str(res->ai_addr), res->ai_addrlen);
++ dprintf(LOG_INFO, "outbound addr is %s/%d", addr2str(res->ai_addr, res->ai_addrlen), res->ai_addrlen);
if (bind(outsock, res->ai_addr, res->ai_addrlen) < 0) {
dprintf(LOG_ERR, "%s" "bind(outbound): %s",
FNAME, strerror(errno));
@@ -619,7 +378,7 @@
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_INET6;
hints.ai_socktype = SOCK_DGRAM;
-@@ -443,7 +542,7 @@
+@@ -445,7 +544,7 @@
exit(1);
}
ifp->outsock = outsock;
@@ -628,7 +387,7 @@
if (signal(SIGHUP, client6_signal) == SIG_ERR) {
dprintf(LOG_WARNING, "%s" "failed to set signal: %s",
FNAME, strerror(errno));
-@@ -459,6 +558,7 @@
+@@ -461,6 +560,7 @@
FNAME, strerror(errno));
exit(1);
}
@@ -636,7 +395,7 @@
}
static void
-@@ -487,6 +587,10 @@
+@@ -489,6 +589,10 @@
memcpy(&client6_iaidaddr.client6_info.iaidinfo, &ifp->iaidinfo,
sizeof(client6_iaidaddr.client6_info.iaidinfo));
duidcpy(&client6_iaidaddr.client6_info.clientid, &client_duid);
@@ -647,7 +406,7 @@
/* parse the lease file */
strcpy(leasename, PATH_CLIENT6_LEASE);
sprintf(iaidstr, "%u", ifp->iaidinfo.iaid);
-@@ -502,6 +606,9 @@
+@@ -504,6 +608,9 @@
sync_leases(client6_lease_file, leasename, client6_lease_temp);
if (client6_lease_file == NULL)
exit(1);
@@ -657,7 +416,7 @@
if (!TAILQ_EMPTY(&client6_iaidaddr.lease_list)) {
// struct dhcp6_lease *cl;
struct dhcp6_listval *lv;
-@@ -527,7 +634,7 @@
+@@ -529,7 +636,7 @@
dprintf(LOG_INFO, "no ipv6 addresses are leased by client");
exit(0);
}
@@ -666,7 +425,7 @@
ifp->link_flag |= IFF_RUNNING;
/* get addrconf prefix from kernel */
-@@ -574,6 +681,11 @@
+@@ -576,6 +683,11 @@
else {
for (sp = TAILQ_FIRST(&client6_iaidaddr.lease_list); sp; sp = sp_next) {
sp_next = TAILQ_NEXT(sp, link);
@@ -678,7 +437,7 @@
if (client6_ifaddrconf(IFADDRCONF_REMOVE, &sp->lease_addr) != 0)
dprintf(LOG_INFO, "%s" "deconfiging address %s failed",
FNAME, in6addr2str(&sp->lease_addr.addr, 0));
-@@ -585,6 +697,11 @@
+@@ -587,6 +699,11 @@
ev_next = TAILQ_NEXT(ev, link);
dhcp6_remove_event(ev);
}
@@ -690,7 +449,7 @@
/* XXX: check the last dhcpv6 client daemon to restore the original file */
{
/* restore /etc/radv.conf.bak back to /etc/radvd.conf */
-@@ -624,19 +741,72 @@
+@@ -626,19 +743,72 @@
static void
client6_mainloop()
{
@@ -765,7 +524,7 @@
switch (ret) {
case -1:
if (errno != EINTR) {
-@@ -648,8 +818,36 @@
+@@ -650,8 +820,36 @@
case 0: /* timeout */
break; /* dhcp6_check_timer() will treat the case */
default: /* received a packet */
@@ -802,7 +561,7 @@
}
}
-@@ -676,6 +874,7 @@
+@@ -678,6 +876,7 @@
switch(ev->state) {
case DHCP6S_INIT:
@@ -810,7 +569,7 @@
/* From INIT state client could
* go to CONFIRM state if the client reboots;
* go to RELEASE state if the client issues a release;
-@@ -715,6 +914,7 @@
+@@ -717,6 +916,7 @@
ev->state = DHCP6S_SOLICIT;
dhcp6_set_timeoparam(ev);
case DHCP6S_SOLICIT:
@@ -818,7 +577,7 @@
if (ifp->servers) {
ifp->current_server = select_server(ifp);
if (ifp->current_server == NULL) {
-@@ -725,7 +925,7 @@
+@@ -727,7 +927,7 @@
}
/* if get the address assginment break */
if (!TAILQ_EMPTY(&client6_iaidaddr.lease_list)) {
@@ -827,7 +586,7 @@
return (NULL);
}
ev->timeouts = 0;
-@@ -733,14 +933,21 @@
+@@ -735,14 +935,21 @@
dhcp6_set_timeoparam(ev);
}
case DHCP6S_INFOREQ:
@@ -849,7 +608,7 @@
if (!TAILQ_EMPTY(&request_list))
client6_send(ev);
else {
-@@ -822,9 +1029,11 @@
+@@ -825,9 +1032,11 @@
switch(ev->state) {
case DHCP6S_SOLICIT:
@@ -861,7 +620,7 @@
if (ifp->current_server == NULL) {
dprintf(LOG_ERR, "%s" "assumption failure", FNAME);
exit(1); /* XXX */
-@@ -832,6 +1041,7 @@
+@@ -835,6 +1044,7 @@
dh6->dh6_msgtype = DH6_REQUEST;
break;
case DHCP6S_RENEW:
@@ -869,7 +628,7 @@
if (ifp->current_server == NULL) {
dprintf(LOG_ERR, "%s" "assumption failure", FNAME);
exit(1); /* XXX */
-@@ -839,6 +1049,7 @@
+@@ -842,6 +1052,7 @@
dh6->dh6_msgtype = DH6_RENEW;
break;
case DHCP6S_DECLINE:
@@ -877,7 +636,7 @@
if (ifp->current_server == NULL) {
dprintf(LOG_ERR, "%s" "assumption failure", FNAME);
exit(1); /* XXX */
-@@ -846,15 +1057,19 @@
+@@ -849,15 +1060,19 @@
dh6->dh6_msgtype = DH6_DECLINE;
break;
case DHCP6S_INFOREQ:
@@ -897,7 +656,7 @@
dh6->dh6_msgtype = DH6_RELEASE;
break;
default:
-@@ -990,12 +1205,34 @@
+@@ -999,12 +1214,34 @@
/* XXX: allow the other emtpy list ?? */
}
if (client6_request_flag & CLIENT6_RELEASE_ADDR) {
@@ -932,33 +691,7 @@
}
break;
default:
-@@ -1039,20 +1276,22 @@
- memcpy(&dst, res->ai_addr, res->ai_addrlen);
- break;
- }
-- default:
-+ default:
- dst = *sa6_allagent;
- break;
- }
- dst.sin6_scope_id = ifp->linkid;
-- dprintf(LOG_DEBUG, "send dst if %s addr is %s scope id is %d",
-+ dprintf(LOG_INFO, "send dst if %s addr is %s scope id is %d",
- ifp->ifname, addr2str((struct sockaddr *)&dst), ifp->linkid);
-+
-+ dprintf(LOG_DEBUG,"\nSEND PACKET\n");
- if (sendto(ifp->outsock, buf, len, MSG_DONTROUTE, (struct sockaddr *)&dst,
- sizeof(dst)) == -1) {
- dprintf(LOG_ERR, FNAME "transmit failed: %s", strerror(errno));
- goto end;
- }
-
-- dprintf(LOG_DEBUG, "%s" "send %s to %s", FNAME,
-+ dprintf(LOG_INFO, "%s" "send %s to %s", FNAME,
- dhcp6msgstr(dh6->dh6_msgtype),
- addr2str((struct sockaddr *)&dst));
-
-@@ -1076,6 +1315,7 @@
+@@ -1087,6 +1324,7 @@
struct cmsghdr *cm;
struct in6_pktinfo *pi = NULL;
@@ -966,7 +699,7 @@
memset(&iov, 0, sizeof(iov));
memset(&mhdr, 0, sizeof(mhdr));
-@@ -1133,9 +1373,11 @@
+@@ -1144,9 +1382,11 @@
switch(dh6->dh6_msgtype) {
case DH6_ADVERTISE:
@@ -978,15 +711,15 @@
(void)client6_recvreply(ifp, dh6, len, &optinfo);
break;
default:
-@@ -1144,7 +1386,6 @@
- addr2str((struct sockaddr *)&from));
+@@ -1155,7 +1395,6 @@
+ addr2str((struct sockaddr *)&from, sizeof(((struct sockaddr *)&from)->sa_data)));
break;
}
-
dhcp6_clear_options(&optinfo);
return;
}
-@@ -1255,7 +1496,22 @@
+@@ -1266,7 +1505,22 @@
/* if the client send preferred addresses reqeust in SOLICIT */
/* XXX: client might have some local policy to select the addresses */
if (!TAILQ_EMPTY(&optinfo0->addr_list))
@@ -1009,7 +742,7 @@
return 0;
}
-@@ -1343,6 +1599,7 @@
+@@ -1354,6 +1608,7 @@
int addr_status_code = DH6OPT_STCODE_UNSPECFAIL;
struct dhcp6_serverinfo *newserver;
int newstate = 0;
@@ -1017,7 +750,7 @@
/* find the corresponding event based on the received xid */
dprintf(LOG_DEBUG, "%s" "reply message XID is (%x)",
FNAME, ntohl(dh6->dh6_xid) & DH6_XIDMASK);
-@@ -1366,13 +1623,16 @@
+@@ -1377,13 +1632,16 @@
dprintf(LOG_INFO, "%s" "no server ID option", FNAME);
return -1;
}
@@ -1035,7 +768,7 @@
newserver = allocate_newserver(ifp, optinfo);
if (newserver == NULL)
return (-1);
-@@ -1395,11 +1655,13 @@
+@@ -1406,11 +1664,13 @@
dprintf(LOG_INFO, "%s" "client DUID mismatch", FNAME);
return -1;
}
@@ -1053,7 +786,7 @@
/*
* The client MAY choose to report any status code or message from the
* status code option in the Reply message.
-@@ -1426,7 +1688,7 @@
+@@ -1437,7 +1697,7 @@
switch (addr_status_code) {
case DH6OPT_STCODE_UNSPECFAIL:
case DH6OPT_STCODE_USEMULTICAST:
@@ -1062,7 +795,7 @@
dhcp6_stcodestr(addr_status_code));
/* retransmit the message with multicast address */
/* how many time allow the retransmission with error status code? */
-@@ -1441,6 +1703,7 @@
+@@ -1452,6 +1712,7 @@
*/
switch (ev->state) {
case DHCP6S_SOLICIT:
@@ -1070,7 +803,7 @@
if (optinfo->iaidinfo.iaid == 0)
break;
else if (!optinfo->flags & DHCIFF_RAPID_COMMIT) {
-@@ -1448,6 +1711,7 @@
+@@ -1459,6 +1720,7 @@
break;
}
case DHCP6S_REQUEST:
@@ -1078,7 +811,7 @@
/* NotOnLink: 1. SOLICIT
* NoAddrAvail: Information Request */
switch(addr_status_code) {
-@@ -1468,32 +1732,57 @@
+@@ -1479,32 +1741,57 @@
case DH6OPT_STCODE_SUCCESS:
case DH6OPT_STCODE_UNDEFINE:
default:
@@ -1139,7 +872,7 @@
break;
case DH6OPT_STCODE_NOADDRAVAIL:
case DH6OPT_STCODE_NOPREFIXAVAIL:
-@@ -1504,11 +1793,26 @@
+@@ -1515,11 +1802,26 @@
default:
dhcp6_update_iaidaddr(optinfo, ADDR_UPDATE);
if (optinfo->type == IAPD)
@@ -1166,7 +899,7 @@
/* NOtOnLink for a Confirm, send SOLICIT message */
rebind_confirm: client6_request_flag &= ~CLIENT6_CONFIRM_ADDR;
switch(addr_status_code) {
-@@ -1526,6 +1830,7 @@
+@@ -1537,6 +1839,7 @@
break;
case DH6OPT_STCODE_SUCCESS:
case DH6OPT_STCODE_UNDEFINE:
@@ -1174,7 +907,7 @@
/* XXX: set up renew/rebind timer */
dprintf(LOG_DEBUG, "%s" "got an expected reply for confirm", FNAME);
ftime(&now);
-@@ -1548,7 +1853,7 @@
+@@ -1559,7 +1862,7 @@
if ( offset > client6_iaidaddr.client6_info.iaidinfo.renewtime)
timo.tv_sec = 0;
else
@@ -1183,7 +916,7 @@
timo.tv_usec = 0;
dhcp6_set_timer(&timo, client6_iaidaddr.timer);
/* check DAD */
-@@ -1564,6 +1869,7 @@
+@@ -1575,6 +1878,7 @@
}
break;
case DHCP6S_DECLINE:
@@ -1191,7 +924,7 @@
/* send REQUEST message to server with none decline address */
dprintf(LOG_DEBUG, "%s"
"got an expected reply for decline, sending request.", FNAME);
-@@ -1572,6 +1878,7 @@
+@@ -1583,6 +1887,7 @@
newstate = DHCP6S_REQUEST;
break;
case DHCP6S_RELEASE:
@@ -1199,7 +932,7 @@
dprintf(LOG_INFO, "%s" "got an expected release, exit.", FNAME);
dhcp6_remove_event(ev);
exit(0);
-@@ -1593,6 +1900,8 @@
+@@ -1604,6 +1909,8 @@
int state;
{
struct dhcp6_event *ev;
@@ -1208,7 +941,7 @@
if ((ev = dhcp6_create_event(ifp, state)) == NULL) {
dprintf(LOG_ERR, "%s" "failed to create an event",
FNAME);
-@@ -1651,6 +1960,11 @@
+@@ -1662,6 +1969,11 @@
/* config the interface for reboot */
if (reboot && client6_iaidaddr.client6_info.type != IAPD &&
(client6_request_flag & CLIENT6_CONFIRM_ADDR)) {
@@ -1220,7 +953,7 @@
if (client6_ifaddrconf(IFADDRCONF_ADD, &cl->lease_addr) != 0) {
dprintf(LOG_INFO, "config address failed: %s",
in6addr2str(&cl->lease_addr.addr, 0));
-@@ -1661,6 +1975,11 @@
+@@ -1672,6 +1984,11 @@
/* update radvd.conf for prefix delegation */
if (reboot && client6_iaidaddr.client6_info.type == IAPD &&
(client6_request_flag & CLIENT6_CONFIRM_ADDR))
@@ -1232,7 +965,7 @@
radvd_parse(&client6_iaidaddr, ADDR_UPDATE);
return (0);
}
-@@ -1752,8 +2071,9 @@
+@@ -1763,8 +2080,9 @@
int newstate;
dprintf(LOG_DEBUG, "enter checking link ...");
strncpy(ifr.ifr_name, dhcp6_if->ifname, IFNAMSIZ);
@@ -1243,7 +976,7 @@
goto settimer;
}
if (ifr.ifr_flags & IFF_RUNNING) {
-@@ -1795,29 +2115,48 @@
+@@ -1806,29 +2124,48 @@
setup_interface(char *ifname)
{
struct ifreq ifr;
@@ -1309,116 +1042,23 @@
}
return;
}
-diff -urN dhcp-0.10.orig/libdhcp6client/dhcp6client.h dhcp-0.10/libdhcp6client/dhcp6client.h
---- dhcp-0.10.orig/libdhcp6client/dhcp6client.h 1969-12-31 19:00:00.000000000 -0500
-+++ dhcp-0.10/libdhcp6client/dhcp6client.h 2006-06-22 11:46:51.000000000 -0400
-@@ -0,0 +1,22 @@
-+/* dhcp6client.h
+--- /dev/null 2006-07-18 14:52:55.494029261 -0400
++++ dhcp-0.10/libdhcp6client/libdhcp_control.h 2006-07-19 01:30:57.000000000 -0400
+@@ -0,0 +1,104 @@
++/* libdhcp_control.h
+ *
-+ * Interface to the DHCPv6 client libdhcp6client library.
++ * DHCP client control API for libdhcp, a minimal interface to the
++ * ISC dhcp IPv4 client libdhcp4client library,
++ * and to the dhcpv6 DHCPv6 client libdhcp6client library.
+ *
++ * Each DHCP client library must include this file to be controlled
++ * by libdhcp.
+ *
+ * Copyright(C) Jason Vas Dias <jvdias at redhat.com> Red Hat Inc. May 2006
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation at
-+ * http://www.fsf.org/licensing/licenses/gpl.txt
-+ * and included in this software distribution as the "LICENSE" file.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ */
-+struct libdhcp_control_s; /* include libdhcp_control.h or libdhcp.h for this */
-+
-+extern int dhcpv6_client( struct libdhcp_control_s *dhc_ctl, int argc, char **argv, char **envp);
-+/* the DHCPv6 client main() function */
-diff -urN dhcp-0.10.orig/libdhcp6client/lease.c dhcp-0.10/libdhcp6client/lease.c
---- dhcp-0.10.orig/libdhcp6client/lease.c 2004-03-03 15:11:16.000000000 -0500
-+++ dhcp-0.10/libdhcp6client/lease.c 2006-06-22 11:46:51.000000000 -0400
-@@ -64,7 +64,7 @@
- static int init_lease_hashes __P((void));
-
- int
--write_lease(const struct dhcp6_lease *lease_ptr,
-+write_6_lease(const struct dhcp6_lease *lease_ptr,
- FILE *file)
- {
- struct tm brokendown_time;
-@@ -140,7 +140,7 @@
- for (i = 0; i < lease_hash_table->hash_size; i++) {
- element = lease_hash_table->hash_list[i];
- while (element) {
-- if (write_lease((struct dhcp6_lease *)element->data,
-+ if (write_6_lease((struct dhcp6_lease *)element->data,
- sync_file) < 0) {
- dprintf(LOG_ERR, "%s" "write lease failed", FNAME);
- return (NULL);
-@@ -152,7 +152,7 @@
- struct dhcp6_lease *lv, *lv_next;
- for (lv = TAILQ_FIRST(&client6_iaidaddr.lease_list); lv; lv = lv_next) {
- lv_next = TAILQ_NEXT(lv, link);
-- if (write_lease(lv, sync_file) < 0)
-+ if (write_6_lease(lv, sync_file) < 0)
- dprintf(LOG_ERR, "%s" "write lease failed", FNAME);
- }
- }
-@@ -354,8 +354,8 @@
- get_linklocal(const char *ifname,
- struct in6_addr *linklocal)
- {
-- struct ifaddrs *ifa, *ifap;
-- struct sockaddr *sd;
-+ struct ifaddrs *ifa=0, *ifap=0;
-+ struct sockaddr *sd=0;
- if (getifaddrs(&ifap) < 0) {
- dprintf(LOG_ERR, "getifaddrs error");
- return -1;
-diff -urN dhcp-0.10.orig/libdhcp6client/lease.h dhcp-0.10/libdhcp6client/lease.h
---- dhcp-0.10.orig/libdhcp6client/lease.h 2003-07-01 22:21:25.000000000 -0400
-+++ dhcp-0.10/libdhcp6client/lease.h 2006-06-22 11:46:51.000000000 -0400
-@@ -101,7 +101,7 @@
- extern FILE *init_leases __P((const char *));
- extern void lease_parse __P((FILE *));
- extern int do_iaidaddr_hash __P((struct dhcp6_lease *, struct client6_if *));
--extern int write_lease __P((const struct dhcp6_lease *, FILE *));
-+extern int write_6_lease __P((const struct dhcp6_lease *, FILE *));
- extern FILE *sync_leases __P((FILE *, const char *, char *));
- extern struct dhcp6_timer *syncfile_timo __P((void *));
- extern unsigned int addr_hash __P((const void *));
-diff -urN dhcp-0.10.orig/libdhcp6client/lease_token.l dhcp-0.10/libdhcp6client/lease_token.l
---- dhcp-0.10.orig/libdhcp6client/lease_token.l 2004-02-04 18:29:24.000000000 -0500
-+++ dhcp-0.10/libdhcp6client/lease_token.l 2006-06-22 11:46:51.000000000 -0400
-@@ -241,6 +241,9 @@
-
- fseek(file, 0, 0);
- yyin = file;
-+ yy_init=1;
-+ yy_start=0;
-+ yy_current_buffer=0;
- yylex();
- return;
- }
-diff -urN dhcp-0.10.orig/libdhcp6client/libdhcp_control.h dhcp-0.10/libdhcp6client/libdhcp_control.h
---- dhcp-0.10.orig/libdhcp6client/libdhcp_control.h 1969-12-31 19:00:00.000000000 -0500
-+++ dhcp-0.10/libdhcp6client/libdhcp_control.h 2006-06-22 11:46:51.000000000 -0400
-@@ -0,0 +1,104 @@
-+/* libdhcp_control.h
-+ *
-+ * DHCP client control API for libdhcp, a minimal interface to the
-+ * ISC dhcp IPv4 client libdhcp4client library,
-+ * and to the dhcpv6 DHCPv6 client libdhcp6client library.
-+ *
-+ * Each DHCP client library must include this file to be controlled
-+ * by libdhcp.
-+ *
-+ * Copyright(C) Jason Vas Dias <jvdias at redhat.com> Red Hat Inc. May 2006
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation at
++ * the Free Software Foundation at
+ * http://www.fsf.org/licensing/licenses/gpl.txt
+ * and included in this software distribution as the "LICENSE" file.
+ *
@@ -1509,3 +1149,315 @@
+} LIBDHCP_Capability;
+
+#endif
+--- /dev/null 2006-07-18 14:52:55.494029261 -0400
++++ dhcp-0.10/libdhcp6client/dhc6_alloc.h 2006-07-19 01:30:57.000000000 -0400
+@@ -0,0 +1,17 @@
++
++extern void *dhc6_alloc( size_t );
++extern void *dhc6_realloc(void *, size_t);
++extern void *dhc6_calloc(size_t, size_t);
++extern char *dhc6_strdup(char *str);
++extern void dhc6_free( void *);
++extern void dhc6_free_all_pointers(void);
++#undef malloc
++#define malloc( size ) dhc6_alloc( size )
++#undef realloc
++#define realloc(ptr, size) dhc6_realloc(ptr, size)
++#undef calloc
++#define calloc(n, size) dhc6_calloc(n, size)
++#undef free
++#define free( ptr ) dhc6_free( ptr )
++#undef strdup
++#define strdup( str ) dhc6_strdup( str )
+--- dhcp-0.10/libdhcp6client/lease.c.libdhcp6client 2004-03-03 15:11:16.000000000 -0500
++++ dhcp-0.10/libdhcp6client/lease.c 2006-07-19 01:30:57.000000000 -0400
+@@ -64,7 +64,7 @@
+ static int init_lease_hashes __P((void));
+
+ int
+-write_lease(const struct dhcp6_lease *lease_ptr,
++write_6_lease(const struct dhcp6_lease *lease_ptr,
+ FILE *file)
+ {
+ struct tm brokendown_time;
+@@ -140,7 +140,7 @@
+ for (i = 0; i < lease_hash_table->hash_size; i++) {
+ element = lease_hash_table->hash_list[i];
+ while (element) {
+- if (write_lease((struct dhcp6_lease *)element->data,
++ if (write_6_lease((struct dhcp6_lease *)element->data,
+ sync_file) < 0) {
+ dprintf(LOG_ERR, "%s" "write lease failed", FNAME);
+ return (NULL);
+@@ -152,7 +152,7 @@
+ struct dhcp6_lease *lv, *lv_next;
+ for (lv = TAILQ_FIRST(&client6_iaidaddr.lease_list); lv; lv = lv_next) {
+ lv_next = TAILQ_NEXT(lv, link);
+- if (write_lease(lv, sync_file) < 0)
++ if (write_6_lease(lv, sync_file) < 0)
+ dprintf(LOG_ERR, "%s" "write lease failed", FNAME);
+ }
+ }
+@@ -354,8 +354,8 @@
+ get_linklocal(const char *ifname,
+ struct in6_addr *linklocal)
+ {
+- struct ifaddrs *ifa, *ifap;
+- struct sockaddr *sd;
++ struct ifaddrs *ifa=0, *ifap=0;
++ struct sockaddr *sd=0;
+ if (getifaddrs(&ifap) < 0) {
+ dprintf(LOG_ERR, "getifaddrs error");
+ return -1;
+--- dhcp-0.10/libdhcp6client/lease.h.libdhcp6client 2003-07-01 22:21:25.000000000 -0400
++++ dhcp-0.10/libdhcp6client/lease.h 2006-07-19 01:30:57.000000000 -0400
+@@ -101,7 +101,7 @@
+ extern FILE *init_leases __P((const char *));
+ extern void lease_parse __P((FILE *));
+ extern int do_iaidaddr_hash __P((struct dhcp6_lease *, struct client6_if *));
+-extern int write_lease __P((const struct dhcp6_lease *, FILE *));
++extern int write_6_lease __P((const struct dhcp6_lease *, FILE *));
+ extern FILE *sync_leases __P((FILE *, const char *, char *));
+ extern struct dhcp6_timer *syncfile_timo __P((void *));
+ extern unsigned int addr_hash __P((const void *));
+--- /dev/null 2006-07-18 14:52:55.494029261 -0400
++++ dhcp-0.10/libdhcp6client/dhc6_alloc.c 2006-07-19 01:30:57.000000000 -0400
+@@ -0,0 +1,67 @@
++#include <malloc.h>
++#include <search.h>
++extern void tdestroy (void *root, void (*free_node)(void *nodep));
++void *ifp_ptr;
++
++static void *ptr_tree=0L;
++
++static int ptr_comparator( const void *p1, const void *p2 )
++{
++ return
++ ( (p1 == p2)
++ ? 0
++ :( (p1 > p2)
++ ? 1
++ : -1
++ )
++ );
++}
++
++void *dhc6_alloc( size_t s )
++{
++ void *ptr = malloc( s );
++ if ( ptr != 0 )
++ tsearch(ptr, &(ptr_tree), ptr_comparator);
++ return ptr;
++}
++
++void *dhc6_realloc( void *ptr, size_t s )
++{
++ void *ptr2 = realloc(ptr, s);
++ if ( ptr2 != 0 )
++ {
++ if ( ptr != 0 )
++ tdelete(ptr,&(ptr_tree), ptr_comparator);
++ tsearch(ptr2, &(ptr_tree), ptr_comparator);
++ }
++ return ptr2;
++}
++
++void *dhc6_calloc( size_t n, size_t s )
++{
++ void *ptr = calloc( n, s );
++ if ( ptr != 0 )
++ tsearch(ptr, &(ptr_tree), ptr_comparator);
++ return ptr;
++}
++
++char *dhc6_strdup( char *str )
++{
++ char *ptr = strdup( str );
++ if ( ptr != 0 )
++ tsearch(ptr, &(ptr_tree), ptr_comparator);
++ return ptr;
++}
++
++void dhc6_free( void *ptr )
++{
++ free(ptr);
++ tdelete(ptr, &(ptr_tree), ptr_comparator);
++}
++
++void dhc6_free_all_pointers(void)
++{
++ if( ptr_tree != 0L )
++ tdestroy(ptr_tree, free);
++ ptr_tree = 0L;
++}
+--- dhcp-0.10/libdhcp6client/common.c.libdhcp6client 2006-07-19 01:30:48.000000000 -0400
++++ dhcp-0.10/libdhcp6client/common.c 2006-07-19 01:30:57.000000000 -0400
+@@ -79,11 +79,19 @@
+ #include "timer.h"
+ #include "lease.h"
+
++#ifdef LIBDHCP
++#include "libdhcp_control.h"
++#endif
++
+ int foreground;
+ int debug_thresh;
+ struct dhcp6_if *dhcp6_if;
+ struct dns_list dnslist;
++#ifdef LIBDHCP
++struct host_conf *host_conflist;
++#else
+ static struct host_conf *host_conflist;
++#endif
+ static int in6_matchflags __P((struct sockaddr *, char *, int));
+ ssize_t gethwid __P((char *, int, const char *, u_int16_t *));
+ static int get_assigned_ipv6addrs __P((char *, char *,
+@@ -647,7 +655,7 @@
+ memset(&ifr, 0, sizeof(ifr));
+ strncpy(ifr.ifr_name, ifnam, sizeof(ifr.ifr_name));
+ ifr.ifr_addr = *(struct sockaddr *)addr;
+-
++ dprintf(LOG_DEBUG,"in6_matchflags: SIOCGIFFLAGS");
+ if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) {
+ warn("in6_matchflags: ioctl(SIOCGIFFLAGS, %s)",
+ addr2str(addr, sizeof (addr->sa_data)));
+@@ -722,6 +730,9 @@
+ struct dhcp6_duid_type1 *dp; /* we only support the type1 DUID */
+ char tmpbuf[256]; /* DUID should be no more than 256 bytes */
+
++#ifdef LIBDHCP
++ if ( libdhcp_control && (libdhcp_control->capability & DHCP_USE_LEASE_DATABASE))
++#endif
+ if ((fp = fopen(idfile, "r")) == NULL && errno != ENOENT)
+ dprintf(LOG_NOTICE, "%s" "failed to open DUID file: %s",
+ FNAME, idfile);
+@@ -776,6 +787,9 @@
+ }
+
+ /* save the (new) ID to the file for next time */
++#ifdef LIBDHCP
++ if ( libdhcp_control && (libdhcp_control->capability & DHCP_USE_LEASE_DATABASE))
++#endif
+ if (!fp) {
+ if ((fp = fopen(idfile, "w+")) == NULL) {
+ dprintf(LOG_ERR, "%s"
+@@ -823,8 +837,13 @@
+ return -1;
+
+ strcpy(if_hwaddr.ifr_name, ifname);
++ dprintf(LOG_DEBUG,"gethwid: ioctl SIOCGIFHWADDR");
+ if (ioctl(skfd, SIOCGIFHWADDR, &if_hwaddr) < 0)
++ {
++ close(skfd);
+ return -1;
++ }
++ close(skfd);
+ /* only support Ethernet */
+ switch (if_hwaddr.ifr_hwaddr.sa_family) {
+ case ARPHRD_ETHER:
+@@ -940,7 +959,7 @@
+ cp = (char *)(p + 1);
+ np = (struct dhcp6opt *)(cp + optlen);
+
+- dprintf(LOG_DEBUG, "%s" "get DHCP option %s, len %d",
++ dprintf(LOG_INFO, "%s" "get DHCP option %s, len %d",
+ FNAME, dhcp6optstr(opt), optlen);
+
+ /* option length field overrun */
+@@ -1085,7 +1104,7 @@
+ ntohl(*(u_int32_t *)(cp + sizeof(u_int32_t)));
+ optinfo->iaidinfo.rebindtime =
+ ntohl(*(u_int32_t *)(cp + 2 * sizeof(u_int32_t)));
+- dprintf(LOG_DEBUG, "get option iaid is %u, renewtime %u, "
++ dprintf(LOG_INFO, "get option iaid is %u, renewtime %u, "
+ "rebindtime %u", optinfo->iaidinfo.iaid,
+ optinfo->iaidinfo.renewtime, optinfo->iaidinfo.rebindtime);
+ if (get_assigned_ipv6addrs(cp + 3 * sizeof(u_int32_t),
+@@ -1189,7 +1208,7 @@
+ opt = ntohs(opth.dh6opt_type);
+ cp = p + sizeof(opth);
+ np = cp + optlen;
+- dprintf(LOG_DEBUG, " IA address option: %s, "
++ dprintf(LOG_INFO, " IA address option: %s, "
+ "len %d", dhcp6optstr(opt), optlen);
+
+ if (np > ep) {
+@@ -1219,7 +1238,7 @@
+ }
+ break;
+ case DH6OPT_IADDR:
+- if (optlen < sizeof(ai) - sizeof(u_int32_t))
++ if (optlen < sizeof(ai)- sizeof(u_int32_t))
+ goto malformed;
+ memcpy(&ai, p, sizeof(ai));
+ /* copy the information into internal format */
+@@ -2028,8 +2047,16 @@
+ va_list ap;
+ char logbuf[LINE_MAX];
+
++#if LIBDHCP
++ va_start(ap, fmt);
++ if ( libdhcp_control && libdhcp_control->eh )
++ libdhcp_control->eh(libdhcp_control, level, fmt, ap);
++ va_end(ap);
++ return;
++#endif
+ va_start(ap, fmt);
+ vsnprintf(logbuf, sizeof(logbuf), fmt, ap);
++ va_end(ap);
+
+ if (foreground && debug_thresh >= level) {
+ time_t now;
+--- dhcp-0.10/libdhcp6client/dhcp6.h.libdhcp6client 2006-07-19 01:30:48.000000000 -0400
++++ dhcp-0.10/libdhcp6client/dhcp6.h 2006-07-19 01:30:57.000000000 -0400
+@@ -116,9 +116,24 @@
+
+ typedef enum { IANA, IATA, IAPD} iatype_t;
+
+-typedef enum { ACTIVE, RENEW,
++#ifdef LIBDHCP
++typedef enum { DHCP6_ACTIVE=1, DHCP6_RENEW,
++ DHCP6_REBIND, DHCP6_EXPIRED,
++ DHCP6_INVALID } state_t;
++
++#define ACTIVE DHCP6_ACTIVE
++#define RENEW DHCP6_RENEW
++#define REBIND DHCP6_REBIND
++#define EXPIRED DHCP6_EXPIRED
++#define INVALID DHCP6_INVALID
++#include <libdhcp_control.h>
++extern LIBDHCP_Control *libdhcp_control;
++#include <dhc6_alloc.h>
++#else
++typedef enum { ACTIVE=1, RENEW,
+ REBIND, EXPIRED,
+ INVALID } state_t;
++#endif
+ /* Internal data structure */
+
+ struct duid {
+--- /dev/null 2006-07-18 14:52:55.494029261 -0400
++++ dhcp-0.10/libdhcp6client/dhcp6client.h 2006-07-19 01:30:57.000000000 -0400
+@@ -0,0 +1,22 @@
++/* dhcp6client.h
++ *
++ * Interface to the DHCPv6 client libdhcp6client library.
++ *
++ *
++ * Copyright(C) Jason Vas Dias <jvdias at redhat.com> Red Hat Inc. May 2006
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation at
++ * http://www.fsf.org/licensing/licenses/gpl.txt
++ * and included in this software distribution as the "LICENSE" file.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ */
++struct libdhcp_control_s; /* include libdhcp_control.h or libdhcp.h for this */
++
++extern int dhcpv6_client( struct libdhcp_control_s *dhc_ctl, int argc, char **argv, char **envp);
++/* the DHCPv6 client main() function */
dhcpv6-0.10-salen.patch:
common.c | 12 +++++++-----
common.h | 2 +-
dhcp6c.c | 15 ++++++++++-----
dhcp6relay.c | 4 ++--
dhcp6s.c | 8 ++++----
5 files changed, 24 insertions(+), 17 deletions(-)
Index: dhcpv6-0.10-salen.patch
===================================================================
RCS file: /cvs/dist/rpms/dhcpv6/devel/dhcpv6-0.10-salen.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dhcpv6-0.10-salen.patch 28 Jun 2006 18:47:40 -0000 1.1
+++ dhcpv6-0.10-salen.patch 19 Jul 2006 06:46:03 -0000 1.2
@@ -1,5 +1,16 @@
---- dhcp-0.10/dhcp6s.c.salen 2006-06-20 17:47:03.000000000 -0400
-+++ dhcp-0.10/dhcp6s.c 2006-06-20 17:47:11.000000000 -0400
+--- dhcp-0.10/common.h.salen 2006-07-18 22:17:41.000000000 -0400
++++ dhcp-0.10/common.h 2006-07-18 22:18:40.000000000 -0400
+@@ -67,7 +67,7 @@
+ extern long random_between __P((long, long));
+ extern int prefix6_mask __P((struct in6_addr *, int));
+ extern int sa6_plen2mask __P((struct sockaddr_in6 *, int));
+-extern char *addr2str __P((struct sockaddr *));
++extern char *addr2str __P((struct sockaddr *, socklen_t));
+ extern char *in6addr2str __P((struct in6_addr *, int));
+ extern const char *getdev __P((struct sockaddr_in6 *));
+ extern int in6_addrscopebyif __P((struct in6_addr *, char *));
+--- dhcp-0.10/dhcp6s.c.salen 2006-07-18 22:17:41.000000000 -0400
++++ dhcp-0.10/dhcp6s.c 2006-07-18 22:17:41.000000000 -0400
@@ -569,7 +569,7 @@
dprintf(LOG_DEBUG, "%s" "received %s from %s", FNAME,
@@ -29,7 +40,7 @@
return 0;
}
--- dhcp-0.10/dhcp6relay.c.salen 2003-02-27 14:43:08.000000000 -0500
-+++ dhcp-0.10/dhcp6relay.c 2006-06-20 17:47:11.000000000 -0400
++++ dhcp-0.10/dhcp6relay.c 2006-07-18 22:17:41.000000000 -0400
@@ -496,7 +496,7 @@
}
@@ -48,51 +59,8 @@
return;
}
---- dhcp-0.10/common.c.salen 2006-06-20 17:47:03.000000000 -0400
-+++ dhcp-0.10/common.c 2006-06-20 18:05:40.000000000 -0400
-@@ -560,17 +560,19 @@
- }
-
- char *
--addr2str(sa)
-+addr2str(sa, salen)
- struct sockaddr *sa;
-+ socklen_t salen;
- {
-- static char addrbuf[8][NI_MAXHOST];
-+ static char addrbuf[8][NI_MAXHOST+1];
- static int round = 0;
- char *cp;
-
- round = (round + 1) & 7;
- cp = addrbuf[round];
-+ memset(cp, '\0', NI_MAXHOST+1);
-
-- if (getnameinfo(sa, NI_MAXSERV, cp, NI_MAXHOST, NULL,
-+ if (getnameinfo(sa, salen, cp, NI_MAXHOST, NULL,
- 0, NI_NUMERICHOST) != 0)
- dprintf(LOG_ERR, "%s getnameinfo return error", FNAME);
-
-@@ -589,7 +591,7 @@
- sa6.sin6_addr = *in6;
- sa6.sin6_scope_id = scopeid;
-
-- return (addr2str((struct sockaddr *)&sa6));
-+ return (addr2str((struct sockaddr *)&sa6, sizeof (*in6)));
- }
-
- /* return IPv6 address scope type. caller assumes that smaller is narrower. */
-@@ -648,7 +650,7 @@
-
- if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) {
- warn("in6_matchflags: ioctl(SIOCGIFFLAGS, %s)",
-- addr2str(addr));
-+ addr2str(addr, sizeof (addr->sa_data)));
- close(s);
- return (-1);
- }
---- dhcp-0.10/dhcp6c.c.salen 2006-06-20 17:47:03.000000000 -0400
-+++ dhcp-0.10/dhcp6c.c 2006-06-20 17:55:46.000000000 -0400
+--- dhcp-0.10/dhcp6c.c.salen 2006-07-18 22:17:41.000000000 -0400
++++ dhcp-0.10/dhcp6c.c 2006-07-18 22:17:41.000000000 -0400
@@ -114,6 +114,7 @@
extern struct dhcp6_iaidaddr client6_iaidaddr;
FILE *dhcp6_resolv_file;
@@ -172,9 +140,9 @@
break;
}
---- dhcp-0.10/libdhcp6client/common.c.salen 2006-06-20 17:47:11.000000000 -0400
-+++ dhcp-0.10/libdhcp6client/common.c 2006-06-20 18:05:41.000000000 -0400
-@@ -568,17 +568,19 @@
+--- dhcp-0.10/common.c.salen 2006-07-18 22:17:41.000000000 -0400
++++ dhcp-0.10/common.c 2006-07-18 22:17:41.000000000 -0400
+@@ -560,17 +560,19 @@
}
char *
@@ -197,7 +165,7 @@
0, NI_NUMERICHOST) != 0)
dprintf(LOG_ERR, "%s getnameinfo return error", FNAME);
-@@ -597,7 +599,7 @@
+@@ -589,7 +591,7 @@
sa6.sin6_addr = *in6;
sa6.sin6_scope_id = scopeid;
@@ -206,8 +174,8 @@
}
/* return IPv6 address scope type. caller assumes that smaller is narrower. */
-@@ -656,7 +658,7 @@
- dprintf(LOG_DEBUG,"in6_matchflags: SIOCGIFFLAGS");
+@@ -648,7 +650,7 @@
+
if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) {
warn("in6_matchflags: ioctl(SIOCGIFFLAGS, %s)",
- addr2str(addr));
@@ -215,115 +183,3 @@
close(s);
return (-1);
}
---- dhcp-0.10/libdhcp6client/dhcp6c.c.salen 2006-06-20 17:47:11.000000000 -0400
-+++ dhcp-0.10/libdhcp6client/dhcp6c.c 2006-06-20 17:55:46.000000000 -0400
-@@ -117,6 +117,7 @@
- extern struct dhcp6_iaidaddr client6_iaidaddr;
- FILE *dhcp6_resolv_file;
- static const struct sockaddr_in6 *sa6_allagent;
-+static socklen_t sa6_alen;
- static struct duid client_duid;
-
- static void usage __P((void));
-@@ -457,7 +458,7 @@
- }
- #endif
- ((struct sockaddr_in6 *)(res->ai_addr))->sin6_scope_id = ifidx;
-- dprintf(LOG_INFO, "inbound addr is %s/%d", addr2str(res->ai_addr), res->ai_addrlen);
-+ dprintf(LOG_DEBUG, "inbound addr is %s/%d", addr2str(res->ai_addr, res->ai_addrlen), res->ai_addrlen);
-
- /*
- * If the interface has JUST been brought up, the kernel may not
-@@ -514,7 +515,7 @@
- exit(1);
- }
- ((struct sockaddr_in6 *)(res->ai_addr))->sin6_scope_id = ifidx;
-- dprintf(LOG_INFO, "outbound addr is %s/%d", addr2str(res->ai_addr), res->ai_addrlen);
-+ dprintf(LOG_INFO, "outbound addr is %s/%d", addr2str(res->ai_addr, res->ai_addrlen), res->ai_addrlen);
- if (bind(outsock, res->ai_addr, res->ai_addrlen) < 0) {
- dprintf(LOG_ERR, "%s" "bind(outbound): %s",
- FNAME, strerror(errno));
-@@ -533,6 +534,7 @@
- }
- memcpy(&sa6_allagent_storage, res->ai_addr, res->ai_addrlen);
- sa6_allagent = (const struct sockaddr_in6 *)&sa6_allagent_storage;
-+ sa6_alen = res->ai_addrlen;
- freeaddrinfo(res);
-
- /* client interface configuration */
-@@ -1021,6 +1023,7 @@
- struct dhcp6_optinfo optinfo;
- ssize_t optlen, len;
- struct timeval duration, now;
-+ socklen_t salen;
-
- ifp = ev->ifp;
-
-@@ -1274,15 +1277,17 @@
- exit(1);
- }
- memcpy(&dst, res->ai_addr, res->ai_addrlen);
-+ salen = res->ai_addrlen;
- break;
- }
- default:
- dst = *sa6_allagent;
-+ salen = sa6_alen;
- break;
- }
- dst.sin6_scope_id = ifp->linkid;
- dprintf(LOG_INFO, "send dst if %s addr is %s scope id is %d",
-- ifp->ifname, addr2str((struct sockaddr *)&dst), ifp->linkid);
-+ ifp->ifname, addr2str((struct sockaddr *)&dst, salen), ifp->linkid);
-
- dprintf(LOG_DEBUG,"\nSEND PACKET\n");
- if (sendto(ifp->outsock, buf, len, MSG_DONTROUTE, (struct sockaddr *)&dst,
-@@ -1293,7 +1298,7 @@
-
- dprintf(LOG_INFO, "%s" "send %s to %s", FNAME,
- dhcp6msgstr(dh6->dh6_msgtype),
-- addr2str((struct sockaddr *)&dst));
-+ addr2str((struct sockaddr *)&dst, salen));
-
- end:
- dhcp6_clear_options(&optinfo);
-@@ -1356,7 +1361,7 @@
-
- dprintf(LOG_DEBUG, "%s" "receive %s from %s scope id %d %s", FNAME,
- dhcp6msgstr(dh6->dh6_msgtype),
-- addr2str((struct sockaddr *)&from),
-+ addr2str((struct sockaddr *)&from, sizeof (((struct sockaddr *)&from)->sa_data)),
- ((struct sockaddr_in6 *)&from)->sin6_scope_id,
- ifp->ifname);
-
-@@ -1383,7 +1388,7 @@
- default:
- dprintf(LOG_INFO, "%s" "received an unexpected message (%s) "
- "from %s", FNAME, dhcp6msgstr(dh6->dh6_msgtype),
-- addr2str((struct sockaddr *)&from));
-+ addr2str((struct sockaddr *)&from, sizeof(((struct sockaddr *)&from)->sa_data)));
- break;
- }
- dhcp6_clear_options(&optinfo);
---- dhcp-0.10/libdhcp6client/common.h.salen 2006-06-20 17:47:03.000000000 -0400
-+++ dhcp-0.10/libdhcp6client/common.h 2006-06-20 17:47:11.000000000 -0400
-@@ -67,7 +67,7 @@
- extern long random_between __P((long, long));
- extern int prefix6_mask __P((struct in6_addr *, int));
- extern int sa6_plen2mask __P((struct sockaddr_in6 *, int));
--extern char *addr2str __P((struct sockaddr *));
-+extern char *addr2str __P((struct sockaddr *, socklen_t));
- extern char *in6addr2str __P((struct in6_addr *, int));
- extern const char *getdev __P((struct sockaddr_in6 *));
- extern int in6_addrscopebyif __P((struct in6_addr *, char *));
---- dhcp-0.10/common.h.salen 2006-06-20 17:47:03.000000000 -0400
-+++ dhcp-0.10/common.h 2006-06-20 17:47:11.000000000 -0400
-@@ -67,7 +67,7 @@
- extern long random_between __P((long, long));
- extern int prefix6_mask __P((struct in6_addr *, int));
- extern int sa6_plen2mask __P((struct sockaddr_in6 *, int));
--extern char *addr2str __P((struct sockaddr *));
-+extern char *addr2str __P((struct sockaddr *, socklen_t));
- extern char *in6addr2str __P((struct in6_addr *, int));
- extern const char *getdev __P((struct sockaddr_in6 *));
- extern int in6_addrscopebyif __P((struct in6_addr *, char *));
Index: dhcpv6.spec
===================================================================
RCS file: /cvs/dist/rpms/dhcpv6/devel/dhcpv6.spec,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- dhcpv6.spec 12 Jul 2006 05:37:21 -0000 1.40
+++ dhcpv6.spec 19 Jul 2006 06:46:03 -0000 1.41
@@ -1,7 +1,7 @@
Summary: DHCPv6 - DHCP server and client for IPv6
Name: dhcpv6
Version: 0.10
-Release: 29.1
+Release: 30
License: GPL
Group: System Environment/Daemons
URL: http://dhcpv6.sourceforge.net/
@@ -30,6 +30,7 @@
Patch18: dhcpv6-0.10-libdhcp6client-Makefile.patch
Patch19: dhcpv6-0.10-libdhcp6client.patch
Patch20: dhcpv6-0.10-salen.patch
+Patch21: dhcpv6-0.10-prefix_bz196429.patch
Prereq: /sbin/chkconfig, /sbin/service
BuildRequires: flex, bison, openssl-devel, autoconf, automake, libtool
@@ -71,7 +72,8 @@
%patch16 -p1 -b .prefix
%patch17 -p1 -b .htonl
%patch18 -p1 -b .libdhcp6client-Makefile
-
+%patch20 -p1 -b .salen
+%patch21 -p1 -b .prefix_bz196429
%if %{NODEBUGINFO}
export CFLAGS=`echo "$RPM_OPT_FLAGS" | sed 's/-O2//g'`' -g3 -gdwarf-2'
%else
@@ -84,7 +86,7 @@
--mandir=/usr/share/man
make libdhcp6client/.
%patch19 -p1 -b .libdhcp6client
-%patch20 -p1 -b .salen
+
%build
make
@@ -191,6 +193,16 @@
%{_libdir}/libdhcp6client.a
%changelog
+* Tue Jul 18 2006 Jason Vas Dias <jvdias at redhat.com> - 0.10-30
+- fix bug 196429:
+ Allow clients from dhcpv6-0.10<=16 to get addresses.
+ >16, the server sent the prefix length; this is now
+ conditional on the client sending the DHC6OPT_REQUEST_PREFIX,
+ and can be disabled by the 'use-ra-prefix' dhcp6c.conf or
+ dhcp6s.conf setting. With the upstream version, the only
+ way to set the clients' address prefixes was by router
+ advertisement.
+
* Wed Jul 12 2006 Jesse Keating <jkeating at redhat.com> - 0.10-29.1
- rebuild
More information about the fedora-cvs-commits
mailing list