Project

General

Profile

Actions

Feature #2347

closed

Add routes into the routing table for delegated IPv6 prefixes.

Added by Seth Mos over 12 years ago. Updated over 12 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
DHCP (IPv4)
Target version:
Start date:
04/06/2012
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Release Notes:

Description

Currently we support Prefix Delegation in the DCHPv6 server (ISC dhcpd 4.2.3). However, the dhcpd server does not add routes into the routing tables for the prefix delegation to work.

Ideally a route should be added and removed from the routing table whenever a Prefix is delegated or released.

There are 2 possible ways to go about this, we can do this outside dhcpd where we monitor the leases file and check for prefix delegations and process that for configuring the routes. The problem being that this will likely always trail the actual dhcp6 request from the client.

Example /var/dhcpd/var/db/dhcpd6.leases file:

ia-pd "\000\000\000\000\000\001\000\001\027\013\002\031\000\014)l&}" {
  cltt 5 2012/04/06 12:13:11;
  iaprefix 2001:470:d72c:5000::/56 {
    binding state active;
    preferred-life 4500;
    max-life 7200;
    ends 5 2012/04/06 14:13:11;
  }
}

For the approach on making this event based we need hooks into the current dhcpv6 server.

There is a message "Picking pool prefix" in dhcpv6.c which is triggered whenever a client gets a IA_PD assigned. There is another message "Picking pool address" just before that holds the IA_NA address which is used for the delegation.

At line 3274 of dhcpv6.c we could probably craft a log message if a prefix is leased to a client.
In the sources of dhcp-4.2.3/server/dhcpv6.c there is the following function which already logs a release.
We could hook into here for removing a route for a delegated prefix. Also see ia_pd_nomatch_release() for orphaned prefixes.

static void
ia_pd_match_release(const struct data_string *client_id,
                    const struct data_string *iapref,
                    struct iasubopt *prefix)
{
        char tmp_addr[INET6_ADDRSTRLEN];

        log_info("Client %s releases prefix %s/%u",
                 print_hex_1(client_id->len, client_id->data, 60),
                 inet_ntop(AF_INET6, iapref->data + 9,
                           tmp_addr, sizeof(tmp_addr)),
                 (unsigned) getUChar(iapref->data + 8));
        if (prefix != NULL) {
                release_lease6(prefix->ipv6_pool, prefix);
                prefix->ia->cltt = cur_time;
                write_ia(prefix->ia);
        }
}

We could also opt for a hybrid approach, fire off a external script on lease/release that parses dhcpd6.lease and adjusts the routes where required.

Actions

Also available in: Atom PDF