hmm, i'm braindead.
And that made it especially hard to deal with ipconfig(8):
by default, ipconfig exits after trying DHCP for 15 seconds
with no answer
--steffen
--- Begin Message ---
Hello,
erik quanstrom <quans...@labs.coraid.com> wrote:
|email
| quans...@quanstro.net
|readme
| don't dhcp by default. it looks like a hang.
[.]
|+ #if(! test -e /net/ipifc/0/ctl || ~ 127.0.0.1 `{cat /net/ipifc/0/local})
|+ # ip/ipconfig >/dev/null >[2=1]
[.]
after looking into the ipconfig source and placing some fprint()
the actual "hang" is caused by a faulty length of the sleep.
If i add
--- a/sys/src/cmd/ip/ipconfig/main.c
+++ b/sys/src/cmd/ip/ipconfig/main.c
@@ -469,6 +469,12 @@ main(int argc, char **argv)
int retry, action;
Ctl *cp;
+ for (retry = 0; retry < 10; ++retry) {
+ long t = time(nil);
+ fprint(2, "retry %d, time %ld\n", retry, t);
+ sleep(1000);
+ }
+
init();
retry = 0;
ARGBEGIN {
then each tick sleeps ~1 second (sometimes a tick needed 3 in the
tests i've done). But if i add
--- a/sys/src/cmd/ip/ipconfig/main.c
+++ b/sys/src/cmd/ip/ipconfig/main.c
@@ -621,10 +621,13 @@ doadd(int retry)
if(dodhcp){
mkclientid();
for(tries = 0; tries < 30; tries++){
+ long t;
dhcpquery(!noconfig, Sselecting);
if(conf.state == Sbound)
break;
sleep(1000);
+ t = time(nil);
+ fprint(2, "retry %d, time %ld\n", tries, t);
}
}
then that sleep takes reproducably 12 seconds. Without having any
ideas what this could be about (VirtualBox?), i nonetheless wonder
wether something like this would be imaginable, since a time
difference is used later on in the code, too:
--- a/sys/src/cmd/ip/ipconfig/main.c
+++ b/sys/src/cmd/ip/ipconfig/main.c
@@ -619,12 +619,15 @@ doadd(int retry)
/* run dhcp if we need something */
if(dodhcp){
+ long start = time(nil);
mkclientid();
for(tries = 0; tries < 30; tries++){
dhcpquery(!noconfig, Sselecting);
if(conf.state == Sbound)
break;
sleep(1000);
+ if (tries > 1 && time(nil) - start > 30)
+ break;
}
}
Apologies for the patch format (it's all half-baked here).
--steffen
--- Begin Message ---
email
quans...@quanstro.net
readme
don't dhcp by default. it looks like a hang.
set sysname, even if ndb not cooperative
use diskparts instead of inline code
removed
files
/rc/bin/termrc termrc
/rc/bin/termrc termrc
termrc.orig:10,18 - termrc:10,22
mntgen -s slashn && chmod 666 /srv/slashn
ndb/cs -f $ndbfile
sysname=`{cat /dev/sysname}
+ if(~ $#sysname 0){
+ sysname = gnot
+ echo -n $sysname >/dev/sysname
+ }
- if(! test -e /net/ipifc/0/ctl || ~ 127.0.0.1 `{cat /net/ipifc/0/local})
- ip/ipconfig >/dev/null >[2=1]
+ #if(! test -e /net/ipifc/0/ctl || ~ 127.0.0.1 `{cat /net/ipifc/0/local})
+ # ip/ipconfig >/dev/null >[2=1]
if(test -e /net/ipifc/0/ctl)
ndb/dns -rf $ndbfile
for(i in /net/ether?)
termrc.orig:30,41 - termrc:34,44
for(i in A w f t m u v L '$' Ι Σ κ æ ©)
/bin/bind -a '#'^$i /dev >/dev/null >[2=1]
- for(disk in /dev/sd??) {
- if(test -f $disk/data && test -f $disk/ctl)
- disk/fdisk -p $disk/data >$disk/ctl >[2]/dev/null
- for(part in $disk/plan9*)
- if(test -f $part)
- disk/prep -p $part >$disk/ctl >[2]/dev/null
+ diskparts
+ sysname=`{cat /dev/sysname}
+ if (~ $#sysname 0 || ~ $sysname '') {
+ sysname = gnot
+ echo -n $sysname >/dev/sysname
}
# hacks
------
merge...backup...copy...
cpfile termrc /n/dist/rc/bin/termrc
# remove these files if you want. I will not remove them for you
# (apatch/undo will not restore them)
done
--- End Message ---
--- End Message ---