IPv6: add DHCPv6 support

The DHCP version is determined according to the first IP address that
appears in the configuration file.  Caveat; counters are of native long
type.  Since IPv6 address space has 2^128 addresses, they are subject to
overflow.

[Sami Kerola:  This commit also fixed a percent sorting bug, which has
been broken always.  See changes ret_percent() for the fix.]

CC: LI Zimu <lzm@cernet.edu.cn>
CC: Xing Li <xing@cernet.edu.cn>
Reviewed-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Cheer Xiao <xiaqqaix@gmail.com>
This commit is contained in:
Cheer Xiao 2012-12-02 19:38:26 +00:00 committed by Sami Kerola
parent 71bcee14e9
commit a57d399643
8 changed files with 267 additions and 119 deletions

View file

@ -239,6 +239,14 @@ int main(int argc, char **argv)
/* Global allocations, counter resets etc */
int prepare_memory(void)
{
/* Fill in prefix length cache */
int i, j;
for (i = 0; i < 2; i++) {
for (j = 0; j < NUM_OF_PREFIX; j++) {
prefix_length[i][j] = strlen(prefixes[i][j]);
}
}
dhcp_version = VERSION_UNKNOWN;
RANGES = 64;
num_ranges = num_shared_networks = 0;
shared_networks =