Comment 17 for bug 1521618

Revision history for this message
Trent Lloyd (lathiat) wrote : Re: wrong subnet in DHCP answer when multiple networks are present

Full patch and explanation here:
https://code.launchpad.net/~lathiat/maas/1.9-lp1521618-dhcp-incorrect-router

With multiple subnets, PXE DHCP clients would receive the router of the first
subnet in the configuration file regardless of which subnet they actually
received a lease from.

This happens because match sections such as "class" (used here to give PXE
clients a smaller lease time) and "host" (not currently used, but is the
example given in the below e-mail) are not actually scoped within the subnet{}
declaration as you would expect. They are actually defined in the global scope
for all subnets, but also inherit options from the subnet{} declaration they
were defined in such as "option routers".

This strange behavior is explained in the following email:
https://lists.isc.org/pipermail/dhcp-users/2011-September/014001.html

We fix this by moving the conditional declarations out into the global scope,
instead of repeating them for each subnet. This way they do not inherit any
options from the subnet scope.