Fix incorrect byte order in ipfstat -f output.

- make sure frag is initialized to 0
- initialize ipfr_p field

NetBSD PR:	55137
Submitted by:	christos@NetBSD.org
Reported by:	christos@NetBSD.org
Obtained from:	NetBSD fil.c r1.32, ip_frag.c r1.8
MFC after:	2 weeks
This commit is contained in:
Cy Schubert 2020-07-17 19:07:59 +00:00
parent 1b5e9f7d1e
commit 4fbd491ee3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=363285
2 changed files with 5 additions and 1 deletions

View file

@ -1698,7 +1698,7 @@ ipf_pr_ipv4hdr(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 */

View file

@ -404,6 +404,7 @@ ipfr_frag_new(softc, softf, fin, pass, table
}
}
memset(&frag, 0, sizeof(frag));
frag.ipfr_v = fin->fin_v;
idx = fin->fin_v;
frag.ipfr_p = fin->fin_p;
@ -452,6 +453,7 @@ ipfr_frag_new(softc, softf, fin, pass, table
FBUMPD(ifs_nomem);
return NULL;
}
memset(fran, 0, sizeof(*fran));
WRITE_ENTER(lock);
@ -489,6 +491,7 @@ ipfr_frag_new(softc, softf, fin, pass, table
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;
@ -677,6 +680,7 @@ ipf_frag_lookup(softc, softf, fin, table
*
* 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;