From 2c2cc1cf2295a5821caeb79beb56565339e89d74 Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Sun, 3 Jul 2011 06:03:54 -0400 Subject: [PATCH] Don't send host name option on DHCP decline or release packets. --- ndhc/dhcp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ndhc/dhcp.c b/ndhc/dhcp.c index a97d4c4..fc9350b 100644 --- a/ndhc/dhcp.c +++ b/ndhc/dhcp.c @@ -1,5 +1,5 @@ /* packet.c - send and react to DHCP message packets - * Time-stamp: <2011-07-03 05:31:57 njk> + * Time-stamp: <2011-07-03 06:03:14 njk> * * (c) 2004-2011 Nicholas J. Kain * @@ -582,7 +582,6 @@ static struct dhcpmsg init_packet(char type, uint32_t xid) add_u8_option(&packet, DHCP_MESSAGE_TYPE, type); memcpy(packet.chaddr, client_config.arp, 6); add_option_clientid(&packet); - add_option_hostname(&packet); return packet; } @@ -595,6 +594,7 @@ int send_discover(struct client_state_t *cs) htons(sizeof(struct ip_udp_dhcp_packet))); add_option_request_list(&packet); add_option_vendor(&packet); + add_option_hostname(&packet); log_line("Sending discover..."); return send_dhcp_raw(&packet); } @@ -608,6 +608,7 @@ int send_selecting(struct client_state_t *cs) htons(sizeof(struct ip_udp_dhcp_packet))); add_option_request_list(&packet); add_option_vendor(&packet); + add_option_hostname(&packet); log_line("Sending select for %s...", inet_ntoa((struct in_addr){.s_addr = cs->clientAddr})); return send_dhcp_raw(&packet); @@ -621,6 +622,7 @@ int send_renew(struct client_state_t *cs) htons(sizeof(struct ip_udp_dhcp_packet))); add_option_request_list(&packet); add_option_vendor(&packet); + add_option_hostname(&packet); log_line("Sending renew..."); return send_dhcp_cooked(&packet, cs->clientAddr, cs->serverAddr); } @@ -634,6 +636,7 @@ int send_rebind(struct client_state_t *cs) htons(sizeof(struct ip_udp_dhcp_packet))); add_option_request_list(&packet); add_option_vendor(&packet); + add_option_hostname(&packet); log_line("Sending rebind..."); return send_dhcp_raw(&packet); }