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

*** 19,35 **** * CDDL HEADER END */ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * INIT_REBOOT state of the DHCP client state machine. */ #include <sys/types.h> #include <stdio.h> - #include <limits.h> #include <sys/socket.h> #include <netinet/in.h> #include <netinet/dhcp.h> #include <netinet/udp.h> #include <netinet/ip_var.h> --- 19,35 ---- * CDDL HEADER END */ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright (c) 2016, Chris Fraire <cfraire@me.com>. * * INIT_REBOOT state of the DHCP client state machine. */ #include <sys/types.h> #include <stdio.h> #include <sys/socket.h> #include <netinet/in.h> #include <netinet/dhcp.h> #include <netinet/udp.h> #include <netinet/ip_var.h>
*** 56,67 **** static void dhcp_init_reboot_v4(dhcp_smach_t *dsmp) { dhcp_pkt_t *dpkt; - const char *reqhost; - char hostfile[PATH_MAX + 1]; /* * assemble DHCPREQUEST message. The max dhcp message size * option is set to the interface max, minus the size of the udp and * ip headers. --- 56,65 ----
*** 77,110 **** if (class_id_len != 0) (void) add_pkt_opt(dpkt, CD_CLASS_ID, class_id, class_id_len); (void) add_pkt_prl(dpkt, dsmp); ! /* ! * Set CD_HOSTNAME option if REQUEST_HOSTNAME is set and a hostname ! * is found in /etc/hostname.<ifname> ! */ ! if (df_get_bool(dsmp->dsm_name, dsmp->dsm_isv6, 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); - if ((dsmp->dsm_reqhost = strdup(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"); - } else { - dhcpmsg(MSG_DEBUG, - "dhcp_selecting: no hostname for %s", - dsmp->dsm_name); - } - } - (void) add_pkt_opt(dpkt, CD_END, NULL, 0); (void) send_pkt(dsmp, dpkt, htonl(INADDR_BROADCAST), stop_init_reboot); } --- 75,87 ---- if (class_id_len != 0) (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_init_reboot); }
*** 180,189 **** --- 157,169 ---- } /* Add required Option Request option */ (void) add_pkt_prl(dpkt, dsmp); + /* Add FQDN if configured */ + (void) dhcp_add_fqdn_opt(dpkt, dsmp); + (void) send_pkt_v6(dsmp, dpkt, ipv6_all_dhcp_relay_and_servers, stop_init_reboot, DHCPV6_CNF_TIMEOUT, DHCPV6_CNF_MAX_RT); return;