Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Apr 2017 13:04:36 +0000 (UTC)
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r317282 - head/sys/netinet6
Message-ID:  <201704221304.v3MD4ahb092577@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kp
Date: Sat Apr 22 13:04:36 2017
New Revision: 317282
URL: https://svnweb.freebsd.org/changeset/base/317282

Log:
  Rename variable for clarity
  
  Rename the mtu variable in ip6_fragment(), because mtu is misleading. The
  variable actually holds the fragment length.
  No functional change.
  
  Suggested by: ae

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==============================================================================
--- head/sys/netinet6/ip6_output.c	Sat Apr 22 11:30:07 2017	(r317281)
+++ head/sys/netinet6/ip6_output.c	Sat Apr 22 13:04:36 2017	(r317282)
@@ -217,7 +217,7 @@ in6_delayed_cksum(struct mbuf *m, uint32
 
 int
 ip6_fragment(struct ifnet *ifp, struct mbuf *m0, int hlen, u_char nextproto,
-    int mtu, uint32_t id)
+    int fraglen , uint32_t id)
 {
 	struct mbuf *m, **mnext, *m_frgpart;
 	struct ip6_hdr *ip6, *mhip6;
@@ -226,13 +226,13 @@ ip6_fragment(struct ifnet *ifp, struct m
 	int error;
 	int tlen = m0->m_pkthdr.len;
 
-	KASSERT(( mtu % 8 == 0), ("Fragment length must be a multiple of 8"));
+	KASSERT((fraglen % 8 == 0), ("Fragment length must be a multiple of 8"));
 
 	m = m0;
 	ip6 = mtod(m, struct ip6_hdr *);
 	mnext = &m->m_nextpkt;
 
-	for (off = hlen; off < tlen; off += mtu) {
+	for (off = hlen; off < tlen; off += fraglen) {
 		m = m_gethdr(M_NOWAIT, MT_DATA);
 		if (!m) {
 			IP6STAT_INC(ip6s_odropped);
@@ -251,18 +251,18 @@ ip6_fragment(struct ifnet *ifp, struct m
 			return (error);
 		}
 		ip6f->ip6f_offlg = htons((u_short)((off - hlen) & ~7));
-		if (off + mtu >= tlen)
-			mtu = tlen - off;
+		if (off + fraglen >= tlen)
+			fraglen = tlen - off;
 		else
 			ip6f->ip6f_offlg |= IP6F_MORE_FRAG;
-		mhip6->ip6_plen = htons((u_short)(mtu + hlen +
+		mhip6->ip6_plen = htons((u_short)(fraglen + hlen +
 		    sizeof(*ip6f) - sizeof(struct ip6_hdr)));
-		if ((m_frgpart = m_copym(m0, off, mtu, M_NOWAIT)) == NULL) {
+		if ((m_frgpart = m_copym(m0, off, fraglen, M_NOWAIT)) == NULL) {
 			IP6STAT_INC(ip6s_odropped);
 			return (ENOBUFS);
 		}
 		m_cat(m, m_frgpart);
-		m->m_pkthdr.len = mtu + hlen + sizeof(*ip6f);
+		m->m_pkthdr.len = fraglen + hlen + sizeof(*ip6f);
 		m->m_pkthdr.fibnum = m0->m_pkthdr.fibnum;
 		m->m_pkthdr.rcvif = NULL;
 		ip6f->ip6f_reserved = 0;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704221304.v3MD4ahb092577>