From: Wlodek Wencel Date: Wed, 24 May 2017 16:42:38 +0000 (+0200) Subject: [master] documentation and examples updated for flex-id hook X-Git-Tag: trac5243_base~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=008208dc26fed5e0e261491bc49acb6bc810d873;p=thirdparty%2Fkea.git [master] documentation and examples updated for flex-id hook --- diff --git a/doc/examples/kea4/reservations.json b/doc/examples/kea4/reservations.json index e3cda897da..c61ac5c573 100644 --- a/doc/examples/kea4/reservations.json +++ b/doc/examples/kea4/reservations.json @@ -31,8 +31,9 @@ // Kea supports reservations by several different types of identifiers: // hw-address (hardware/MAC address of the client), duid (DUID inserted by the -// client), client-id (client identifier inserted by the client) and circuit-id -// (circuit identifier inserted by the relay agent). When told to do so, Kea can +// client), client-id (client identifier inserted by the client), circuit-id +// (circuit identifier inserted by the relay agent) and flex-id (flexible identifier +// available when flex_id hook library is loaded). When told to do so, Kea can // check for all of those identifier types, but it takes a costly database lookup // to do so. It is therefore useful from a performance perspective to use only // the reservation types that are actually used in a given network. @@ -40,7 +41,8 @@ // The example below is not optimal from a performance perspective, but it // nicely showcases the host reservation capabilities. Please use the minimum // set of identifier types used in your network. -"host-reservation-identifiers": [ "circuit-id", "hw-address", "duid", "client-id" ], +"host-reservation-identifiers": [ "circuit-id", "hw-address", "duid", + "client-id", "flex-id" ], // Define a subnet with four reservations. Some of the reservations belong // to the dynamic pool. Kea is able to handle this case, but it is not diff --git a/doc/examples/kea6/reservations.json b/doc/examples/kea6/reservations.json index 0b30d637ae..770e9dfa4d 100644 --- a/doc/examples/kea6/reservations.json +++ b/doc/examples/kea6/reservations.json @@ -27,12 +27,13 @@ "renew-timer": 1000, "rebind-timer": 2000, -// Kea supports two types of identifiers in DHCPv6: hw-address (hardware/MAC address -// of the client) and duid (DUID inserted by the client). When told to do so, Kea can +// Kea supports three types of identifiers in DHCPv6: hw-address (hardware/MAC address +// of the client), duid (DUID inserted by the client) and flex-id (flexible identifier +// available when flex_id hook library is loaded) When told to do so, Kea can // check for each of these identifier types, but it takes a costly database lookup // to do so. It is therefore useful from a performance perspective to use only // the reservation types that are actually used in a given network. - "host-reservation-identifiers": [ "duid", "hw-address" ], + "host-reservation-identifiers": [ "duid", "hw-address", "flex-id" ], // The following list defines subnets. Subnet, pools and interface definitions // are the same as in the regular scenario, without host reservations. diff --git a/doc/guide/hooks.xml b/doc/guide/hooks.xml index 7bfb23e00a..6e12f60d84 100644 --- a/doc/guide/hooks.xml +++ b/doc/guide/hooks.xml @@ -630,8 +630,9 @@ link address: 3001::1, hop count: 1, identified by remote-id: only the first 6 bytes of the interface-id are interesting, because remaining bytes are either randomly changed or not unique between devices. Therefore the customer decided to use first 6 bytes of the - interface-id option inserted by the relay agent. This could be - achieved by using the following configuration: + interface-id option inserted by the relay agent. After adding "flex-id" + host-reservation-identifiers goal can be achieved by using the + following configuration: "Dhcp6": { "subnet6": [{ ..., // subnet definition starts here @@ -640,11 +641,12 @@ link address: 3001::1, hop count: 1, identified by remote-id: "ip-addresses": [ "2001:db8::1" ] ], }], // end of subnet definitions + "host-reservation-identifiers": ["duid", "flex-id"], // add "flex-id" to reservation identifiers "hooks-libraries": [ { "library": "/path/libdhcp_flex_id.so", "parameters": { - "identifier-expression": "substring(relay6[0].option[18],0,8)" + "identifier-expression": "substring(relay6[0].option[18].hex,0,8)" } }, ... @@ -672,6 +674,26 @@ link address: 3001::1, hop count: 1, identified by remote-id: The former is more convenient for printable characters, while hex string values are more convenient for non-printable characters. + +"Dhcp6": { + "subnet6": [{ ..., // subnet definition starts here + "reservations": [ + "flex-id": "01:02:03:04:05:06", // value of the first 8 bytes of the interface-id + "ip-addresses": [ "2001:db8::1" ] + ], + }], // end of subnet definitions + "host-reservation-identifiers": ["duid", "flex-id"], // add "flex-id" to reservation identifiers + "hooks-libraries": [ + { + "library": "/path/libdhcp_flex_id.so", + "parameters": { + "identifier-expression": "vendor[4491].option[1026].hex" + } + }, + ... + ] +} +