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

*** 18,37 **** * * CDDL HEADER END */ /* * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. * * SELECTING state of the client state machine. */ #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <strings.h> #include <time.h> - #include <limits.h> #include <netinet/in.h> #include <net/route.h> #include <net/if.h> #include <netinet/dhcp.h> #include <netinet/udp.h> --- 18,37 ---- * * CDDL HEADER END */ /* * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, Chris Fraire <cfraire@me.com>. * * SELECTING state of the client state machine. */ #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <strings.h> #include <time.h> #include <netinet/in.h> #include <net/route.h> #include <net/if.h> #include <netinet/dhcp.h> #include <netinet/udp.h>
*** 104,115 **** void dhcp_selecting(dhcp_smach_t *dsmp) { dhcp_pkt_t *dpkt; - const char *reqhost; - char hostfile[PATH_MAX + 1]; /* * We first set up to collect OFFER/Advertise packets as they arrive. * We then send out DISCOVER/Solicit probes. Then we wait a * user-tunable number of seconds before seeing if OFFERs/ --- 104,113 ----
*** 176,185 **** --- 174,186 ---- /* Enable Rapid-Commit */ (void) add_pkt_opt(dpkt, DHCPV6_OPT_RAPID_COMMIT, NULL, 0); /* xxx add Reconfigure Accept */ + /* Add FQDN if configured */ + (void) dhcp_add_fqdn_opt(dpkt, dsmp); + (void) send_pkt_v6(dsmp, dpkt, ipv6_all_dhcp_relay_and_servers, stop_selecting, DHCPV6_SOL_TIMEOUT, DHCPV6_SOL_MAX_RT); } else { if ((dpkt = init_pkt(dsmp, DISCOVER)) == NULL) { dhcpmsg(MSG_ERROR, "dhcp_selecting: unable to set up "
*** 199,229 **** (void) add_pkt_opt(dpkt, CD_CLASS_ID, class_id, class_id_len); } (void) add_pkt_prl(dpkt, dsmp); ! if (df_get_bool(dsmp->dsm_name, dsmp->dsm_isv6, ! DF_REQUEST_HOSTNAME)) { ! dhcpmsg(MSG_DEBUG, ! "dhcp_selecting: DF_REQUEST_HOSTNAME"); ! (void) snprintf(hostfile, sizeof (hostfile), ! "/etc/hostname.%s", dsmp->dsm_name); - if ((reqhost = iffile_to_hostname(hostfile)) != NULL) { - dhcpmsg(MSG_DEBUG, "dhcp_selecting: host %s", - reqhost); - dsmp->dsm_reqhost = strdup(reqhost); - if (dsmp->dsm_reqhost != NULL) - (void) add_pkt_opt(dpkt, CD_HOSTNAME, - dsmp->dsm_reqhost, - strlen(dsmp->dsm_reqhost)); - else - dhcpmsg(MSG_WARNING, - "dhcp_selecting: cannot allocate " - "memory for host name option"); - } - } (void) add_pkt_opt(dpkt, CD_END, NULL, 0); (void) send_pkt(dsmp, dpkt, htonl(INADDR_BROADCAST), stop_selecting); } --- 200,212 ---- (void) add_pkt_opt(dpkt, CD_CLASS_ID, class_id, class_id_len); } (void) add_pkt_prl(dpkt, dsmp); ! if (dhcp_add_fqdn_opt(dpkt, dsmp) != 0) ! (void) dhcp_add_hostname_opt(dpkt, dsmp); (void) add_pkt_opt(dpkt, CD_END, NULL, 0); (void) send_pkt(dsmp, dpkt, htonl(INADDR_BROADCAST), stop_selecting); }