Message ID | 1503926835-2098-1-git-send-email-jonatan.schlag@ipfire.org |
---|---|
State | Accepted |
Commit | f5551504acee63fdb27511ae10418675640e05f4 |
Headers |
Return-Path: <network-bounces@lists.ipfire.org> Received: from mail01.ipfire.org by mail01.ipfire.org (Dovecot) with LMTP id GRiQAzkapFmAGQAAmDronw ; Mon, 28 Aug 2017 15:27:21 +0200 Received: from mail01.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id D280527C8; Mon, 28 Aug 2017 15:27:20 +0200 (CEST) Received: from ipfire.localdomain (dslb-088-073-207-162.088.073.pools.vodafone-ip.de [88.73.207.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 94E0F27C8; Mon, 28 Aug 2017 15:27:18 +0200 (CEST) From: Jonatan Schlag <jonatan.schlag@ipfire.org> To: network@lists.ipfire.org Subject: [PATCH] dhclient-script: fix bound Date: Mon, 28 Aug 2017 15:27:12 +0200 Message-Id: <1503926835-2098-1-git-send-email-jonatan.schlag@ipfire.org> X-Mailer: git-send-email 2.6.3 X-BeenThere: network@lists.ipfire.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List for the network package <network.lists.ipfire.org> List-Unsubscribe: <http://lists.ipfire.org/mailman/options/network>, <mailto:network-request@lists.ipfire.org?subject=unsubscribe> List-Archive: <http://lists.ipfire.org/pipermail/network/> List-Post: <mailto:network@lists.ipfire.org> List-Help: <mailto:network-request@lists.ipfire.org?subject=help> List-Subscribe: <http://lists.ipfire.org/mailman/listinfo/network>, <mailto:network-request@lists.ipfire.org?subject=subscribe> Errors-To: network-bounces@lists.ipfire.org Sender: "network" <network-bounces@lists.ipfire.org> |
Series |
dhclient-script: fix bound
|
|
Commit Message
Jonatan Schlag
Aug. 28, 2017, 11:27 p.m. UTC
When we get a BOUND we should have only new_* variables set.
So it is stated in the manpage.
Apparently, also old_* variables are set so we never got into the block where the IP address was set.
We now always set a new IP Address when we get a BOUND.
Fixes: #11363
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
---
src/dhclient-script | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Comments
Thanks for investigating this one. It was a tough one. Great work! -Michael On Mon, 2017-08-28 at 15:27 +0200, Jonatan Schlag wrote: > When we get a BOUND we should have only new_* variables set. > So it is stated in the manpage. > Apparently, also old_* variables are set so we never got into the block where > the IP address was set. > We now always set a new IP Address when we get a BOUND. > > Fixes: #11363 > > Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org> > --- > src/dhclient-script | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/src/dhclient-script b/src/dhclient-script > index c2e0678..ec990bf 100644 > --- a/src/dhclient-script > +++ b/src/dhclient-script > @@ -197,7 +197,8 @@ case "${reason}" in > > BOUND|RENEW|REBIND|REBOOT) > # Check if the IP address has changed. If so, delete all > routes and stuff. > - if [ -n "${old_ip_address}" -a "${old_ip_address}" != > "${new_ip_address}" ]; then > + if [ -n "${old_ip_address}" -a "${old_ip_address}" != > "${new_ip_address}" ] || \ > + [ "${reason}" = "BOUND" ]; then > ipv4_flush_device ${interface} > fi > > @@ -208,7 +209,8 @@ case "${reason}" in > [ ! "${old_network_number}" = > "${new_network_number}" ] || \ > [ ! "${old_broadcast_address}" = > "${new_broadcast_address}" ] || \ > [ ! "${old_routers}" = > "${new_routers}" ] || \ > - [ ! "${old_interface_mtu}" = > "${new_interface_mtu}" ]; then > + [ ! "${old_interface_mtu}" = > "${new_interface_mtu}" ] || \ > + [ "${reason}" = "BOUND" ]; then > > > # Calc the prefix from the subnet > mask
Hi Why was that patch not merged? I just searched for this patch and cloud not find him. Am Mo, 28. Aug, 2017 um 3:27 schrieb Jonatan Schlag <jonatan.schlag@ipfire.org>: > When we get a BOUND we should have only new_* variables set. > So it is stated in the manpage. > Apparently, also old_* variables are set so we never got into the > block where the IP address was set. > We now always set a new IP Address when we get a BOUND. > > Fixes: #11363 > > Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org> > --- > src/dhclient-script | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/src/dhclient-script b/src/dhclient-script > index c2e0678..ec990bf 100644 > --- a/src/dhclient-script > +++ b/src/dhclient-script > @@ -197,7 +197,8 @@ case "${reason}" in > > BOUND|RENEW|REBIND|REBOOT) > # Check if the IP address has changed. If so, delete all routes > and stuff. > - if [ -n "${old_ip_address}" -a "${old_ip_address}" != > "${new_ip_address}" ]; then > + if [ -n "${old_ip_address}" -a "${old_ip_address}" != > "${new_ip_address}" ] || \ > + [ "${reason}" = "BOUND" ]; then > ipv4_flush_device ${interface} > fi > > @@ -208,7 +209,8 @@ case "${reason}" in > [ ! "${old_network_number}" = "${new_network_number}" ] || \ > [ ! "${old_broadcast_address}" = "${new_broadcast_address}" ] > || \ > [ ! "${old_routers}" = "${new_routers}" ] || \ > - [ ! "${old_interface_mtu}" = "${new_interface_mtu}" ]; then > + [ ! "${old_interface_mtu}" = "${new_interface_mtu}" ] || \ > + [ "${reason}" = "BOUND" ]; then > > > # Calc the prefix from the subnet mask > -- > 2.6.3 > <div>Hi</div>Why was that patch not merged? I just searched for this patch and cloud not find him.<br><br>Am Mo, 28. Aug, 2017 um 3:27 schrieb Jonatan Schlag <jonatan.schlag@ipfire.org>:<br> <blockquote type="cite"><div class="plaintext" style="white-space: pre-wrap;">When we get a BOUND we should have only new_* variables set. So it is stated in the manpage. Apparently, also old_* variables are set so we never got into the block where the IP address was set. We now always set a new IP Address when we get a BOUND. Fixes: #11363 Signed-off-by: Jonatan Schlag <<a href="mailto:jonatan.schlag@ipfire.org">jonatan.schlag@ipfire.org</a>> --- src/dhclient-script | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dhclient-script b/src/dhclient-script index c2e0678..ec990bf 100644 --- a/src/dhclient-script +++ b/src/dhclient-script @@ -197,7 +197,8 @@ case "${reason}" in BOUND|RENEW|REBIND|REBOOT) # Check if the IP address has changed. If so, delete all routes and stuff. - if [ -n "${old_ip_address}" -a "${old_ip_address}" != "${new_ip_address}" ]; then + if [ -n "${old_ip_address}" -a "${old_ip_address}" != "${new_ip_address}" ] || \ + [ "${reason}" = "BOUND" ]; then ipv4_flush_device ${interface} fi @@ -208,7 +209,8 @@ case "${reason}" in [ ! "${old_network_number}" = "${new_network_number}" ] || \ [ ! "${old_broadcast_address}" = "${new_broadcast_address}" ] || \ [ ! "${old_routers}" = "${new_routers}" ] || \ - [ ! "${old_interface_mtu}" = "${new_interface_mtu}" ]; then + [ ! "${old_interface_mtu}" = "${new_interface_mtu}" ] || \ + [ "${reason}" = "BOUND" ]; then # Calc the prefix from the subnet mask <div>-- </div>2.6.3 </div></blockquote>
Hi, I don't know why this hasn't been merged. It is a bit hacky and I cannot remember if I wanted it to be reworked or so. I merged it now because it is good enough for now and we probably need to refactor the dhclient-script at some time. Best, -Michael On Sat, 2018-01-20 at 19:30 +0100, Jonatan Schlag wrote: > Hi > Why was that patch not merged? I just searched for this patch and cloud not > find him. > > Am Mo, 28. Aug, 2017 um 3:27 schrieb Jonatan Schlag <jonatan.schlag@ipfire.org > >: > > When we get a BOUND we should have only new_* variables set. > > So it is stated in the manpage. > > Apparently, also old_* variables are set so we never got into the block > > where the IP address was set. > > We now always set a new IP Address when we get a BOUND. > > > > Fixes: #11363 > > > > Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org> > > --- > > src/dhclient-script | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/src/dhclient-script b/src/dhclient-script > > index c2e0678..ec990bf 100644 > > --- a/src/dhclient-script > > +++ b/src/dhclient-script > > @@ -197,7 +197,8 @@ case "${reason}" in > > > > BOUND|RENEW|REBIND|REBOOT) > > # Check if the IP address has changed. If so, delete all > > routes and stuff. > > - if [ -n "${old_ip_address}" -a "${old_ip_address}" != > > "${new_ip_address}" ]; then > > + if [ -n "${old_ip_address}" -a "${old_ip_address}" != > > "${new_ip_address}" ] || \ > > + [ "${reason}" = "BOUND" ]; then > > ipv4_flush_device ${interface} > > fi > > > > @@ -208,7 +209,8 @@ case "${reason}" in > > [ ! "${old_network_number}" = > > "${new_network_number}" ] || \ > > [ ! "${old_broadcast_address}" = > > "${new_broadcast_address}" ] || \ > > [ ! "${old_routers}" = > > "${new_routers}" ] || \ > > - [ ! "${old_interface_mtu}" = > > "${new_interface_mtu}" ]; then > > + [ ! "${old_interface_mtu}" = > > "${new_interface_mtu}" ] || \ > > + [ "${reason}" = "BOUND" ]; then > > > > > > # Calc the prefix from the subnet > > mask > > -- > > 2.6.3 > >
diff --git a/src/dhclient-script b/src/dhclient-script index c2e0678..ec990bf 100644 --- a/src/dhclient-script +++ b/src/dhclient-script @@ -197,7 +197,8 @@ case "${reason}" in BOUND|RENEW|REBIND|REBOOT) # Check if the IP address has changed. If so, delete all routes and stuff. - if [ -n "${old_ip_address}" -a "${old_ip_address}" != "${new_ip_address}" ]; then + if [ -n "${old_ip_address}" -a "${old_ip_address}" != "${new_ip_address}" ] || \ + [ "${reason}" = "BOUND" ]; then ipv4_flush_device ${interface} fi @@ -208,7 +209,8 @@ case "${reason}" in [ ! "${old_network_number}" = "${new_network_number}" ] || \ [ ! "${old_broadcast_address}" = "${new_broadcast_address}" ] || \ [ ! "${old_routers}" = "${new_routers}" ] || \ - [ ! "${old_interface_mtu}" = "${new_interface_mtu}" ]; then + [ ! "${old_interface_mtu}" = "${new_interface_mtu}" ] || \ + [ "${reason}" = "BOUND" ]; then # Calc the prefix from the subnet mask