9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Steffen "Daode" Nurpmeso <sdaoden@gmail.com>
To: erik quanstrom <quanstro@quanstro.net>
Cc: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] [sources] applied patch: /n/atom/patch/applied/termrcnodhcp
Date: Tue, 15 Oct 2013 15:15:17 +0200	[thread overview]
Message-ID: <20131015141517.bphExS/C92FhFNd7gqDyCj4w@dietcurd.local> (raw)
In-Reply-To: <20131015133242.BzZtmIHXbY5g5ZxUYrTW3X/A@dietcurd.local>

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

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

[-- Attachment #2: Original message content --]
[-- Type: message/rfc822, Size: 5964 bytes --]

[-- Attachment #2.1.1: Type: text/plain, Size: 2057 bytes --]

Hello,

erik quanstrom <quanstro@labs.coraid.com> wrote:
 |email
 | quanstro@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

[-- Attachment #2.1.2: Original message content --]
[-- Type: message/rfc822, Size: 2815 bytes --]

From: erik quanstrom <quanstro@labs.coraid.com>
To: sources@9atom.org
Subject: [sources] applied patch: /n/atom/patch/applied/termrcnodhcp
Date: Sun, 13 Oct 2013 13:18:00 -0400
Message-ID: <250d3e7e5500a6e7d72c8ab3d49f9641@coraid.com>

email
	quanstro@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


  parent reply	other threads:[~2013-10-15 13:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <250d3e7e5500a6e7d72c8ab3d49f9641@coraid.com>
2013-10-15 12:32 ` Steffen Daode Nurpmeso
2013-10-15 12:58   ` erik quanstrom
2013-10-15 13:15   ` Steffen Daode Nurpmeso [this message]
     [not found]   ` <ca2e3c3a59e76e71362f34b52b6502fc@coraid.com>
2013-10-15 13:19     ` Steffen Daode Nurpmeso
2013-10-15 13:22       ` erik quanstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131015141517.bphExS/C92FhFNd7gqDyCj4w@dietcurd.local \
    --to=sdaoden@gmail.com \
    --cc=9fans@9fans.net \
    --cc=quanstro@quanstro.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).