Revision: 449 http://vde.svn.sourceforge.net/vde/?rev=449&view=rev Author: rd235 Date: 2010-11-23 19:47:49 +0000 (Tue, 23 Nov 2010)
Log Message: ----------- bugfixes: 1- priority queue could swap packets in fifo channel on heavy traffic 2- BPDU packets had wrong length (tnx to Michele Cucchi) Modified Paths: -------------- trunk/vde-2/src/vde_switch/fstp.c trunk/vde-2/src/wirefilter.c Modified: trunk/vde-2/src/vde_switch/fstp.c =================================================================== --- trunk/vde-2/src/vde_switch/fstp.c 2010-11-20 23:16:04 UTC (rev 448) +++ trunk/vde-2/src/vde_switch/fstp.c 2010-11-23 19:47:49 UTC (rev 449) @@ -153,7 +153,7 @@ static struct fstbpdu outpacket = { .header.dest=BPDUADDR, - .header.proto={0x00,0x39}, /* 802.3 packet length */ + .header.proto={0x00,0x27}, /* 802.3 packet length */ .llc={0x42,0x42,0x3}, .stp_protocol={0,0}, .stp_version=2, @@ -163,7 +163,7 @@ static struct fsttagbpdu outtagpacket = { .header.dest=BPDUADDR, .header.proto={0x81,0x00}, - .tag_proto={0x00,0x39}, + .tag_proto={0x00,0x27}, .llc={0x42,0x42,0x3}, .stp_protocol={0,0}, .stp_version=2, Modified: trunk/vde-2/src/wirefilter.c =================================================================== --- trunk/vde-2/src/wirefilter.c 2010-11-20 23:16:04 UTC (rev 448) +++ trunk/vde-2/src/wirefilter.c 2010-11-23 19:47:49 UTC (rev 449) @@ -375,15 +375,17 @@ struct packpq { unsigned long long when; + unsigned int counter; int dir; unsigned char *buf; int size; }; struct packpq **pqh; -struct packpq sentinel={0,0,NULL,0}; +struct packpq sentinel={0,0,0,NULL,0}; int npq,maxpq; unsigned long long maxwhen; +unsigned int counter; #define PQCHUNK 100 @@ -459,12 +461,19 @@ while (k<= npq>>1) { int j= k<<1; - if (j<npq && pqh[j]->when > pqh[j+1]->when) j++; - if (old->when <= pqh[j]->when) { + if (j<npq && + (pqh[j]->when > pqh[j+1]->when || + (pqh[j]->when == pqh[j+1]->when && + pqh[j]->counter > pqh[j+1]->counter) + ) + ) j++; + if (old->when < pqh[j]->when || + (old->when == pqh[j]->when && + old->counter < pqh[j]->counter) + ) break; - } else { + else pqh[k]=pqh[j];k=j; - } } pqh[k]=old; } @@ -490,8 +499,15 @@ } gettimeofday(&v,NULL); new->when= ((unsigned long long)v.tv_sec * 1000 + v.tv_usec/1000) + delms; - if (new->when > maxwhen) maxwhen=new->when; - if (!nofifo && new->when < maxwhen) new->when=maxwhen; + if (new->when > maxwhen) { + maxwhen=new->when; + counter=0; + } + if (!nofifo && new->when <= maxwhen) { + new->when=maxwhen; + counter++; + } + new->counter=counter; new->dir=dir; new->buf=malloc(size); if (new->buf==NULL) { @@ -517,7 +533,8 @@ } } {int k=++npq; - while (new->when < pqh[k>>1]->when) { + while (new->when < pqh[k>>1]->when || + (new->when == pqh[k>>1]->when && new->counter < pqh[k>>1]->counter)) { pqh[k]=pqh[k>>1]; k >>= 1; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Increase Visibility of Your 3D Game App & Earn a Chance To Win $500! Tap into the largest installed PC base & get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev _______________________________________________ vde-users mailing list vde-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vde-users