dhcp-host selection fix for v4/v6

This commit is contained in:
Simon Kelley
2013-10-11 15:19:28 +01:00
parent d56a604a96
commit 24b5a5d50b
3 changed files with 30 additions and 26 deletions

View File

@@ -644,20 +644,20 @@ size_t calc_subnet_opt(struct subnet_opt *opt, union mysockaddr *source)
int len;
void *addrp;
if (source->sa.sa_family == AF_INET)
{
opt->family = htons(1);
opt->source_netmask = daemon->addr4_netmask;
addrp = &source->in.sin_addr;
}
#ifdef HAVE_IPV6
else
if (source->sa.sa_family == AF_INET6)
{
opt->family = htons(2);
opt->source_netmask = daemon->addr6_netmask;
addrp = &source->in6.sin6_addr;
}
else
#endif
{
opt->family = htons(1);
opt->source_netmask = daemon->addr4_netmask;
addrp = &source->in.sin_addr;
}
opt->scope_netmask = 0;
len = 0;