summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2018-09-10 16:14:07 +0000
committerbluhm <bluhm@openbsd.org>2018-09-10 16:14:07 +0000
commitf02cb2e83cda2e7c843af31d86dd656fd741d8ab (patch)
treeeaf8366e40f233b53e70230953160d8a4fca02ba /sys/netinet
parentif_setrdomain could potentially call if_clone_create recursively in the create (diff)
downloadwireguard-openbsd-f02cb2e83cda2e7c843af31d86dd656fd741d8ab.tar.xz
wireguard-openbsd-f02cb2e83cda2e7c843af31d86dd656fd741d8ab.zip
Instead of calculating the mbuf packet header length here and there,
put the algorithm into a new function m_calchdrlen(). Also set an uninitialized m_len to 0 in NFS code. OK claudio@
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/ip_input.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 3e9bab33b36..9d248132686 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_input.c,v 1.339 2018/09/10 12:47:02 bluhm Exp $ */
+/* $OpenBSD: ip_input.c,v 1.340 2018/09/10 16:14:07 bluhm Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@@ -964,14 +964,7 @@ insert:
pool_put(&ipq_pool, fp);
m->m_len += (ip->ip_hl << 2);
m->m_data -= (ip->ip_hl << 2);
- {
- int plen = 0;
-
- KASSERT(m->m_flags & M_PKTHDR);
- for (t = m; t; t = t->m_next)
- plen += t->m_len;
- m->m_pkthdr.len = plen;
- }
+ m_calchdrlen(m);
return (m);
dropfrag: