Re: [9fans] bug or feature ? --- ip/ping -6

2016-01-04 Thread Anthony Martin
erik quanstrom  once said:
> unfortunately, the simlification removes the code that solves an important
> use case.  it's important to be able to specify the protocol or network stack,
> such as in
> 
>   ip/ping /net.alt/icmp!someaddress

Most commands use an -x option and setnetmtpt(2) to arrange
an alternate network root. Is there any reason not to do the
same for ip/ping?

  Anthony



Re: [9fans] bug or feature ? --- ip/ping -6

2016-01-04 Thread erik quanstrom
> erik quanstrom  once said:
> > unfortunately, the simlification removes the code that solves an important
> > use case.  it's important to be able to specify the protocol or network 
> > stack,
> > such as in
> > 
> > ip/ping /net.alt/icmp!someaddress
> 
> Most commands use an -x option and setnetmtpt(2) to arrange
> an alternate network root. Is there any reason not to do the
> same for ip/ping?

"most" commands do not.  for example,

cpu -h /net.alt/tcp!ladd.quanstro.net

sorry i haven't the time to do statistics, but i'm pretty sure that
only programs lib ndb/dnsquery that do not take dial strings are
exceptions here.  and they are self-inconsistent.  some take -x
(bare option) and some take -x /mnt/pt.

that notwithstanding, it seems logical to allow icmpv6!host
as a proper dial string for ping, and this requires the same code.

i think it makes sense to do it as ping and traceroute have done.

- erik



Re: [9fans] bug or feature ? --- ip/ping -6

2016-01-04 Thread erik quanstrom
> "most" commands do not.  for example,
> 
>   cpu -h /net.alt/tcp!ladd.quanstro.net
> 

it turns out i had a bit of extra time since it's too icy to leave the
house.  :-(

anyway, here are all the programs that take -x mntpt, as determined by
the man pages.

vnc(1) vncs
httpfile(4)
6in4(8)
ndb(8) ndb/cs, csquery, dns, dnstcp, dnsquery, dnsdebug
ppp(8) ip/ppp, pppoe, pptp, pptpd
secstore(8) secstored
syslogd(8)
udpecho(8)

none of these programs take a dial string.

however, some of them could (see nettest(8), 
http://sources.9atom.org/magic/man2html/8/nettest)
such as syslogd, udpecho, secstored and vncs.

httpfile, well, rob has already made the point.

- erik



[9fans] subtracting pointers on amd64 6c

2016-01-04 Thread cinap_lenrek
in the function /sys/src/cmd/cc/sub.c:/^arith we emit code
that cast the 64-bit subtraction result to 32-bit LONG *before*
doing the division of the sizeof of the pointer type.

so when the pointers are more than 4gb apart, we will calculate
the wrong result, even tho the result would have fit into a
32-bit LONG *after* the division.

questions:

1) why do we cast to long?
2) if a pointer subtraction has to yield a long, why dont we cast *after* the 
division?

if(n->op == OSUB)
if(i == TIND && j == TIND) {
w = n->right->type->link->width;
if(w < 1 || n->left->type->link == T || 
n->left->type->link->width < 1)
goto bad;
n->type = types[ewidth[TIND] <= ewidth[TLONG]? TLONG: TVLONG];
if(1 && ewidth[TIND] > ewidth[TLONG]){  <--- here
n1 = new1(OXXX, Z, Z);
*n1 = *n;
n->op = OCAST;
n->left = n1;
n->right = Z;
n->type = types[TLONG];
}
if(w > 1) {
n1 = new1(OXXX, Z, Z);
*n1 = *n;
n->op = ODIV;
n->left = n1;
n1 = new1(OCONST, Z, Z);
n1->vconst = w;
n1->type = n->type;
n->right = n1;
w = vlog(n1);
if(w >= 0) {
n->op = OASHR;
n1->vconst = w;
}
}
return;
}

--
cinap