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

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/cmd-inet/sbin/dhcpagent/request.c
          +++ new/usr/src/cmd/cmd-inet/sbin/dhcpagent/request.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
       24 + * Copyright (c) 2016, Chris Fraire <cfraire@me.com>.
  24   25   *
  25   26   * REQUESTING state of the client state machine.
  26   27   */
  27   28  
  28   29  #include <stdlib.h>
  29   30  #include <string.h>
  30   31  #include <search.h>
  31   32  #include <sys/types.h>
  32   33  #include <netinet/in.h>
  33   34  #include <netinet/dhcp.h>
↓ open down ↓ 38 lines elided ↑ open up ↑
  72   73          d6in.d6in_iaid = htonl(dsmp->dsm_lif->lif_iaid);
  73   74          d6in.d6in_t1 = htonl(0);
  74   75          d6in.d6in_t2 = htonl(0);
  75   76          (void) add_pkt_opt(dpkt, DHCPV6_OPT_IA_NA,
  76   77              (dhcpv6_option_t *)&d6in + 1,
  77   78              sizeof (d6in) - sizeof (dhcpv6_option_t));
  78   79  
  79   80          /* Add required Option Request option */
  80   81          (void) add_pkt_prl(dpkt, dsmp);
  81   82  
       83 +        /* Add FQDN if configured */
       84 +        (void) dhcp_add_fqdn_opt(dpkt, dsmp);
       85 +
  82   86          (void) send_pkt_v6(dsmp, dpkt, dsmp->dsm_server, stop_requesting,
  83   87              DHCPV6_REQ_TIMEOUT, DHCPV6_REQ_MAX_RT);
  84   88  
  85   89          /* For DHCPv6, state switch cannot fail */
  86   90          (void) set_smach_state(dsmp, REQUESTING);
  87   91  }
  88   92  
  89   93  /*
  90   94   * server_unicast_option(): determines the server address to use based on the
  91   95   *                          DHCPv6 Server Unicast option present in the given
↓ open down ↓ 214 lines elided ↑ open up ↑
 306  310                          (void) add_pkt_opt(dpkt, CD_CLASS_ID, class_id,
 307  311                              class_id_len);
 308  312                  }
 309  313                  (void) add_pkt_prl(dpkt, dsmp);
 310  314  
 311  315                  /*
 312  316                   * dsm_reqhost was set for this state machine in
 313  317                   * dhcp_selecting() if the DF_REQUEST_HOSTNAME option set and a
 314  318                   * host name was found
 315  319                   */
 316      -                if (dsmp->dsm_reqhost != NULL) {
      320 +                if (dhcp_add_fqdn_opt(dpkt, dsmp) != 0 &&
      321 +                    dsmp->dsm_reqhost != NULL) {
 317  322                          (void) add_pkt_opt(dpkt, CD_HOSTNAME, dsmp->dsm_reqhost,
 318  323                              strlen(dsmp->dsm_reqhost));
 319  324                  }
 320  325                  (void) add_pkt_opt(dpkt, CD_END, NULL, 0);
 321  326  
 322  327                  /*
 323  328                   * send out the REQUEST, trying retransmissions.  either a NAK
 324  329                   * or too many REQUEST attempts will revert us to SELECTING.
 325  330                   */
 326  331  
↓ open down ↓ 892 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX