: Fix truncated fragment check in ipt_unclean
PATCH 8/10 : Fix truncated fragment check in ipt_unclean
This patch for 2.4 fixes the truncated fragment check in ipt_unclean. The check for length % 8 == 0 is performed on the total length of the packet instead of the data length.
Author: Patrick McHardy <[email protected]>
--
- Harald Welte <[email protected]> http://www.netfilter.org/
============================================================================
"Fragmentation is like classful addressing -- an interesting early
architectural error that shows how much experimentation was going
on while IP was being designed." -- Paul Vixie
# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/06/20 22:49:42+02:00 [email protected]
# [NETFILTER]: Fix truncated fragment check in ipt_unclean
#
# net/ipv4/netfilter/ipt_unclean.c # 2004/06/20 22:49:39+02:00 [email protected] +2 -3 # [NETFILTER]: Fix truncated fragment check in ipt_unclean # diff -Nru a/net/ipv4/netfilter/ipt_unclean.c b/net/ipv4/netfilter/ipt_unclean.c --- a/net/ipv4/netfilter/ipt_unclean.c 2004-06-20 23:02:57 +02:00 +++ b/net/ipv4/netfilter/ipt_unclean.c 2004-06-20 23:02:57 +02:00 @@ -467,9 +467,8 @@ /* Fragment checks. */
/* CHECK: More fragments, but doesn't fill 8-byte boundary. */
- if ((ntohs(iph->frag_off) & IP_MF)
- && (ntohs(iph->tot_len) % 8) != 0) {
- limpk("Truncated fragment %u long.\n", ntohs(iph->tot_len));
+ if ((ntohs(iph->frag_off) & IP_MF) && datalen % 8 != 0) {
+ limpk("Truncated fragment %u long.\n", datalen);
return 0;
}