[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] slirp: Add IPv6 support to the TFTP code
From: |
Thomas Huth |
Subject: |
Re: [Qemu-devel] [PATCH] slirp: Add IPv6 support to the TFTP code |
Date: |
Tue, 16 Feb 2016 13:09:21 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
On 16.02.2016 11:30, Samuel Thibault wrote:
> 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.
Ok, I don't have a preference here, so I'll change it.
>> -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.
That makes sense, too, I'll change it.
Thanks for the review!
Thomas