All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Hongyang <hongyang.yang@easystack.cn>
To: zhanghailiang <zhang.zhanghailiang@huawei.com>, qemu-devel@nongnu.org
Cc: jasowang@redhat.com, dgilbert@redhat.com, zhangchen.fnst@cn.fujitsu.com
Subject: Re: [Qemu-devel] [PATCH v3 4/4] net/filter: Add a default filter to each netdev
Date: Tue, 2 Feb 2016 11:16:48 +0800	[thread overview]
Message-ID: <56B01FA0.8030509@easystack.cn> (raw)
In-Reply-To: <1454328077-18820-5-git-send-email-zhang.zhanghailiang@huawei.com>



On 02/01/2016 08:01 PM, zhanghailiang wrote:
> We add each netdev a default buffer filter, and
> the default buffer filter is disabled, so it has
> no side effect for packets delivering in qemu net layer.
>
> The default buffer filter can be used by COLO or Micro-checkpoint,
> The reason we add the default filter is we hope to support
> hot add network during COLO state in future.
>
> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
> ---
> v2:
> - Add codes that generate id automatically for default filter
>    (Jason's suggestion)
> - Some other minor fixes.
> ---
>   include/net/filter.h |  4 ++++
>   net/net.c            | 23 +++++++++++++++++++++++
>   2 files changed, 27 insertions(+)
>
> diff --git a/include/net/filter.h b/include/net/filter.h
> index 661abef..8f5fa31 100644
> --- a/include/net/filter.h
> +++ b/include/net/filter.h
> @@ -22,6 +22,10 @@
>   #define NETFILTER_CLASS(klass) \
>       OBJECT_CLASS_CHECK(NetFilterClass, (klass), TYPE_NETFILTER)
>
> +#define DEFAULT_FILTER_TYPE "nop"
> +
> +#define TYPE_FILTER_BUFFER "filter-buffer"
> +
>   typedef void (FilterSetup) (NetFilterState *nf, Error **errp);
>   typedef void (FilterCleanup) (NetFilterState *nf);
>   /*
> diff --git a/net/net.c b/net/net.c
> index a49af48..998e90a 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -77,6 +77,12 @@ const char *host_net_devices[] = {
>
>   int default_net = 1;
>
> +/*
> + * TODO: Export this with an option for users to control
> + * this with comand line ?
> + */
> +char default_netfilter_type[16] = TYPE_FILTER_BUFFER;
> +
>   /***********************************************************/
>   /* network device redirectors */
>
> @@ -1029,6 +1035,23 @@ static int net_client_init1(const void *object, int is_netdev, Error **errp)
>           }
>           return -1;
>       }
> +
> +    if (is_netdev) {

If as I said earlier add a 'defult-filter' property to netdev, we
can use that property here to init default filter.

> +        const Netdev *netdev = object;
> +        char default_name[128];
> +
> +        snprintf(default_name, sizeof(default_name),
> +                "%s%s", netdev->id, DEFAULT_FILTER_TYPE);

name is "nop"

> +        /*
> +        * Here we add each netdev a default filter,
> +        * it will disabled by default, Users can enable it when necessary.
> +        */
> +        netdev_add_filter(netdev->id,
> +                          default_netfilter_type,
> +                          default_name,

type is filter-buffer, but name is "nop"?

> +                          true,
> +                          errp);
> +    }
>       return 0;
>   }
>
>

-- 
Thanks,
Yang

  reply	other threads:[~2016-02-02  3:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-01 12:01 [Qemu-devel] [PATCH v3 0/4] Netfilter: Add each netdev a default filter zhanghailiang
2016-02-01 12:01 ` [Qemu-devel] [PATCH v3 1/4] net/filter: Add a 'status' property for filter object zhanghailiang
2016-02-01 12:01 ` [Qemu-devel] [PATCH v3 2/4] net/filter: Introduce a helper to add a filter to the netdev zhanghailiang
2016-02-02  3:14   ` Yang Hongyang
2016-02-05  2:24     ` Hailiang Zhang
2016-02-01 12:01 ` [Qemu-devel] [PATCH v3 3/4] filter-buffer: Accept zero interval zhanghailiang
2016-02-01 12:01 ` [Qemu-devel] [PATCH v3 4/4] net/filter: Add a default filter to each netdev zhanghailiang
2016-02-02  3:16   ` Yang Hongyang [this message]
2016-02-05  2:35     ` Hailiang Zhang
2016-02-02  3:11 ` [Qemu-devel] [PATCH v3 0/4] Netfilter: Add each netdev a default filter Yang Hongyang
2016-02-02 12:34   ` Hailiang Zhang

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=56B01FA0.8030509@easystack.cn \
    --to=hongyang.yang@easystack.cn \
    --cc=dgilbert@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zhang.zhanghailiang@huawei.com \
    --cc=zhangchen.fnst@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.