Browse Source

[3464] PoolsListParser logic improved

Tomek Mrugalski 10 years ago
parent
commit
200a1b9631
3 changed files with 18 additions and 3 deletions
  1. 6 0
      doc/guide/dhcp4-srv.xml
  2. 9 3
      src/lib/dhcpsrv/dhcp_parsers.cc
  3. 3 0
      src/lib/dhcpsrv/dhcp_parsers.h

+ 6 - 0
doc/guide/dhcp4-srv.xml

@@ -401,6 +401,12 @@ temporarily override a list of interface names and listen on all interfaces.
     in square brackets, even though only one range of addresses is
     specified in this example.</para>
 
+    <para>Each <command>pool</command> is a structure that describes
+    the pool parameters. Currently there is only one parameter,
+    <command>pool</command>, which gives the range of addresses
+    in the pool. Additional parameters will be added in future
+    releases of Kea.</para>
+
     <para>It is possible to define more than one pool in a subnet: continuing
     the previous example, further assume that 192.0.2.64/26 should be also be
     managed by the server. It could be written as 192.0.2.64 to

+ 9 - 3
src/lib/dhcpsrv/dhcp_parsers.cc

@@ -962,13 +962,19 @@ PoolsListParser::build(ConstElementPtr pools) {
 
         parser->build(pool);
 
-        // Before we can create a pool, we need to ask the pool parser
-        // to create it.
-        parser->commit();
+        // Let's store the parser, but do not commit anything yet
+        parsers_.push_back(parser);
     }
 }
 
 void PoolsListParser::commit() {
+
+    // Commit each parser first. It will store the pool structure
+    // in pools_.
+    BOOST_FOREACH(ParserPtr parser, parsers_) {
+        parser->commit();
+    }
+
     if (pools_) {
         // local_pools_ holds the values produced by the build function.
         // At this point parsing should have completed successfuly so

+ 3 - 0
src/lib/dhcpsrv/dhcp_parsers.h

@@ -902,6 +902,9 @@ protected:
     /// A temporary storage for pools configuration. It is the
     /// storage where pools are stored by the build function.
     PoolStoragePtr local_pools_;
+
+    /// Collection of parsers;
+    ParserCollection parsers_;
 };
 
 /// @brief parser for additional relay information