<div dir="ltr"><br><div>Hi there,</div><div><br></div><div>I'm trying to use the latest Git revision of Kea (e7c3e4b) and I think I'm running into a bug. I'm hoping someone can help me with a sanity check.</div><div><br></div><div>My configuration is still super basic as I'm currently doing R&D, but it seems to be the case that kea-dhcp4 in 1.0.0-git is ignoring host reservations stored in MySQL.</div>







<div><br></div><div>Here's my config:</div><div><br></div><div>-- cut --</div><div><div>{</div><div><span class="" style="white-space:pre">   </span>"Dhcp4": {</div><div><span class="" style="white-space:pre">               </span>"interfaces-config": {</div><div><span class="" style="white-space:pre">                   </span>"interfaces": ["eth0"]</div><div><span class="" style="white-space:pre">         </span>},</div><div><span class="" style="white-space:pre">         </span>"lease-database": {</div><div><span class="" style="white-space:pre">                      </span>"type": "mysql",</div><div><span class="" style="white-space:pre">                       </span>"host": "localhost",</div><div><span class="" style="white-space:pre">                   </span>"name": "******",</div><div><span class="" style="white-space:pre">                      </span>"user": "******",</div><div><span class="" style="white-space:pre">                      </span>"password": "******"</div><div><span class="" style="white-space:pre">           </span>},</div><div><span class="" style="white-space:pre">         </span>"hosts-database": {</div><div><span class="" style="white-space:pre">                      </span>"type": "mysql",</div><div><span class="" style="white-space:pre">                       </span>"host": "localhost",</div><div><span class="" style="white-space:pre">                   </span>"name": "******",</div><div><span class="" style="white-space:pre">                      </span>"user": "******",</div><div><span class="" style="white-space:pre">                      </span>"password": "******"</div><div><span class="" style="white-space:pre">           </span>},</div><div><span class="" style="white-space:pre">         </span>"client-classes": [{</div><div><span class="" style="white-space:pre">                     </span>"name": "iPXE",</div><div><span class="" style="white-space:pre">                        </span>"test": "option[77].exists and option[77].hex == 'iPXE'",</div><div><span class="" style="white-space:pre">                      </span>"option-data": [{</div><div><span class="" style="white-space:pre">                                </span>"name": "boot-file-name",</div><div><span class="" style="white-space:pre">                              </span>"data": "http://******/api/provision"</div><div><span class="" style="white-space:pre">                  </span>}]</div><div><span class="" style="white-space:pre">         </span>}, {</div><div><span class="" style="white-space:pre">                       </span>"name": "bootstrap",</div><div><span class="" style="white-space:pre">                   </span>"test": "option[60].exists and not(option[77].exists)",</div><div><span class="" style="white-space:pre">                        </span>"option-data": [{</div><div><span class="" style="white-space:pre">                                </span>"name": "boot-file-name",</div><div><span class="" style="white-space:pre">                              </span>"data": "ipxe/undionly.kpxe"</div><div><span class="" style="white-space:pre">                   </span>}]</div><div><span class="" style="white-space:pre">         </span>}, {</div><div><span class="" style="white-space:pre">                       </span>"name": "renew",</div><div><span class="" style="white-space:pre">                       </span>"test": "option[50].exists"</div><div><span class="" style="white-space:pre">            </span>}],</div><div><span class="" style="white-space:pre">                </span>"expired-leases-processing": {</div><div><span class="" style="white-space:pre">                   </span>"reclaim-timer-wait-time": 10,</div><div><span class="" style="white-space:pre">                   </span>"flush-reclaimed-timer-wait-time": 25,</div><div><span class="" style="white-space:pre">                   </span>"hold-reclaimed-time": 3600,</div><div><span class="" style="white-space:pre">                     </span>"max-reclaim-leases": 100,</div><div><span class="" style="white-space:pre">                       </span>"max-reclaim-time": 250,</div><div><span class="" style="white-space:pre">                 </span>"unwarned-reclaim-cycles": 5</div><div><span class="" style="white-space:pre">             </span>},</div><div><span class="" style="white-space:pre">         </span>"valid-lifetime": 4000,</div><div><span class="" style="white-space:pre">          </span>"subnet4": [{</div><div><span class="" style="white-space:pre">                    </span>"subnet": "<a href="http://10.129.129.0/29">10.129.129.0/29</a>",</div><div><span class="" style="white-space:pre">                        </span>"id": 1,</div><div><span class="" style="white-space:pre">                 </span>"pools": [{</div><div><span class="" style="white-space:pre">                              </span>"pool": "10.129.129.2 - 10.129.129.6"</div><div><span class="" style="white-space:pre">                  </span>}],</div><div><span class="" style="white-space:pre">                        </span>"option-data": [{</div><div><span class="" style="white-space:pre">                                </span>"name": "routers",</div><div><span class="" style="white-space:pre">                             </span>"data": "10.129.129.1"</div><div><span class="" style="white-space:pre">                 </span>}]</div><div><span class="" style="white-space:pre">         </span>}, {</div><div><span class="" style="white-space:pre">                       </span>"subnet": "<a href="http://10.129.129.8/29">10.129.129.8/29</a>",</div><div><span class="" style="white-space:pre">                        </span>"id": 2,</div><div><span class="" style="white-space:pre">                 </span>"pools": [{</div><div><span class="" style="white-space:pre">                              </span>"pool": "10.129.129.10 - 10.129.129.14"</div><div><span class="" style="white-space:pre">                        </span>}],</div><div><span class="" style="white-space:pre">                        </span>"option-data": [{</div><div><span class="" style="white-space:pre">                                </span>"name": "routers",</div><div><span class="" style="white-space:pre">                             </span>"data": "10.129.129.9"</div><div><span class="" style="white-space:pre">                 </span>}]</div><div><span class="" style="white-space:pre">         </span>}]</div><div><span class="" style="white-space:pre"> </span>},</div><div><span class="" style="white-space:pre"> </span>"Dhcp6": {</div><div><span class="" style="white-space:pre">               </span>"interfaces-config": {</div><div><span class="" style="white-space:pre">                   </span>"interfaces": ["eth0"]</div><div><span class="" style="white-space:pre">         </span>},</div><div><span class="" style="white-space:pre">         </span>"lease-database": {</div><div><span class="" style="white-space:pre">                      </span>"type": "mysql",</div><div><span class="" style="white-space:pre">                       </span>"host": "localhost",</div><div><span class="" style="white-space:pre">                   </span>"name": "******",</div><div><span class="" style="white-space:pre">                      </span>"user": "******",</div><div><span class="" style="white-space:pre">                      </span>"password": "******"</div><div><span class="" style="white-space:pre">           </span>},</div><div><span class="" style="white-space:pre">         </span>"hosts-database": {</div><div><span class="" style="white-space:pre">                      </span>"type": "mysql",</div><div><span class="" style="white-space:pre">                       </span>"host": "localhost",</div><div><span class="" style="white-space:pre">                   </span>"name": "******",</div><div><span class="" style="white-space:pre">                      </span>"user": "******",</div><div><span class="" style="white-space:pre">                      </span>"password": "******"</div><div><span class="" style="white-space:pre">           </span>},</div><div><span class="" style="white-space:pre">         </span>"expired-leases-processing": {</div><div><span class="" style="white-space:pre">                   </span>"reclaim-timer-wait-time": 10,</div><div><span class="" style="white-space:pre">                   </span>"flush-reclaimed-timer-wait-time": 25,</div><div><span class="" style="white-space:pre">                   </span>"hold-reclaimed-time": 3600,</div><div><span class="" style="white-space:pre">                     </span>"max-reclaim-leases": 100,</div><div><span class="" style="white-space:pre">                       </span>"max-reclaim-time": 250,</div><div><span class="" style="white-space:pre">                 </span>"unwarned-reclaim-cycles": 5</div><div><span class="" style="white-space:pre">             </span>},</div><div><span class="" style="white-space:pre">         </span>"preferred-lifetime": 3000,</div><div><span class="" style="white-space:pre">              </span>"valid-lifetime": 4000,</div><div><span class="" style="white-space:pre">          </span>"renew-timer": 1000,</div><div><span class="" style="white-space:pre">             </span>"rebind-timer": 2000,</div><div><span class="" style="white-space:pre">            </span>"subnet6": []</div><div><span class="" style="white-space:pre">    </span>},</div><div><span class="" style="white-space:pre"> </span>"DhcpDdns": {</div><div><span class="" style="white-space:pre">            </span>"ip-address": "127.0.0.1",</div><div><span class="" style="white-space:pre">             </span>"port": 53001,</div><div><span class="" style="white-space:pre">           </span>"tsig-keys": [],</div><div><span class="" style="white-space:pre">         </span>"forward-ddns": {},</div><div><span class="" style="white-space:pre">              </span>"reverse-ddns": {}</div><div><span class="" style="white-space:pre">       </span>},</div><div><span class="" style="white-space:pre"> </span>"Logging": {</div><div><span class="" style="white-space:pre">             </span>"loggers": [{</div><div><span class="" style="white-space:pre">                    </span>"name": "kea-dhcp4",</div><div><span class="" style="white-space:pre">                   </span>"output_options": [{</div><div><span class="" style="white-space:pre">                             </span>"output": "/var/log/kea-dhcp4.log"</div><div><span class="" style="white-space:pre">                     </span>}],</div><div><span class="" style="white-space:pre">                        </span>"severity": "DEBUG",</div><div><span class="" style="white-space:pre">                   </span>"debuglevel": 99</div><div><span class="" style="white-space:pre">         </span>}, {</div><div><span class="" style="white-space:pre">                       </span>"name": "kea-dhcp6",</div><div><span class="" style="white-space:pre">                   </span>"output_options": [{</div><div><span class="" style="white-space:pre">                             </span>"output": "/var/log/kea-dhcp6.log"</div><div><span class="" style="white-space:pre">                     </span>}],</div><div><span class="" style="white-space:pre">                        </span>"severity": "INFO",</div><div><span class="" style="white-space:pre">                    </span>"debuglevel": 0</div><div><span class="" style="white-space:pre">          </span>}, {</div><div><span class="" style="white-space:pre">                       </span>"name": "kea-dhcp-ddns",</div><div><span class="" style="white-space:pre">                       </span>"output_options": [{</div><div><span class="" style="white-space:pre">                             </span>"output": "/var/log/kea-ddns.log"</div><div><span class="" style="white-space:pre">                      </span>}],</div><div><span class="" style="white-space:pre">                        </span>"severity": "INFO",</div><div><span class="" style="white-space:pre">                    </span>"debuglevel": 0</div><div><span class="" style="white-space:pre">          </span>}]</div><div><span class="" style="white-space:pre"> </span>}</div><div>}</div></div><div>-- cut --</div><div><br></div><div>Lease information is being updated, so I know that it's talking to MySQL; if I intentionally set an incorrect password on the hosts-database stanza, the daemon throws a MySQL error as expected, so I know it's aware of the hosts table, it's just not querying it. A dump of the database shows identical column values for the encoded MAC address in the lease4 and hosts tables (although I can send that along, too, if it helps). </div><div><br></div><div>If I revert back to the 1.0.0 release version, reservations work fine, but the config parser gags on the 'exists' keyword in the client-classes section, which limits my ability to chainload iPXE, since it doesn't support the 'exists' test keyword. I'm reluctant to go back to 1.0.0 regardless, though, since there were also some weird interactions between it and the latest build of iPXE, which was regularly (but not always) rejecting DHCPOFFER packets from Kea because it thought they were non-local; the 1.0.0-git version doesn't have this problem. Manually adding a reservation to the configuration file works as expected under both versions, but that's the opposite direction of where I want to go with what I'm designing.</div><div><br></div><div>I switched on the query logging on the MySQL daemon and the traffic pattern is indeed different when I toggle between versions; 1.0.0-git doesn't generate any queries like this, but 1.0.0 does:</div><div><br></div><div>-- cut --<br><span class="">Execute   SELECT host_id, dhcp_identifier, dhcp_identifier_type, dhcp4_subnet_id, dhcp6_subnet_id, ipv4_address, hostname, dhcp4_client_classes, dhcp6_client_classes </span><span class="">FROM hosts</span><span class=""> WHERE dhcp4_subnet_id = 2 AND dhcp_identifier_type = 0    AND dhcp_identifier = '</span><span class="">^L<C4></span><span class="">z'<br></span>-- cut --</div><div><br></div><div>I tried a couple of things, like tweaking the query, but I suspect the underlying issue is a bit deeper than that, and my C++-fu is weak. :/<br><br>Any guidance or advice would be greatly appreciated!</div><div><br></div><div>thanks,</div><div>Klaus</div></div>