From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56087) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVctq-0006qw-Ur for qemu-devel@nongnu.org; Tue, 16 Feb 2016 05:30:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVctn-00066O-OT for qemu-devel@nongnu.org; Tue, 16 Feb 2016 05:30:30 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:42233) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVctn-00065w-Hr for qemu-devel@nongnu.org; Tue, 16 Feb 2016 05:30:27 -0500 Date: Tue, 16 Feb 2016 11:30:24 +0100 From: Samuel Thibault Message-ID: <20160216103024.GD2823@var.bordeaux.inria.fr> References: <1455612458-28274-1-git-send-email-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1455612458-28274-1-git-send-email-thuth@redhat.com> Subject: Re: [Qemu-devel] [PATCH] slirp: Add IPv6 support to the TFTP code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth Cc: jan.kiszka@siemens.com, jasowang@redhat.com, qemu-devel@nongnu.org Hello, Thanks for working on it :) Thomas Huth, on Tue 16 Feb 2016 09:47:38 +0100, wrote: > -static int tftp_session_allocate(Slirp *slirp, struct tftp_t *tp) > +static int tftp_session_allocate(struct sockaddr_storage *srcsas, Slirp *slirp, > + struct tftp_t *tp) slirp is usually the first parameter, it'd probably be better to keep this habit. > -static int tftp_session_find(Slirp *slirp, struct tftp_t *tp) > +static int tftp_session_find(struct sockaddr_storage *srcsas, Slirp *slirp, > + struct tftp_t *tp) ditto. > +static void tftp_udp_output(struct tftp_session *spt, struct mbuf *m, > + struct tftp_t *recv_tp) > +{ > + if (spt->client_addr.ss_family == AF_INET6) { > + struct sockaddr_in6 sa6, da6; > + > + memcpy(&sa6.sin6_addr, spt->slirp->vhost_addr6.s6_addr, 16); Why not simply sa6.sin6_addr = spt->slirp->vhost_addr6? The compiler will optimize the structure assignment as an inline copy or memcpy call as appropriate. > + sa6.sin6_port = recv_tp->udp.uh_dport; > + memcpy(&da6.sin6_addr, > + &((struct sockaddr_in6 *)&spt->client_addr)->sin6_addr, 16); ditto. Otherwise the patch looks particularly good :) Samuel