Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Nov 2021 01:35:39 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 5b5bbf2e7c34 - stable/13 - sctp: Remove now-unneeded mb_unmapped_to_ext() calls
Message-ID:  <202111300135.1AU1ZdNM054659@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=5b5bbf2e7c341ec6ba569536fb14acb990d53334

commit 5b5bbf2e7c341ec6ba569536fb14acb990d53334
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-11-16 18:38:09 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-11-30 01:35:20 +0000

    sctp: Remove now-unneeded mb_unmapped_to_ext() calls
    
    sctp_delayed_checksum() now handles unmapped mbufs, thanks to m_apply().
    
    No functional change intended.
    
    Reviewed by:    tuexen
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 756bb50b6a867f3309ce76d76f1842a667dd303a)
---
 sys/netinet/ip_divert.c     |  6 ------
 sys/netinet/ip_output.c     | 12 ------------
 sys/netipsec/ipsec_output.c | 12 ------------
 sys/netpfil/pf/pf.c         |  3 ---
 4 files changed, 33 deletions(-)

diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index 4919893d6a61..936e216e0926 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -220,9 +220,6 @@ divert_packet(struct mbuf *m, bool incoming)
 	}
 #if defined(SCTP) || defined(SCTP_SUPPORT)
 	if (m->m_pkthdr.csum_flags & CSUM_SCTP) {
-		m = mb_unmapped_to_ext(m);
-		if (m == NULL)
-			return;
 		sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2));
 		m->m_pkthdr.csum_flags &= ~CSUM_SCTP;
 	}
@@ -238,9 +235,6 @@ divert_packet(struct mbuf *m, bool incoming)
 	}
 #if defined(SCTP) || defined(SCTP_SUPPORT)
 	if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) {
-		m = mb_unmapped_to_ext(m);
-		if (m == NULL)
-			return;
 		sctp_delayed_cksum(m, sizeof(struct ip6_hdr));
 		m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6;
 	}
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index c269fca42015..4acec2bb877c 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -750,12 +750,6 @@ sendit:
 	}
 #if defined(SCTP) || defined(SCTP_SUPPORT)
 	if (m->m_pkthdr.csum_flags & CSUM_SCTP & ~ifp->if_hwassist) {
-		m = mb_unmapped_to_ext(m);
-		if (m == NULL) {
-			IPSTAT_INC(ips_odropped);
-			error = ENOBUFS;
-			goto bad;
-		}
 		sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2));
 		m->m_pkthdr.csum_flags &= ~CSUM_SCTP;
 	}
@@ -908,12 +902,6 @@ ip_fragment(struct ip *ip, struct mbuf **m_frag, int mtu,
 	}
 #if defined(SCTP) || defined(SCTP_SUPPORT)
 	if (m0->m_pkthdr.csum_flags & CSUM_SCTP) {
-		m0 = mb_unmapped_to_ext(m0);
-		if (m0 == NULL) {
-			error = ENOBUFS;
-			IPSTAT_INC(ips_odropped);
-			goto done;
-		}
 		sctp_delayed_cksum(m0, hlen);
 		m0->m_pkthdr.csum_flags &= ~CSUM_SCTP;
 	}
diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c
index 86f06fd10947..a2deef95cdb5 100644
--- a/sys/netipsec/ipsec_output.c
+++ b/sys/netipsec/ipsec_output.c
@@ -336,12 +336,6 @@ ipsec4_common_output(struct mbuf *m, struct inpcb *inp, int forwarding)
 		if (m->m_pkthdr.csum_flags & CSUM_SCTP) {
 			struct ip *ip;
 
-			m = mb_unmapped_to_ext(m);
-			if (m == NULL) {
-				IPSECSTAT_INC(ips_out_nomem);
-				key_freesp(&sp);
-				return (ENOBUFS);
-			}
 			ip = mtod(m, struct ip *);
 			sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2));
 			m->m_pkthdr.csum_flags &= ~CSUM_SCTP;
@@ -642,12 +636,6 @@ ipsec6_common_output(struct mbuf *m, struct inpcb *inp, int forwarding)
 		}
 #if defined(SCTP) || defined(SCTP_SUPPORT)
 		if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) {
-			m = mb_unmapped_to_ext(m);
-			if (m == NULL) {
-				IPSEC6STAT_INC(ips_out_nomem);
-				key_freesp(&sp);
-				return (ENOBUFS);
-			}
 			sctp_delayed_cksum(m, sizeof(struct ip6_hdr));
 			m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6;
 		}
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index 042658906bd2..84db11d2f0ef 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -5976,9 +5976,6 @@ pf_route(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp,
 	}
 #if defined(SCTP) || defined(SCTP_SUPPORT)
 	if (m0->m_pkthdr.csum_flags & CSUM_SCTP & ~ifp->if_hwassist) {
-		m0 = mb_unmapped_to_ext(m0);
-		if (m0 == NULL)
-			goto done;
 		sctp_delayed_cksum(m0, (uint32_t)(ip->ip_hl << 2));
 		m0->m_pkthdr.csum_flags &= ~CSUM_SCTP;
 	}



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