All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Hongyang <yanghy@cn.fujitsu.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: thuth@redhat.com, zhang.zhanghailiang@huawei.com,
	lizhijian@cn.fujitsu.com, jasowang@redhat.com,
	qemu-devel@nongnu.org, mrhines@linux.vnet.ibm.com,
	stefanha@redhat.com, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v8 01/11] net: add a new object netfilter
Date: Mon, 31 Aug 2015 09:31:21 +0800	[thread overview]
Message-ID: <55E3AE69.6060004@cn.fujitsu.com> (raw)
In-Reply-To: <87pp27abxa.fsf@blackfin.pond.sub.org>



On 08/28/2015 07:29 PM, Markus Armbruster wrote:
> Yang Hongyang <yanghy@cn.fujitsu.com> writes:
>
>> On 08/26/2015 10:04 PM, Markus Armbruster wrote:
>>> Missed a bunch of revisions of this series, please excuse gaps in my
>>> understanding.
>>
>> Thank you for the review.
>>
>>>
>>> Yang Hongyang <yanghy@cn.fujitsu.com> writes:
>>>
>>>> Add the framework for a new netfilter object and a new
>>>> -netfilter CLI option as a basis for the following patches.
>>>>
>>>> Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
>>>> CC: Paolo Bonzini <pbonzini@redhat.com>
>>>> CC: Eric Blake <eblake@redhat.com>
>>>> Reviewed-by: Thomas Huth <thuth@redhat.com>
>>>> ---
>>>>    include/net/filter.h    | 15 +++++++++++++++
>>>>    include/sysemu/sysemu.h |  1 +
>>>>    net/Makefile.objs       |  1 +
>>>>    net/filter.c            | 27 +++++++++++++++++++++++++++
>>>>    qemu-options.hx         |  1 +
>>>>    vl.c                    | 13 +++++++++++++
>>>>    6 files changed, 58 insertions(+)
>>>>    create mode 100644 include/net/filter.h
>>>>    create mode 100644 net/filter.c
>>>>
>>>> diff --git a/include/net/filter.h b/include/net/filter.h
>>>> new file mode 100644
>>>> index 0000000..4242ded
>>>> --- /dev/null
>>>> +++ b/include/net/filter.h
>>>> @@ -0,0 +1,15 @@
>>>> +/*
>>>> + * Copyright (c) 2015 FUJITSU LIMITED
>>>> + *
>>>> + * This work is licensed under the terms of the GNU GPL, version 2 or
>>>> + * later.  See the COPYING file in the top-level directory.
>>>> + */
>>>> +
>>>> +#ifndef QEMU_NET_FILTER_H
>>>> +#define QEMU_NET_FILTER_H
>>>> +
>>>> +#include "qemu-common.h"
>>>> +
>>>> +int net_init_filters(void);
>>>> +
>>>> +#endif /* QEMU_NET_FILTER_H */
>>>> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
>>>> index 44570d1..15d6d00 100644
>>>> --- a/include/sysemu/sysemu.h
>>>> +++ b/include/sysemu/sysemu.h
>>>> @@ -212,6 +212,7 @@ extern QemuOptsList qemu_chardev_opts;
>>>>    extern QemuOptsList qemu_device_opts;
>>>>    extern QemuOptsList qemu_netdev_opts;
>>>>    extern QemuOptsList qemu_net_opts;
>>>> +extern QemuOptsList qemu_netfilter_opts;
>>>>    extern QemuOptsList qemu_global_opts;
>>>>    extern QemuOptsList qemu_mon_opts;
>>>>
>>>> diff --git a/net/Makefile.objs b/net/Makefile.objs
>>>> index ec19cb3..914aec0 100644
>>>> --- a/net/Makefile.objs
>>>> +++ b/net/Makefile.objs
>>>> @@ -13,3 +13,4 @@ common-obj-$(CONFIG_HAIKU) += tap-haiku.o
>>>>    common-obj-$(CONFIG_SLIRP) += slirp.o
>>>>    common-obj-$(CONFIG_VDE) += vde.o
>>>>    common-obj-$(CONFIG_NETMAP) += netmap.o
>>>> +common-obj-y += filter.o
>>>> diff --git a/net/filter.c b/net/filter.c
>>>> new file mode 100644
>>>> index 0000000..4e40f08
>>>> --- /dev/null
>>>> +++ b/net/filter.c
>>>> @@ -0,0 +1,27 @@
>>>> +/*
>>>> + * Copyright (c) 2015 FUJITSU LIMITED
>>>> + *
>>>> + * This work is licensed under the terms of the GNU GPL, version 2 or
>>>> + * later.  See the COPYING file in the top-level directory.
>>>> + */
>>>> +
>>>> +#include "qemu-common.h"
>>>> +#include "net/filter.h"
>>>> +
>>>> +int net_init_filters(void)
>>>> +{
>>>> +    return 0;
>>>> +}
>>>> +
>>>> +QemuOptsList qemu_netfilter_opts = {
>>>> +    .name = "netfilter",
>>>> +    .implied_opt_name = "type",
>>>> +    .head = QTAILQ_HEAD_INITIALIZER(qemu_netfilter_opts.head),
>>>> +    .desc = {
>>>> +        /*
>>>> +         * no elements => accept any params
>>>> +         * validation will happen later
>>>> +         */
>>>> +        { /* end of list */ }
>>>> +    },
>>>> +};
>>>
>>> Ignorant question: why dynamic validation (empty .desc) instead of
>>> statically defined parameters?  The documentation you add in PATCH 10
>>> suggests they're not actually dynamic.
>>
>> Actually I was following the netdev stuff. There might be bunch of filters,
>> and I don't know the params of each filter until it is realized.
>
> I realized that later on in your series.
>
>>>> diff --git a/qemu-options.hx b/qemu-options.hx
>>>> index 77f5853..0d52d02 100644
>>>> --- a/qemu-options.hx
>>>> +++ b/qemu-options.hx
>>>> @@ -1575,6 +1575,7 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
>>>>        "socket][,vlan=n][,option][,option][,...]\n"
>>>>        "                old way to initialize a host network interface\n"
>>>>        "                (use the -netdev option if possible instead)\n", QEMU_ARCH_ALL)
>>>> +DEF("netfilter", HAS_ARG, QEMU_OPTION_netfilter, "", QEMU_ARCH_ALL)
>>>>    STEXI
>>>>    @item -net nic[,vlan=@var{n}][,macaddr=@var{mac}][,model=@var{type}] [,name=@var{name}][,addr=@var{addr}][,vectors=@var{v}]
>>>>    @findex -net
>>>
>>> Wrong spot: this is between DEF(net, ...) and its STEXI..ETEXI stanza.
>>> Suggest to move it behind the ETEXI.
>>>
>>> Missing help string.  You add the help in PATCH 10.  What about adding
>>> it here already?  Would serve as a hint of the things to come later in
>>> your series.
>>>
>>> Missing STEXI..ETEXI stanza for the user manual.
>>
>> If I understand correctly, you are suggesting separate the netfilter from
>> net, seems more reasonable, so I should add something like:
>> DEF("netfilter", HAS_ARG, QEMU_OPTION_netfilter, "", QEMU_ARCH_ALL)
>> STEXI..ETEXI
>>
>> after the DEF(net, ...) and its STEXI..ETEXI stanza, am I right?
>
> Yes.  Always keep DEF(whatever, ...) and its STEXI..ETEXI together.
>
> Inserting netfilter after net seems the most logical place.

Yes, thank you.

>
> [...]
> .
>

-- 
Thanks,
Yang.

  reply	other threads:[~2015-08-31  1:31 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-26  9:59 [Qemu-devel] [PATCH v8 00/11] Add a netfilter object and netbuffer filter Yang Hongyang
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 01/11] net: add a new object netfilter Yang Hongyang
2015-08-26 14:04   ` Markus Armbruster
2015-08-27  2:34     ` Yang Hongyang
2015-08-28 11:29       ` Markus Armbruster
2015-08-31  1:31         ` Yang Hongyang [this message]
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 02/11] init/cleanup of netfilter object Yang Hongyang
2015-08-26 13:13   ` Thomas Huth
2015-08-26 14:41   ` Markus Armbruster
2015-08-26 15:31     ` Eric Blake
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 03/11] netfilter: add netfilter_{add|del} commands Yang Hongyang
2015-08-26 15:17   ` Markus Armbruster
2015-08-26 15:37     ` Eric Blake
2015-08-28 11:37       ` Markus Armbruster
2015-08-31  1:36         ` Yang Hongyang
2015-08-31  7:08           ` Markus Armbruster
2015-08-31  9:01             ` Yang Hongyang
2015-08-31 14:53               ` Eric Blake
2015-09-01  1:24                 ` Yang Hongyang
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 04/11] netfilter: hook packets before net queue send Yang Hongyang
2015-08-27 14:35   ` Thomas Huth
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 05/11] move out net queue structs define Yang Hongyang
2015-08-27 14:38   ` Thomas Huth
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 06/11] netfilter: add an API to pass the packet to next filter Yang Hongyang
2015-08-27 15:11   ` Thomas Huth
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 07/11] netfilter: print filter info associate with the netdev Yang Hongyang
2015-08-27 14:46   ` Thomas Huth
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 08/11] net/queue: export qemu_net_queue_append_iov Yang Hongyang
2015-08-27 15:05   ` Thomas Huth
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 09/11] netfilter: add a netbuffer filter Yang Hongyang
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 10/11] filter/buffer: update command description and help Yang Hongyang
2015-08-26 15:55   ` Markus Armbruster
2015-08-27  2:42     ` Yang Hongyang
2015-08-28 11:42       ` Markus Armbruster
2015-08-31  1:30         ` Yang Hongyang
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 11/11] tests: add test cases for netfilter object Yang Hongyang
2015-08-26 15:58 ` [Qemu-devel] [PATCH v8 00/11] Add a netfilter object and netbuffer filter Markus Armbruster
2015-08-27  2:25   ` Yang Hongyang
2015-08-27  1:05 ` Thomas Huth
2015-08-27  2:24   ` Yang Hongyang
2015-08-27  3:15 ` Jason Wang
2015-08-31  1:43   ` Yang Hongyang

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=55E3AE69.6060004@cn.fujitsu.com \
    --to=yanghy@cn.fujitsu.com \
    --cc=armbru@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=mrhines@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.com \
    --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 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.