changeset 2057:ab6d98b99524 draft

Fix a compile issue on Big Endian machines. Don't use magic numbers for DHCPv6 FQDN bits.
author Roy Marples <roy@marples.name>
date Sat, 22 Jun 2013 09:15:35 +0000
parents eaed912c1227
children 6f42edb32d59
files dhcp6.c dhcp6.h
diffstat 2 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/dhcp6.c	Fri Jun 21 18:58:09 2013 +0000
+++ b/dhcp6.c	Sat Jun 22 09:15:35 2013 +0000
@@ -623,19 +623,19 @@
 			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) {
--- a/dhcp6.h	Fri Jun 21 18:58:09 2013 +0000
+++ b/dhcp6.h	Sat Jun 22 09:15:35 2013 +0000
@@ -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[];