what are your routes?
; cat /net/iproute
there will be some /128 routes that are actually broadcast addresses.
you can run the attached command to get your ethernet devices, mac, address/mask
and network. there's a similar program in /sys/src/libip called testreadipifc.c
- erik
#include <u.h>
#include <libc.h>
#include <ip.h>
char *efmt = "%.2ux:%.2ux:%.2ux:%.2ux:%.2ux:%.2ux";
#pragma varargck type "e" uchar*
int
ethfmt(Fmt *f)
{
char buf[6*2+6];
uchar *p;
p = va_arg(f->args, uchar*);
snprint(buf, sizeof buf, efmt, p[0], p[1], p[2], p[3], p[4], p[5],
p[6]);
va_end(p);
return fmtstrcpy(f, buf);
}
void
ipifcprint(int idx)
{
Ipifc *ifc;
Iplifc *l;
uchar eth[6];
for(ifc = readipifc(0, 0, idx); ifc; ifc = ifc->next){
print("%d:%s ", ifc->index, ifc->dev);
if(myetheraddr(eth, ifc->dev) == 0)
print("\t" "%#e", eth);
print("\n");
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 [interface number] ...\n");
exits("usage");
}
void
main(int argc, char **argv){
char* r;
int i;
ARGBEGIN{
}ARGEND;
fmtinstall('I', eipfmt);
fmtinstall('M', eipfmt);
fmtinstall('E', eipfmt);
fmtinstall('e', ethfmt);
if(*argv)
for(; *argv; argv++){
i = strtoul(*argv, &r, 0);
if (*r)
usage();
ipifcprint(i);
}
else
ipifcprint(-1);
exits(0);
}