git: be02517f6f19 - stable/15 - LinuxKPI: skbuff: add support for frags in linuxkpi_skb_copy()

Bjoern A. Zeeb <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a66a1ff.27722.81b95ae__3169.51598958752$1785111150$gmane$org@gitrepo.freebsd.org>
The branch stable/15 has been updated by bz:

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

commit be02517f6f19a6b8c8f4e850c992c9cd749713bf
Author:     Bjoern A. Zeeb <[email protected]>
AuthorDate: 2026-02-03 22:13:24 +0000
Commit:     Bjoern A. Zeeb <[email protected]>
CommitDate: 2026-07-26 16:48:19 +0000

    LinuxKPI: skbuff: add support for frags in linuxkpi_skb_copy()
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 1e4ec01603c4b1e0b0eb524f28f731eb5cb5f6dc)
---
 sys/compat/linuxkpi/common/src/linux_skbuff.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_skbuff.c b/sys/compat/linuxkpi/common/src/linux_skbuff.c
index a2aa601d594e..5af9633691a6 100644
--- a/sys/compat/linuxkpi/common/src/linux_skbuff.c
+++ b/sys/compat/linuxkpi/common/src/linux_skbuff.c
@@ -191,6 +191,7 @@ linuxkpi_skb_copy(const struct sk_buff *skb, gfp_t gfp)
 	struct skb_shared_info *shinfo;
 	size_t len;
 	unsigned int headroom;
+	uint16_t fragno, count;
 
 	/* Full buffer size + any fragments. */
 	len = skb->end - skb->head + skb->data_len;
@@ -209,10 +210,15 @@ linuxkpi_skb_copy(const struct sk_buff *skb, gfp_t gfp)
 
 	/* Deal with fragments. */
 	shinfo = skb->shinfo;
-	if (shinfo->nr_frags > 0) {
-		printf("%s:%d: NOT YET SUPPORTED; missing %d frags\n",
-		    __func__, __LINE__, shinfo->nr_frags);
-		SKB_TODO();
+	for (count = fragno = 0;
+	    count < shinfo->nr_frags && fragno < nitems(shinfo->frags);
+	    fragno++) {
+		if (shinfo->frags[fragno].page != NULL) {
+			skb_put_data(new,
+			    skb_frag_address(&shinfo->frags[fragno]),
+			    shinfo->frags[fragno].size);
+			count++;
+		}
 	}
 
 	/* Deal with header fields. */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.