2014-06-18 10:04:34 +00:00
|
|
|
--- a/src/dhcp.c
|
|
|
|
+++ b/src/dhcp.c
|
2016-05-19 10:55:15 +00:00
|
|
|
@@ -147,7 +147,7 @@ void dhcp_packet(time_t now, int pxe_fd)
|
2014-06-18 10:04:34 +00:00
|
|
|
ssize_t sz;
|
|
|
|
int iface_index = 0, unicast_dest = 0, is_inform = 0;
|
2016-05-19 10:55:15 +00:00
|
|
|
int rcvd_iface_index;
|
2014-06-18 10:04:34 +00:00
|
|
|
- struct in_addr iface_addr;
|
|
|
|
+ struct in_addr iface_addr, *addrp = NULL;
|
|
|
|
struct iface_param parm;
|
|
|
|
#ifdef HAVE_LINUX_NETWORK
|
|
|
|
struct arpreq arp_req;
|
2016-05-19 10:55:15 +00:00
|
|
|
@@ -277,11 +277,9 @@ void dhcp_packet(time_t now, int pxe_fd)
|
2014-06-18 10:04:34 +00:00
|
|
|
{
|
|
|
|
ifr.ifr_addr.sa_family = AF_INET;
|
|
|
|
if (ioctl(daemon->dhcpfd, SIOCGIFADDR, &ifr) != -1 )
|
|
|
|
- iface_addr = ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr;
|
|
|
|
- else
|
|
|
|
{
|
|
|
|
- my_syslog(MS_DHCP | LOG_WARNING, _("DHCP packet received on %s which has no address"), ifr.ifr_name);
|
|
|
|
- return;
|
|
|
|
+ addrp = &iface_addr;
|
|
|
|
+ iface_addr = ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (tmp = daemon->dhcp_except; tmp; tmp = tmp->next)
|
2016-05-19 10:55:15 +00:00
|
|
|
@@ -300,7 +298,7 @@ void dhcp_packet(time_t now, int pxe_fd)
|
2014-06-18 10:04:34 +00:00
|
|
|
parm.relay_local.s_addr = 0;
|
|
|
|
parm.ind = iface_index;
|
|
|
|
|
|
|
|
- if (!iface_check(AF_INET, (struct all_addr *)&iface_addr, ifr.ifr_name, NULL))
|
|
|
|
+ if (!iface_check(AF_INET, (struct all_addr *)addrp, ifr.ifr_name, NULL))
|
|
|
|
{
|
|
|
|
/* If we failed to match the primary address of the interface, see if we've got a --listen-address
|
|
|
|
for a secondary */
|
2016-05-19 10:55:15 +00:00
|
|
|
@@ -320,6 +318,12 @@ void dhcp_packet(time_t now, int pxe_fd)
|
2014-06-18 10:04:34 +00:00
|
|
|
complete_context(match.addr, iface_index, NULL, match.netmask, match.broadcast, &parm);
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (!addrp)
|
|
|
|
+ {
|
|
|
|
+ my_syslog(MS_DHCP | LOG_WARNING, _("DHCP packet received on %s which has no address"), ifr.ifr_name);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
if (!iface_enumerate(AF_INET, &parm, complete_context))
|
|
|
|
return;
|
|
|
|
|