NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/55137: ipfstat -f incorrect output



>Number:         55137
>Category:       kern
>Synopsis:       ipfstat -f incorrect output
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 03 12:05:00 +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@localhost:/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;



Home | Main Index | Thread Index | Old Index