[Dnsmasq-discuss] [PATCH] dhcp-host option: error out on multiple host names

Dominik Derigs dl6er at dl6er.de
Sun Dec 22 20:19:34 UTC 2024


Hey Simon,

the resulting commit 
https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=commit;h=6c9bc0156a8d36d56735831cb81e786d628ed73e 
made a mistake by breaking the else-if chain.

In current master we can no longer specify hosts with extra arguments, 
e.g., the "infinite" in

dhcp-host=AA:BB:CC:DD:EE:FF,192.168.1.5,server,infinite

Best,
Dominik

On 02.12.24 00:53, Simon Kelley wrote:
> Patch applied.
>
> Thanks for your contribution!
>
> Cheers,
>
> Simon.
>
> On 11/27/24 12:40, Reynir Björnsson wrote:
>> Please find below a patch that will error out on multiple host names 
>> passed to --dhcp-host. Please also excuse me if I am making mistakes 
>> as this is the first time I try to contribute to dnsmasq.
>>
>> Best,
>> Reynir Björnsson
>>
>> ---
>>
>> dhcp-host option: error out on multiple host names
>>
>> Only one host name is allowed. So instead of silently ignoring all but
>> the last host name we error out.
>> ---
>>   src/option.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/src/option.c b/src/option.c
>> index ed0d9e1..536ea12 100644
>> --- a/src/option.c
>> +++ b/src/option.c
>> @@ -4146,6 +4146,12 @@ static int one_opt(int option, char *arg, char 
>> *errstr, char *gen_err, int comma
>>                 new->flags |= CONFIG_DISABLE;
>>               else
>>                 {
>> +            if (new->hostname)
>> +              {
>> +                dhcp_config_free(new);
>> +                ret_err(_("multiple DHCP host names"));
>> +              }
>> +
>>               if (!(new->hostname = canonicalise_opt(arg)) ||
>>                   !legal_hostname(new->hostname))
>>                 {
>
>
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss



More information about the Dnsmasq-discuss mailing list