vx32

Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log | Files | Refs

commit 321d124f7cf6baa3e051aa5162e09b0f1af1afb9
parent 239ea575a54c087fe434ef18282f36f1ea1779bc
Author: Jesus Galan Lopez (yiyus) <yiyu.jgl@gmail.com>
Date:   Sun, 13 Jun 2010 17:44:17 +0200

found the bug, fixed it: unix atoi() is a bitch

Diffstat:
src/9vx/a/devether.c | 21+++++++++------------
src/9vx/a/ip/ethermedium.c | 6------
src/9vx/a/netif.c | 2+-
src/9vx/devtabve.c | 1-
4 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/src/9vx/a/devether.c b/src/9vx/a/devether.c @@ -163,11 +163,11 @@ etheriq(Ether* ether, Block* bp, int fromwire) /* is it for me? */ tome = memcmp(pkt->d, ether->ea, sizeof(pkt->d)) == 0; fromme = memcmp(pkt->s, ether->ea, sizeof(pkt->s)) == 0; -if(tome||fromme) -iprint("XXX PACK: %2.2ux:%2.2ux:%2.2ux:%2.2ux:%2.2ux:%2.2ux -> %2.2ux:%2.2ux:%2.2ux:%2.2ux:%2.2ux:%2.2ux%s[%d]%s\n", -pkt->s[0], pkt->s[1], pkt->s[2],pkt->s[3], pkt->s[4], pkt->s[5], -pkt->d[0], pkt->d[1], pkt->d[2],pkt->d[3], pkt->d[4], pkt->d[5], -(tome ? " <<--" : ""), len, (fromme ? " -->>" : "")); + // if(tome||fromme) + // iprint("XXX PACK: %2.2ux:%2.2ux:%2.2ux:%2.2ux:%2.2ux:%2.2ux -> %2.2ux:%2.2ux:%2.2ux:%2.2ux:%2.2ux:%2.2ux%s[%d]%s\n", + // pkt->s[0], pkt->s[1], pkt->s[2],pkt->s[3], pkt->s[4], pkt->s[5], + // pkt->d[0], pkt->d[1], pkt->d[2],pkt->d[3], pkt->d[4], pkt->d[5], + // (tome ? " <<--" : ""), len, (fromme ? " -->>" : "")); /* * Multiplex the packet to all the connections which want it. * If the packet is not to be used subsequently (fromwire != 0), @@ -175,10 +175,8 @@ pkt->d[0], pkt->d[1], pkt->d[2],pkt->d[3], pkt->d[4], pkt->d[5], * saving a copy of the data (usual case hopefully). */ for(fp = ether->ni.f; fp < ep; fp++){ - if((f = *fp) != nil){ -// if(tome) -// iprint("XXX f->type =%X, type = %X\n", f->type, type); -// XXX if(f->type == type || f->type < 0) + if((f = *fp) != nil) + if(f->type == type || f->type < 0) if(tome || multi || f->prom){ /* Don't want to hear bridged packets */ if(f->bridge && !fromwire && !fromme) @@ -198,7 +196,6 @@ pkt->d[0], pkt->d[1], pkt->d[2],pkt->d[3], pkt->d[4], pkt->d[5], else etherrtrace(f, pkt, len); } - } //XXX } if(fx){ @@ -451,8 +448,8 @@ etherprobe(int cardno, int ctlrno) memmove(ether->ni.addr, ether->ea, Eaddrlen); memset(ether->ni.bcast, 0xFF, Eaddrlen); -// iprint("XXX EADDR: %2.2ux:%2.2ux:%2.2ux:%2.2ux:%2.2ux:%2.2ux\n", -// ether->ea[0], ether->ea[1], ether->ea[2],ether->ea[3], ether->ea[4], ether->ea[5]); + // iprint("XXX EADDR: %2.2ux:%2.2ux:%2.2ux:%2.2ux:%2.2ux:%2.2ux\n", + // ether->ea[0], ether->ea[1], ether->ea[2],ether->ea[3], ether->ea[4], ether->ea[5]); return ether; } diff --git a/src/9vx/a/ip/ethermedium.c b/src/9vx/a/ip/ethermedium.c @@ -161,9 +161,7 @@ etherbind(Ipifc *ifc, int argc, char **argv) * this device. */ snprint(addr, sizeof(addr), "%s!0x800", argv[2]); /* ETIP4 */ -iprint("XXX chandial mchan4: %s\n", &addr); mchan4 = chandial(addr, nil, dir, &cchan4); -iprint("XXX mchan4 = %x\n", mchan4->type); /* * make it non-blocking @@ -202,9 +200,7 @@ iprint("XXX mchan4 = %x\n", mchan4->type); * open arp conversation */ snprint(addr, sizeof(addr), "%s!0x806", argv[2]); /* ETARP */ -iprint("XXX chandial achan: %s\n", &addr); achan = chandial(addr, nil, nil, nil); -iprint("XXX achan = %x\n", achan->type); /* * open ipv6 conversation @@ -213,9 +209,7 @@ iprint("XXX achan = %x\n", achan->type); * this device. */ snprint(addr, sizeof(addr), "%s!0x86DD", argv[2]); /* ETIP6 */ -iprint("XXX chandial mchan6: %s\n", &addr); mchan6 = chandial(addr, nil, dir, &cchan6); -iprint("XXX mchan6 = %x\n", mchan6->type); /* * make it non-blocking diff --git a/src/9vx/a/netif.c b/src/9vx/a/netif.c @@ -341,7 +341,7 @@ netifwrite(Netif *nif, Chan *c, void *a, long n) QLOCK(nif); f = nif->f[NETID(c->qid.path)]; if((p = matchtoken(buf, "connect")) != 0){ - type = atoi(p); + sscanf(p, "%x", &type); if(typeinuse(nif, type)) error(Einuse); f->type = type; diff --git a/src/9vx/devtabve.c b/src/9vx/devtabve.c @@ -64,7 +64,6 @@ extern void ethermediumlink(void); extern void loopbackmediumlink(void); extern void netdevmediumlink(void); void links(void) { -iprint("XXX links\n"); ethermediumlink(); loopbackmediumlink(); netdevmediumlink();