Set SO_BINDTODEVICE on DHCP sockets when doing DHCP on one interface

only. Fixes OpenSTack use-case.
This commit is contained in:
Simon Kelley
2012-04-16 14:41:56 +01:00
parent 1023dcbc9e
commit 9380ba70d6
5 changed files with 70 additions and 2 deletions

View File

@@ -209,6 +209,21 @@ int main (int argc, char **argv)
for (if_tmp = daemon->if_names; if_tmp; if_tmp = if_tmp->next)
if (if_tmp->name && !if_tmp->used)
die(_("unknown interface %s"), if_tmp->name, EC_BADNET);
#if defined(HAVE_LINUX_NETWORK) && defined(HAVE_DHCP)
/* after enumerate_interfaces() */
if (daemon->dhcp)
{
bindtodevice(daemon->dhcpfd);
if (daemon->enable_pxe)
bindtodevice(daemon->pxefd);
}
#endif
#if defined(HAVE_LINUX_NETWORK) && defined(HAVE_DHCP6)
if (daemon->dhcp6)
bindtodevice(daemon->dhcp6fd);
#endif
}
else
create_wildcard_listeners();