From: Michael Renzmann <mrenzmann@web.de>
To: netdev@oss.sgi.com
Subject: Minor bug in tun.c
Date: Fri, 15 Oct 2004 13:14:01 +0200 [thread overview]
Message-ID: <416FB0F9.6040203@web.de> (raw)
Hi all.
I'm currently trying to learn a bit more about driver programming,
therefore I'm working a little with tun.c (using the version that comes
with 2.6.7). I have some experience with C programming in general, but
I'm a newbie when it comes to kernel stuff.
Have a look at the following code (taken from the function tun_net_xmit()):
=== cut ===
/* Queue packet */
if (!(tun->flags & TUN_ONE_QUEUE)) {
/* Normal queueing mode.
* Packet scheduler handles dropping. */
if (skb_queue_len(&tun->readq) >= TUN_READQ_SIZE)
netif_stop_queue(dev);
} else {
/* Single queue mode.
* Driver handles dropping itself. */
if (skb_queue_len(&tun->readq) >= dev->tx_queue_len)
goto drop;
}
skb_queue_tail(&tun->readq, skb);
=== cut ===
Look at the code that is executed when TUN_ONE_QUEUE isn't set in
tun->flags. If the length of the queue has reached its maximum value
(given as TUN_READQ_SIZE), the current packet still is appended to the
queue, thereby exceeding the maximum length by 1.
In my eyes the simplest way to correct that would be to change
if (skb_queue_len(&tun->readq) >= TUN_READQ_SIZE)
to read
if (skb_queue_len(&tun->readq) >= TUN_READQ_SIZE - 1)
Please correct me if I'm wrong.
Bye, Mike
reply other threads:[~2004-10-15 11:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=416FB0F9.6040203@web.de \
--to=mrenzmann@web.de \
--cc=netdev@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).