]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix a compile issue on Big Endian machines.
authorRoy Marples <roy@marples.name>
Sat, 22 Jun 2013 09:15:35 +0000 (09:15 +0000)
committerRoy Marples <roy@marples.name>
Sat, 22 Jun 2013 09:15:35 +0000 (09:15 +0000)
Don't use magic numbers for DHCPv6 FQDN bits.

dhcp6.c
dhcp6.h

diff --git a/dhcp6.c b/dhcp6.c
index 205fce2b654b71a056a26e9ce2158f34d3901ff8..47ba45e532dabd97a6c559d23cfde29842035bc1 100644 (file)
--- 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 063403b106591816619ff19bbd75525b563e390d..6c177da459b50747e571b8c5b219a412be126773 100644 (file)
--- a/dhcp6.h
+++ b/dhcp6.h
 #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[];