dhcpd: remember and record hostnames; optimize get_option

dumpleases: show hostnames

function                                             old     new   delta
add_lease                                            230     292     +62
send_offer                                           403     421     +18
send_ACK                                             232     249     +17
read_leases                                          249     258      +9
dumpleases_main                                      604     609      +5
nobody_responds_to_arp                                84      86      +2
udhcp_end_option                                      32      30      -2
udhcp_get_option                                     222     171     -51
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 6/2 up/down: 113/-53)            Total: 60 bytes
This commit is contained in:
Denis Vlasenko
2009-04-01 12:36:09 +00:00
parent 3266aa9ec2
commit bd79c3d337
8 changed files with 145 additions and 120 deletions

View File

@@ -135,7 +135,7 @@ static char **fill_envp(struct dhcpMessage *packet)
char **envp, **curr;
const char *opt_name;
uint8_t *temp;
char over = 0;
uint8_t over = 0;
if (packet) {
for (i = 0; dhcp_options[i].code; i++) {
@@ -147,7 +147,7 @@ static char **fill_envp(struct dhcpMessage *packet)
}
if (packet->siaddr)
num_options++;
temp = get_option(packet, DHCP_OPTION_OVER);
temp = get_option(packet, DHCP_OPTION_OVERLOAD);
if (temp)
over = *temp;
if (!(over & FILE_FIELD) && packet->file[0])