From 8dba80a6f0d5da93482e86b9df0c88b29ff5a098 Mon Sep 17 00:00:00 2001 From: Ted Lemon Date: Wed, 22 May 1996 10:15:55 +0000 Subject: [PATCH] Supply Requested Address from ciaddr; reflect server identifier --- client/dhclient.c | 22 +++++++++++++++++----- dhclient.c | 22 +++++++++++++++++----- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/client/dhclient.c b/client/dhclient.c index 4478688f..362b4c33 100644 --- a/client/dhclient.c +++ b/client/dhclient.c @@ -190,6 +190,7 @@ void bootp (packet) void dhcp (packet) struct packet *packet; { +note ("got a dhcp packet: %d", packet -> packet_type); switch (packet -> packet_type) { case DHCPOFFER: dhcpoffer (packet); @@ -338,6 +339,7 @@ void send_request (packet) struct tree_cache dhcprequest_tree; struct tree_cache dhcprqo_tree; struct tree_cache dhcprqa_tree; + struct tree_cache dhcpsid_tree; memset (options, 0, sizeof options); memset (&outgoing, 0, sizeof outgoing); @@ -360,16 +362,26 @@ void send_request (packet) options [DHO_DHCP_MESSAGE] -> timeout = 0xFFFFFFFF; options [DHO_DHCP_MESSAGE] -> tree = (struct tree *)0; + /* Request the address we were offered... */ options [DHO_DHCP_REQUESTED_ADDRESS] = &dhcprqa_tree; options [DHO_DHCP_REQUESTED_ADDRESS] -> value = - packet -> options [DHO_DHCP_REQUESTED_ADDRESS].data; - options [DHO_DHCP_REQUESTED_ADDRESS] -> len = - packet -> options [DHO_DHCP_REQUESTED_ADDRESS].len; - options [DHO_DHCP_REQUESTED_ADDRESS] -> buf_size = - packet -> options [DHO_DHCP_REQUESTED_ADDRESS].len; + (unsigned char *)&packet -> raw -> yiaddr; + options [DHO_DHCP_REQUESTED_ADDRESS] -> len = 4; + options [DHO_DHCP_REQUESTED_ADDRESS] -> buf_size = 4; options [DHO_DHCP_REQUESTED_ADDRESS] -> timeout = 0xFFFFFFFF; options [DHO_DHCP_REQUESTED_ADDRESS] -> tree = (struct tree *)0; + /* Send back the server identifier... */ + options [DHO_DHCP_SERVER_IDENTIFIER] = &dhcpsid_tree; + options [DHO_DHCP_SERVER_IDENTIFIER] -> value = + packet -> options [DHO_DHCP_SERVER_IDENTIFIER].data; + options [DHO_DHCP_SERVER_IDENTIFIER] -> len = + packet -> options [DHO_DHCP_SERVER_IDENTIFIER].len; + options [DHO_DHCP_SERVER_IDENTIFIER] -> buf_size = + packet -> options [DHO_DHCP_SERVER_IDENTIFIER].len; + options [DHO_DHCP_SERVER_IDENTIFIER] -> timeout = 0xFFFFFFFF; + options [DHO_DHCP_SERVER_IDENTIFIER] -> tree = (struct tree *)0; + /* Set up the option buffer... */ cons_options ((struct packet *)0, &outgoing, options, 0); diff --git a/dhclient.c b/dhclient.c index 4478688f..362b4c33 100644 --- a/dhclient.c +++ b/dhclient.c @@ -190,6 +190,7 @@ void bootp (packet) void dhcp (packet) struct packet *packet; { +note ("got a dhcp packet: %d", packet -> packet_type); switch (packet -> packet_type) { case DHCPOFFER: dhcpoffer (packet); @@ -338,6 +339,7 @@ void send_request (packet) struct tree_cache dhcprequest_tree; struct tree_cache dhcprqo_tree; struct tree_cache dhcprqa_tree; + struct tree_cache dhcpsid_tree; memset (options, 0, sizeof options); memset (&outgoing, 0, sizeof outgoing); @@ -360,16 +362,26 @@ void send_request (packet) options [DHO_DHCP_MESSAGE] -> timeout = 0xFFFFFFFF; options [DHO_DHCP_MESSAGE] -> tree = (struct tree *)0; + /* Request the address we were offered... */ options [DHO_DHCP_REQUESTED_ADDRESS] = &dhcprqa_tree; options [DHO_DHCP_REQUESTED_ADDRESS] -> value = - packet -> options [DHO_DHCP_REQUESTED_ADDRESS].data; - options [DHO_DHCP_REQUESTED_ADDRESS] -> len = - packet -> options [DHO_DHCP_REQUESTED_ADDRESS].len; - options [DHO_DHCP_REQUESTED_ADDRESS] -> buf_size = - packet -> options [DHO_DHCP_REQUESTED_ADDRESS].len; + (unsigned char *)&packet -> raw -> yiaddr; + options [DHO_DHCP_REQUESTED_ADDRESS] -> len = 4; + options [DHO_DHCP_REQUESTED_ADDRESS] -> buf_size = 4; options [DHO_DHCP_REQUESTED_ADDRESS] -> timeout = 0xFFFFFFFF; options [DHO_DHCP_REQUESTED_ADDRESS] -> tree = (struct tree *)0; + /* Send back the server identifier... */ + options [DHO_DHCP_SERVER_IDENTIFIER] = &dhcpsid_tree; + options [DHO_DHCP_SERVER_IDENTIFIER] -> value = + packet -> options [DHO_DHCP_SERVER_IDENTIFIER].data; + options [DHO_DHCP_SERVER_IDENTIFIER] -> len = + packet -> options [DHO_DHCP_SERVER_IDENTIFIER].len; + options [DHO_DHCP_SERVER_IDENTIFIER] -> buf_size = + packet -> options [DHO_DHCP_SERVER_IDENTIFIER].len; + options [DHO_DHCP_SERVER_IDENTIFIER] -> timeout = 0xFFFFFFFF; + options [DHO_DHCP_SERVER_IDENTIFIER] -> tree = (struct tree *)0; + /* Set up the option buffer... */ cons_options ((struct packet *)0, &outgoing, options, 0);