Print this page
7388 Support DHCP Client FQDN. Allow IAID/DUID for all v4.

@@ -18,10 +18,11 @@
  *
  * CDDL HEADER END
  */
 /*
  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Chris Fraire <cfraire@me.com>.
  *
  * This module contains core functions for managing DHCP state machine
  * instances.
  */
 

@@ -330,10 +331,12 @@
         free(dsmp->dsm_cid);
         free(dsmp->dsm_prl);
         free(dsmp->dsm_pil);
         free(dsmp->dsm_routers);
         free(dsmp->dsm_reqhost);
+        free(dsmp->dsm_msg_reqhost);
+        free(dsmp->dsm_reqfqdn);
         free(dsmp);
 
         /* no big deal if this fails */
         if (global_smach_count == 0 && inactivity_id == -1) {
                 inactivity_id = iu_schedule_timer(tq, DHCP_INACTIVITY_WAIT,

@@ -1047,18 +1050,21 @@
         /*
          * There was either no user-specified Client ID value, or we were
          * unable to parse it.  We need to determine if a Client ID is required
          * and, if so, generate one.
          *
-         * If it's IPv4, not in an IPMP group, and not a logical interface,
+         * If it's IPv4, not in an IPMP group, not a logical interface,
+         * and a DHCP default for DF_V4_DEFAULT_IAID_DUID is not affirmative,
          * then we need to preserve backward-compatibility by avoiding
          * new-fangled DUID/IAID construction.  (Note: even for IPMP test
          * addresses, we construct a DUID/IAID since we may renew a lease for
          * an IPMP test address on any functioning IP interface in the group.)
          */
         if (!pif->pif_isv6 && pif->pif_grifname[0] == '\0' &&
-            strchr(dsmp->dsm_name, ':') == NULL) {
+            strchr(dsmp->dsm_name, ':') == NULL &&
+            !df_get_bool(dsmp->dsm_name, pif->pif_isv6,
+            DF_V4_DEFAULT_IAID_DUID)) {
                 if (pif->pif_hwtype == ARPHRD_IB) {
                         /*
                          * This comes from the DHCP over IPoIB specification.
                          * In the absence of an user specified client id, IPoIB
                          * automatically uses the required format, with the

@@ -1216,10 +1222,19 @@
         dsmp->dsm_ack = dsmp->dsm_orig_ack = NULL;
 
         free(dsmp->dsm_reqhost);
         dsmp->dsm_reqhost = NULL;
 
+        /*
+         * Do not reset dsm_msg_reqhost here. Unlike dsm_reqhost coming from
+         * /etc/host.*, dsm_msg_reqhost comes externally, and it survives until
+         * it is reset from another external message.
+         */
+
+        free(dsmp->dsm_reqfqdn);
+        dsmp->dsm_reqfqdn = NULL;
+
         cancel_smach_timers(dsmp);
 
         (void) set_smach_state(dsmp, INIT);
         if (dsmp->dsm_isv6) {
                 dsmp->dsm_server = ipv6_all_dhcp_relay_and_servers;