qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
To: Jason Wang <jasowang@redhat.com>, qemu devel <qemu-devel@nongnu.org>
Cc: Li Zhijian <lizhijian@cn.fujitsu.com>,
	"eddie . dong" <eddie.dong@intel.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	zhanghailiang <zhang.zhanghailiang@huawei.com>
Subject: Re: [Qemu-devel] [RFC PATCH V5 4/4] colo-compare: add TCP, UDP, ICMP packet comparison
Date: Wed, 13 Jul 2016 13:10:43 +0800	[thread overview]
Message-ID: <5785CD53.90206@cn.fujitsu.com> (raw)
In-Reply-To: <5785AD5C.6040903@redhat.com>



On 07/13/2016 10:54 AM, Jason Wang wrote:
>
>
> On 2016年07月11日 18:02, Zhang Chen wrote:
>>>> +static int colo_packet_compare_icmp(Packet *spkt, Packet *ppkt)
>>>> +{
>>>> +    int network_length;
>>>> +    struct icmp *icmp_ppkt, *icmp_spkt;
>>>> +
>>>> +    trace_colo_compare_main("compare icmp");
>>>> +    network_length = ppkt->ip->ip_hl * 4;
>>>> +    if (ppkt->size != spkt->size ||
>>>> +        ppkt->size < network_length + ETH_HLEN) {
>>>> + trace_colo_compare_icmp_miscompare_size(ppkt->size, spkt->size);
>>>> +        return -1;
>>>> +    }
>>>> +    icmp_ppkt = (struct icmp *)(ppkt->data + network_length + 
>>>> ETH_HLEN);
>>>> +    icmp_spkt = (struct icmp *)(spkt->data + network_length + 
>>>> ETH_HLEN);
>>>> +
>>>> +    if ((icmp_ppkt->icmp_type == icmp_spkt->icmp_type) &&
>>>> +        (icmp_ppkt->icmp_code == icmp_spkt->icmp_code)) {
>>>> +        if (icmp_ppkt->icmp_type == ICMP_REDIRECT) {
>>>> +            if (icmp_ppkt->icmp_gwaddr.s_addr !=
>>>> +                icmp_spkt->icmp_gwaddr.s_addr) {
>>>> +                trace_colo_compare_main("icmp_gwaddr.s_addr not 
>>>> same");
>>>> + trace_colo_compare_icmp_miscompare_addr("ppkt s_addr",
>>>> + inet_ntoa(icmp_ppkt->icmp_gwaddr));
>>>> + trace_colo_compare_icmp_miscompare_addr("spkt s_addr",
>>>> + inet_ntoa(icmp_spkt->icmp_gwaddr));
>>>> +                return -1;
>>>> +            }
>>>> +        } else if ((icmp_ppkt->icmp_type == ICMP_UNREACH) &&
>>>> +                   (icmp_ppkt->icmp_type == ICMP_UNREACH_NEEDFRAG)) {
>>>> +            if (icmp_ppkt->icmp_nextmtu != icmp_spkt->icmp_nextmtu) {
>>>> +                trace_colo_compare_main("icmp_nextmtu not same");
>>>> + trace_colo_compare_icmp_miscompare_mtu("ppkt nextmtu",
>>>> + icmp_ppkt->icmp_nextmtu);
>>>> + trace_colo_compare_icmp_miscompare_mtu("spkt nextmtu",
>>>> + icmp_spkt->icmp_nextmtu);
>>>> +                return -1;
>>>> +            }
>>>> +        }
>>>> +    } else {
>>>> +        return -1;
>>>> +    }
>>>
>>> Why only compare part of icmp packet?
>>>
>>
>> That's include most of situation, increase all part of icmp
>> can reduce compare efficiency.
>>
>> Thanks
>> Zhang Chen 
>
> I believe we should cover all instead of "most" of situations. And 
> looks like icmp packet were all small, so there's probably no need to 
> do special tricks like this.
>
>

OK, I will fix this in next version.

Thanks
Zhang Chen

>
> .
>

-- 
Thanks
zhangchen

  reply	other threads:[~2016-07-13  5:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-23 11:34 [Qemu-devel] [RFC PATCH V5 0/4] Introduce COLO-compare Zhang Chen
2016-06-23 11:34 ` [Qemu-devel] [RFC PATCH V5 1/4] colo-compare: introduce colo compare initialization Zhang Chen
2016-07-08  3:40   ` Jason Wang
2016-07-08  8:21     ` Zhang Chen
2016-07-08  9:12       ` Jason Wang
2016-07-11  5:14         ` Zhang Chen
2016-06-23 11:34 ` [Qemu-devel] [RFC PATCH V5 2/4] colo-compare: track connection and enqueue packet Zhang Chen
2016-07-08  4:07   ` Jason Wang
2016-07-08  9:56     ` Zhang Chen
2016-07-11  5:41       ` Jason Wang
2016-07-12  5:42         ` Zhang Chen
2016-06-23 11:34 ` [Qemu-devel] [RFC PATCH V5 3/4] colo-compare: introduce packet comparison thread Zhang Chen
2016-07-08  4:23   ` Jason Wang
2016-07-11  7:17     ` Zhang Chen
2016-06-23 11:34 ` [Qemu-devel] [RFC PATCH V5 4/4] colo-compare: add TCP, UDP, ICMP packet comparison Zhang Chen
2016-07-08  8:59   ` Jason Wang
2016-07-11 10:02     ` Zhang Chen
2016-07-13  2:54       ` Jason Wang
2016-07-13  5:10         ` Zhang Chen [this message]
2016-07-07  7:47 ` [Qemu-devel] [RFC PATCH V5 0/4] Introduce COLO-compare Zhang Chen
2016-07-07  8:41   ` Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5785CD53.90206@cn.fujitsu.com \
    --to=zhangchen.fnst@cn.fujitsu.com \
    --cc=dgilbert@redhat.com \
    --cc=eddie.dong@intel.com \
    --cc=jasowang@redhat.com \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zhang.zhanghailiang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).