qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCHv7 4/9] slirp: Factorizing tcpiphdr structure wit


From: Thomas Huth
Subject: Re: [Qemu-devel] [PATCHv7 4/9] slirp: Factorizing tcpiphdr structure with an union
Date: Mon, 22 Feb 2016 08:56:59 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0

On 22.02.2016 02:48, Samuel Thibault wrote:
> Hello,
> 
> Thomas Huth, on Fri 19 Feb 2016 14:44:59 +0100, wrote:
>>> +   m->m_data -= sizeof(struct tcpiphdr) - (sizeof(struct ip)
>>> +                                        + sizeof(struct tcphdr));
>>> +   m->m_len += sizeof(struct tcpiphdr) - (sizeof(struct ip)
>>> +                                       + sizeof(struct tcphdr));
>>
>> I'm somewhat having a hard time to understand the  "+ sizeof(struct
>> tcphdr))" here.
>>
>> In the tcp_output.c code, there is this:
>>
>>      m->m_data += sizeof(struct tcpiphdr) - sizeof(struct tcphdr)
>>                                           - sizeof(struct ip);
>>
>> So with my limited point of view, I'd rather expect this here in
>> tcp_input.c:
>>
>>      m->m_data -= sizeof(struct tcpiphdr) - (sizeof(struct ip)
>>                                           - sizeof(struct tcphdr));
>> i.e. "-" instead of "+" here ----------------^
> 
> The parentheses and indentation were misleading actually, here is how it
> should actually looks like:
> 
>>> +   m->m_data -= sizeof(struct tcpiphdr) - ( sizeof(struct ip)
>>> +                                            + sizeof(struct tcphdr));
> 
> I've now dropped the parentheses, so it looks like the tcp_output.c code:
> 
>       m->m_data -= sizeof(struct tcpiphdr) - sizeof(struct ip)
>                                            - sizeof(struct tcphdr);

Ah, sorry, I indeed simply got confused because it was written in two
different ways :-/ ... would it maybe be applicable to use the
TCPIPHDR_DELTA macro here instead?

Apart from that, the patch looks ok to me.

 Thomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]