From: Roy Marples Date: Sat, 22 Jun 2013 09:15:35 +0000 (+0000) Subject: Fix a compile issue on Big Endian machines. X-Git-Tag: v6.0.1~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a8c05b27104a5fb723a6fe89c25cfc9dfd322c81;p=thirdparty%2Fdhcpcd.git Fix a compile issue on Big Endian machines. Don't use magic numbers for DHCPv6 FQDN bits. --- diff --git a/dhcp6.c b/dhcp6.c index 205fce2b..47ba45e5 100644 --- a/dhcp6.c +++ b/dhcp6.c @@ -623,19 +623,19 @@ dhcp6_makemessage(struct interface *ifp) p = D6_OPTION_DATA(o); switch (ifo->fqdn) { case FQDN_BOTH: - *p = 0x01; + *p = D6_FQDN_BOTH; break; case FQDN_PTR: - *p = 0x00; + *p = D6_FQDN_PTR; break; default: - *p = 0x04; + *p = D6_FQDN_NONE; break; } - o->len = encode_rfc1035(hostname, p + 1); - if (o->len == 0) - *p = 0x04; - o->len = htons(++o->len); + l = encode_rfc1035(hostname, p + 1); + if (l == 0) + *p = D6_FQDN_NONE; + o->len = htons(l + 1); } if (n_options) { diff --git a/dhcp6.h b/dhcp6.h index 063403b1..6c177da4 100644 --- a/dhcp6.h +++ b/dhcp6.h @@ -83,6 +83,10 @@ #define D6_OPTION_POSIX_TIMEZONE 41 #define D6_OPTION_TZDB_TIMEZONE 42 +#define D6_FQDN_PTR 0x00 +#define D6_FQDN_BOTH 0x01 +#define D6_FQDN_NONE 0x04 + #include "dhcp.h" #include "ipv6.h" extern const struct dhcp_opt dhcp6_opts[];