#246621 ifupdown: Please (optionally) stop DHCP clients in such a way that they do not relinquish leases

Package:
ifupdown
Source:
ifupdown
Description:
high level tools to configure network interfaces
Submitter:
John Wong
Date:
2024-10-07 14:15:03 UTC
Severity:
wishlist
Tags:
#246621#5
Date:
2004-04-30 02:20:32 UTC
From:
To:
When I reboot my computer, when the dhcp interface is upped, it always
gets a new IP.  It is as if there is no /var/run/dhclient.eth0.leases
When it comes up, /var/run/dhclient.eth0.leases just has one lease entry.
With the previous version 0.6.4-4.6, /var/lib/dhcp3/dhclient.leases was
used and dhcp3-client does get the that is in the existing lease.  With
0.6.4-4.8, it looks like the leases is placed in /var/run (which may be
purged, but bootclean.sh is not enabled).

Downgrading to 0.6.4-4.6 goes back to using
/var/lib/dhcp3/dhclient.leases and all is good.

Maybe setting the path to back to /var/lib/dhcp[3] would solve this
problem?

I'm using Debian sid on kernel 2.6.5

John

#246621#10
Date:
2004-04-30 06:35:44 UTC
From:
To:
merge 246621 196865
thanks

Please follow up at #196865.
--
Thomas Hood

#246621#21
Date:
2004-05-03 22:48:36 UTC
From:
To:
I would like to track the "don't release the lease" issue here, so
for ease of reference I copy the relevant information over from
#196865, which is marked fixed and will be closed sooner or later.
// Thomas
-------------------------------------------------------------------

Message received at 196865@bugs.debian.org:
Received: (at 196865) by bugs.debian.org; 23 Apr 2004 01:34:02 +0000
Return-path: <ron@rjmx.net>
Received: from sccrmhc13.comcast.net [204.127.202.64]
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1BGpZq-0004TQ-00; Thu, 22 Apr 2004 18:34:02 -0700
Received: from mail.rjmx.net (rjmx.net[24.218.135.94])
          by comcast.net (sccrmhc13) with ESMTP
          id <2004042301333101600cqnhde>; Fri, 23 Apr 2004 01:33:31 +0000
Received: from khufu.rjmx.net (root@khufu.rjmx.net [192.168.1.2])
	by mail.rjmx.net (8.12.11/8.12.11/Debian-3) with ESMTP id i3N1XHtl006488
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT);
	Thu, 22 Apr 2004 21:33:18 -0400
Received: from khufu.rjmx.net (ron@localhost [127.0.0.1])
	by khufu.rjmx.net (8.12.11/8.12.11/Debian-3) with ESMTP id i3N1XHJg002801
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT);
	Thu, 22 Apr 2004 21:33:17 -0400
Received: (from ron@localhost)
	by khufu.rjmx.net (8.12.11/8.12.11/Debian-3) id i3N1XHq1002800;
	Thu, 22 Apr 2004 21:33:17 -0400
Message-Id: <200404230133.i3N1XHq1002800@khufu.rjmx.net>
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: Ron Murray <rjmx@rjmx.net>
To: Debian Bug Tracking System <196865@bugs.debian.org>
Subject: ifupdown: Stopping dhclient3 with -r switch releases current lease
Reply-To: Ron Murray <rjmx@rjmx.net>
X-Mailer: reportbug 2.56
Date: Thu, 22 Apr 2004 21:33:17 -0400
Delivered-To: 196865@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-7.0 required=4.0 tests=BAYES_00,HAS_PACKAGE
	autolearn=no version=2.60-bugs.debian.org_2004_03_25
X-Spam-Level:
X-CrossAssassin-Score: 1

Package: ifupdown
Version: 0.6.4-4.8
Severity: normal
Followup-For: Bug #196865


When you use the -r switch to terminate dhclient3, it releases the
current lease. This might be fine for a PPP system, but there are many
situations when it's annoying. For example, my Internet connection is
via cable modem. I have my own domain whose DNS is at Zoneedit. With
the new ifdown script, I'll lose my current IP address if I reboot the
box, and that means going through the hassles of propagating the new
IP address through DNS. I'm sure people will think of other reasons
why this is a bad idea.

If you really must allow for releasing the lease on shutdown, at least
provide a configuration switch somewhere, perhaps in
/etc/network/interfaces, so the rest of us can ignore it.

Note that, according to the dhclient man page, releasing the current
lease on shutdown is not required by the DHCP protocol.

 .....Ron

- -- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.5-khufu-1
Locale: LANG=C, LC_CTYPE=C

Versions of packages ifupdown depends on:
ii  debconf [debconf-2.0]       1.4.21       Debian configuration management sy
ii  libc6                       2.3.2.ds1-11 GNU C Library: Shared libraries an
ii  net-tools                   1.60-9       The NET-3 networking toolkit

- -- debconf information:
  ifupdown/convert-interfaces: true
iD8DBQFAiHJditqjxNhsdN4RAlIEAKCTE9pIqaboaGOt8q89HwabcUW1YACeLzm3
Y9GnNL/4+Phzv8r2/wMqb5c=
=9tmL
-----END PGP SIGNATURE-----
Return-path: <jdthood@yahoo.co.uk>
Received: from post-20.mail.nl.demon.net [194.159.73.1]
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1BHKNX-0004PG-00; Sat, 24 Apr 2004 03:27:24 -0700
Received: from [82.161.38.140] (helo=thanatos)
	by post-20.mail.nl.demon.net with esmtp (Exim 3.36 #2)
	id 1BHKNX-000Daz-00
	for 196865-submitter@bugs.debian.org; Sat, 24 Apr 2004 10:27:23 +0000
Received: from localhost (localhost [127.0.0.1])
	by thanatos (Postfix) with ESMTP id 15D6510D66E
	for <196865-submitter@bugs.debian.org>; Sat, 24 Apr 2004 12:27:16 +0200 (CEST)
Subject: What to do?
From: Thomas Hood <jdthood@yahoo.co.uk>
To: 196865-submitter@bugs.debian.org
Content-Type: text/plain
Message-Id: <1082802435.4773.501.camel@localhost>
Mime-Version: 1.0
X-Mailer: Ximian Evolution 1.4.5
Date: Sat, 24 Apr 2004 12:27:16 +0200
Content-Transfer-Encoding: 7bit
Delivered-To: 196865-submitter@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-2.0 required=4.0 tests=BAYES_00 autolearn=no
	version=2.60-bugs.debian.org_2004_03_25
X-Spam-Level:
X-CrossAssassin-Score: 1

The motivation behind filing #196865 was to stop dhclient in such
a way that the latter would execute its exit hook script.  If we
can't do this by doing "dhclient -r" (because we don't want leases
to be released) then how can we do it?
--
Thomas




Return-path: <rjmx@rjmx.net>
Received: from rwcrmhc11.comcast.net [204.127.198.35]
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1BHjEv-0001ss-00; Sun, 25 Apr 2004 06:00:09 -0700
Received: from mail.rjmx.net (rjmx.net[24.218.135.94])
          by comcast.net (rwcrmhc11) with ESMTP
          id <20040425125938013004mbcpe>; Sun, 25 Apr 2004 12:59:38 +0000
Received: from rjmx.net (ron@khufu.rjmx.net [192.168.1.2])
	by mail.rjmx.net (8.12.11/8.12.11/Debian-3) with ESMTP id i3PCxDYB023543
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
	for <196865@bugs.debian.org>; Sun, 25 Apr 2004 08:59:14 -0400
Message-ID: <408BB620.2070404@rjmx.net>
Date: Sun, 25 Apr 2004 08:59:12 -0400
From: Ron Murray <rjmx@rjmx.net>
Reply-To: rjmx@rjmx.net
User-Agent: Mozilla Thunderbird 0.5 (X11/20040306)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: 196865@bugs.debian.org
Subject: Re: #196865
References: <1082884472.1605.23.camel@localhost>
In-Reply-To: <1082884472.1605.23.camel@localhost>
X-Enigmail-Version: 0.83.2.0
X-Enigmail-Supports: pgp-inline, pgp-mime
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Delivered-To: 196865@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=0.7 required=4.0 tests=BAYES_00,SUBJ_HAS_UNIQ_ID
	autolearn=no version=2.60-bugs.debian.org_2004_03_25
X-Spam-Level:
X-CrossAssassin-Score: 1

Thomas Hood wrote:

Hi.

    I've done some thinking about this one. I think what's really needed
is a switch (I'd say -q, but it's already taken) to tell dhclient to
stop, running its exit hooks, but not drop the lease. I've always
thought there should be one anyway; having to stop it by sending a kill
always seemed a little weird to me.

    So we need a volunteer to add it. Unless we can persuade upstream to
do it, of course. I'd be prepared to look into it if everyone thinks
it's a good idea.

  .....Ron


Return-path: <jdthood@yahoo.co.uk>
Received: from post-20.mail.nl.demon.net [194.159.73.1]
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1BHlkP-00011Z-00; Sun, 25 Apr 2004 08:40:49 -0700
Received: from [82.161.38.140] (helo=thanatos)
	by post-20.mail.nl.demon.net with esmtp (Exim 3.36 #2)
	id 1BHlkN-000HUX-00; Sun, 25 Apr 2004 15:40:47 +0000
Received: from localhost (localhost [127.0.0.1])
	by thanatos (Postfix) with ESMTP
	id 7292010D6A5; Sun, 25 Apr 2004 17:40:46 +0200 (CEST)
Subject: Re: Bug#196865: #196865
From: Thomas Hood <jdthood@yahoo.co.uk>
To: rjmx@rjmx.net, 196865-quiet@bugs.debian.org
In-Reply-To: <408BB620.2070404@rjmx.net>
References: <1082884472.1605.23.camel@localhost> <408BB620.2070404@rjmx.net>
Content-Type: text/plain
Message-Id: <1082907646.1603.88.camel@localhost>
Mime-Version: 1.0
X-Mailer: Ximian Evolution 1.4.5
Date: Sun, 25 Apr 2004 17:40:46 +0200
Content-Transfer-Encoding: 7bit
Delivered-To: 196865-quiet@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-2.3 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER,
	SUBJ_HAS_UNIQ_ID autolearn=no version=2.60-bugs.debian.org_2004_03_25
X-Spam-Level:
X-CrossAssassin-Score: 1

What would happen if ifdown merely "paused" the client in the sense
of the word 'pause' used in the "THE CONTROL OBJECT" section of
dhclient3(8)?  According to the man page "this unconfigures any
interfaces the client is using" without releasing the lease.

I have just tried to do this by running the omshell command but I
didn't get anywhere:

    jdthood@thanatos:~$ omshell
    > connect
    dhcpctl_connect: connection refused

I don't know what to do next.
--
Thomas




Return-path: <rjmx@rjmx.net>
Received: from rwcrmhc12.comcast.net [216.148.227.85]
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1BICZV-00033t-00; Mon, 26 Apr 2004 13:19:21 -0700
Received: from mail.rjmx.net (rjmx.net[24.218.135.94])
          by comcast.net (rwcrmhc12) with ESMTP
          id <2004042620185001400i8335e>; Mon, 26 Apr 2004 20:18:50 +0000
Received: from khufu.rjmx.net.rjmx.net (ron@khufu.rjmx.net [192.168.1.2])
	by mail.rjmx.net (8.12.11/8.12.11/Debian-3) with ESMTP id i3QKIT3j015864;
	Mon, 26 Apr 2004 16:18:29 -0400
Date: Mon, 26 Apr 2004 16:18:29 -0400
Message-ID: <8765bmlch6.wl%rjmx@rjmx.net>
From: Ron Murray <rjmx@rjmx.net>
To: Thomas Hood <jdthood@yahoo.co.uk>
Cc: 196865-quiet@bugs.debian.org
Subject: Re: Bug#196865: #196865
In-Reply-To: <1082907646.1603.88.camel@localhost>
References: <1082884472.1605.23.camel@localhost>
	<408BB620.2070404@rjmx.net>
	<1082907646.1603.88.camel@localhost>
User-Agent: Wanderlust/2.11.24 (Wonderwall) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.3 (i386-pc-linux-gnu) MULE/5.0 (SAKAKI)
Reply-To: rjmx@rjmx.net
MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka")
Content-Type: text/plain; charset=US-ASCII
Delivered-To: 196865-quiet@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-2.3 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER,
	SUBJ_HAS_UNIQ_ID autolearn=no version=2.60-bugs.debian.org_2004_03_25
X-Spam-Level:
X-CrossAssassin-Score: 1

At Sun, 25 Apr 2004 17:40:46 +0200,
Thomas Hood <jdthood@yahoo.co.uk> wrote:
today, and although the documentation is very, very poor (read:
nonexistent), I managed to get some results.

First off, you need to have

omapi port <number>;

   in your dhclient.conf. Without this, it doesn't even start up the
omapi interface. You can use an arbitrary port number for <number>;
I'd leave 7911 free in case you want to do the same thing on dhcpd and
I don't know whether they can coexist on the same port or not.

   The dhcpd.conf man page claimed the syntax was

omapi-port <number>;

   but that didn't work.

Then start up omshell: lines beginning with '>' are entered by the
user:

ron@khufu:~$omshell
obj: <null>				# (server response)
obj: control
obj: control
state = 00:00:00:04		# Server prints current state
obj: control
state = 3

   The above seems to suspend DHCP quite successfully. You can then
try and un-suspend it by setting the state to 4, but this didn't seem
to bring the interface back up. Setting the state to 0 did, however.

   Note that omshell doesn't seem to have any facility for reading
commands from a file. Probably need some kind of "here document"
syntax in the script.


Return-path: <jdthood@yahoo.co.uk>
Received: from aglu.demon.nl (thanatos) [82.161.38.140]
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1BJCwl-0000BM-00; Thu, 29 Apr 2004 07:55:31 -0700
Received: from localhost (localhost [127.0.0.1])
	by thanatos (Postfix) with ESMTP
	id 3DED010D60D; Thu, 29 Apr 2004 16:55:29 +0200 (CEST)
Subject: Re: Bug#196865: #196865
From: Thomas Hood <jdthood@yahoo.co.uk>
To: rjmx@rjmx.net
Cc: 196865@bugs.debian.org
In-Reply-To: <8765bmlch6.wl%rjmx@rjmx.net>
References: <1082884472.1605.23.camel@localhost> <408BB620.2070404@rjmx.net>
	 <1082907646.1603.88.camel@localhost>  <8765bmlch6.wl%rjmx@rjmx.net>
Content-Type: text/plain
Message-Id: <1083250527.3026.105.camel@localhost>
Mime-Version: 1.0
X-Mailer: Ximian Evolution 1.4.5
Date: Thu, 29 Apr 2004 16:55:28 +0200
Content-Transfer-Encoding: 7bit
Delivered-To: 196865@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-2.3 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER,
	SUBJ_HAS_UNIQ_ID autolearn=no version=2.60-bugs.debian.org_2004_03_25
X-Spam-Level:
X-CrossAssassin-Score: 1

On Mon, 2004-04-26 at 22:18, Ron Murray wrote in part:

It did for me too.  I put logging commands into dhclient-script
and observed that on transition to state 3 the script gets run
with reason == STOP.  The interface is deconfigured but left
"UP" according to ifconfig.

It did for me.  The interface was configured again (inet_addr,
Bcast and Mask were assigned the values they had prior to the
suspend)  and the dhclient-script was run with reason == REBOOT.

Setting the state to 0 appeared to do nothing in my case.

The script appended below (watch out for line wrapping) suspends and
then kills the dhclient3 program given a kernel interface name and
the dhclient process's omapi port as arguments.  It works on my
system (dhcp3-client 3.0+3.0.1rc13-1).  Implementing this idea in
ifup involves, additionally, selecting a different port number for
each instance of dhclient3 and its using that port number to
suspend+kill the daemon as below.
                                                 // Thomas Hood


#!/bin/sh

MYNAME="${0##*/}"
IFACE="$1"
PORT="$2"

report_err() { echo "${MYNAME}: Error: $*" >&2 ; }

read PID crap < /var/run/dhclient.$IFACE.pid
[ "$PID" ] || { report_err "Could not get PID" ; exit 1 ; }

TARG_STATE=3
OMSHELL_CMDS="
port $PORT
connect
new control
open
set state = $TARG_STATE
update
"

echo "$OMSHELL_CMDS" | omshell

start-stop-daemon --stop --pidfile="/var/run/dhclient.$IFACE.pid"
--retry=1 --signal=TERM

#246621#32
Date:
2005-02-13 01:36:02 UTC
From:
To:
Attached to this mail is a suggested patch to dhclient that adds
a switch -x that can be used instead of -r when bringing down a
DHCP interface.

The patch makes sure to kill the currently running client and
then goes about its business similar to -r but instead of
relinquishing the lease it merely calls the script with STOP
and then exits.

I know this patch probably belongs tagged to the dhcp3 package,
but since this is the bug I want to have fixed it feels like
the appropriate place.

Let the discussion continue...

Regards
 /Jocke

#246621#37
Date:
2005-02-13 09:11:17 UTC
From:
To:

Great!

Please submit your patch in a wish report against dhcp3-client.  In the
report, make reference to #246621 so that the dhcp3-client maintainers
know why this option is wanted.  Write to #246621 again, letting us know
what the number of the new report is.

Also, remember actually to attach the patch.  :)

#246621#42
Date:
2005-02-13 13:00:57 UTC
From:
To:
The previously forgotten patch has now been submitted to
dhcp3-client as issue #295064.

Regards
  /Jocke

#246621#47
Date:
2007-03-21 13:19:57 UTC
From:
To:
The attached patch uses the "-x" switch instead of the "-r" switch when
gracefully shutting down the dhclient3 and thus won't DHCPRELEASE the
host's IP.

The attached patch depends on dhcp3-client including the proposed patch
in #295064.

Thanks,
*t

#246621#52
Date:
2007-03-22 13:01:03 UTC
From:
To:
see attachement
#246621#57
Date:
2008-01-14 11:15:38 UTC
From:
To:
Hello Andrew,

Oh, my bad. I was really referring to #295064, I apologize. I have
submitted the patch from #295064 upstream and it was integrated. So...

.. yes, it should be possible to close it along with #295064 and #247812
with the upload of 3.1.0. It'd be nice to let #246621 know about the
upload too once it's done.

Thanks for your dhcp support in Debian Andrew!
*t

#246621#62
Date:
2009-09-07 20:28:34 UTC
From:
To:
Hey! What's going on with this bug? Will it be fixed at last? I need to
mention, that along with not releasing leases on ifdown it is a good thing to
not renew leases on every ifup.

#246621#67
Date:
2012-04-29 03:22:23 UTC
From:
To:
Hi,

Just wanted to let you know that dhclient now sports a -x option to quit the
client without releasing the lease, so ifupdown could now do something about
this if it wanted to.

regards

Andrew

#246621#72
Date:
2012-05-02 09:53:02 UTC
From:
To:
tags 246621 patch
thanks

Here's an untested patch fixing this.

thanks,
guillem

#246621#79
Date:
2012-05-02 12:01:43 UTC
From:
To:
Hello,

On Wed, 2 May 2012 11:53:02 +0200 Guillem Jover <guillem@debian.org> wrote:

Hi, but what's the rationale of using it in this context? I'd rather
call it in 'up' to kill any already running dhclient so we don't have
two running at the same moment.

#246621#84
Date:
2012-05-02 12:08:13 UTC
From:
To:
Hello,

On Wed, 2 May 2012 14:01:43 +0200 Andrew Shadura <bugzilla@tut.by> wrote:

Aha, I see now (I've just read the discussion which is here since 2004).
Maybe it's better to make it an optional, but still -r by default? Or
-x is better?

#246621#89
Date:
2012-05-12 14:01:41 UTC
From:
To:
After seeing #610553 I guess making it an option might ineed seem
better. I'd be happy either way as long as I can make some of my
systems not release the lease ever.

thanks,
guillem

#246621#94
Date:
2019-02-05 23:36:42 UTC
From:
To:
Attached is a patch providing an option to keep the lease. A new
optional parameter is created in the /etc/network/interfaces file. The
default is set so the current behavior is not changed, thus there is no
impact on existing systems.

Please apply this patch to ifupdown.

#246621#99
Date:
2024-10-07 13:46:36 UTC
From:
To:
Hello Dear,
Greetings to you and your family
I realized that it will be difficult to contact you by Email, I sent you an
E Mail 2days ago but I haven't received any response from you.
Kindly reply for further instructions.
Have a great day.
Mrs Iris Boudreau

#246621#104
Date:
2024-10-07 13:46:36 UTC
From:
To:
Hello Dear,
Greetings to you and your family
I realized that it will be difficult to contact you by Email, I sent you an
E Mail 2days ago but I haven't received any response from you.
Kindly reply for further instructions.
Have a great day.
Mrs Iris Boudreau

#246621#107
Date:
2024-10-07 13:46:36 UTC
From:
To:
Hello Dear,
Greetings to you and your family
I realized that it will be difficult to contact you by Email, I sent you an
E Mail 2days ago but I haven't received any response from you.
Kindly reply for further instructions.
Have a great day.
Mrs Iris Boudreau