Re: netcfg: using udhcpc to get dhcp lease fails

2010-02-01 Thread Frans Pop
On Monday 01 February 2010, Frans Pop wrote:
 On Monday 01 February 2010, Otavio Salvador wrote:
   I.e, multiple IP addresses should be comma-separated. This also goes
   for ntp-servers, which probably should not have quotes as it's
   similar to dns.
 
  Fixed both issues; I can't test it now so if you have time do a last
  check.

 This is not going to work in busybox shell:
option domain-name-servers ${dns/ /,};

 Suggest you use a function, something like:
 comma_separate() {
   echo $1 | sed s/ /,/g
 }

 and then use:
option domain-name-servers $(comma_separate $dns);

 And the same substitution should be made for ntp servers, which can also
 have multiple values.

I've committed this myself (for routers, dns and ntp).


-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: netcfg: using udhcpc to get dhcp lease fails

2010-02-01 Thread Frans Pop
On Sunday 31 January 2010, Otavio Salvador wrote:
 On Sun, Jan 31, 2010 at 4:32 PM, Frans Pop elen...@planet.nl wrote:
  Having all leases in the file would mostly be an aid for
  troubleshooting. It's not a huge issue for me though.

 To it to concatenate them is a simgle line change in the script so I
 can do it easily. I just didn't think it was useful but if you want
 just tell me and I do it.

I've tested this a bit and the strange the strange thing is that I don't 
get any new entries for normal renews. I see new REQUEST+ACKs on my 
server, but nothing in D-I in either the syslog or the leases file.
So apparently either the script does not get called on normal renews (maybe 
it will be called only if something changes), or there is some bug.

After some thought I've decided to make the change anyway. IMO it can be 
useful for troubleshooting, especially as given the above it would only 
result in multiple entries in case of exceptions.

Change has been committed.

As far as I'm concerned all is OK now. We will need a new busybox upload 
before we can upload netcfg though.

Cheers,
FJP


-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: netcfg: using udhcpc to get dhcp lease fails

2010-02-01 Thread Otavio Salvador
Hello,

On Mon, Feb 1, 2010 at 1:34 PM, Frans Pop elen...@planet.nl wrote:
 On Monday 01 February 2010, Frans Pop wrote:
 On Monday 01 February 2010, Otavio Salvador wrote:
   I.e, multiple IP addresses should be comma-separated. This also goes
   for ntp-servers, which probably should not have quotes as it's
   similar to dns.
 
  Fixed both issues; I can't test it now so if you have time do a last
  check.

 This is not going to work in busybox shell:
    option domain-name-servers ${dns/ /,};

 Suggest you use a function, something like:
 comma_separate() {
       echo $1 | sed s/ /,/g
 }

 and then use:
    option domain-name-servers $(comma_separate $dns);

 And the same substitution should be made for ntp servers, which can also
 have multiple values.

 I've committed this myself (for routers, dns and ntp).

Your suggestion makes the code much nicer to read, indeed, however I
did test it inside of busybox' shell and it worked. Has it failed for
you?

I tried it using busybox sh, in regular system, and it worked.

Your code is OK for me, just to clarify it. I just want to confirm it
has failed.

Cheers,

-- 
Otavio Salvador  O.S. Systems
E-mail: ota...@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br


--
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: netcfg: using udhcpc to get dhcp lease fails

2010-02-01 Thread Frans Pop
On Monday 01 February 2010, Otavio Salvador wrote:
 Your suggestion makes the code much nicer to read, indeed, however I
 did test it inside of busybox' shell and it worked. Has it failed for
 you?

I tried the commands I showed in an earlier mail in D-I debug shell. Maybe 
the configs are different, or either you or I made some mistake.


-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: netcfg: using udhcpc to get dhcp lease fails

2010-01-31 Thread Otavio Salvador
Hello Frans,

On Sat, Jan 30, 2010 at 9:48 PM, Frans Pop elen...@planet.nl wrote:
 On Saturday 30 January 2010, Otavio Salvador wrote:
  I built a netboot image without dhcp3-udeb to test udhcpc, but it
  failed miserably as it did not manage to get a lease during netcfg.
  How well was this tested?

 Works OK now. Nice.

Good; I have a limited way of testing it now so it is nice to know it
has worked fine to you.

 Now it has one. /var/lib/udhcp/udhcpc.leases.
[...]
 Probably worth adding/fixing for udhcpc is:
 - missing option host-name

I've added it but I can't test it right now. Please see if it works for you.

 - missing option domain-name-servers
 - missing option dhcp-server-identifier
 - strange leading slash for subnet-mask
 - typo option domain-nam (missing e)
 The other differences are probably not that relevant.

I've fixed/added them all.

 Oh, and we also need 'ntpservers' I think. I can't test that here now, but
 netcfg does (in dhcp.c):
    if ((d = fopen(NTP_SERVER_FILE, r)) != NULL) {
        char ntpservers[DHCP_OPTION_LEN + 1] = { 0 };
        fgets(ntpservers, DHCP_OPTION_LEN, d);
        fclose(d);
        unlink(NTP_SERVER_FILE);

        if (!empty_str(ntpservers)) {
            debconf_set(client, netcfg/dhcp_ntp_servers,
                        ntpservers);
        }
    }
 and the clock-setup postinst has:
    db_get netcfg/dhcp_ntp_servers

Yes; it should work fine. The script writes the content to the file
netcfg expects. I couldn't test it as well but ought to work fine.

 Also, if I run netcfg multiple times with dhcp3, I get multiple leases in
 the leases file. You seem to overwrite the existing file. Not sure if that
 needs fixing or not.

I think it is not worth. syslog now has the gotten IP each time it
runs so is easy to spot if it has been run twice.

-- 
Otavio Salvador  O.S. Systems
E-mail: ota...@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br


--
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: netcfg: using udhcpc to get dhcp lease fails

2010-01-31 Thread Luk Claes
Otavio Salvador wrote:
 Hello Frans,
 
 On Sat, Jan 30, 2010 at 9:48 PM, Frans Pop elen...@planet.nl wrote:
 On Saturday 30 January 2010, Otavio Salvador wrote:
 I built a netboot image without dhcp3-udeb to test udhcpc, but it
 failed miserably as it did not manage to get a lease during netcfg.
 How well was this tested?
 Works OK now. Nice.
 
 Good; I have a limited way of testing it now so it is nice to know it
 has worked fine to you.
 
 Now it has one. /var/lib/udhcp/udhcpc.leases.
 [...]
 Probably worth adding/fixing for udhcpc is:
 - missing option host-name
 
 I've added it but I can't test it right now. Please see if it works for you.
 
 - missing option domain-name-servers
 - missing option dhcp-server-identifier
 - strange leading slash for subnet-mask
 - typo option domain-nam (missing e)
 The other differences are probably not that relevant.
 
 I've fixed/added them all.
 
 Oh, and we also need 'ntpservers' I think. I can't test that here now, but
 netcfg does (in dhcp.c):
if ((d = fopen(NTP_SERVER_FILE, r)) != NULL) {
char ntpservers[DHCP_OPTION_LEN + 1] = { 0 };
fgets(ntpservers, DHCP_OPTION_LEN, d);
fclose(d);
unlink(NTP_SERVER_FILE);

if (!empty_str(ntpservers)) {
debconf_set(client, netcfg/dhcp_ntp_servers,
ntpservers);
}
}
 and the clock-setup postinst has:
db_get netcfg/dhcp_ntp_servers
 
 Yes; it should work fine. The script writes the content to the file
 netcfg expects. I couldn't test it as well but ought to work fine.
 
 Also, if I run netcfg multiple times with dhcp3, I get multiple leases in
 the leases file. You seem to overwrite the existing file. Not sure if that
 needs fixing or not.
 
 I think it is not worth. syslog now has the gotten IP each time it
 runs so is easy to spot if it has been run twice.

With dhcp3 not all the leases in the file are valid aka only the latest
one for every IP is valid if it's not expired yet. I'm not sure if udhcp
would cope with invalid leases in the leases file?

Cheers

Luk


-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: netcfg: using udhcpc to get dhcp lease fails

2010-01-31 Thread Frans Pop
On Sunday 31 January 2010, Luk Claes wrote:
 Otavio Salvador wrote:
  Also, if I run netcfg multiple times with dhcp3, I get multiple
  leases in the leases file. You seem to overwrite the existing file.
  Not sure if that needs fixing or not.
 
  I think it is not worth. syslog now has the gotten IP each time it
  runs so is easy to spot if it has been run twice.

The same is true with dhcp3 isn't it?

 With dhcp3 not all the leases in the file are valid aka only the latest
 one for every IP is valid if it's not expired yet.

Of course.

 I'm not sure if udhcp would cope with invalid leases in the leases file?

It's only an output file. udhcp itself does not use it.

Having all leases in the file would mostly be an aid for troubleshooting.
It's not a huge issue for me though.


-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: netcfg: using udhcpc to get dhcp lease fails

2010-01-31 Thread Otavio Salvador
Hello,

On Sun, Jan 31, 2010 at 4:09 PM, Luk Claes l...@debian.org wrote:
 With dhcp3 not all the leases in the file are valid aka only the latest
 one for every IP is valid if it's not expired yet. I'm not sure if udhcp
 would cope with invalid leases in the leases file?

It can't. The lease file is being written by the script and since it
is there just to be easier to check things and allow for easier
integration I think that replacing it all time works fine.

-- 
Otavio Salvador  O.S. Systems
E-mail: ota...@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br


-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: netcfg: using udhcpc to get dhcp lease fails

2010-01-31 Thread Otavio Salvador
Hello,

On Sun, Jan 31, 2010 at 4:32 PM, Frans Pop elen...@planet.nl wrote:
 I'm not sure if udhcp would cope with invalid leases in the leases file?

 It's only an output file. udhcp itself does not use it.

 Having all leases in the file would mostly be an aid for troubleshooting.
 It's not a huge issue for me though.

To it to concatenate them is a simgle line change in the script so I
can do it easily. I just didn't think it was useful but if you want
just tell me and I do it.

-- 
Otavio Salvador  O.S. Systems
E-mail: ota...@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br


-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: netcfg: using udhcpc to get dhcp lease fails

2010-01-31 Thread Frans Pop
Another issue.

The Depends: for netcfg in debian/control now has:
   dhcp3-client-udeb (= 3.1.0-2) [kfreebsd-i386 kfreebsd-amd64]

According to policy this is only allowed for build dependencies, not for 
regular ones. Or am I missing something?

If I'm right the dependency should be added dynamically at build time from 
the rules file. We have a few examples how to do that, for example 
clock-setup.

Note that dhcp3-client-udeb is currently also included from the pkg-lists 
files.


-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: netcfg: using udhcpc to get dhcp lease fails

2010-01-31 Thread Frans Pop
On Sunday 31 January 2010, Otavio Salvador wrote:
  Probably worth adding/fixing for udhcpc is:
  - missing option host-name

 I've added it but I can't test it right now. Please see if it works for
 you.

  - missing option domain-name-servers
  - missing option dhcp-server-identifier
  - strange leading slash for subnet-mask
  - typo option domain-nam (missing e)
  The other differences are probably not that relevant.

 I've fixed/added them all.

Looks better now. There a few last minor issues.

dhcp3 gives:
  option domain-name-servers 10.19.66.2,10.19.66.1;
udhcpc gives:
  option domain-name-servers 10.19.66.2 10.19.66.1;

I.e, multiple IP addresses should be comma-separated. This also goes for 
ntp-servers, which probably should not have quotes as it's similar to dns.

I've also tested ntp-servers now. Works correctly.


-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: netcfg: using udhcpc to get dhcp lease fails

2010-01-31 Thread Otavio Salvador
Hello,

On Sun, Jan 31, 2010 at 9:06 PM, Frans Pop elen...@planet.nl wrote:
 Another issue.

 The Depends: for netcfg in debian/control now has:
   dhcp3-client-udeb (= 3.1.0-2) [kfreebsd-i386 kfreebsd-amd64]

 According to policy this is only allowed for build dependencies, not for
 regular ones. Or am I missing something?

Yes, you're right. I changed it already.

 If I'm right the dependency should be added dynamically at build time from
 the rules file. We have a few examples how to do that, for example
 clock-setup.

Did it.

 Note that dhcp3-client-udeb is currently also included from the pkg-lists
 files.

I was planning to do that change later but since netcfg doesn't have
changes planned until this release and 1.51 has it included I did it
now.

Should work fine :-)

-- 
Otavio Salvador  O.S. Systems
E-mail: ota...@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br


--
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: netcfg: using udhcpc to get dhcp lease fails

2010-01-31 Thread Otavio Salvador
Hello,

On Sun, Jan 31, 2010 at 9:46 PM, Frans Pop elen...@planet.nl wrote:
 Looks better now. There a few last minor issues.

 dhcp3 gives:
  option domain-name-servers 10.19.66.2,10.19.66.1;
 udhcpc gives:
  option domain-name-servers 10.19.66.2 10.19.66.1;


 I.e, multiple IP addresses should be comma-separated. This also goes for
 ntp-servers, which probably should not have quotes as it's similar to dns.

 I've also tested ntp-servers now. Works correctly.

Fixed both issues; I can't test it now so if you have time do a last check.

Thanks a lot.

-- 
Otavio Salvador  O.S. Systems
E-mail: ota...@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br


--
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: netcfg: using udhcpc to get dhcp lease fails

2010-01-31 Thread Frans Pop
On Monday 01 February 2010, Otavio Salvador wrote:
  I.e, multiple IP addresses should be comma-separated. This also goes
  for ntp-servers, which probably should not have quotes as it's similar
  to dns.

 Fixed both issues; I can't test it now so if you have time do a last
 check.

This is not going to work in busybox shell:
   option domain-name-servers ${dns/ /,};

# test=a b c
# echo ${test/ /,}
/bin/sh: syntax error: bad substitution

Suggest you use a function, something like:
comma_separate() {
echo $1 | sed s/ /,/g
}

and then use:
   option domain-name-servers $(comma_separate $dns);

And the same substitution should be made for ntp servers, which can also 
have multiple values.


-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: netcfg: using udhcpc to get dhcp lease fails

2010-01-30 Thread Otavio Salvador
Hello Frans,

On Tue, Jan 26, 2010 at 1:33 PM, Frans Pop elen...@planet.nl wrote:
 I've just tried running the SVN version of netcfg which includes the
 following change:
   [ Otavio Salvador ]
   * Add support for udhcpc. This was based on Luk Claes but changed to
     avoid dropping support for dhclient, dhclient3 and pump for now.

 I built a netboot image without dhcp3-udeb to test udhcpc, but it failed
 miserably as it did not manage to get a lease during netcfg.
 How well was this tested?

It was a long time since I last looked at it; I've looked again and I
found that the script was not being set as executable. I've fixed it
for next busybox' upload.

 It did work when run from a debug shell:
 # ip link set up dev eth0
 # udhcpd
 udhcpd (v1.14.2) started
 Sending discover...
 Sending select for 10.19.66.61
 Lease of 10.19.66.61 obtained, lease time 7200

It works now inside of the installer.

 Another issue is that I could not find a lease file anywhere, which makes
 troubleshooting network issues more difficult.

Now it has one. /var/lib/udhcp/udhcpc.leases.

 It also means that using udhcpd would break setting a preseed file from the
 DHCP server config [1]. And we have had bug reports in the past when that
 no longer worked.

I've looked at busybox' code and netcfg and I've fixed the missing
things that are need for this support (we need to pass bootfile param

 As there was no lease file I could not verify if the filename option was
 even included in the lease or not.

I've changed upcoming busybox' script to write a leases file and
changed preseed to use it.

It should work fine.

-- 
Otavio Salvador  O.S. Systems
E-mail: ota...@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br


--
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: netcfg: using udhcpc to get dhcp lease fails

2010-01-30 Thread Frans Pop
On Saturday 30 January 2010, Otavio Salvador wrote:
 It was a long time since I last looked at it; I've looked again and I
 found that the script was not being set as executable. I've fixed it
 for next busybox' upload.

Thanks for the fixes. I'll give it a go.


-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: netcfg: using udhcpc to get dhcp lease fails

2010-01-30 Thread Frans Pop
On Saturday 30 January 2010, Otavio Salvador wrote:
  I built a netboot image without dhcp3-udeb to test udhcpc, but it
  failed miserably as it did not manage to get a lease during netcfg.
  How well was this tested?

Works OK now. Nice.

 Now it has one. /var/lib/udhcp/udhcpc.leases.

udhcpc given me:
lease {
  interface eth0;
  fixed-address 10.19.66.61;
  filename http://www/preseed.cfg;;
  subnet-mask /255.255.255.0;
  option domain-nam fjphome.nl;
  option routers 10.19.66.1;
  option ntp-servers ;
}

While dhcp3 gives:
lease {
  interface eth0;
  fixed-address 10.19.66.61;
  filename http://www/preseed.cfg;;
  option subnet-mask 255.255.255.0;
  option routers 10.19.66.1;
  option dhcp-lease-time 7200;
  option unknown-208 f1:0:74:7e;
  option dhcp-message-type 5;
  option unknown-209 debian-installer/pxelinux.cfg/default;
  option domain-name-servers 10.19.66.2,10.19.66.1;
  option dhcp-server-identifier 10.19.66.2;
  option unknown-210 /;
  option host-name vbox1;
  option domain-name fjphome.nl;
  renew 0 2010/01/31 01:23:15;
  rebind 0 2010/01/31 02:19:33;
  expire 0 2010/01/31 02:34:33;
}

Probably worth adding/fixing for udhcpc is:
- missing option host-name
- missing option domain-name-servers
- missing option dhcp-server-identifier
- strange leading slash for subnet-mask
- typo option domain-nam (missing e)
The other differences are probably not that relevant.

Oh, and we also need 'ntpservers' I think. I can't test that here now, but 
netcfg does (in dhcp.c):
if ((d = fopen(NTP_SERVER_FILE, r)) != NULL) {
char ntpservers[DHCP_OPTION_LEN + 1] = { 0 };
fgets(ntpservers, DHCP_OPTION_LEN, d);
fclose(d);
unlink(NTP_SERVER_FILE);

if (!empty_str(ntpservers)) {
debconf_set(client, netcfg/dhcp_ntp_servers,
ntpservers);
}
}
and the clock-setup postinst has:
db_get netcfg/dhcp_ntp_servers

Also, if I run netcfg multiple times with dhcp3, I get multiple leases in 
the leases file. You seem to overwrite the existing file. Not sure if that 
needs fixing or not.

Cheers,
FJP


-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



netcfg: using udhcpc to get dhcp lease fails

2010-01-26 Thread Frans Pop
I've just tried running the SVN version of netcfg which includes the 
following change:
   [ Otavio Salvador ]
   * Add support for udhcpc. This was based on Luk Claes but changed to
 avoid dropping support for dhclient, dhclient3 and pump for now.

I built a netboot image without dhcp3-udeb to test udhcpc, but it failed 
miserably as it did not manage to get a lease during netcfg.
How well was this tested?

It did work when run from a debug shell:
# ip link set up dev eth0
# udhcpd
udhcpd (v1.14.2) started
Sending discover...
Sending select for 10.19.66.61
Lease of 10.19.66.61 obtained, lease time 7200

Another issue is that I could not find a lease file anywhere, which makes 
troubleshooting network issues more difficult.
It also means that using udhcpd would break setting a preseed file from the 
DHCP server config [1]. And we have had bug reports in the past when that 
no longer worked.

As there was no lease file I could not verify if the filename option was 
even included in the lease or not.

Cheers,
FJP

[1] http://d-i.alioth.debian.org/manual/en.i386/apbs02.html#preseed-dhcp
See also dhcp_preseed_url() in preseed.sh.


signature.asc
Description: This is a digitally signed message part.