FS#13237 - Copying manual network configuration to rc.conf

Attached to Project: Release Engineering
Opened by Alexander De Sousa (Aphanic) - Thursday, 12 February 2009, 10:05 GMT
Last edited by Gerhard Brauer (GerBra) - Thursday, 30 July 2009, 06:17 GMT
Task Type Bug Report
Category AIF
Status Closed
Assigned To Aaron Griffin (phrakture)
Gerhard Brauer (GerBra)
Dieter Plaetinck (Dieter_be)
Architecture All
Severity Medium
Priority Normal
Reported Version 2009.02-RC
Due in Version 2009.08-RC
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

If you choose to configure network manually (by entering IP, net mask, broadcast IP, ...) and then you choose to use that settings in the installed system, the setup script may not update correctly the broadcast IP and even giving an invalid one.

To reproduce this bug just use any IP with at least one of the bytes different from the default one (e.g. 192.168.8.2, which would give an incorrect broadcast IP) or with more than 8 digits (e.g. 192.168.0.27, would give an invalid broadcast IP).

The attached patch fixes it.
This task depends upon

Closed by  Gerhard Brauer (GerBra)
Thursday, 30 July 2009, 06:17 GMT
Reason for closing:  Fixed
Comment by Gerhard Brauer (GerBra) - Thursday, 12 February 2009, 11:04 GMT
I don't see the problem. If you choose a other IP than the default (with an other subnet) then you must also change the - default - broadcast address. The installer doesn't do that automatically for you.
And when all values for your network are correct in network setup dialog then these values are also correct in generated rc.conf.
I've made all my tests with an 10.0.0.X IP and settings and see never a problem.
Comment by Alexander De Sousa (Aphanic) - Thursday, 12 February 2009, 11:10 GMT
Sorry, there's a mistake in that patch, this one does work.
Comment by Alexander De Sousa (Aphanic) - Thursday, 12 February 2009, 11:16 GMT
This is the problem:

In line 884 of the setup script there is: sed -i "s#192.168.0.2# $IPADDR#g" ${DESTDIR}/etc/rc.conf

Which means that it will replace 192.168.0.2 by the IP address you choose. The problem is that the line 62 in the default rc.conf is:

eth0="eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255"

So if you choosed 192.168.0.27 (for example) it will end up looking like this:

eth0="eth0 192.168.0.27 netmask 255.255.255.0 broadcast 192.168.0.2755"

If you take a look at the broadcast IP it is clearly invalid.
Comment by Alexander De Sousa (Aphanic) - Thursday, 12 February 2009, 11:28 GMT
To clarify, the sed line that should replace the default broadcast IP with the one you choosed (line 886) looks for 192.168.0.255 in rc.conf and won't find it.
Comment by Dieter Plaetinck (Dieter_be) - Thursday, 12 February 2009, 12:01 GMT
looks like there are 2 problems here:
- the sed for the ip does a global replace and since the broadcast contains the ip-string it will also replace there, updating the broadcast in rc.conf to something incorrect
- the sed that should fix the broadcast cannot find what it's looking for, because the previous thing.

your solution fixes both and looks good to me. let's use it for the next release
Comment by Aaron Griffin (phrakture) - Friday, 13 February 2009, 16:54 GMT
Out of curiosity, do we need the final quote in the broadcast sed expression? It makes it ugly, and breaks the expression with a simply space or any addition after that entry.
Comment by Dieter Plaetinck (Dieter_be) - Friday, 13 February 2009, 18:08 GMT
Good point. Imho we don't need it. let's leave it out (the characters \# ) for both the regex and the replacement part.
Comment by Dieter Plaetinck (Dieter_be) - Saturday, 14 February 2009, 17:11 GMT Comment by Alexander De Sousa (Aphanic) - Sunday, 15 February 2009, 13:27 GMT
That's right, the final quote is not needed as "broadcast" does not appear more times in rc.conf.

I left in case it could appear more times because it was already there.
Comment by Dieter Plaetinck (Dieter_be) - Sunday, 08 March 2009, 16:42 GMT
Implemented in aif. all that's needed right now is testing :)
Comment by Alexander De Sousa (Aphanic) - Tuesday, 14 April 2009, 10:49 GMT
I'm sorry to answer so late, I've been in hospital for some time and I wont be able to perform tests and so right now. I need some time to rest and recover but I'll be back as soon as possible.

Anyway I've taken a look to the code in AIF (lib-network.sh) and it should work, I can't see anything wrong there. The code already worked with the old installer and in AIF it is essentially the same.

Regards.
Comment by Dieter Plaetinck (Dieter_be) - Tuesday, 14 April 2009, 11:08 GMT
that's okay. good luck with the recovery and all.
Comment by Gerhard Brauer (GerBra) - Thursday, 30 July 2009, 06:17 GMT
Seems fixed at last in 2009.08-beta1.
Tested with IP 192.168.xxx.201, broadcast was correctly set. All values during manual network config are correctly parsed to generated rc.conf.

Loading...