NetBSD Problem Report #55149
From www@netbsd.org Tue Apr 7 10:29:26 2020
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 7540A1BF4CF
for <gnats-bugs@gnats.NetBSD.org>; Tue, 7 Apr 2020 10:29:26 +0000 (UTC)
Message-Id: <20200407102925.6F6781BF4CF@mollari.NetBSD.org>
Date: Tue, 7 Apr 2020 10:29:25 +0000 (UTC)
From: hashikaw@mail.ru
Reply-To: hashikaw@mail.ru
To: gnats-bugs@NetBSD.org
Subject: ipfilter fil.c's problem
X-Send-Pr-Version: www-1.0
>Number: 55149
>Category: kern
>Synopsis: ipfilter fil.c's problem
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Apr 07 10:30:00 +0000 2020
>Closed-Date: Sun Apr 12 08:47:26 +0000 2020
>Last-Modified: Sun Apr 12 08:47:26 +0000 2020
>Originator: Kouichi Hashikawa
>Release: 9.0-RELEASE
>Organization:
>Environment:
NetBSD kalinka 9.0 NetBSD 9.0 (GENERIC) #0: Fri Feb 14 00:06:28 UTC 2020 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
in src/sys/external/bsd/ipf/netinet/fil.c:ipf_pr_ipv4hdr(),
morefrag is always 0.
--------
off &= IP_MF|IP_OFFMASK;
if (off != 0) {
fi->fi_flx |= FI_FRAG;
off &= IP_OFFMASK;
if (off != 0) {
int morefrag = off & IP_MF;
--------
>How-To-Repeat:
always.
>Fix:
I think, problem will be fixed by following patch.
--- src/sys/external/bsd/ipf/netinet/fil.c-dist0 2020-04-03 19:57:07.663853044 +0900
+++ src/sys/external/bsd/ipf/netinet/fil.c 2020-04-07 19:27:03.182639923 +0900
@@ -1685,6 +1685,7 @@
const struct optlist *op;
u_char *s, opt;
u_short off;
+ int morefrag;
fr_ip_t *fi;
ip_t *ip;
@@ -1697,7 +1698,8 @@
fin->fin_crc = p;
fi->fi_tos = ip->ip_tos;
fin->fin_id = ntohs(ip->ip_id);
- off = ntohs(ip->ip_off);
+ off = ntohs(ip->ip_off) & IP_OFFMASK;
+ morefrag = ntohs(ip->ip_off) & IP_MF;
/* Get both TTL and protocol */
fi->fi_p = ip->ip_p;
@@ -1722,13 +1724,9 @@
* set packet attribute flags based on the offset and
* calculate the byte offset that it represents.
*/
- off &= IP_MF|IP_OFFMASK;
- if (off != 0) {
+ if (morefrag != 0 || off != 0) {
fi->fi_flx |= FI_FRAG;
- off &= IP_OFFMASK;
if (off != 0) {
- int morefrag = off & IP_MF;
-
if (off == 1 && p == IPPROTO_TCP) {
fin->fin_flx |= FI_SHORT; /* RFC 3128 */
DT1(ipf_fi_tcp_frag_off_1, fr_info_t *, fin);
>Release-Note:
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/55149 CVS commit: src/sys/external/bsd/ipf/netinet
Date: Thu, 9 Apr 2020 14:20:40 -0400
Module Name: src
Committed By: christos
Date: Thu Apr 9 18:20:40 UTC 2020
Modified Files:
src/sys/external/bsd/ipf/netinet: fil.c
Log Message:
PR/55149: Kouichi Hashikawa: Get morefrag before we strip it out from off
To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/external/bsd/ipf/netinet/fil.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->needs-pullups
State-Changed-By: maya@NetBSD.org
State-Changed-When: Sat, 11 Apr 2020 12:26:12 +0000
State-Changed-Why:
Appropriate state for fixed in -current, not fixed in release branches but should be
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/55149 CVS commit: [netbsd-9] src/sys/external/bsd/ipf/netinet
Date: Sun, 12 Apr 2020 08:39:42 +0000
Module Name: src
Committed By: martin
Date: Sun Apr 12 08:39:42 UTC 2020
Modified Files:
src/sys/external/bsd/ipf/netinet [netbsd-9]: fil.c ip_frag.c
Log Message:
Pull up following revision(s) (requested by christos in ticket #827):
sys/external/bsd/ipf/netinet/fil.c: revision 1.32
sys/external/bsd/ipf/netinet/fil.c: revision 1.33
sys/external/bsd/ipf/netinet/ip_frag.c: revision 1.8
PR/55137: Kouichi Hashikawa: ipfstat -f incorrect output
Fix incorrect byte order.
PR/55137: Kouichi Hashikawa: ipfstat -f incorrect output
- make sure frag is initialized to 0
- initialize ipfr_p field
PR/55149: Kouichi Hashikawa: Get morefrag before we strip it out from off
To generate a diff of this commit:
cvs rdiff -u -r1.29.2.2 -r1.29.2.3 src/sys/external/bsd/ipf/netinet/fil.c
cvs rdiff -u -r1.7 -r1.7.6.1 src/sys/external/bsd/ipf/netinet/ip_frag.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: needs-pullups->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Sun, 12 Apr 2020 08:47:26 +0000
State-Changed-Why:
Applied & pulled up to netbsd-9. Christos mentioned none of these pullups affect security so it sounds like it's ok to not go further in pullups. Please mention if you think otherwise. Thanks for the patch!
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.