|
@@ -754,13 +754,6 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) {
|
|
|
opt->setUint32(lease->valid_lft_);
|
|
|
answer->addOption(opt);
|
|
|
|
|
|
- // Router (type 3)
|
|
|
- Subnet::OptionDescriptor opt_routers =
|
|
|
- subnet->getOptionDescriptor("dhcp4", DHO_ROUTERS);
|
|
|
- if (opt_routers.option) {
|
|
|
- answer->addOption(opt_routers.option);
|
|
|
- }
|
|
|
-
|
|
|
// Subnet mask (type 1)
|
|
|
answer->addOption(getNetmaskOption(subnet));
|
|
|
|
|
@@ -857,14 +850,17 @@ Dhcpv4Srv::processDiscover(Pkt4Ptr& discover) {
|
|
|
|
|
|
copyDefaultFields(discover, offer);
|
|
|
appendDefaultOptions(offer, DHCPOFFER);
|
|
|
- appendRequestedOptions(discover, offer);
|
|
|
|
|
|
assignLease(discover, offer);
|
|
|
|
|
|
- // There are a few basic options that we always want to
|
|
|
- // include in the response. If client did not request
|
|
|
- // them we append them for him.
|
|
|
- appendBasicOptions(discover, offer);
|
|
|
+ // Adding any other options makes sense only when we got the lease.
|
|
|
+ if (offer->getYiaddr() != IOAddress("0.0.0.0")) {
|
|
|
+ appendRequestedOptions(discover, offer);
|
|
|
+ // There are a few basic options that we always want to
|
|
|
+ // include in the response. If client did not request
|
|
|
+ // them we append them for him.
|
|
|
+ appendBasicOptions(discover, offer);
|
|
|
+ }
|
|
|
|
|
|
return (offer);
|
|
|
}
|
|
@@ -880,17 +876,20 @@ Dhcpv4Srv::processRequest(Pkt4Ptr& request) {
|
|
|
|
|
|
copyDefaultFields(request, ack);
|
|
|
appendDefaultOptions(ack, DHCPACK);
|
|
|
- appendRequestedOptions(request, ack);
|
|
|
|
|
|
// Note that we treat REQUEST message uniformly, regardless if this is a
|
|
|
// first request (requesting for new address), renewing existing address
|
|
|
// or even rebinding.
|
|
|
assignLease(request, ack);
|
|
|
|
|
|
- // There are a few basic options that we always want to
|
|
|
- // include in the response. If client did not request
|
|
|
- // them we append them for him.
|
|
|
- appendBasicOptions(request, ack);
|
|
|
+ // Adding any other options makes sense only when we got the lease.
|
|
|
+ if (ack->getYiaddr() != IOAddress("0.0.0.0")) {
|
|
|
+ appendRequestedOptions(request, ack);
|
|
|
+ // There are a few basic options that we always want to
|
|
|
+ // include in the response. If client did not request
|
|
|
+ // them we append them for him.
|
|
|
+ appendBasicOptions(request, ack);
|
|
|
+ }
|
|
|
|
|
|
return (ack);
|
|
|
}
|