Further tweaks to DHCP FQDN option.

This commit is contained in:
Simon Kelley
2012-08-30 11:43:35 +01:00
parent 2e34ac1403
commit 9fed0f71c2

View File

@@ -510,17 +510,27 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
char *pq = daemon->dhcp_buff; char *pq = daemon->dhcp_buff;
unsigned char *pp, *op = option_ptr(opt, 0); unsigned char *pp, *op = option_ptr(opt, 0);
/* Set an MBZ bit to indicate receipt of FQDN option - cleared later */ fqdn_flags = *op;
fqdn_flags = *op | 0x10;
len -= 3; len -= 3;
op += 3; op += 3;
pp = op; pp = op;
/* Always force update, since the client has no way to do it itself. */ /* NB, the following always sets at least one bit */
if (!option_bool(OPT_FQDN_UPDATE) && !(fqdn_flags & 0x01)) if (option_bool(OPT_FQDN_UPDATE))
fqdn_flags |= 0x03; {
if (fqdn_flags & 0x01)
fqdn_flags &= ~0x08; {
fqdn_flags |= 0x02; /* set O */
fqdn_flags &= ~0x01; /* clear S */
}
fqdn_flags |= 0x08; /* set N */
}
else
{
if (!(fqdn_flags & 0x01))
fqdn_flags |= 0x03; /* set S and O */
fqdn_flags &= ~0x08; /* clear N */
}
if (fqdn_flags & 0x04) if (fqdn_flags & 0x04)
while (*op != 0 && ((op + (*op) + 1) - pp) < len) while (*op != 0 && ((op + (*op) + 1) - pp) < len)