re-queue delay line in ip_dummynet.c
Liu, Huan (Huan)
huanliu at lucent.com
Tue Nov 18 18:15:10 PST 2003
I'd like to give a pipe random delay time and re-queue packets in delay-line
according to their output_time, However I always get fatal error when
packets go through pipe. I guess the code get match condition when re-queue
the delay line while other process may be sending a packet and delete it
from delay line at same time.
Here is what I modified in ip_dummynet.c
float mydelay; /*cast integer random() to float*/
/* added for re-queue delay chain in move_pkt*/
struct dn_pkt *mypkt, *prepkt;
static void
move_pkt(struct dn_pkt *pkt, struct dn_flow_queue *q,
struct dn_pipe *p, int len)
{
q->head = DN_NEXT(pkt) ;
q->len-- ;
q->len_bytes -= len ;
/* example, delay 9010ms, will delay random interval range 0~10ms*/
if(p->delay >= 9000) {
mydelay = random();
pkt->output_time = curr_time +
(int)((mydelay/0x7fffffff)*(p->delay-9000));
}
else
pkt->output_time = curr_time + p->delay;
if (p->head == NULL) {
p->head = pkt;
p->tail = pkt;
}
else {
mypkt = p->head;
prepkt = NULL;
while(mypkt != NULL) {
if(pkt->output_time < mypkt->output_time) {
if(prepkt == NULL) {
DN_NEXT(pkt) = mypkt;
p->head = pkt;
} else {
DN_NEXT(pkt) = mypkt;
DN_NEXT(prepkt) = pkt;
}
/* printf("no problem in move_pkt, re-chain delay line.
\n"); */
break;
}
prepkt = mypkt;
mypkt = DN_NEXT(prepkt);
}
if(mypkt == NULL) {
DN_NEXT(p->tail) = pkt;
p->tail = pkt;
}
}
DN_NEXT(p->tail) = NULL;
}
I set
ipfw add 500 pipe 1 icmp from 135.254.62.218 to 135.254.61.230
ipfw add 501 pipe 2 icmp from 135.254.62.230 to 135.254.61.218
ipfw pipe 1 config delay 9020ms
ipfw pipe 2 config delay 9020ms
Then I ping 135.254.62.218 from 135.254.61.230, the icmp will go through
this freeBSD machine, after a well, the machine got page fault error and
reboot.
Any comment will be appreciated, I'd like to know if it's possible to
re-queue delay-line. No problem found if only giving each packet a random
delay time without re-queue delay line.
Thanks.
Huan Liu
More information about the freebsd-net
mailing list