]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Finished merge of (hex in integer options) trac5087_base
authorFrancis Dupont <fdupont@isc.org>
Tue, 18 Apr 2017 06:52:32 +0000 (08:52 +0200)
committerFrancis Dupont <fdupont@isc.org>
Tue, 18 Apr 2017 06:52:32 +0000 (08:52 +0200)
1  2 
ChangeLog
doc/examples/kea4/multiple-options.json
doc/examples/kea6/multiple-options.json
doc/guide/dhcp4-srv.xml
doc/guide/dhcp6-srv.xml
src/lib/dhcp/option_definition.cc
src/lib/dhcp/option_definition.h
src/lib/dhcp/tests/option_definition_unittest.cc

diff --cc ChangeLog
index 06a4310f3f517241b4b26c9f74a953fd50b9cb05,fac2ae76b1bfde78d5d527c59e90e249337b7418..d368266990af502e8a43449da0a97b8ca4451a9a
+++ b/ChangeLog
++1242. [func]          fdupont
++      Integer fields in options can now be specified in either
++      decimal or hexadecimal format.
++      (Trac $4540, git xxx)
++
 +1241. [func]          fdupont
 +      Support for tuple-based options added. DHCPv6 option
 +      bootfile-param (code 60) can now be set in a more convenient
 +      manner.
 +      (Trac #4070, git 30102cacee95b91e6c4666f0c11f06232f19eeb9)
 +
 +1240. [bug]           marcin
 +      Corrected IOFetch unit test failures on Debian.
 +      (Trac #5216, git a7c2946678c43aedfb2e3c37b9730a10067528f3)
 +
 +1239. [func]          marcin
 +      Implemented additional sanity checks when adding host
 +      reservations into the configuration file.
 +      (Trac #5207, git ea42c6f479918235ae4a67a60d08720e2664720c)
 +
 +Kea 1.2.0-beta released on April 7, 2017
 +
 +1238. [build]         tmark,tomek
 +      Library version numbers bumped for release.
 +      (Trac #5201     git 58c9c5b705d72031c1589c30c542384a9d43e0f3)
 +
 +1237. [bug]           marcin
 +      Fixed hanging Control Agent unit tests.
 +      (Trac #5200, git 65daafd135965f9eb0bd4c3a22085d4bd3c6ffbe)
 +
 +1236. [build]         zeitounator
 +      Improvements in tools/tests_in_valgrind.sh script.
 +      (Github #49, git 272e7babf9ebeab5f78850394d72c9431041e2e9)
 +
 +1235. [func]          MrMarvin
 +      kea-admin now supports -h (and --host) parameter that can specify
 +      MySQL or PostgreSQL database locations other than the default
 +      localhost.
 +      (Github #14, git 4038157a3499ad90956c98a2172c57b173f2b985)
 +
 +1234. [build]         fdupont
 +      Improved installation procedure for kea-shell.
 +      (Trac #5170, git 68a902fb723965ee6f5b7a8272224395917525cc)
 +
 +1233. [doc]           marcin
 +      Documented new component Kea Control Agent in the Administrator's
 +      Manual and the Developer's Guide.
 +      (Trac #5175, git abf7887ad65eb4b221a1fe61ea0c9773b4feaddb)
 +
 +1232. [func]          tomek
 +      host4_identifier and host6_identifier hook points have been added.
 +      Premium: Flexible Identifier (flex-id) hook point has been developed.
 +      It allows users to specify a custom expression that takes any
 +      option, field, characteristic or property of the packet to be
 +      used as identifier and then do reservations based on the evaluated
 +      expression for each incoming packet.
 +      (Trac #5132, git cd497526d5bff7ae55bb41c9264fb33943a0cf62)
 +
 +1231. [func]          marcin
 +      Control agent forwards commands to be handled by other Kea
 +      servers.
 +      (Trac #5078, git 19a50ed1ccafae19ef10d84cba73992cadf49753)
 +
 +1230. [bug]           fdupont
 +      kea-dhcp-ddns now correctly populates the original ID in the TSIG rdata
 +      when doing signed updates.  Prior to this the value was set to zero
 +      causing PowerDNS to reject then requests with a bad key error.
 +      (Trac #5071, git cafa3d5c24f0112b0b9384a9c1083fe8a3eeb2bf)
 +
 +1229. [func]          fdupont
 +      A new command: config-test has been implemented in DHCPv4, DHCPv6
 +      and control agent servers. It allows checking whether new
 +      configuration looks correct.
 +      (Trac #5150, git 5f6cf226e848baef8d9af64e16c1dbf617a0a798)
 +
 +1228. [bug]           fdupont
 +      Logging on syslog now uses correctly the given facility. If none
 +      is given the default facility is local0, and with an unrecognized
 +      value user (log4cplus default). The syslog openlog() ident
 +      parameter is the program name.
 +      (Trac #5053, git 532d9f0e459ab1450a83a5015a2dd54745794383)
 +
 +1227. [func]          fdupont, tomek
 +      Additional commands: version-get, build-report have been
 +      implemented for DHCPv4, DHCPv6 and Control Agent
 +      components. Control Agent also now supports shutdown command.
 +      (Trac #102, git 9d2b8326fc032876d74c1768c61c630987c25cc5)
 +
 +1226. [func]          fdupont
 +      Command line option -t support added to libprocess and implemented
 +      for kea-dhcp-ddns and kea-ctrl-agent. It allows configuration sanity
 +      checking. Note that some parameters, such as ip-address, port, and
 +      DNS server addresses for instance for kea-dhcp-ddns are not fully
 +      checked as sockets are not opened or connections are not attempted.
 +      (Trac #5152, git 2231d79ebebd3cdf432cd4a8ac32018d180e27b6)
 +
 +1225. [func]          tomek
 +      Two new commands: config-get (retrieves current configuration)
 +      and config-write (writes current configuration to disk) have been
 +      implemented.
 +      (Trac #5151, git ffb26811736a2ae6f9b5556b9823aa284b7e0aec)
 +
 +1224. [func]          fdupont
 +      toElement(), a crucial functionality for upcoming get-config
 +      and write-config command, has been implemented.
 +      (Trac #5114, git df38c26f957c9ac329718ac9d70ffbcf7b95c4e9)
 +
 +1223. [func]          tomek
 +      Kea-shell, a management client able to connect to REST interface
 +      provided by Control Agent, has been added. Control Agent now
 +      uses bison parser, which provides better sanity checks, improved
 +      comments and file inclusions.
 +      (Trac #5137, git 816dc5ccfa374bd9942a49c7bac475f6d0523caa)
 +
 +1222. [func]          fdupont
 +      Obsolete parameter 'allow-client-update' has been removed
 +      from DHCPv4 and DHCPv6 components.
 +      (Trac #5145, git 01fde297a978e2bd832655ac7276e5aa3a7e8400)
 +
 +1221. [func]          tomek
 +      Control agent is now able to parse the input configuration and
 +      store it in its configuration syntax structure. Upcoming tickets
 +      will take advantage of that information.
 +      (Trac #5134, git 828304f2f408888e4b096418e90e35ba524979d0)
 +
 +1220. [func]          parisioa, fdupont, tomek
 +      DHCPv4 and DHCPv6 parsers have updated to accept database port
 +      parameter. The parameter for Cassandra is now called
 +      "contact-points" (was "contact_points" previously).
 +      (Trac #5061, git d12b6f4a6d80d6bc854f2a8a086e412dc37867bc)
 +
 +1219.   [func]                marcin
 +      Control Agent uses libkea-http to process commands over
 +      the RESTful interface.
 +        (Trac #5107, git 88ce715926a46b6b3832630116fc7782adc46c7b)
 +
 +1218. [func]          tmark, tomek
 +      Configuration parsing for D2 has been migrated to bison/flex
 +      and the SimpleParser framework.  This includes changes to
 +      libprocess which render the CPL agnostic to the underlying
 +      parsing mechanisms.
 +      (Trac #5110, git feb2cedc0936364a923ab78542a21114533dd0f5)
 +
 +1217. [func]          marcin
 +      Implemented libkea-http library.
 +      (Trac #5077, git cd72284b5b221e620770883db7e166c4d3ba7eb6)
 +      (Trac #5088, git 715d18f961801ffbd798a65b19459178c3a53857)
 +      (Trac #5099, git 7e8df7993f295431e2cb6a13858f746649c4e18d)
 +
 +1216. [func]          fdupont, tomek
 +      Command line option -t implemented for DHCPv4 and DHCPv6.  It
 +      allows configuration sanity checking. Note that not all parameters
 +      are completely checked. In particular, service and control channel
 +      sockets are not opened, and hook libraries are not loaded.
 +      (Trac #3770, git 1d12582e270935ee7b72548d9c66753f4eea4ca4)
 +
 +1215. [doc]           tomek
 +      Developer's Guide updated to cover flex/bison parser.
 +      (Trac #5112, git 44139d821c1f4e43dbff22d49101a0854e4f9f5b)
 +
 +1214. [func]          tomek
 +      Bison parser implemented for Control-agent. The code is able
 +      to syntactically parse input configuration, but the output
 +      is not used yet.
 +      (Trac #5076, git d99048aa5b90efa7812a75cdae98a0913470f5a6)
 +
 +1213. [bug]           fdupont
 +      Option string values containing comma can now be specified
 +      correctly by preceding comma with double backslashes (e.g.
 +      "foo\\,bar").
 +      (Trac #5105, git fa79ac2396aa94d7bac91bd12d3593ebaaa9386d)
 +
 +1212. [doc]           andreipavelQ
 +      Many spelling corrections.
 +      (Github #47, git a6a7ca1ced8c63c1e11ef4c572f09272340afdd7)
 +
 +1211. [func]          andreipavelQ
 +      Updated PostgreSQL version reporting to be in line with
 +      MySQL and Cassandra.
 +      (Github #42, git 7ef4a190facadd66775b4a44c696d1c4215616cd)
 +
 +1210. [doc]           andreipavelQ
 +      Doxygen version updated to 1.8.11.
 +      (Github #45, git ce72998382b62269823fa0dcbfa41dfa9c72b69e)
 +
 +1209. [func]          tomek
 +      Relay options are now printed in DHCPv6 when sufficiently detailed
 +      debug logging is requested.
 +      (Trac #5131, git 5bf58b21fcf07f2e2e97275efa1f76cde913b30a)
 +
 +1208. [func]          tomek
 +      Global DHCPv4 and DHCPv6 parsers have been migrated to the
 +      SimpleParser framework. Several parameters (renew-timer,
 +      rebind-timer, preferred-lifetime, valid-lifetime, match-client-id,
 +      next-server, decline-probation-period, dhcp4o6-port,
 +      echo-client-id) now have explicit default values.
 +      (Trac #5019, git f3538dd031e6f29abcd516f425d72c8f929abbb0)
 +
 +1207. [func]          fdupont
 +      Client classes parser migrated to SimpleParser. The 'name'
 +      parameter in 'client-classes' definitions is now mandatory.
 +      (Trac #5098, git e93906e48a6e2b0ff78c5e37dca642646fe47d43)
 +
 +1206. [func]          tomek
 +      'hooks-libraries' parser migrated to SimpleParser. The code will
 +      now refuse a configuration if a hook library fails to load.
 +      (Trac #5031, #5041, git 1bbaf4cbcf6fda59bacdf526a6c762315fdd88a1)
 +
  1205. [func]          tomek
        Parsers for interfaces configuration converted to SimpleParser.
        Removed obsolete 'version' parameter in Dhcp6.
index 00544ec8b8240be657180c9dc24f09a4e7c2cc16,0741fcfafcc7239edc1f5511ca536166e47e890e..7eda91fad1c285f750f3f55c4e56907834c751f8
      "type": "memfile"
    },
  
# Addresses will be assigned with a lifetime of 4000 seconds.
// Addresses will be assigned with a lifetime of 4000 seconds.
    "valid-lifetime": 4000,
  
# Renew and rebind timers are commented out. This implies that options
# 58 and 59 will not be sent to the client. In this case it is up to
# the client to pick the timer values according to RFC2131. Uncomment the
# timers to send these options to the client.
#  "renew-timer": 1000,
#  "rebind-timer": 2000,
// Renew and rebind timers are commented out. This implies that options
// 58 and 59 will not be sent to the client. In this case it is up to
// the client to pick the timer values according to RFC2131. Uncomment the
// timers to send these options to the client.
//  "renew-timer": 1000,
//  "rebind-timer": 2000,
  
--// Defining a subnet. There are 3 DHCP options returned to the
++// Defining a subnet. There are some DHCP options returned to the
 +// clients connected to this subnet. The first and third options are
+ // clients connected to this subnet. The first two options are
  // identified by the name. The third option is identified by the
  // option code.
    "subnet4": [
      {
         "pools": [ { "pool":  "192.0.2.10 - 192.0.2.200" } ],
         "subnet": "192.0.2.0/24",
 -        "interface": "ethX",
 -
 -        // This is how option values are defined for this particular subnet.
 -        "option-data": [
 +       "interface": "ethX",
 +       "option-data": [
+             // When specifying options, you typically need to specify
+             // one of (name or code) and data. The full option specification
+             // covers name, code, space, csv-format and data.
+             // space defaults to "dhcp4" which is usually correct, unless you
+             // use encapsulate options. csv-format defaults to "true", so
+             // this is also correct, unless you want to specify the whole
+             // option value as long hex string. For example, to specify
+             // domain-name-servers you could do this:
+             // {
+             //     "name": "domain-name-servers",
+             //     "code": 6,
+             //     "csv-format": "true",
+             //     "space": "dhcp4",
+             //     "data": "192.0.2.1, 192.0.2.2"
+             // }
+             // but it's a lot of writing, so it's easier to do this instead:
 -            {
 -                "name": "domain-name-servers",
 -                "data": "192.0.2.1, 192.0.2.2"
 -            },
 -
 +         {
 +             "name": "domain-name-servers",
 +             "data": "192.0.2.1, 192.0.2.2"
 +         },
+             // Note the Kea provides some of the options on its own. In
+             // particular:
+             // - IP address lease time (option 51) is governed by valid-lifetime
+             //   parameter, so you don't need to specify it as option.
+             // - Subnet mask (option 1) is calculated automatically from the
+             //   subnet parameter specified for each "subnet4" entry.
+             // - renewal-timer (option 58) is calculated from renew-timer
+             //   parameter
+             // - rebind timer (option 59) is calculated from rebind-timer
+             //   parameter
+             // For each IPv4 subnet you most likely need to specify at least
+             // one router.
 -            {
 -                "name": "routers",
 -                "data": "192.0.2.1"
 -            },
 -
 +         {
 +             "name": "routers",
 +             "data": "192.0.2.1"
 +         },
+             // Typically people prefer to refer to options by their names, so they
+             // don't need to remember the code names. However, some people like
+             // to use numerical values. For example, option "domain-name" uses
+             // option code 15, so you can reference to it either by
+             // "name": "domain-name" or "code": 15.
 -            {
 -                "code": 15,
 -                "data": "example.org"
 -            },
++         {
++             "code": 15,
++             "data": "example.org"
++         },
++            // String options that have a comma in their values need to have
++            // it escaped (i.e. each comma is predeced by two backslashes).
++            // That's because commas are reserved for separating fields in
++            // compound options. At the same time, we need to be conformant
++            // with JSON spec, that does not allow "\,". Therefore the
++            // slightly uncommon double backslashes notation is needed.
++
++            // Legal JSON escapes are \ followed by "\/bfnrt character
++            // or \u followed by 4 hexa-decimal numbers (currently Kea
++            // supports only \u0000 to \u00ff code points).
++            // CSV processing translates '\\' into '\' and '\,' into ','
++            // only so for instance '\x' is translated into '\x'. But
++            // as it works on a JSON string value each of these '\'
++            // characters must be doubled on JSON input.
 +         {
-              // String options that have a comma in their values need to have
-              // it escaped (i.e. each comma is predeced by two backslashes).
-              // That's because commas are reserved for separating fields in
-              // compound options. At the same time, we need to be conformant
-              // with JSON spec, that does not allow "\,". Therefore the
-              // slightly uncommon double backslashes notation is needed.
-              "name": "boot-file-name",
-              "data": "EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00"
++            "name": "boot-file-name",
++            "data": "EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00"
  
-              // Legal JSON escapes are \ followed by "\/bfnrt character
-              // or \u followed by 4 hexa-decimal numbers (currently Kea
-              // supports only \u0000 to \u00ff code points).
-              // CSV processing translates '\\' into '\' and '\,' into ','
-              // only so for instance '\x' is translated into '\x'. But
-              // as it works on a JSON string value each of these '\'
-              // characters must be doubled on JSON input.
++         },
+             // Options that take integer values can either be specified in
+             // dec or hex format. Hex format could be either plain (e.g. abcd)
+             // or prefixed with 0x (e.g. 0xabcd).
 -            {
 -               "name": "default-ip-ttl",
 -               "data": "0xf0"
 -            }
++         {
++            "name": "default-ip-ttl",
++            "data": "0xf0"
 +         }
         ]
      } 
    ]
index e7932b80139d3eb57f65b0066c2e4dd61eaaf14c,7ff428b3188878bf34cf8e797092b8f93d3b5e68..ca7b64a9cb2ebab51cddb7fb08d8a135d15c64b6
    "renew-timer": 1000,
    "rebind-timer": 2000,
  
- # Defining a subnet. There are 3 DHCP options returned to the
- # clients connected to this subnet. The first option is identified
- # by the name. The second option is identified by the code.
- # There are two address pools defined within this subnet. Pool
- # specific value for option 12 is defined for the pool:
- # 2001:db8:1::1 - 2001:db8:1::100. Clients obtaining an address
- # from this pool will be assigned option 12 with a value of
- # 3001:cafe::21. Clients belonging to this subnet but obtaining
- # addresses from the other pool, or the clients obtaining
- # stateless configuration will be assigned subnet specific value
- # of option 12, i.e. 2001:db8:1:0:ff00::1.
- # For DHCPv6 subnets can have prefix delegation pools too so
- # a pd-pools with an option-data is defined too.
 -// Defining a subnet. There are 2 DHCP options returned to the
++// Defining a subnet. There are some DHCP options returned to the
+ // clients connected to this subnet. The first option is identified
+ // by the name. The second option is identified by the code.
+ // There are two address pools defined within this subnet. Pool
+ // specific value for option 12 is defined for the pool:
+ // 2001:db8:1::1 - 2001:db8:1::100. Clients obtaining an address
+ // from this pool will be assigned option 12 with a value of
+ // 3001:cafe::21. Clients belonging to this subnet but obtaining
+ // addresses from the other pool, or the clients obtaining
+ // stateless configuration will be assigned subnet specific value
+ // of option 12, i.e. 2001:db8:1:0:ff00::1.
++// For DHCPv6 subnets can have prefix delegation pools too so
++// a pd-pools with an option-data is defined too.
    "subnet6": [
      {
-       "option-data": [
-         {
-             "name": "dns-servers",
-             "data": "2001:db8:2::45, 2001:db8:2::100"
-         },
-         {
-             "code": 12,
-             "data": "2001:db8:1:0:ff00::1"
-         },
-         {
+         // This is how option values are defined for this particular subnet.
+         "option-data": [
+             // When specifying options, you typically need to specify
+             // one of (name or code) and data. The full option specification
+             // covers name, code, space, csv-format and data.
+             // space defaults to "dhcp6" which is usually correct, unless you
+             // use encapsulate options. csv-format defaults to "true", so
+             // this is also correct, unless you want to specify the whole
+             // option value as long hex string. For example, to specify
+             // domain-name-servers you could do this:
+             // {
+             //     "name": "dns-servers",
+             //     "code": 23,
+             //     "csv-format": "true",
+             //     "space": "dhcp6",
+             //     "data": "2001:db8:2::45, 2001:db8:2::100"
+             // }
+             // but it's a lot of writing, so it's easier to do this instead:
+             {
+                 "name": "dns-servers",
+                 "data": "2001:db8:2::45, 2001:db8:2::100"
+             },
+             // Typically people prefer to refer to options by their names, so they
+             // don't need to remember the code names. However, some people like
+             // to use numerical values. For example, DHCPv6 can optionally use
+             // server unicast communication, if extra option is present. Option
+             // "unicast" uses option code 12, so you can reference to it either
+             // by "name": "unicast" or "code": 12.
+             {
+                 "code": 12,
+                 "data": "2001:db8:1:0:ff00::1"
+             },
++
 +            // String options that have a comma in their values need to have
 +            // it escaped (i.e. each comma is predeced by two backslashes).
 +            // That's because commas are reserved for separating fields in
 +            // compound options. At the same time, we need to be conformant
 +            // with JSON spec, that does not allow "\,". Therefore the
 +            // slightly uncommon double backslashes notation is needed.
-             "name": "new-posix-timezone",
-             "data": "EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00"
 +
 +            // Legal JSON escapes are \ followed by "\/bfnrt character
 +            // or \u followed by 4 hexa-decimal numbers (currently Kea
 +            // supports only \u0000 to \u00ff code points).
 +            // CSV processing translates '\\' into '\' and '\,' into ','
 +            // only so for instance '\x' is translated into '\x'. But
 +            // as it works on a JSON string value each of these '\'
 +            // characters must be doubled on JSON input.
-         },
-         {
++            {
++                "name": "new-posix-timezone",
++                "data": "EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00"
++            },
++
+             // Options that take integer values can either be specified in
+             // dec or hex format. Hex format could be either plain (e.g. abcd)
+             // or prefixed with 0x (e.g. 0xabcd).
+             {
+                 "name": "preference",
+                 "data": "0xf0"
++            },
++
 +            // A few options are encoded in (length, string) tuples
 +            // which can be defined using only strings as the CSV
 +            // processing computes lengths.
-             "name": "bootfile-param",
-             "data": "root=/dev/sda2, quiet, splash"
-         }
++            {
++                "name": "bootfile-param",
++                "data": "root=/dev/sda2, quiet, splash"
+             }
        ],
        "pools": [
          {
Simple merge
Simple merge
Simple merge
Simple merge