BIND 10 trac3207, updated. 081cc5311fd9e8cc52b0610b77bb72997eeba835 [3207] Added support for TFTP_SERVER option to user_chech hook library

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Oct 25 14:14:41 UTC 2013


The branch, trac3207 has been updated
       via  081cc5311fd9e8cc52b0610b77bb72997eeba835 (commit)
      from  c9c132e4cb353b7fbe16e5c98ef72f8c7e498f81 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 081cc5311fd9e8cc52b0610b77bb72997eeba835
Author: Thomas Markwalder <tmark at isc.org>
Date:   Fri Oct 25 10:13:24 2013 -0400

    [3207] Added support for TFTP_SERVER option to user_chech hook library
    
    User check hook library now supports adding TFTP server option to DHCP
    response packet options from values in user registry.

-----------------------------------------------------------------------

Summary of changes:
 src/hooks/dhcp/user_chk/pkt_send_co.cc |   76 ++++++++++++++++++++++----------
 1 file changed, 52 insertions(+), 24 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/hooks/dhcp/user_chk/pkt_send_co.cc b/src/hooks/dhcp/user_chk/pkt_send_co.cc
index 24fc62e..77cb7c6 100644
--- a/src/hooks/dhcp/user_chk/pkt_send_co.cc
+++ b/src/hooks/dhcp/user_chk/pkt_send_co.cc
@@ -111,47 +111,75 @@ int pkt4_send(CalloutHandle& handle) {
 }
 
 void add4Options(Pkt4Ptr& response, UserPtr& user) {
-    std::string bootfile = user->getProperty("bootfile");
-    if (!bootfile.empty()) {
+    std::string opt_value = user->getProperty("bootfile");
+    if (!opt_value.empty()) {
         std::cout << "DHCP UserCheckHook : add4Options "
-              << "adding boot file:" << bootfile << std::endl;
+              << "adding boot file:" << opt_value << std::endl;
 
         // Set file field
-        response->setFile((const uint8_t*)(bootfile.c_str()),
-                          bootfile.length());
+        response->setFile((const uint8_t*)(opt_value.c_str()),
+                          opt_value.length());
 
         // Remove the option if it exists.
-        OptionPtr boot_opt = response->getOption(DHO_BOOT_FILE_NAME);
-        if (boot_opt) {
+        OptionPtr opt = response->getOption(DHO_BOOT_FILE_NAME);
+        if (opt) {
             response->delOption(DHO_BOOT_FILE_NAME);
         }
 
         // Now add the boot file option.
-        boot_opt.reset(new OptionString(Option::V4, DHO_BOOT_FILE_NAME,
-                                        bootfile));
+        opt.reset(new OptionString(Option::V4, DHO_BOOT_FILE_NAME, opt_value));
+        response->addOption(opt);
+    }
+
+    opt_value = user->getProperty("tftp_server");
+    if (!opt_value.empty()) {
+        std::cout << "DHCP UserCheckHook : add4Options "
+              << "adding TFTP server:" << opt_value << std::endl;
+
+        // Remove the option if it exists.
+        OptionPtr opt = response->getOption(DHO_TFTP_SERVER_NAME);
+        if (opt) {
+            response->delOption(DHO_TFTP_SERVER_NAME);
+        }
 
-        response->addOption(boot_opt);
+        // Now add the boot file option.
+        opt.reset(new OptionString(Option::V4, DHO_TFTP_SERVER_NAME,
+                                   opt_value));
+        response->addOption(opt);
     }
     // add next option here
 }
 
 void add6Options(Pkt6Ptr& response, UserPtr& user) {
-    std::string bootfile = user->getProperty("bootfile");
-    if (!bootfile.empty()) {
+    OptionPtr vendor = response->getOption(D6O_VENDOR_OPTS);
+    if (!vendor) {
+        return;
+    }
+
+    /// @todo: This will be DOCSIS3_V6_CONFIG_FILE.
+    /// Unfortunately, 3207 was branched from master before
+    /// 3194 was merged in, so this branch does not have
+    /// src/lib/dhcp/docsis3_option_defs.h.
+
+    std::string opt_value = user->getProperty("bootfile");
+    if (!opt_value.empty()) {
         std::cout << "DHCP UserCheckHook : add6Options "
-                  << "adding boot file:" << bootfile << std::endl;
-        OptionPtr vendor = response->getOption(D6O_VENDOR_OPTS);
-        if (vendor) {
-            /// @todo: This will be DOCSIS3_V6_CONFIG_FILE.
-            /// Unfortunately, 3207 was branched from master before
-            /// 3194 was merged in, so this branch does not have
-            /// src/lib/dhcp/docsis3_option_defs.h.
-            vendor->delOption(33);
-            OptionPtr boot_opt(new OptionString(Option::V6, 33,
-                                                bootfile));
-            vendor->addOption(boot_opt);
-        }
+                  << "adding boot file:" << opt_value << std::endl;
+        vendor->delOption(33);
+        OptionPtr boot_opt(new OptionString(Option::V6, 33, opt_value));
+        vendor->addOption(boot_opt);
+    }
+
+    opt_value = user->getProperty("tftp_server");
+    if (!opt_value.empty()) {
+        std::cout << "DHCP UserCheckHook : add6Options "
+                  << "adding tftp server:" << opt_value << std::endl;
+
+        vendor->delOption(32);
+        OptionPtr opt(new OptionString(Option::V6, 32, opt_value));
+        vendor->addOption(opt);
     }
+
     // add next option here
 }
 



More information about the bind10-changes mailing list