mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-04 09:09:56 +00:00
Fix a bug which I discovered recently while doing IPv6 testing at
Wind River. In the IPv4 output path, one of the tests in ip_output() checks how many slots are actually available in the interface output queue before attempting to send a packet. If, for example, we need to transmit a packet of 32K bytes over an interface with an MTU of 1500, we know it's going to take about 21 fragments to do it. If there's less than 21 slots left in the output queue, there's no point in transmitting anything at all: IP does not do retransmission, so sending only some of the fragments would just be a waste of bandwidth. (In an extreme case, if you're sending a heavy stream of fragmented packets, you might find yourself sending nothing by the first fragment of all your packets.) So if ip_output() notices there's not enough room in the output queue to send the frame, it just dumps the packet and returns ENOBUFS to the app. It turns out ip6_output() lacks this code. Consequently, this caused the netperf UDPIPV6_STREAM test to produce very poor results with large write sizes. This commit adds code to check the remaining space in the output queue and junk fragmented packets if they're too big to be sent, just like with IPv4. (I can't imagine anyone's running an NFS server using UDP over IPv6, but if they are, this will likely make them a lot happier. :)
This commit is contained in:
parent
15a3ddef19
commit
6f8aee2268
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=129196
@ -1044,6 +1044,7 @@ skip_ipsec2:;
|
||||
u_char nextproto;
|
||||
struct ip6ctlparam ip6cp;
|
||||
u_int32_t mtu32;
|
||||
int qslots = ifp->if_snd.ifq_maxlen - ifp->if_snd.ifq_len;
|
||||
|
||||
/*
|
||||
* Too large for the destination or interface;
|
||||
@ -1068,6 +1069,17 @@ skip_ipsec2:;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify that we have any chance at all of being able to queue
|
||||
* the packet or packet fragments
|
||||
*/
|
||||
if (qslots <= 0 || ((u_int)qslots * (mtu - hlen)
|
||||
< tlen /* - hlen */)) {
|
||||
error = ENOBUFS;
|
||||
ip6stat.ip6s_odropped++;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
mnext = &m->m_nextpkt;
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user