From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54892) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVekC-0000bX-E9 for qemu-devel@nongnu.org; Tue, 16 Feb 2016 07:28:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVekB-0000DE-5x for qemu-devel@nongnu.org; Tue, 16 Feb 2016 07:28:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49614) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVekB-0000DA-0r for qemu-devel@nongnu.org; Tue, 16 Feb 2016 07:28:39 -0500 References: <7e5350fcc22ce656b9c523215387437877098904.1455471945.git.samuel.thibault@ens-lyon.org> From: Thomas Huth Message-ID: <56C315EE.7090601@redhat.com> Date: Tue, 16 Feb 2016 13:28:30 +0100 MIME-Version: 1.0 In-Reply-To: <7e5350fcc22ce656b9c523215387437877098904.1455471945.git.samuel.thibault@ens-lyon.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCHv7 3/9] slirp: Adding IPv6 UDP support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Samuel Thibault , qemu-devel@nongnu.org Cc: zhanghailiang , Li Zhijian , Stefan Hajnoczi , Jason Wang , Dave Gilbert , Vasiliy Tolstov , Huangpeng , Gonglei , Jan Kiszka , Guillaume Subiron On 14.02.2016 18:47, Samuel Thibault wrote: > From: Guillaume Subiron > > This adds the sin6 case in the fhost and lhost unions and related macros. > It adds udp6_input() and udp6_output(). > It adds the IPv6 case in sorecvfrom(). > Finally, udp_input() is called by ip6_input(). > > Signed-off-by: Guillaume Subiron > Signed-off-by: Samuel Thibault > --- > slirp/Makefile.objs | 2 +- > slirp/ip6_input.c | 2 +- > slirp/socket.c | 5 ++ > slirp/socket.h | 6 ++ > slirp/udp.h | 5 ++ > slirp/udp6.c | 156 ++++++++++++++++++++++++++++++++++++++++++++++++++++ > 6 files changed, 174 insertions(+), 2 deletions(-) > create mode 100644 slirp/udp6.c ... > diff --git a/slirp/udp6.c b/slirp/udp6.c > new file mode 100644 > index 0000000..6c0d55f > --- /dev/null > +++ b/slirp/udp6.c ... > +int udp6_output(struct socket *so, struct mbuf *m, > + struct sockaddr_in6 *saddr, struct sockaddr_in6 *daddr) > +{ > + struct ip6 *ip; > + struct udphdr *uh; > + > + DEBUG_CALL("udp6_output"); > + DEBUG_ARG("so = %lx", (long)so); > + DEBUG_ARG("m = %lx", (long)m); > + > + /* adjust for header */ > + m->m_data -= sizeof(struct udphdr); > + m->m_len += sizeof(struct udphdr); > + uh = mtod(m, struct udphdr *); > + m->m_data -= sizeof(struct ip6); > + m->m_len += sizeof(struct ip6); > + ip = mtod(m, struct ip6 *); > + > + /* Build IP header */ > + ip->ip_pl = htons(m->m_len - sizeof(struct ip6)); > + ip->ip_nh = IPPROTO_UDP; > + ip->ip_src = saddr->sin6_addr; > + ip->ip_dst = daddr->sin6_addr; > + > + /* Build UDP header */ > + uh->uh_sport = saddr->sin6_port; > + uh->uh_dport = daddr->sin6_port; > + uh->uh_ulen = ip->ip_pl; > + uh->uh_sum = 0; > + uh->uh_sum = ip6_cksum(m); > + if (uh->uh_sum == 0) > + uh->uh_sum = 0xffff; Nit: QEMU coding style requires braces for all if-statements. > + return ip6_output(so, m, 0); > +} When you've fixed the small nit, feel free to add my: Reviewed-by: Thomas Huth