diff options
author | Simon Kelley <simon@thekelleys.org.uk> | 2012-08-30 11:43:35 +0100 |
---|---|---|
committer | Simon Kelley <simon@thekelleys.org.uk> | 2012-08-30 11:43:35 +0100 |
commit | 9fed0f71c26d90f9dd231d36ea16ee688cbfa956 (patch) | |
tree | 6389f1a62a229b68a160be7307d6ecdcd0556722 | |
parent | 2e34ac14037517975134bbb54aa666696438c3ce (diff) | |
download | dnsmasq-9fed0f71c26d90f9dd231d36ea16ee688cbfa956.tar.gz |
Further tweaks to DHCP FQDN option.
-rw-r--r-- | src/rfc2131.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/rfc2131.c b/src/rfc2131.c index ff7e114..207f450 100644 --- a/src/rfc2131.c +++ b/src/rfc2131.c @@ -510,17 +510,27 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index, char *pq = daemon->dhcp_buff; unsigned char *pp, *op = option_ptr(opt, 0); - /* Set an MBZ bit to indicate receipt of FQDN option - cleared later */ - fqdn_flags = *op | 0x10; + fqdn_flags = *op; len -= 3; op += 3; pp = op; - /* Always force update, since the client has no way to do it itself. */ - if (!option_bool(OPT_FQDN_UPDATE) && !(fqdn_flags & 0x01)) - fqdn_flags |= 0x03; - - fqdn_flags &= ~0x08; + /* NB, the following always sets at least one bit */ + if (option_bool(OPT_FQDN_UPDATE)) + { + if (fqdn_flags & 0x01) + { + 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) while (*op != 0 && ((op + (*op) + 1) - pp) < len) |