public inbox for network@lists.ipfire.org
 help / color / mirror / Atom feed
* Re: [PATCH] dhclient-script: fix bound
       [not found] <1516473057.2816.0@mail01.ipfire.org>
@ 2018-01-22 13:08 ` Michael Tremer
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Tremer @ 2018-01-22 13:08 UTC (permalink / raw)
  To: network

[-- Attachment #1: Type: text/plain, Size: 2174 bytes --]

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(a)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(a)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
> > 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dhclient-script: fix bound
  2017-08-28 13:27 Jonatan Schlag
@ 2017-09-07 19:46 ` Michael Tremer
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Tremer @ 2017-09-07 19:46 UTC (permalink / raw)
  To: network

[-- Attachment #1: Type: text/plain, Size: 1676 bytes --]

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(a)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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] dhclient-script: fix bound
@ 2017-08-28 13:27 Jonatan Schlag
  2017-09-07 19:46 ` Michael Tremer
  0 siblings, 1 reply; 3+ messages in thread
From: Jonatan Schlag @ 2017-08-28 13:27 UTC (permalink / raw)
  To: network

[-- Attachment #1: Type: text/plain, Size: 1448 bytes --]

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(a)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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-22 13:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1516473057.2816.0@mail01.ipfire.org>
2018-01-22 13:08 ` [PATCH] dhclient-script: fix bound Michael Tremer
2017-08-28 13:27 Jonatan Schlag
2017-09-07 19:46 ` Michael Tremer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox