--- dnsmasq-2.57.origg/src/rfc2131.c 2011-02-17 21:00:15.000000000 +0530 +++ dnsmasq-2.57/src/rfc2131.c 2011-06-18 17:48:59.000000000 +0530 @@ -829,8 +829,23 @@ and set discovery_control = 8 */ if (boot) { - if (boot->next_server.s_addr) + if (boot->next_server.s_addr) { mess->siaddr = boot->next_server; + } else if (boot->sname) { + + /* + * If the pxe server name is given in the conf then + * cycle thru its addresses. + */ + + struct crec *crecp; + time_t now = dnsmasq_time(); + crecp = cache_find_by_name(NULL, boot->sname, now, + F_DHCP | F_HOSTS); + if (crecp) { + mess->siaddr = *(struct in_addr*)&crecp->addr; + } + } if (boot->file) strncpy((char *)mess->file, boot->file, sizeof(mess->file)-1); @@ -2222,8 +2237,23 @@ strncpy((char *)mess->file, boot->file, sizeof(mess->file)-1); } - if (boot->next_server.s_addr) + if (boot->next_server.s_addr) { mess->siaddr = boot->next_server; + } else if (boot->sname) { + + /* + * If the pxe server name is given in the conf then + * cycle thru its addresses. + */ + + struct crec *crecp; + time_t now = dnsmasq_time(); + crecp = cache_find_by_name(NULL, boot->sname, now, + F_DHCP | F_HOSTS); + if (crecp) { + mess->siaddr = *(struct in_addr*)&crecp->addr; + } + } } else /* Use the values of the relevant options if no dhcp-boot given and