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@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss

Reply via email to