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
This commit is contained in:
martin 2020-04-12 08:39:42 +00:00
parent c439c03d13
commit 53c3b70c17
2 changed files with 10 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fil.c,v 1.29.2.2 2019/10/03 17:18:32 martin Exp $ */
/* $NetBSD: fil.c,v 1.29.2.3 2020/04/12 08:39:42 martin Exp $ */
/*
* Copyright (C) 2012 by Darren Reed.
@ -141,7 +141,7 @@ extern struct timeout ipf_slowtimer_ch;
#if !defined(lint)
#if defined(__NetBSD__)
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.29.2.2 2019/10/03 17:18:32 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.29.2.3 2020/04/12 08:39:42 martin Exp $");
#else
static const char sccsid[] = "@(#)fil.c 1.36 6/5/96 (C) 1993-2000 Darren Reed";
static const char rcsid[] = "@(#)Id: fil.c,v 1.1.1.2 2012/07/22 13:45:07 darrenr Exp $";
@ -1696,7 +1696,7 @@ ipf_pr_ipv4hdr(fr_info_t *fin)
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 */
@ -1724,11 +1724,10 @@ ipf_pr_ipv4hdr(fr_info_t *fin)
*/
off &= IP_MF|IP_OFFMASK;
if (off != 0) {
int morefrag = off & IP_MF;
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);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_frag.c,v 1.7 2018/06/03 10:37:23 maxv Exp $ */
/* $NetBSD: ip_frag.c,v 1.7.6.1 2020/04/12 08:39:42 martin Exp $ */
/*
* Copyright (C) 2012 by Darren Reed.
@ -86,7 +86,7 @@ struct file;
#if !defined(lint)
#if defined(__NetBSD__)
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_frag.c,v 1.7 2018/06/03 10:37:23 maxv Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip_frag.c,v 1.7.6.1 2020/04/12 08:39:42 martin Exp $");
#else
static const char sccsid[] = "@(#)ip_frag.c 1.11 3/24/96 (C) 1993-2000 Darren Reed";
static const char rcsid[] = "@(#)Id: ip_frag.c,v 1.1.1.2 2012/07/22 13:45:17 darrenr Exp";
@ -393,6 +393,7 @@ ipfr_frag_new(
}
}
memset(&frag, 0, sizeof(frag));
frag.ipfr_v = fin->fin_v;
idx = fin->fin_v;
frag.ipfr_p = fin->fin_p;
@ -441,6 +442,7 @@ ipfr_frag_new(
FBUMPD(ifs_nomem);
return NULL;
}
memset(fran, 0, sizeof(*fran));
WRITE_ENTER(lock);
@ -478,6 +480,7 @@ ipfr_frag_new(
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 @@ ipf_frag_lookup(
*
* build up a hash value to index the table with.
*/
memset(&frag, 0, sizeof(frag));
frag.ipfr_v = fin->fin_v;
idx = fin->fin_v;
frag.ipfr_p = fin->fin_p;