diff options
| author | Roy Marples <roy@marples.name> | 2008-08-06 22:12:37 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2008-08-06 22:12:37 +0000 |
| commit | 4971c6237d01d56a1a6fb34df8568682c7638032 (patch) | |
| tree | 04947e2cebd1d4567729de39d6129f741d3ce343 /dhcp.c | |
| parent | 0bdf7a9499e336a8c59fa5f918a7e805e7291fbc (diff) | |
| download | dhcpcd-4971c6237d01d56a1a6fb34df8568682c7638032.tar.xz | |
Revert FQDN to ASCII encoding as I cannot find out what RFC4702 really means for encoding :/
Diffstat (limited to 'dhcp.c')
| -rw-r--r-- | dhcp.c | 31 |
1 files changed, 13 insertions, 18 deletions
@@ -713,8 +713,6 @@ make_message(struct dhcp_message **message, uint32_t ul; uint16_t sz; const struct dhcp_opt *opt; - uint8_t *d; - const char *c, *e; dhcp = xzalloc(sizeof (*dhcp)); m = (uint8_t *)dhcp; @@ -832,9 +830,9 @@ make_message(struct dhcp_message **message, memcpy(p, options->hostname, options->hostname[0] + 1); p += options->hostname[0] + 1; } else { - /* Draft IETF DHC-FQDN option (81) */ + /* IETF DHC-FQDN option (81), RFC4702 */ *p++ = DHCP_FQDN; - *p++ = options->hostname[0] + 5; + *p++ = options->hostname[0] + 3; /* * Flags: 0000NEOS * S: 1 => Client requests Server to update @@ -845,22 +843,19 @@ make_message(struct dhcp_message **message, * N: 1 => Client requests Server to not * update DNS */ - *p++ = (options->fqdn & 0x9) | 0x4; + *p++ = (options->fqdn & 0x9); + /* FIXME: We should use DNS format as + * RFC4702 claims ASCII is deprecated. + * However I cannot find anything that says + * what this encoding actually is, so we + * use ASCII. + * To flip the encoding bit, set it like so + * *p++ = (options->fqdn & 0x9) | 0x4; */ *p++ = 0; /* from server for PTR RR */ *p++ = 0; /* from server for A RR if S=1 */ - c = options->hostname + 1; - e = c + options->hostname[0]; - d = p++; - while (c < e) { - if (*c == '.') { - *d = p - d - 1; - d = p++; - } else - *p++ = (uint8_t) *c; - c++; - } - *d = p - d - 1; - *p++ = 0; + memcpy(p, options->hostname + 1, + options->hostname[0]); + p += options->hostname[0]; } } |
