diff options
author | luigi <luigi@FreeBSD.org> | 1999-03-26 14:15:59 +0000 |
---|---|---|
committer | luigi <luigi@FreeBSD.org> | 1999-03-26 14:15:59 +0000 |
commit | bb2e8627df0b3ef08917543048f28eaf026fdc5a (patch) | |
tree | 940f8637d0cfad0f80abf4399b405b4a611263d4 /sys/netinet | |
parent | edc6ba8438177b743bf28cef8de80e323b89bfd5 (diff) | |
download | FreeBSD-src-bb2e8627df0b3ef08917543048f28eaf026fdc5a.zip FreeBSD-src-bb2e8627df0b3ef08917543048f28eaf026fdc5a.tar.gz |
Use the correct length from the mbuf header instead of the one from
the IP header (this would not work for bridged packets).
This has been fixed long ago in the 2.2 branch.
Problem noticed by: a few people
Fix suggested by: Remy Nonnenmacher
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/ip_dummynet.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/netinet/ip_dummynet.c b/sys/netinet/ip_dummynet.c index 973e886..8bc2f4a 100644 --- a/sys/netinet/ip_dummynet.c +++ b/sys/netinet/ip_dummynet.c @@ -10,7 +10,7 @@ * * This software is provided ``AS IS'' without any warranties of any kind. * - * $Id: ip_dummynet.c,v 1.8 1999/01/27 22:42:24 dillon Exp $ + * $Id: ip_dummynet.c,v 1.9 1999/03/24 12:43:39 luigi Exp $ */ /* @@ -145,19 +145,19 @@ dn_move(struct dn_pipe *pipe, int immediate) * is reset after the first insertion; */ while ( pkt ) { - struct ip *ip=mtod(pkt->dn_m, struct ip *); + int len = pkt->dn_m->m_pkthdr.len ; /* * queue limitation: pass packets down if the len is * such that the pkt would go out before the next tick. */ if (pipe->bandwidth) { - if (pipe->numbytes < ip->ip_len) + if (pipe->numbytes < len) break; - pipe->numbytes -= ip->ip_len; + pipe->numbytes -= len; } pipe->r_len--; /* elements in queue */ - pipe->r_len_bytes -= ip->ip_len ; + pipe->r_len_bytes -= len ; /* * to add delay jitter, must act here. A lower value @@ -282,7 +282,7 @@ dummynet_io(int pipe_nr, int dir, { struct dn_pkt *pkt; struct dn_pipe *pipe; - struct ip *ip=mtod(m, struct ip *); + int len = m->m_pkthdr.len ; int s=splimp(); @@ -311,7 +311,7 @@ dummynet_io(int pipe_nr, int dir, if ( (pipe->plr && random() < pipe->plr) || (pipe->queue_size && pipe->r_len >= pipe->queue_size) || (pipe->queue_size_bytes && - ip->ip_len + pipe->r_len_bytes > pipe->queue_size_bytes) || + len + pipe->r_len_bytes > pipe->queue_size_bytes) || (pkt = (struct dn_pkt *)malloc(sizeof (*pkt), M_IPFW, M_NOWAIT) ) == NULL ) { splx(s); @@ -344,7 +344,7 @@ dummynet_io(int pipe_nr, int dir, (struct dn_pkt *)pipe->r.tail->dn_next = pkt; pipe->r.tail = pkt; pipe->r_len++; - pipe->r_len_bytes += ip->ip_len ; + pipe->r_len_bytes += len ; /* * here we could implement RED if we like to @@ -590,7 +590,7 @@ ip_dn_ctl(struct sockopt *sopt) void ip_dn_init(void) { - printf("DUMMYNET initialized (980901) -- size dn_pkt %d\n", + printf("DUMMYNET initialized (990326) -- size dn_pkt %d\n", sizeof(struct dn_pkt)); all_pipes = NULL ; ip_dn_ctl_ptr = ip_dn_ctl; |