diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -868,16 +868,14 @@ 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