From dc2bd884f89305db87a5f674bafe3ad6ea416a6e Mon Sep 17 00:00:00 2001 From: bluhm Date: Thu, 4 Aug 2022 18:05:09 +0000 Subject: [PATCH] Use 16 bit variable to store more fragment flag. This avoids loss of significant bits on big endian machines. Bug has been introduced in previous commit by removing the =! 0 check. OK mvs@ --- sys/netinet/ip_input.c | 5 +++-- sys/netinet/ip_var.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 91765d2bab3..8389ae05009 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.375 2022/07/28 22:05:39 bluhm Exp $ */ +/* $OpenBSD: ip_input.c,v 1.376 2022/08/04 18:05:09 bluhm Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -577,7 +577,8 @@ ip_fragcheck(struct mbuf **mp, int *offp) struct ip *ip; struct ipq *fp; struct ipqent *ipqe; - int mff, hlen; + int hlen; + uint16_t mff; ip = mtod(*mp, struct ip *); hlen = ip->ip_hl << 2; diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h index f5e2a765e21..2eb8c6f3cba 100644 --- a/sys/netinet/ip_var.h +++ b/sys/netinet/ip_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_var.h,v 1.94 2022/07/25 23:19:34 bluhm Exp $ */ +/* $OpenBSD: ip_var.h,v 1.95 2022/08/04 18:05:09 bluhm Exp $ */ /* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */ /* @@ -174,7 +174,7 @@ struct ipqent { LIST_ENTRY(ipqent) ipqe_q; struct ip *ipqe_ip; struct mbuf *ipqe_m; /* mbuf contains packet */ - u_int8_t ipqe_mff; /* for IP fragmentation */ + uint16_t ipqe_mff; /* for IP fragmentation */ }; /* -- 2.20.1