Browse Source

[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.
Marcin Siodelski 10 years ago
parent
commit
ac1832cdbb
2 changed files with 6 additions and 4 deletions
  1. 2 2
      src/bin/dhcp4/dhcp4_messages.mes
  2. 4 2
      src/bin/dhcp4/dhcp4_srv.cc

+ 2 - 2
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

+ 4 - 2
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());