[Kea-users] Is KEA trying to do some smart caching?

Ola Thoresen ola at nytt.no
Wed Apr 20 09:48:41 UTC 2016


Just did some more debugging, and made a minimal "proof of concept":

int pkt4_send(CalloutHandle& handle) {
         Pkt4Ptr response4_ptr;
         handle.getArgument("response4", response4_ptr);

         interesting << "Got argument " << "\n";
         flush(interesting);

         OptionPtr x_opt_ptr = response4_ptr->getOption(43);
         interesting << "Got 43 " << "\n";
         flush(interesting);

         if (x_opt_ptr) {
                 interesting << "Val " << x_opt_ptr->toString() << "\n";
                 flush(interesting);

                 OptionPtr x_sub_ptr = x_opt_ptr->getOption(1);
                 interesting << "Got 01 " << "\n";
                 flush(interesting);

                 if (x_sub_ptr) {
                         interesting << "Val " << x_sub_ptr->toString() 
<< "\n";
                         flush(interesting);

                         interesting << "Straight from the argument: " 
<< x_sub_ptr->toString() << "\n";
                         flush(interesting);


                         x_opt_ptr->delOption(1);
                         x_sub_ptr.reset(new OptionString(Option::V4, 1, 
"MyValue"));
                         x_opt_ptr->addOption(x_sub_ptr);

                         interesting << "And now it is: " << 
x_opt_ptr->toString() << "\n";
                         flush(interesting);
                 }
         }
}



This gives me the following output:

====== 1. DHCP-packet after restart of kea-dhcp4: =====

Got argument
Got 43
Val type=043, len=041:,
options:
   type=001, len=033: "cpe/config?hostname=@OPTION_82_2@" (string)
   type=003, len=004: "http" (string)
Got 01
Val cpe/config?hostname=@OPTION_82_2@
Straight from the argument: cpe/config?hostname=@OPTION_82_2@
And now it is: type=043, len=015:,
options:
   type=001, len=007: "MyValue" (string)
   type=003, len=004: "http" (string)



====== 2. DHCP-packet =====

Got argument
Got 43
Val type=043, len=015:,
options:
   type=001, len=007: "MyValue" (string)
   type=003, len=004: "http" (string)
Got 01
Val MyValue
Straight from the argument: MyValue
And now it is: type=043, len=015:,
options:
   type=001, len=007: "MyValue" (string)
   type=003, len=004: "http" (string)




I am no C++-expert, so it is probably me who are changing a value I 
should not change, but to me it looks like what I get from
  handle.getArgument("response4", response4_ptr);
still contains data from the previous DHCP-packet is sent.



Rgds.

Ola Thoresen



More information about the Kea-users mailing list