--leasequery can now take a subnet argument.

This commit is contained in:
Simon Kelley
2025-04-30 11:44:47 +01:00
parent 48658ebc54
commit 075e4a56b7
3 changed files with 6 additions and 5 deletions

View File

@@ -1438,10 +1438,11 @@ DHCP options. This make extra space available in the DHCP packet for
options but can, rarely, confuse old or broken clients. This flag
forces "simple and safe" behaviour to avoid problems in such a case.
.TP
.B --leasequery[=<addr>]
.B --leasequery[=<addr>[/<prefix>]]
Enable RFC 4388 leasequery. The dnsmasq DHCP server will answer LEASEQUERY messages from DHCP relays
when this option is given. If an address is given, only queries from a relay at that address are allowed. Repeat
the --leasequery option to specify multiple addresses. To correctly answer lease queries it is necessary to store extra data in
when this option is given. If an address or subnet is given, only queries from a relay at that source are allowed. Repeat
the --leasequery option to specify multiple allowed sources.
To correctly answer lease queries it is necessary to store extra data in
the lease database, and this is also enabled by the \fB--leasequery\fP option. The extra fields
(agent-info and vendorclass) are stored in the leases file in a somewhat backwards compatible manner.
Enabling and then disabling leasequery will not cause problems; the extra information will be aged

View File

@@ -501,7 +501,7 @@ static struct {
{ '4', ARG_DUP, "set:<tag>,<mac address>", gettext_noop("Map MAC address (with wildcards) to option set."), NULL },
{ LOPT_BRIDGE, ARG_DUP, "<iface>,<alias>..", gettext_noop("Treat DHCP requests on aliases as arriving from interface."), NULL },
{ LOPT_SHARED_NET, ARG_DUP, "<iface>|<addr>,<addr>", gettext_noop("Specify extra networks sharing a broadcast domain for DHCP"), NULL},
{ LOPT_LEASEQUERY, ARG_DUP, "[<addr>]", gettext_noop("Enable RFC 4388 leasequery functions for DHCPv4"), NULL },
{ LOPT_LEASEQUERY, ARG_DUP, "[<addr>[/prefix>]]", gettext_noop("Enable RFC 4388 leasequery functions for DHCPv4"), NULL },
{ '5', OPT_NO_PING, NULL, gettext_noop("Disable ICMP echo address checking in the DHCP server."), NULL },
{ '6', ARG_ONE, "<path>", gettext_noop("Shell script to run on DHCP lease creation and destruction."), NULL },
{ LOPT_LUASCRIPT, ARG_DUP, "path", gettext_noop("Lua script to run on DHCP lease creation and destruction."), NULL },

View File

@@ -1069,7 +1069,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
struct bogus_addr *baddrp;
for (baddrp = daemon->leasequery_addr; baddrp; baddrp = baddrp->next)
if (!baddrp->is6 && baddrp->addr.addr4.s_addr == leasequery_source.s_addr)
if (!baddrp->is6 && is_same_net_prefix(leasequery_source, baddrp->addr.addr4, baddrp->prefix))
break;
if (!baddrp)