From: Marcin Siodelski Date: Tue, 17 Mar 2015 18:39:11 +0000 (+0100) Subject: [3737] Fixed the logging message when the lease allocation fails. X-Git-Tag: kea-0.9.1~21^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac1832cdbb42b62cd7bf30fce9ebe5fab0dacd7c;p=thirdparty%2Fkea.git [3737] Fixed the logging message when the lease allocation fails. Log the ciaddr and requested-ip-address if exists. Previously the message said it logged yiaddr sent by the client, but the client doesn't set the yiaddr. --- diff --git a/src/bin/dhcp4/dhcp4_messages.mes b/src/bin/dhcp4/dhcp4_messages.mes index 3aa3fad787..a15909f1cf 100644 --- a/src/bin/dhcp4/dhcp4_messages.mes +++ b/src/bin/dhcp4/dhcp4_messages.mes @@ -168,7 +168,7 @@ a lease. It is up to the client to choose one server out of other advertised and continue allocation with that server. This is a normal behavior and indicates successful operation. -% DHCP4_LEASE_ADVERT_FAIL failed to advertise a lease for client client-id %1, hwaddr %2, client sent yiaddr %3 +% DHCP4_LEASE_ADVERT_FAIL failed to advertise a lease for client-id %1, hwaddr %2, client sent ciaddr %3, requested-ip-address %4 This message indicates that the server has failed to offer a lease to the specified client after receiving a DISCOVER message from it. There are many possible reasons for such a failure. @@ -178,7 +178,7 @@ This debug message indicates that the server successfully granted a lease in response to client's REQUEST message. This is a normal behavior and indicates successful operation. -% DHCP4_LEASE_ALLOC_FAIL failed to grant a lease for client-id %1, hwaddr %2, client sent yiaddr %3 +% DHCP4_LEASE_ALLOC_FAIL failed to grant a lease for client-id %1, hwaddr %2, client sent ciaddr %3, requested-ip-address %4 This message indicates that the server failed to grant a lease to the specified client after receiving a REQUEST message from it. There are many possible reasons for such a failure. Additional messages will indicate the diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index 532376f0ca..914e46ed13 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -1092,7 +1092,7 @@ Dhcpv4Srv::assignLease(Dhcpv4Exchange& ex) { if (opt_requested_address) { hint = opt_requested_address->readAddress(); - } else if (query->getCiaddr() != IOAddress::IPV4_ZERO_ADDRESS()) { + } else if (!query->getCiaddr().isV4Zero()) { hint = query->getCiaddr(); } @@ -1292,7 +1292,9 @@ Dhcpv4Srv::assignLease(Dhcpv4Exchange& ex) { DHCP4_LEASE_ADVERT_FAIL:DHCP4_LEASE_ALLOC_FAIL) .arg(client_id?client_id->toText():"(no client-id)") .arg(hwaddr?hwaddr->toText():"(no hwaddr info)") - .arg(hint.toText()); + .arg(query->getCiaddr().toText()) + .arg(opt_requested_address ? + opt_requested_address->readAddress().toText() : "(no address)"); resp->setType(DHCPNAK); resp->setYiaddr(IOAddress::IPV4_ZERO_ADDRESS());