9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@coraid.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Re: PPP error: cannot write IP - link not up
Date: Tue,  6 Mar 2007 06:17:03 -0500	[thread overview]
Message-ID: <d17a46fb1037001c6d073472dab7de69@coraid.com> (raw)
In-Reply-To: <32a656c20703060155o426c506co8c87a3f61c319d6f@mail.gmail.com>

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

On Tue Mar  6 04:55:44 EST 2007, vester.thacker@gmail.com wrote:
> On 3/6/07, Stevie_Lancaster <teenageriot@gmx.de> wrote:
> 
> > Thanks for your reply. Under /net there is already a directory ether0.
> > So I guess the device got binded there. Am I right?
> 
> I believe it to mean that the device was recognized, but it does not
> mean that it was binded.

i guess this is pedantic but, yes it does mean the device is bound
into the namespace and in most cases you can send and receive
raw ethernet frames.

i've attached an overly-complicated program which prints out the
ip configuration by interface.  output is like so:

	; ipifc
	0:/net/ether0 	00a0c973fa3f	1514
		205.185.197.2/120	205.185.197.0
	0:/net.alt/ether1 	000102ed3163	1514
		65.14.39.132/123	65.14.39.128

the first line is the ipifc index, a ':', the mountpoint, mac and mtu.
subsequent indented lines are  address, a '/', netmask and
network for each configured address.  you can get the same
information with

	; cat cat /net*/ipifc/?/status>[2=]

but it's a lot harder to read. ;-)

- erik

[-- Attachment #2: ipifc.c --]
[-- Type: text/plain, Size: 1141 bytes --]

#include <u.h>
#include <libc.h>
#include <ip.h>

char *mtab[10] = {"/net", "/net.alt"};
int nmtab = 2;

void 
ipifcprint(char *m, int idx)
{
	Ipifc 	*ifc;
	Iplifc	*l;
	uchar 	eth[6];

	for(ifc = readipifc(m, 0, idx); ifc; ifc = ifc->next){
		print("%d:%s ", ifc->index, ifc->dev);
		if(myetheraddr(eth, ifc->dev) == 0)
			print("\t"	"%E", eth);
		print("\t"	"%d\n", ifc->mtu);
		for(l = ifc->lifc; l; l = l->next)
			print("\t" "%I%M" "\t" "%I\n", l->ip, l->mask, l->net);
	}

//	freeipifc(ifc);
}

void
usage(void)
{
	fprint(2, "usage: ipfic [-m net mtpt] [interface number] ...\n");
	exits("usage");
}

void
main(int argc, char **argv){
	char* r;
	int i, m;

	m = 0;
	ARGBEGIN{
	case 'm':
		if(m++ == 0)
			nmtab = 0;
		if(++nmtab < nelem(mtab))
			mtab[nmtab-1] = EARGF(usage());
		break;
	}ARGEND;

	fmtinstall('I', eipfmt);
	fmtinstall('M', eipfmt);
	fmtinstall('E', eipfmt);
	if(*argv)
		for(; *argv; argv++){
			i = strtoul(*argv, &r, 0);
			if (*r)
				usage();
			ipifcprint(mtab[0], i);
		}
	else
		for(i = 0; i < nmtab; i++)
			ipifcprint(mtab[i], -1);

	exits(0);
}

  reply	other threads:[~2007-03-06 11:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-05  9:52 [9fans] " Stevie_Lancaster
2007-03-05 10:20 ` Vester Thacker
2007-03-06  9:41 ` [9fans] " Stevie_Lancaster
2007-03-06  9:55   ` Vester Thacker
2007-03-06 11:17     ` erik quanstrom [this message]
2007-03-06 11:47       ` Vester Thacker

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=d17a46fb1037001c6d073472dab7de69@coraid.com \
    --to=quanstro@coraid.com \
    --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).