9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: geoff@collyer.net
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Small patch to tftpd; command line announce strings.
Date: Wed, 22 Jan 2003 17:22:21 -0800	[thread overview]
Message-ID: <47d3cbd4463e137227523e39b75b97ee@collyer.net> (raw)
In-Reply-To: <200301222255.h0MMtFw01079@augusta.math.psu.edu>

Listen doesn't need a -x; its last argument is the network directory
to use:

	aux/listen -t /bin/service.auth -d /bin/service.alt /net.alt/tcp

Initialising additional interfaces isn't conveniently packaged up, so
I wrote `ifup', which does the job.  I use it like this in cpurc:

# network services
aux/listen -q -t /bin/service.auth -d /bin/service tcp
ip/tftpd
ip/dhcpd
# alternate interfaces & their services
switch ($sysname) {
case cpu
	ifup alt 1 $sysname	external service.alt
	ifup gig 2 $sysname-gig	local	 service
	timesync /net.alt/udp!^((ntp1 ntp2)^.mainecoon.com openbsd)
case cpub
	ifup alt 1 $sysname external service.alt
case cpuc
	ifup gig 1 $sysname-gig local service
}

The first interface (/net) is handled specially; it often is already
configured when cpurc starts.

This is ifup:
---
#!/bin/rc
# ifup mtsfx etherno sysnm ndbfile svcdir - configure /net.$mtsfx
# TODO: share a protocol stack between ether0 and gig ether
#	and just add a route to the other gig host
if (! ~ $#* 5) {
	echo usage: $0 mtsfx etherno sysnm ndbfile svcdir
	exit usage
}
rfork e
mtsfx=$1	etherno=$2	sysnm=$3	ndbfile=$4	svcdir=$5
mtpt=/net.^$mtsfx
ndbf=/lib/ndb/^$ndbfile

# merge protocol stack and ethernet interface at mount point
bind -b '#l'^$etherno $mtpt
bind -b '#I'^$etherno $mtpt

# figure out ip, ipgw & ipmask
ipgw=dummy			# in case ndb doesn't list one
for (attr in ip ipgw ipmask)
	eval `{ndb/ipquery -f $ndbf sys $sysnm $attr | tr ' ' '\12' | sed 1q}

# configure interface and set up out-calling machinery
# first arg can be "ether" or "gbe" iff it can handle jumbo packets
ip/ipconfig -x .$mtsfx -g $ipgw ether $mtpt/ether$etherno $ip $ipmask
ndb/cs -x $mtpt -f $ndbf
if (! ~ $mtsfx gig)
 	ndb/dns -sx $mtpt -f $ndbf

# start up listeners
aux/listen -t /bin/service.auth -d /bin/^$svcdir $mtpt^/tcp
if (! ~ $mtsfx gig) {
	ip/dhcpd -x $mtpt -f $ndbf	# for the printer
	ip/rip -x $mtpt
}
if (~ $mtsfx alt)
	auth/secstored -x $mtpt
---



      reply	other threads:[~2003-01-23  1:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-22 22:55 Dan Cross
2003-01-23  1:22 ` geoff [this message]

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=47d3cbd4463e137227523e39b75b97ee@collyer.net \
    --to=geoff@collyer.net \
    --cc=9fans@cse.psu.edu \
    /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).