NetBSD Problem Report #55137

From www@netbsd.org  Fri Apr  3 12:00:34 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 DD83D1A9213
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  3 Apr 2020 12:00:34 +0000 (UTC)
Message-Id: <20200403120033.D0C0B1A921E@mollari.NetBSD.org>
Date: Fri,  3 Apr 2020 12:00:33 +0000 (UTC)
From: hashikaw@mail.ru
Reply-To: hashikaw@mail.ru
To: gnats-bugs@NetBSD.org
Subject: ipfstat -f incorrect output
X-Send-Pr-Version: www-1.0

>Number:         55137
>Category:       kern
>Synopsis:       ipfstat -f incorrect output
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 03 12:05:00 +0000 2020
>Closed-Date:    Sun Apr 12 08:46:42 +0000 2020
>Last-Modified:  Sun Apr 12 08:46:42 +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:
id(Identification field of IP packet) and pr(Protocol field of IP packet ) by ipfstat -f is incorrect.

--------
# ipfstat -f
IP fragment states:
14	new
6	expired
20	hits
0	retrans
0	too short
0	no memory
0	already exist
8	inuse

inet XXX.XXX.XXX -> YYY id 2423 ttl 87 pr 0 pkts 2 bytes 1520 seen0 1 ref 2
...
--------
>How-To-Repeat:
always.
>Fix:
I think, problem of id will be fixed by following patch,


--- src/sys/external/bsd/ipf/netinet/fil.c-dist 2020-01-12 16:09:09.000000000 +0900
+++ src/sys/external/bsd/ipf/netinet/fil.c      2020-04-03 19:57:07.663853044 +0900
@@ -1696,7 +1696,7 @@
        fi->fi_p = p;
        fin->fin_crc = p;
        fi->fi_tos = ip->ip_tos;
-       fin->fin_id = ip->ip_id;
+       fin->fin_id = ntohs(ip->ip_id);
        off = ntohs(ip->ip_off);

        /* Get both TTL and protocol */


and, problem of pr will be fixed by following patch.


--- src/sys/external/bsd/ipf/netinet/ip_frag.c-dist     2020-01-12 16:09:09.000000000 +0900
+++ src/sys/external/bsd/ipf/netinet/ip_frag.c  2020-04-03 18:48:11.432837423 +0900
@@ -393,6 +393,7 @@
                }
        }

+       bzero((char *)&frag, sizeof(frag));
        frag.ipfr_v = fin->fin_v;
        idx = fin->fin_v;
        frag.ipfr_p = fin->fin_p;
@@ -441,6 +442,7 @@
                FBUMPD(ifs_nomem);
                return NULL;
        }
+       bzero((char *)fran, sizeof(*fran));

        WRITE_ENTER(lock);

@@ -478,6 +480,7 @@
        table[idx] = fra;
        bcopy((char *)&frag.ipfr_ifp, (char *)&fra->ipfr_ifp, IPFR_CMPSZ);
        fra->ipfr_v = fin->fin_v;
+       fra->ipfr_p = fin->fin_p;
        fra->ipfr_ttl = softc->ipf_ticks + softf->ipfr_ttl;
        fra->ipfr_firstend = frag.ipfr_firstend;

@@ -655,6 +658,7 @@
         *
         * build up a hash value to index the table with.
         */
+       bzero((char *)&frag, sizeof(frag));
        frag.ipfr_v = fin->fin_v;
        idx = fin->fin_v;
        frag.ipfr_p = fin->fin_p;

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55137 CVS commit: src/sys/external/bsd/ipf/netinet
Date: Sat, 4 Apr 2020 22:50:28 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Sun Apr  5 02:50:28 UTC 2020

 Modified Files:
 	src/sys/external/bsd/ipf/netinet: fil.c

 Log Message:
 PR/55137: Kouichi Hashikawa: ipfstat -f incorrect output
 Fix incorrect byte order.


 To generate a diff of this commit:
 cvs rdiff -u -r1.31 -r1.32 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.

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55137 CVS commit: src/sys/external/bsd/ipf/netinet
Date: Sat, 4 Apr 2020 22:51:34 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Sun Apr  5 02:51:34 UTC 2020

 Modified Files:
 	src/sys/external/bsd/ipf/netinet: ip_frag.c

 Log Message:
 PR/55137: Kouichi Hashikawa: ipfstat -f incorrect output
 - make sure frag is initialized to 0
 - initialize ipfr_p field


 To generate a diff of this commit:
 cvs rdiff -u -r1.7 -r1.8 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.

From: Christos Zoulas <christos@zoulas.com>
To: Kouichi Hashikawa <hashikaw@mail.ru>
Cc: gnats-bugs@netbsd.org,
 kern-bug-people@netbsd.org,
 gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org
Subject: Re: PR/55137 CVS commit: src/sys/external/bsd/ipf/netinet
Date: Sat, 11 Apr 2020 09:49:49 -0400

 --Apple-Mail=_2C1C914F-67A2-4D93-AE1D-E44FFC379DC3
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii

 Done for all 3 commits.

 christos

 --Apple-Mail=_2C1C914F-67A2-4D93-AE1D-E44FFC379DC3
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename=signature.asc
 Content-Type: application/pgp-signature;
 	name=signature.asc
 Content-Description: Message signed with OpenPGP

 -----BEGIN PGP SIGNATURE-----
 Comment: GPGTools - http://gpgtools.org

 iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCXpHK/QAKCRBxESqxbLM7
 Oi+sAJ0WgRK5mRHkNlYI5wEztMPeGH2hCACgsDK9w7e9cMQJzf4aotVSUuhvl/k=
 =HgJ4
 -----END PGP SIGNATURE-----

 --Apple-Mail=_2C1C914F-67A2-4D93-AE1D-E44FFC379DC3--

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55137 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: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Sun, 12 Apr 2020 08:46:42 +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:

NetBSD Home
NetBSD PR Database Search

(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.