[Dnsmasq-discuss] [PATCH 3/6] Create temporary leases on DISCOVER message

Geert Stappers stappers at stappers.nl
Wed Jul 13 14:36:10 UTC 2022


On Fri, Jul 08, 2022 at 10:26:35PM +0200, Petr Menšík wrote:
> From 7885f99da642306bc3ae65f591f36dd4a704918d Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik at redhat.com>
> Date: Fri, 10 Dec 2021 20:18:20 +0100
> Subject: [PATCH 3/6] Create temporary leases on DISCOVER message
> 
> Previously only ping cache contained hash of few last pinged addresses.
> They allowed skipping of address proposed to different host in
> allocate_address. If no-ping were used together with dhcp-sequential-ip,
> nothing would prevent offering single address to multiple clients.
> 
> Use temporary leases to store clients interested right when DHCPDISCOVER is
> received. It makes sure that address is 'reserved' for that client when
> he requests it. Uses short expiration time.
> ---
>  src/dbus.c    |  2 +-
>  src/dnsmasq.h |  3 ++-
>  src/lease.c   | 25 +++++++++++++++++--------
>  src/rfc2131.c | 30 ++++++++++++++++++++++++------
>  4 files changed, 44 insertions(+), 16 deletions(-)
> 
> diff --git a/src/dbus.c b/src/dbus.c
> index bf6b661..571743f 100644
> --- a/src/dbus.c
> +++ b/src/dbus.c
> @@ -537,7 +537,7 @@ static DBusMessage *dbus_add_lease(DBusMessage* message)
>  				      "ia_id and is_temporary must be zero for IPv4 lease");
>        
>        if (!(lease = lease_find_by_addr(addr.addr4)))
> -    	lease = lease4_allocate(addr.addr4);
> +    	lease = lease4_allocate(addr.addr4, 0);
>      }
>  #ifdef HAVE_DHCP6
>    else if (inet_pton(AF_INET6, ipaddr, &addr.addr6))

Output from `git am`:
|Applying: Create temporary leases on DISCOVER message
|.git/rebase-apply/patch:17: space before tab in indent.
|    	lease = lease4_allocate(addr.addr4, 0);
|warning: 1 line adds whitespace errors.

"repaired" in my public git repo.

More about that git repository in another email.



Groeten
Geert Stappers
-- 
Silence is hard to parse



More information about the Dnsmasq-discuss mailing list