TUN/TAP Device Output Queue

Discussion in 'Linux Networking' started by calvin, Mar 6, 2004.

  1. calvin

    calvin Guest

    I am running some network simulation under Redhat9.0 with tun.c
    ver1.5.
    I opened 6 vitual tun devices under /net/dev/tun1~6.
    Because of simulation request, I need to know which tun device has
    packets in its output queue (buffer) waiting to be sent. How can I get
    this information by writing a function in tun.c. I know how to do
    under FreeBSD tun device as following:

    j = 0;
    for (i=0; i<=6; i++) {
    if (tunctl.tun_if.if_snd.ifq_len > 0)
    ThisTunHasPacketInQueue[j++] = i; /* save tun number i into my
    array */
    }
    return(j);

    But how can I do the same job under Linux? Thanks

    Calvin
     
    calvin, Mar 6, 2004
    #1
    1. Advertisements

  2. calvin

    Cameron Kerr Guest

    I thought FreeBSD and Linux share the same tun code. So it should be
    very similar, if not the same.

    netstat displays this information. Perhaps it would be useful to study
    what it does.
     
    Cameron Kerr, Mar 6, 2004
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.