[Git][slirp/libslirp][master] icmp: Fix msg duplication for debugging

Samuel Thibault (@sthibaul) gitlab at gitlab.freedesktop.org
Wed Apr 24 16:43:39 UTC 2024



Samuel Thibault pushed to branch master at slirp / libslirp


Commits:
0ad461c2 by Samuel Thibault at 2024-04-24T18:43:24+02:00
icmp: Fix msg duplication for debugging

In case of socket error, we are not consuming the package. So duplicate
it after socket operations, once we are sure that we will consume the
packet.

- - - - -


1 changed file:

- src/ip_icmp.c


Changes:

=====================================
src/ip_icmp.c
=====================================
@@ -91,9 +91,7 @@ void icmp_cleanup(Slirp *slirp)
 static int icmp_send(struct socket *so, struct mbuf *m, int hlen)
 {
     Slirp *slirp = m->slirp;
-    M_DUP_DEBUG(slirp, m, 0, 0);
 
-    struct ip *ip = mtod(m, struct ip *);
     struct sockaddr_in addr;
 
     /*
@@ -133,6 +131,9 @@ static int icmp_send(struct socket *so, struct mbuf *m, int hlen)
         return -1;
     }
 
+    M_DUP_DEBUG(slirp, m, 0, 0);
+    struct ip *ip = mtod(m, struct ip *);
+
     so->so_m = m;
     so->so_faddr = ip->ip_dst;
     so->so_laddr = ip->ip_src;



View it on GitLab: https://gitlab.freedesktop.org/slirp/libslirp/-/commit/0ad461c225cfcc263ea1c2dd5cbb6093d146b093

-- 
View it on GitLab: https://gitlab.freedesktop.org/slirp/libslirp/-/commit/0ad461c225cfcc263ea1c2dd5cbb6093d146b093
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/slirp/attachments/20240424/5c53b145/attachment-0001.htm>


More information about the Slirp mailing list