re-queue delay line in ip_dummynet.c

From: Liu, Huan (Huan) (huanliu_at_lucent.com)
Date: 11/19/03

  • Next message: Sean Chittenden: "Re: bsd-airtools update to 0.3 important for freebsd5"
    To: "'freebsd-net@FreeBSD.ORG'" <freebsd-net@FreeBSD.ORG>
    Date: Wed, 19 Nov 2003 11:13:47 +0900
    
    

    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

    _______________________________________________
    freebsd-net@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-net
    To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"


  • Next message: Sean Chittenden: "Re: bsd-airtools update to 0.3 important for freebsd5"

    Relevant Pages

    • Re: tcp hostcache and ip fastforward for review
      ... It would probably break or delay many things. ... This is an unlikely case (many small packets sent to a non-interactive ... > for minmss it will reset and drop the connection. ... which is unfortunate. ...
      (freebsd-current)
    • Re: tcp hostcache and ip fastforward for review
      ... It would probably break or delay many things. ... This is an unlikely case (many small packets sent to a non-interactive ... > for minmss it will reset and drop the connection. ... which is unfortunate. ...
      (freebsd-net)
    • Re: dialup dns delay
      ... via wget, results in a delay of up to 60 seconds, while the DNS ... To demonstrate this, if I ping the DNS, immediately after connecting: ... 54 packets transmitted, 3 packets received, 94% packet loss ...
      (comp.sys.acorn.networking)
    • Re: ip phone design considerations
      ... >I am planning on designing an IP phone for a student project. ... a whole bunch of gaps in a row, i.e., the transmitter has stopped). ... In addition to lost packets, you might also have to deal with: ... introducing more end-to-end delay. ...
      (sci.electronics.design)
    • dialup dns delay
      ... via wget, results in a delay of up to 60 seconds, while the DNS resolves ... To demonstrate this, if I ping the DNS, immediately after connecting: ... 54 packets transmitted, 3 packets received, 94% packet loss ... The high packet loss is evidenced by a long delay. ...
      (comp.sys.acorn.networking)