mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
ip_output: always increase "cantfrag" stat if ip_fragment() fails
While here, join two unlikely cases into one if clause. Submitted by: Ivan Rozhuk <rozhuk.im gmail.com> PR: 265718 Reviewed by: mjg, melifaro Differential revision: https://reviews.freebsd.org/D36584
This commit is contained in:
parent
145a50dcda
commit
da6715bbb1
|
@ -868,16 +868,14 @@ ip_fragment(struct ip *ip, struct mbuf **m_frag, int mtu,
|
|||
ip_len = ntohs(ip->ip_len);
|
||||
ip_off = ntohs(ip->ip_off);
|
||||
|
||||
if (ip_off & IP_DF) { /* Fragmentation not allowed */
|
||||
IPSTAT_INC(ips_cantfrag);
|
||||
return EMSGSIZE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Must be able to put at least 8 bytes per fragment.
|
||||
* Packet shall not have "Don't Fragment" flag and have at least 8
|
||||
* bytes of payload.
|
||||
*/
|
||||
if (len < 8)
|
||||
return EMSGSIZE;
|
||||
if (__predict_false((ip_off & IP_DF) || len < 8)) {
|
||||
IPSTAT_INC(ips_cantfrag);
|
||||
return (EMSGSIZE);
|
||||
}
|
||||
|
||||
/*
|
||||
* If the interface will not calculate checksums on
|
||||
|
|
Loading…
Reference in a new issue