mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Fix dhcp-name-match to function when name supplied in --dhcp-host.
This commit is contained in:
@@ -740,12 +740,9 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
||||
}
|
||||
else if (client_hostname)
|
||||
{
|
||||
struct dhcp_match_name *m;
|
||||
size_t nl;
|
||||
|
||||
domain = strip_hostname(client_hostname);
|
||||
|
||||
if ((nl = strlen(client_hostname)) != 0)
|
||||
if (strlen(client_hostname) != 0)
|
||||
{
|
||||
hostname = client_hostname;
|
||||
|
||||
@@ -766,30 +763,36 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
||||
netid = &known_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (m = daemon->dhcp_name_match; m; m = m->next)
|
||||
if (hostname)
|
||||
{
|
||||
struct dhcp_match_name *m;
|
||||
size_t nl = strlen(hostname);
|
||||
|
||||
for (m = daemon->dhcp_name_match; m; m = m->next)
|
||||
{
|
||||
size_t ml = strlen(m->name);
|
||||
char save = 0;
|
||||
|
||||
if (nl < ml)
|
||||
continue;
|
||||
if (nl > ml)
|
||||
{
|
||||
size_t ml = strlen(m->name);
|
||||
char save = 0;
|
||||
|
||||
if (nl < ml)
|
||||
continue;
|
||||
if (nl > ml)
|
||||
{
|
||||
save = client_hostname[ml];
|
||||
client_hostname[ml] = 0;
|
||||
}
|
||||
|
||||
if (hostname_isequal(client_hostname, m->name) &&
|
||||
(save == 0 || m->wildcard))
|
||||
{
|
||||
m->netid->next = netid;
|
||||
netid = m->netid;
|
||||
save = hostname[ml];
|
||||
hostname[ml] = 0;
|
||||
}
|
||||
|
||||
if (save != 0)
|
||||
client_hostname[ml] = save;
|
||||
|
||||
if (hostname_isequal(hostname, m->name) &&
|
||||
(save == 0 || m->wildcard))
|
||||
{
|
||||
m->netid->next = netid;
|
||||
netid = m->netid;
|
||||
}
|
||||
|
||||
if (save != 0)
|
||||
hostname[ml] = save;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user